pidgin: 45d6ac96: Fix the chat-room rejoining bug where th...

sadrul at pidgin.im sadrul at pidgin.im
Sun Jun 1 17:06:49 EDT 2008


-----------------------------------------------------------------
Revision: 45d6ac96faff4505b292cb4df4cdf8104114a04b
Ancestor: 069f197178d158cdd308687095c14d49d8eee0ed
Author: sadrul at pidgin.im
Date: 2008-06-01T18:08:14
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/45d6ac96faff4505b292cb4df4cdf8104114a04b

Modified files:
        libpurple/protocols/jabber/chat.c
        libpurple/protocols/jabber/chat.h
        libpurple/protocols/jabber/presence.c

ChangeLog: 

Fix the chat-room rejoining bug where the list appears empty.
Closes #5541.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/chat.c	76d62da2c6f7afa96e3fe52e273988717e6c33d5
+++ libpurple/protocols/jabber/chat.c	cac367aff66c4693fc91eccb7f95f0169a0a7a6e
@@ -308,7 +308,7 @@ void jabber_chat_leave(PurpleConnection 
 
 	jabber_chat_part(chat, NULL);
 
-	chat->conv = NULL;
+	chat->left = TRUE;
 }
 
 void jabber_chat_destroy(JabberChat *chat)
============================================================
--- libpurple/protocols/jabber/chat.h	67931fd52732b837f63ee3ff76a088c624bd3127
+++ libpurple/protocols/jabber/chat.h	c0bbce375c14390fe32a65d300ebbb780e7cf6df
@@ -49,6 +49,7 @@ typedef struct _JabberChat {
 	PurpleRequestType config_dialog_type;
 	void *config_dialog_handle;
 	GHashTable *members;
+	gboolean left;
 } JabberChat;
 
 GList *jabber_chat_info(PurpleConnection *gc);
============================================================
--- libpurple/protocols/jabber/presence.c	e9cd5c584fe9108ac7d0ff70b083c6ca5634aa26
+++ libpurple/protocols/jabber/presence.c	969cd4281c60264367322996c483c2695daffa61
@@ -49,7 +49,7 @@ static void chats_send_presence_foreach(
 	xmlnode *presence = user_data;
 	char *chat_full_jid;
 
-	if(!chat->conv)
+	if(!chat->conv || chat->left)
 		return;
 
 	chat_full_jid = g_strdup_printf("%s@%s/%s", chat->room, chat->server,
@@ -581,13 +581,13 @@ void jabber_presence_parse(JabberStream 
 		if(state == JABBER_BUDDY_STATE_ERROR) {
 			char *title, *msg = jabber_parse_error(js, packet, NULL);
 
-			if(chat->conv) {
+			if (!chat->conv) {
+				title = g_strdup_printf(_("Error joining chat %s"), from);
+				purple_serv_got_join_chat_failed(js->gc, chat->components);
+			} else {
 				title = g_strdup_printf(_("Error in chat %s"), from);
 				if (g_hash_table_size(chat->members) == 0)
 					serv_got_chat_left(js->gc, chat->id);
-			} else {
-				title = g_strdup_printf(_("Error joining chat %s"), from);
-				purple_serv_got_join_chat_failed(js->gc, chat->components);
 			}
 			purple_notify_error(js->gc, title, title, msg);
 			g_free(title);
@@ -609,8 +609,9 @@ void jabber_presence_parse(JabberStream 
 
 			/* If we haven't joined the chat yet, we don't care that someone
 			 * left, or it was us leaving after we closed the chat */
-			if(!chat->conv) {
-				if(jid->resource && chat->handle && !strcmp(jid->resource, chat->handle))
+			if (!chat->conv || chat->left) {
+				if (chat->left &&
+						jid->resource && chat->handle && !strcmp(jid->resource, chat->handle))
 					jabber_chat_destroy(chat);
 				jabber_id_free(jid);
 				g_free(status);


More information about the Commits mailing list