2023-06-30 09:54:08 +00:00
|
|
|
package payload
|
|
|
|
|
|
|
|
import "go.mau.fi/mautrix-gmessages/libgm/binary"
|
|
|
|
|
|
|
|
func NewMessageData(requestID string, encodedStr string, routingOpCode int64, msgType int64) *binary.MessageData {
|
|
|
|
return &binary.MessageData{
|
2023-06-30 13:26:46 +00:00
|
|
|
RequestID: requestID,
|
2023-06-30 09:54:08 +00:00
|
|
|
RoutingOpCode: routingOpCode,
|
|
|
|
EncodedData: encodedStr,
|
|
|
|
MsgTypeArr: &binary.MsgTypeArr{
|
|
|
|
EmptyArr: &binary.EmptyArr{},
|
|
|
|
MsgType: msgType,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-30 13:26:46 +00:00
|
|
|
func NewEncodedPayload(requestId string, opCode int64, encryptedData []byte, sessionID string) *binary.EncodedPayload {
|
2023-06-30 09:54:08 +00:00
|
|
|
return &binary.EncodedPayload{
|
2023-06-30 13:26:46 +00:00
|
|
|
RequestID: requestId,
|
2023-06-30 09:54:08 +00:00
|
|
|
Opcode: opCode,
|
|
|
|
EncryptedData: encryptedData,
|
2023-06-30 13:26:46 +00:00
|
|
|
SessionID: sessionID,
|
2023-06-30 09:54:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-30 12:49:32 +00:00
|
|
|
func NewAuthData(requestId string, rpcKey []byte, date *binary.Date) *binary.AuthMessage {
|
2023-06-30 09:54:08 +00:00
|
|
|
return &binary.AuthMessage{
|
2023-06-30 13:26:46 +00:00
|
|
|
RequestID: requestId,
|
2023-06-30 09:54:08 +00:00
|
|
|
RpcKey: rpcKey,
|
|
|
|
Date: date,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewSendMessage(pairedDevice *binary.Device, messageData *binary.MessageData, authData *binary.AuthMessage, ttl int64) *binary.SendMessage {
|
|
|
|
return &binary.SendMessage{
|
|
|
|
PairedDevice: pairedDevice,
|
|
|
|
MessageData: messageData,
|
|
|
|
AuthData: authData,
|
2023-06-30 13:26:46 +00:00
|
|
|
TTL: ttl,
|
2023-06-30 09:54:08 +00:00
|
|
|
EmptyArr: &binary.EmptyArr{},
|
|
|
|
}
|
|
|
|
}
|