changeset 8182:3e1762ad0f98

[gaim-migrate @ 8901] This plugs a tiny memory leak, and I think it will fix marv's ISP-suckage auto-join bug. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Thu, 29 Jan 2004 04:47:01 +0000
parents 0609485e5bb5
children ab0fce369327
files src/protocols/jabber/presence.c
diffstat 1 files changed, 16 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/jabber/presence.c	Wed Jan 28 22:15:47 2004 +0000
+++ b/src/protocols/jabber/presence.c	Thu Jan 29 04:47:01 2004 +0000
@@ -299,20 +299,22 @@
 			jabber_chat_destroy(chat);
 			jabber_id_free(jid);
 			g_free(status);
+			g_free(room_jid);
 			return;
 		}
 
 
-		if(!chat->conv) {
-			chat->id = i++;
-			chat->muc = muc;
-			chat->conv = serv_got_joined_chat(js->gc, chat->id, room_jid);
-			gaim_conv_chat_set_nick(GAIM_CONV_CHAT(chat->conv), jid->resource);
-		}
-
 		if(type && !strcmp(type, "unavailable")) {
 			gboolean nick_change = FALSE;
 
+			/* If we haven't joined the chat yet, we don't care that someone left */
+			if(!chat->conv) {
+				jabber_id_free(jid);
+				g_free(status);
+				g_free(room_jid);
+				return;
+			}
+
 			jabber_buddy_remove_resource(jb, jid->resource);
 			if(chat->muc) {
 				xmlnode *x;
@@ -345,6 +347,13 @@
 				}
 			}
 		} else {
+			if(!chat->conv) {
+				chat->id = i++;
+				chat->muc = muc;
+				chat->conv = serv_got_joined_chat(js->gc, chat->id, room_jid);
+				gaim_conv_chat_set_nick(GAIM_CONV_CHAT(chat->conv), jid->resource);
+			}
+
 			jabber_buddy_track_resource(jb, jid->resource, priority, state,
 					status);