diff libpurple/protocols/jabber/presence.c @ 18712:c65c4caa817a

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 07:01:13 +0000
parents 8f9c62a370fb
children bf8b69cba9ae
line wrap: on
line diff
--- a/libpurple/protocols/jabber/presence.c	Sun Jul 29 06:10:24 2007 +0000
+++ b/libpurple/protocols/jabber/presence.c	Sun Jul 29 07:01:13 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);