Remove all left chats

Use new TGLCF_LEFT instead of user count to determine left chats more reliably.
This commit is contained in:
mjentsch 2016-01-24 21:29:48 +01:00
parent 4e08542823
commit 660376b9df
2 changed files with 3 additions and 5 deletions

View file

@ -34,8 +34,7 @@
static void tgl_chat_iterator_cb (tgl_peer_t *peer, void *extra) {
NSMutableArray *A = (__bridge NSMutableArray *)(extra);
// chats with 0 participants were deleted or left by the user
if (tgl_get_peer_type (peer->id) == TGL_PEER_CHAT && peer->chat.users_num > 0) {
if (tgl_get_peer_type (peer->id) == TGL_PEER_CHAT && !(peer->chat.flags & TGLCF_LEFT)) {
[A addObject: [NSString stringWithUTF8String: peer->print_name]];
}
}

View file

@ -305,9 +305,8 @@ static void on_get_dialog_list_done (struct tgl_state *TLS, void *extra, int suc
p2tgl_prpl_got_user_status (TLS, UC->id, &UC->user.status);
}
} else if (tgl_get_peer_type (UC->id) == TGL_PEER_CHAT) {
if (UC->chat.users_num > 0 &&
purple_account_get_bool (tls_get_data (TLS)->pa, TGP_KEY_JOIN_GROUP_CHATS, TGP_DEFAULT_JOIN_GROUP_CHATS)) {
// FIXME: dont add LEFT chats
if (purple_account_get_bool (tls_get_data (TLS)->pa, TGP_KEY_JOIN_GROUP_CHATS, TGP_DEFAULT_JOIN_GROUP_CHATS)) {
PurpleChat *PC = tgp_blist_chat_find (TLS, UC->id);
if (!PC) {
PC = p2tgl_chat_new (TLS, &UC->chat);