Skip to content

Commit

Permalink
Add create group payload type
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Jan 22, 2024
1 parent 299eab2 commit 0b2fb96
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions messagix/socket/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var TaskLabels = map[string]string{
"SetThreadImageTask": "37",
"SendMessageTask": "46",
"ReportAppStateTask": "123",
"CreateGroupTask": "130",
"RemoveParticipantTask": "140",
"MuteThreadTask": "144",
"FetchThreadsTask": "145",
Expand Down
20 changes: 20 additions & 0 deletions messagix/socket/threads.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,26 @@ func (t *CreateThreadTask) Create() (interface{}, interface{}, bool) {
return t, strconv.FormatInt(t.ThreadFBID, 10), false
}

type CreateGroupPayload struct {
ThreadID int64 `json:"thread_id"`
OTID string `json:"otid"`
Source int `json:"source"` // 0
SendType int `json:"send_type"` // 8
}

type CreateGroupTask struct {
Participants []int64 `json:"participants"`
SendPayload CreateGroupPayload `json:"send_payload"`
}

func (t *CreateGroupTask) GetLabel() string {
return TaskLabels["CreateGroupTask"]
}

func (t *CreateGroupTask) Create() (interface{}, interface{}, bool) {
return t, strconv.FormatInt(t.SendPayload.ThreadID, 10), false
}

type DeleteThreadTask struct {
ThreadKey int64 `json:"thread_key"`
RemoveType int64 `json:"remove_type"`
Expand Down

0 comments on commit 0b2fb96

Please sign in to comment.