Update list conversations payload

This commit is contained in:
Tulir Asokan 2023-07-16 00:55:55 +03:00
parent 4931b1a666
commit 14084b9832
6 changed files with 653 additions and 585 deletions

File diff suppressed because it is too large Load diff

View file

@ -74,9 +74,9 @@ type ActionType int32
const ( const (
ActionType_UNSPECIFIED ActionType = 0 ActionType_UNSPECIFIED ActionType = 0
ActionType_LIST_CONVERSATIONS ActionType = 1 ActionType_LIST_CONVERSATIONS ActionType = 1
ActionType_LIST_CONVERSATIONS_SYNC ActionType = 1111 // fake value
ActionType_LIST_MESSAGES ActionType = 2 ActionType_LIST_MESSAGES ActionType = 2
ActionType_SEND_MESSAGE ActionType = 3 ActionType_SEND_MESSAGE ActionType = 3
ActionType_LIST_CONVERSATIONS_SYNC ActionType = 1111
ActionType_MESSAGE_UPDATES ActionType = 4 ActionType_MESSAGE_UPDATES ActionType = 4
ActionType_LIST_CONTACTS ActionType = 6 ActionType_LIST_CONTACTS ActionType = 6
ActionType_CONVERSATION_UPDATES ActionType = 7 ActionType_CONVERSATION_UPDATES ActionType = 7
@ -125,9 +125,9 @@ var (
ActionType_name = map[int32]string{ ActionType_name = map[int32]string{
0: "UNSPECIFIED", 0: "UNSPECIFIED",
1: "LIST_CONVERSATIONS", 1: "LIST_CONVERSATIONS",
1111: "LIST_CONVERSATIONS_SYNC",
2: "LIST_MESSAGES", 2: "LIST_MESSAGES",
3: "SEND_MESSAGE", 3: "SEND_MESSAGE",
1111: "LIST_CONVERSATIONS_SYNC",
4: "MESSAGE_UPDATES", 4: "MESSAGE_UPDATES",
6: "LIST_CONTACTS", 6: "LIST_CONTACTS",
7: "CONVERSATION_UPDATES", 7: "CONVERSATION_UPDATES",
@ -173,9 +173,9 @@ var (
ActionType_value = map[string]int32{ ActionType_value = map[string]int32{
"UNSPECIFIED": 0, "UNSPECIFIED": 0,
"LIST_CONVERSATIONS": 1, "LIST_CONVERSATIONS": 1,
"LIST_CONVERSATIONS_SYNC": 1111,
"LIST_MESSAGES": 2, "LIST_MESSAGES": 2,
"SEND_MESSAGE": 3, "SEND_MESSAGE": 3,
"LIST_CONVERSATIONS_SYNC": 1111,
"MESSAGE_UPDATES": 4, "MESSAGE_UPDATES": 4,
"LIST_CONTACTS": 6, "LIST_CONTACTS": 6,
"CONVERSATION_UPDATES": 7, "CONVERSATION_UPDATES": 7,
@ -1758,11 +1758,11 @@ var file_messages_proto_rawDesc = []byte{
0x6e, 0x74, 0x10, 0x0e, 0x2a, 0x8b, 0x09, 0x0a, 0x0a, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x6e, 0x74, 0x10, 0x0e, 0x2a, 0x8b, 0x09, 0x0a, 0x0a, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54,
0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49,
0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x4c, 0x49, 0x53, 0x54, 0x5f, 0x43, 0x4f, 0x4e, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x4c, 0x49, 0x53, 0x54, 0x5f, 0x43, 0x4f, 0x4e,
0x56, 0x45, 0x52, 0x53, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x56, 0x45, 0x52, 0x53, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x10, 0x01, 0x12, 0x1c, 0x0a, 0x17,
0x4c, 0x49, 0x53, 0x54, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x53, 0x10, 0x02, 0x12, 0x4c, 0x49, 0x53, 0x54, 0x5f, 0x43, 0x4f, 0x4e, 0x56, 0x45, 0x52, 0x53, 0x41, 0x54, 0x49, 0x4f,
0x10, 0x0a, 0x0c, 0x53, 0x45, 0x4e, 0x44, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x4e, 0x53, 0x5f, 0x53, 0x59, 0x4e, 0x43, 0x10, 0xd7, 0x08, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x49,
0x03, 0x12, 0x1c, 0x0a, 0x17, 0x4c, 0x49, 0x53, 0x54, 0x5f, 0x43, 0x4f, 0x4e, 0x56, 0x45, 0x52, 0x53, 0x54, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x53, 0x10, 0x02, 0x12, 0x10, 0x0a,
0x53, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x5f, 0x53, 0x59, 0x4e, 0x43, 0x10, 0xd7, 0x08, 0x12, 0x0c, 0x53, 0x45, 0x4e, 0x44, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x03, 0x12,
0x13, 0x0a, 0x0f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x13, 0x0a, 0x0f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54,
0x45, 0x53, 0x10, 0x04, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x49, 0x53, 0x54, 0x5f, 0x43, 0x4f, 0x4e, 0x45, 0x53, 0x10, 0x04, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x49, 0x53, 0x54, 0x5f, 0x43, 0x4f, 0x4e,
0x54, 0x41, 0x43, 0x54, 0x53, 0x10, 0x06, 0x12, 0x18, 0x0a, 0x14, 0x43, 0x4f, 0x4e, 0x56, 0x45, 0x54, 0x41, 0x43, 0x54, 0x53, 0x10, 0x06, 0x12, 0x18, 0x0a, 0x14, 0x43, 0x4f, 0x4e, 0x56, 0x45,

View file

@ -89,9 +89,16 @@ message FetchConversationMessagesPayload {
Cursor cursor = 5; Cursor cursor = 5;
} }
message ListCoversationsPayload { message ListConversationsPayload {
int64 count = 2; // no idea if this is actually amount to list enum Folder {
int64 field4 = 4; // no idea what this is , but only value ive seen is 1 UNKNOWN = 0;
INBOX = 1;
ARCHIVE = 2;
SPAM_BLOCKED = 5;
}
int64 count = 2;
Folder folder = 4;
} }
message Cursor { message Cursor {

View file

@ -160,9 +160,9 @@ message ConfigVersion {
enum ActionType { enum ActionType {
UNSPECIFIED = 0; UNSPECIFIED = 0;
LIST_CONVERSATIONS = 1; LIST_CONVERSATIONS = 1;
LIST_CONVERSATIONS_SYNC = 1111; // fake value
LIST_MESSAGES = 2; LIST_MESSAGES = 2;
SEND_MESSAGE = 3; SEND_MESSAGE = 3;
LIST_CONVERSATIONS_SYNC = 1111;
MESSAGE_UPDATES = 4; MESSAGE_UPDATES = 4;
LIST_CONTACTS = 6; LIST_CONTACTS = 6;
CONVERSATION_UPDATES = 7; CONVERSATION_UPDATES = 7;

View file

@ -6,8 +6,8 @@ import (
"go.mau.fi/mautrix-gmessages/libgm/binary" "go.mau.fi/mautrix-gmessages/libgm/binary"
) )
func (c *Client) ListConversations(count int64) (*binary.Conversations, error) { func (c *Client) ListConversations(count int64, folder binary.ListConversationsPayload_Folder) (*binary.Conversations, error) {
payload := &binary.ListCoversationsPayload{Count: count, Field4: 1} payload := &binary.ListConversationsPayload{Count: count, Folder: folder}
//var actionType binary.ActionType //var actionType binary.ActionType
//if !c.synced { //if !c.synced {
// actionType = binary.ActionType_LIST_CONVERSATIONS_SYNC // actionType = binary.ActionType_LIST_CONVERSATIONS_SYNC

View file

@ -9,7 +9,7 @@ import (
func (c *Client) handleClientReady(newSessionId string) { func (c *Client) handleClientReady(newSessionId string) {
c.Logger.Info().Any("sessionId", newSessionId).Msg("Client is ready!") c.Logger.Info().Any("sessionId", newSessionId).Msg("Client is ready!")
conversations, convErr := c.ListConversations(25) conversations, convErr := c.ListConversations(25, binary.ListConversationsPayload_INBOX)
if convErr != nil { if convErr != nil {
panic(convErr) panic(convErr)
} }