Fix bug that caused dropping of group chat messages when leaving the chat window open during reconnect

This commit is contained in:
mjentsch 2015-05-30 15:55:13 +02:00
parent e7554c739c
commit 8c859ad825

View file

@ -41,16 +41,17 @@ void chat_users_update (struct tgl_state *TLS, struct tgl_chat *chat) {
PurpleConversation *chat_show (PurpleConnection *gc, int id) {
connection_data *conn = purple_connection_get_protocol_data(gc);
PurpleConversation *convo = purple_find_chat (gc, id);
PurpleConvChat *chat = purple_conversation_get_chat_data (convo);
tgl_peer_t *P = tgl_peer_get (conn->TLS, TGL_MK_CHAT(id));
if (! convo) {
if (! P) {
warning ("Chat %d not existing, not showing...", id);
return NULL;
}
convo = p2tgl_got_joined_chat (conn->TLS, &P->chat);
chat_users_update (conn->TLS, &P->chat);
if (! P) {
warning ("Chat %d not existing, not showing...", id);
return NULL;
}
if (! convo || (chat && purple_conv_chat_has_left (chat))) {
convo = p2tgl_got_joined_chat (conn->TLS, &P->chat);
}
chat_users_update (conn->TLS, &P->chat);
return convo;
}