2023-06-30 09:54:08 +00:00
|
|
|
package payload
|
|
|
|
|
|
|
|
import (
|
2023-06-30 12:49:32 +00:00
|
|
|
"github.com/google/uuid"
|
|
|
|
|
|
|
|
"go.mau.fi/mautrix-gmessages/libgm/binary"
|
|
|
|
"go.mau.fi/mautrix-gmessages/libgm/pblite"
|
2023-06-30 09:54:08 +00:00
|
|
|
)
|
|
|
|
|
2023-06-30 12:49:32 +00:00
|
|
|
func ReceiveMessages(rpcKey []byte) ([]byte, string, error) {
|
|
|
|
payload := &binary.ReceiveMessagesRequest{
|
|
|
|
Auth: &binary.AuthMessage{
|
2023-07-09 11:16:52 +00:00
|
|
|
RequestID: uuid.New().String(),
|
|
|
|
TachyonAuthToken: rpcKey,
|
|
|
|
ConfigVersion: ConfigMessage,
|
2023-06-30 09:54:08 +00:00
|
|
|
},
|
2023-06-30 12:49:32 +00:00
|
|
|
Unknown: &binary.ReceiveMessagesRequest_UnknownEmptyObject2{
|
|
|
|
Unknown: &binary.ReceiveMessagesRequest_UnknownEmptyObject1{},
|
2023-06-30 09:54:08 +00:00
|
|
|
},
|
|
|
|
}
|
2023-07-15 12:56:55 +00:00
|
|
|
jsonData, err := pblite.Marshal(payload)
|
2023-06-30 09:54:08 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, "", err
|
|
|
|
}
|
2023-06-30 13:26:46 +00:00
|
|
|
return jsonData, payload.Auth.RequestID, nil
|
2023-06-30 09:54:08 +00:00
|
|
|
}
|