src/protocols/jabber/presence.c

changeset 8043
86a087e9624c
parent 8010
e9896003ea75
child 8135
d4df7d1821a5
--- a/src/protocols/jabber/presence.c	Fri Jan 09 16:58:33 2004 +0000
+++ b/src/protocols/jabber/presence.c	Sat Jan 10 01:48:24 2004 +0000
@@ -153,9 +153,11 @@
 	xmlnode *y;
 	gboolean muc = FALSE;
 
-	jb = jabber_buddy_find(js, from, TRUE);
 
-	if(!jb)
+	if(!(jb = jabber_buddy_find(js, from, TRUE)))
+		return;
+
+	if(!(jid = jabber_id_new(from)))
 		return;
 
 	if(jb->error_msg) {
@@ -188,9 +190,11 @@
 				_("Authorize"), G_CALLBACK(authorize_add_cb),
 				_("Deny"), G_CALLBACK(deny_add_cb));
 		g_free(msg);
+		jabber_id_free(jid);
 		return;
 	} else if(type && !strcmp(type, "subscribed")) {
 		/* we've been allowed to see their presence, but we don't care */
+		jabber_id_free(jid);
 		return;
 	} else {
 		if((y = xmlnode_get_child(packet, "show"))) {
@@ -212,8 +216,6 @@
 		}
 	}
 
-	if(!(jid = jabber_id_new(from)))
-		return;
 
 	for(y = packet->child; y; y = y->next) {
 		if(y->type != NODE_TYPE_TAG)
@@ -377,7 +379,12 @@
 		if(state == JABBER_STATE_ERROR ||
 				(type && (!strcmp(type, "unavailable") ||
 						  !strcmp(type, "unsubscribed")))) {
+			GaimConversation *conv;
+
 			jabber_buddy_remove_resource(jb, jid->resource);
+			if((conv = jabber_find_unnormalized_conv(from, js->gc->account)))
+				gaim_conversation_set_name(conv, buddy_name);
+
 		} else {
 			jabber_buddy_track_resource(jb, jid->resource, priority, state,
 					status);

mercurial