diff libpurple/protocols/jabber/presence.c @ 18739:f29794be0163

applied changes from bbcc1925d9e449bb9599d378da2764bf47da2a7a through c2cc31f23a71f23062555721f8101fc9c997bae2 I commited this yesterday, but it includes some other changes that I didn't mean to commit, so I reverted it and now I'm just committing this file. Here's the original commit message: When we get a presence of type="error" from the server that corresponds to a Jabber chat, only destroy/free/close/leave the chat room if the error happened while joining (and we were therefore never in the room). This fixes the following bug: 1. Join a room 2. Try to change your nickname to something that's being used by someone else 3. The server gives you an error message, but you're not actually kicked out of the room 4. Pidgin thinks you've been kicked out and won't let you send messages to the room, etc.
author Mark Doliner <mark@kingant.net>
date Sun, 29 Jul 2007 21:32:36 +0000
parents bf8b69cba9ae
children 177552010f1d 1ca6c4b234ab dd5932225deb
line wrap: on
line diff
--- a/libpurple/protocols/jabber/presence.c	Sun Jul 29 21:29:10 2007 +0000
+++ b/libpurple/protocols/jabber/presence.c	Sun Jul 29 21:32:36 2007 +0000
@@ -413,7 +413,8 @@
 
 			if(chat->conv) {
 				title = g_strdup_printf(_("Error in chat %s"), from);
-				serv_got_chat_left(js->gc, chat->id);
+				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);
 			}
@@ -421,7 +422,9 @@
 			g_free(title);
 			g_free(msg);
 
-			jabber_chat_destroy(chat);
+			if (g_hash_table_size(chat->members) == 0)
+				/* Only destroy the chat if the error happened while joining */
+				jabber_chat_destroy(chat);
 			jabber_id_free(jid);
 			g_free(status);
 			g_free(room_jid);