Compare commits
2 Commits
1b9870a0ea
...
69e16be9d1
Author | SHA1 | Date |
---|---|---|
Artem Savkov | 69e16be9d1 | |
Artem Savkov | 3a300cd417 |
|
@ -901,9 +901,6 @@ gboolean discord_parse_message(struct im_connection *ic, gchar *buf, guint64 siz
|
|||
}
|
||||
}
|
||||
|
||||
dd->state = WS_READY;
|
||||
imcb_connected(ic);
|
||||
|
||||
json_value *pcs = json_o_get(data, "private_channels");
|
||||
if (pcs != NULL && pcs->type == json_array) {
|
||||
for (int pcidx = 0; pcidx < pcs->u.array.length; pcidx++) {
|
||||
|
@ -946,6 +943,9 @@ gboolean discord_parse_message(struct im_connection *ic, gchar *buf, guint64 siz
|
|||
}
|
||||
}
|
||||
|
||||
dd->state = WS_READY;
|
||||
imcb_connected(ic);
|
||||
|
||||
} else if (g_strcmp0(event, "GUILD_SYNC") == 0) {
|
||||
json_value *data = json_o_get(js, "d");
|
||||
const char *id = json_o_str(data, "id");
|
||||
|
|
|
@ -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