diff options
author | mjentsch <mtthsjntsch@gmail.com> | 2015-09-06 18:33:30 +0300 |
---|---|---|
committer | mjentsch <mtthsjntsch@gmail.com> | 2015-09-08 18:06:56 +0300 |
commit | 888cffffc1e8dbc4780ff339509ffae1a76b5cf4 (patch) | |
tree | fcbabc4a82b5f27715e95c291d04e5b22a254b33 /telegram-base.c | |
parent | 592b31e8c89a8719073e6ca231dfff2231d14bf4 (diff) |
Improve group chat management
Load full chat info lazily, prevents useless network request and should fix issues with delays through flood errors when handling big amounts of user chats. Handle chat participant deletions and additions correctly and only touch the user list when it is actually updated, this should fix some issues with printing annoying messages in Finch and users not showing up in the buddy list in certain situations. Only add chats to buddy list that are actively joined or receive incoming message, which should help keeping the buddy list more tidy when using much chats.
Diffstat (limited to 'telegram-base.c')
-rw-r--r-- | telegram-base.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/telegram-base.c b/telegram-base.c index a369d43..9aafa63 100644 --- a/telegram-base.c +++ b/telegram-base.c @@ -620,10 +620,9 @@ void request_accept_secret_chat (struct tgl_state *TLS, struct tgl_secret_chat * void create_group_chat_done_cb (struct tgl_state *TLS, void *title, int success) { if (success) { - tgl_peer_t *t = tgl_peer_get_by_name(TLS, title); - if (t) { - connection_data *conn = TLS->ev_base; - chat_show (conn->gc, tgl_get_peer_id(t->id)); + tgl_peer_t *P = tgl_peer_get_by_name (TLS, title); + if (P && tgl_get_peer_type (P->id) == TGL_PEER_CHAT) { + tgp_chat_show (TLS, &P->chat); } } tgp_notify_on_error_gw (TLS, NULL, success); @@ -645,7 +644,7 @@ void tgp_create_group_chat_by_usernames (struct tgl_state *TLS, const char *titl if (P && tgl_get_peer_id (P->id) != TLS->our_id) { ids[j++] = P->id; } else { - debug("User %s not found in peer list", users[j]); + debug ("User %s not found in peer list", users[j]); } } if (i > 0) { @@ -662,9 +661,9 @@ static void create_group_chat_cb (void *_data, PurpleRequestFields* fields) { debug ("create_group_chat_cb()"); struct accept_create_chat_data *data = _data; const char *users[3] = { - purple_request_fields_get_string(fields, "user1"), - purple_request_fields_get_string(fields, "user2"), - purple_request_fields_get_string(fields, "user3") + purple_request_fields_get_string (fields, "user1"), + purple_request_fields_get_string (fields, "user2"), + purple_request_fields_get_string (fields, "user3") }; tgp_create_group_chat_by_usernames (data->TLS, data->title, users, 3, FALSE); |