pidgin: 5185dfd5: tighter scoping++

darkrain42 at pidgin.im darkrain42 at pidgin.im
Wed Apr 29 01:40:38 EDT 2009


-----------------------------------------------------------------
Revision: 5185dfd520b5ad9924dded045aaa0b84ee8a3ef9
Ancestor: ae2962f019013296b87740e608de5db314b90d8a
Author: darkrain42 at pidgin.im
Date: 2009-04-29T05:37:58
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/5185dfd520b5ad9924dded045aaa0b84ee8a3ef9

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

ChangeLog: 

tighter scoping++

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/presence.c	7c33eaff31d3675904a9961cb121870727797e5d
+++ libpurple/protocols/jabber/presence.c	d698adbc46de47ac6c5246408413806196420e41
@@ -604,7 +604,6 @@ void jabber_presence_parse(JabberStream 
 
 	if(jid->node && (chat = jabber_chat_find(js, jid->node, jid->domain))) {
 		static int i = 1;
-		char *room_jid = g_strdup_printf("%s@%s", jid->node, jid->domain);
 
 		if(state == JABBER_BUDDY_STATE_ERROR) {
 			char *title, *msg = jabber_parse_error(js, packet, NULL);
@@ -626,7 +625,6 @@ void jabber_presence_parse(JabberStream 
 				jabber_chat_destroy(chat);
 			jabber_id_free(jid);
 			g_free(status);
-			g_free(room_jid);
 			g_free(avatar_hash);
 			return;
 		}
@@ -643,7 +641,6 @@ void jabber_presence_parse(JabberStream 
 					jabber_chat_destroy(chat);
 				jabber_id_free(jid);
 				g_free(status);
-				g_free(room_jid);
 				g_free(avatar_hash);
 				return;
 			}
@@ -699,12 +696,14 @@ void jabber_presence_parse(JabberStream 
 			}
 		} else {
 			if(!chat->conv) {
+				char *room_jid = g_strdup_printf("%s@%s", jid->node, jid->domain);
 				chat->id = i++;
 				chat->muc = muc;
 				chat->conv = serv_got_joined_chat(js->gc, chat->id, room_jid);
 				purple_conv_chat_set_nick(PURPLE_CONV_CHAT(chat->conv), chat->handle);
 
 				jabber_chat_disco_traffic(chat);
+				g_free(room_jid);
 			}
 
 			jabber_buddy_track_resource(jb, jid->resource, priority, state,
@@ -719,7 +718,6 @@ void jabber_presence_parse(JabberStream 
 				purple_conv_chat_user_set_flags(PURPLE_CONV_CHAT(chat->conv), jid->resource,
 						flags);
 		}
-		g_free(room_jid);
 	} else {
 		buddy_name = g_strdup_printf("%s%s%s", jid->node ? jid->node : "",
 									 jid->node ? "@" : "", jid->domain);


More information about the Commits mailing list