Sync private groups as well
Turns out opcode 13 is responsible for syncing private group DMs. Ask for that on join. Don't have any way to check it currently, just hoping it will return a familiar message.
This commit is contained in:
parent
1b9870a0ea
commit
3a300cd417
|
@ -108,6 +108,15 @@ void discord_ws_sync_channel(discord_data *dd, const char *guild_id,
|
|||
g_string_free(buf, TRUE);
|
||||
}
|
||||
|
||||
void discord_ws_sync_private_group(discord_data *dd, const char *channel_id)
|
||||
{
|
||||
GString *buf = g_string_new("");
|
||||
g_string_printf(buf, "{\"op\":%d,\"d\":{\"channel_id\":\"%s\"}}",
|
||||
OPCODE_REQUEST_SYNC_PRIVATE_GROUP, channel_id);
|
||||
discord_ws_send_payload(dd, buf->str, buf->len);
|
||||
g_string_free(buf, TRUE);
|
||||
}
|
||||
|
||||
static gboolean discord_ws_heartbeat_timeout(gpointer data, gint fd,
|
||||
b_input_condition cond)
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@ typedef enum {
|
|||
OPCODE_HELLO,
|
||||
OPCODE_HEARTBEAT_ACK,
|
||||
OPCODE_REQUEST_SYNC,
|
||||
OPCODE_UNKNOWN,
|
||||
OPCODE_REQUEST_SYNC_PRIVATE_GROUP,
|
||||
OPCODE_REQUEST_SYNC_CHANNEL
|
||||
} discord_opcode;
|
||||
|
||||
|
@ -44,3 +44,4 @@ void discord_ws_set_status(struct im_connection *ic, gchar *status,
|
|||
void discord_ws_sync_server(discord_data *dd, const char *id);
|
||||
void discord_ws_sync_channel(discord_data *dd, const char *guild_id,
|
||||
const char *channel_id, unsigned int members);
|
||||
void discord_ws_sync_private_group(discord_data *dd, const char *channel_id);
|
||||
|
|
|
@ -217,6 +217,7 @@ struct groupchat *discord_chat_do_join(struct im_connection *ic,
|
|||
} else if (cinfo != NULL && cinfo->type == CHANNEL_GROUP_PRIVATE) {
|
||||
gc = imcb_chat_new(ic, cinfo->to.group.name);
|
||||
|
||||
discord_ws_sync_private_group(dd, cinfo->id);
|
||||
if (is_auto_join) {
|
||||
imcb_chat_name_hint(gc, room);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue