gobjectification: 440cbfb9: Replace PURPLE_CONNECTION_IS_VALID with ...

qulogic at pidgin.im qulogic at pidgin.im
Wed Aug 13 00:51:05 EDT 2008


-----------------------------------------------------------------
Revision: 440cbfb950ba7a8e6b4141f9d4dfd42e784f0677
Ancestor: b65f8741f956a0077dd0810a4cde389a6246acf6
Author: qulogic at pidgin.im
Date: 2008-08-13T03:26:45
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/440cbfb950ba7a8e6b4141f9d4dfd42e784f0677

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

ChangeLog: 

Replace PURPLE_CONNECTION_IS_VALID with PURPLE_CONNECTION_IS_CONNECTED, 
g_object_ref, and g_object_unref in XMPP presence.c and usermood.c 
since the comments say a not-disconnected is what's needed.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/presence.c	fa131d107f464f778f5f5cdc871a396c08b6836a
+++ libpurple/protocols/jabber/presence.c	f73117dc3b85c5ec09d2fa4cfad4366aa46fc825
@@ -310,9 +310,10 @@ static void authorize_add_cb(gpointer da
 static void authorize_add_cb(gpointer data)
 {
 	struct _jabber_add_permit *jap = data;
-	if(PURPLE_CONNECTION_IS_VALID(jap->gc))
+	if (PURPLE_CONNECTION_IS_CONNECTED(jap->gc))
 		jabber_presence_subscription_set(purple_object_get_protocol_data(PURPLE_OBJECT(jap->gc)),
 			jap->who, "subscribed");
+	g_object_unref(G_OBJECT(jap->gc));
 	g_free(jap->who);
 	g_free(jap);
 }
@@ -320,9 +321,10 @@ static void deny_add_cb(gpointer data)
 static void deny_add_cb(gpointer data)
 {
 	struct _jabber_add_permit *jap = data;
-	if(PURPLE_CONNECTION_IS_VALID(jap->gc))
+	if(PURPLE_CONNECTION_IS_CONNECTED(jap->gc))
 		jabber_presence_subscription_set(purple_object_get_protocol_data(PURPLE_OBJECT(jap->gc)),
 			jap->who, "unsubscribed");
+	g_object_unref(G_OBJECT(jap->gc));
 	g_free(jap->who);
 	g_free(jap);
 }
@@ -467,7 +469,7 @@ void jabber_presence_parse(JabberStream 
 				onlist = TRUE;
 		}
 
-		jap->gc = js->gc;
+		jap->gc = g_object_ref(js->gc);
 		jap->who = g_strdup(from);
 		jap->js = js;
 
============================================================
--- libpurple/protocols/jabber/usermood.c	3a4156f7ac17c81d2386d993a055c80f13e13d93
+++ libpurple/protocols/jabber/usermood.c	1a9e1a6bac4dbc05614514df1628af2b18afd3b3
@@ -150,8 +150,9 @@ static void do_mood_set_from_fields(Purp
 	const int max_mood_idx = sizeof(moodstrings) / sizeof(moodstrings[0]) - 1;
 	int selected_mood = purple_request_fields_get_choice(fields, "mood");
 
-	if (!PURPLE_CONNECTION_IS_VALID(gc)) {
+	if (!PURPLE_CONNECTION_IS_CONNECTED(gc)) {
 		purple_debug_error("jabber", "Unable to set mood; account offline.\n");
+		g_object_unref(G_OBJECT(gc));
 		return;
 	}
 
@@ -159,10 +160,13 @@ static void do_mood_set_from_fields(Purp
 
 	if (selected_mood < 0 || selected_mood >= max_mood_idx) {
 		purple_debug_error("jabber", "Invalid mood index (%d) selected.\n", selected_mood);
+		g_object_unref(G_OBJECT(gc));
 		return;
 	}
 
 	jabber_mood_set(js, moodstrings[selected_mood], purple_request_fields_get_string(fields, "text"));
+
+	g_object_unref(G_OBJECT(gc));
 }
 
 static void do_mood_set_mood(PurplePluginAction *action) {
@@ -198,7 +202,7 @@ static void do_mood_set_mood(PurplePlugi
 						  _("Set"), G_CALLBACK(do_mood_set_from_fields),
 						  _("Cancel"), NULL,
 						  purple_connection_get_account(gc), NULL, NULL,
-						  gc);
+						  g_object_ref(G_OBJECT(gc)));
 	
 }
 


More information about the Commits mailing list