im.pidgin.gobjectification: bd224457a8446153f26abe33e06343417dd41ded

grim at pidgin.im grim at pidgin.im
Sun Nov 4 13:50:51 EST 2007


-----------------------------------------------------------------
Revision: bd224457a8446153f26abe33e06343417dd41ded
Ancestor: 011ac75b8f05b652a512a28effe220e4866ee216
Author: grim at pidgin.im
Date: 2007-10-28T06:23:25
Branch: im.pidgin.gobjectification

Modified files:
        configure.ac libpurple/account.c libpurple/connection.h
        libpurple/marshallers.list

ChangeLog: 

Cleaned up account.c so it compiles with warnings, still have breakage all over the place


-------------- next part --------------
============================================================
--- configure.ac	831a76b9cbb5fee74b87b2411c4b8dcf1be616fd
+++ configure.ac	59520285f24299cdd87b5be65853d7fe77a0a6d3
@@ -283,6 +283,9 @@ AC_SUBST(GLIB_LIBS)
 AC_SUBST(GLIB_CFLAGS)
 AC_SUBST(GLIB_LIBS)
 
+GLIB_GENMARSHAL=`pkg-config --variable=glib_genmarshal glib-2.0`
+AC_SUBST(GLIB_GENMARSHAL)
+
 AC_ARG_WITH([extraversion],
 			AC_HELP_STRING([--with-extraversion=STRING],
 						   [extra version number to be displayed in Help->About and --help (for packagers)]),
============================================================
--- libpurple/account.c	e01143f1357d87110ac982d3e2a7c479019987d4
+++ libpurple/account.c	b9cc404bf3e5be5c77eefd9e0e96db9500213913
@@ -28,6 +28,7 @@
 #include "core.h"
 #include "dbus-maybe.h"
 #include "debug.h"
+#include "marshallers.h"
 #include "network.h"
 #include "notify.h"
 #include "pounce.h"
@@ -1278,22 +1279,24 @@ purple_account_request_change_user_info(
 void
 purple_account_request_change_user_info(PurpleAccount *account)
 {
-	PurpleConnection *gc;
+	PurpleConnection *pc;
+	PurpleConnectionFlags flags;
 	char primary[256];
 
 	g_return_if_fail(account != NULL);
 	g_return_if_fail(purple_account_is_connected(account));
 
-	gc = purple_account_get_connection(account);
+	pc = purple_account_get_connection(account);
+	flags = purple_connection_get_flags(pc);
 
 	g_snprintf(primary, sizeof(primary),
 			   _("Change user information for %s"),
 			   purple_account_get_username(account));
 
-	purple_request_input(gc, _("Set User Info"), primary, NULL,
+	purple_request_input(pc, _("Set User Info"), primary, NULL,
 					   purple_account_get_user_info(account),
-					   TRUE, FALSE, ((gc != NULL) &&
-					   (gc->flags & PURPLE_CONNECTION_HTML) ? "html" : NULL),
+					   TRUE, FALSE,
+					   (flags & PURPLE_CONNECTION_FLAGS_HTML) ? "html" : NULL,
 					   _("Save"), G_CALLBACK(set_user_info_cb),
 					   _("Cancel"), NULL,
 					   account, NULL, NULL,
@@ -1415,7 +1418,7 @@ purple_account_set_enabled(PurpleAccount
 purple_account_set_enabled(PurpleAccount *account, const char *ui,
 			 gboolean value)
 {
-	PurpleConnection *gc;
+	PurpleConnection *pc;
 	gboolean was_enabled = FALSE;
 
 	g_return_if_fail(account != NULL);
@@ -1424,14 +1427,14 @@ purple_account_set_enabled(PurpleAccount
 	was_enabled = purple_account_get_enabled(account, ui);
 
 	purple_account_set_ui_bool(account, ui, "auto-login", value);
-	gc = purple_account_get_connection(account);
+	pc = purple_account_get_connection(account);
 
 	if(was_enabled && !value)
 		purple_signal_emit(purple_accounts_get_handle(), "account-disabled", account);
 	else if(!was_enabled && value)
 		purple_signal_emit(purple_accounts_get_handle(), "account-enabled", account);
 
-	if ((gc != NULL) && (gc->wants_to_die == TRUE))
+	if ((pc != NULL) && (purple_connection_wants_to_die(pc) == TRUE))
 		return;
 
 	if (value && purple_presence_is_online(account->presence))
@@ -1676,33 +1679,36 @@ purple_account_get_state(const PurpleAcc
 static PurpleConnectionState
 purple_account_get_state(const PurpleAccount *account)
 {
-	PurpleConnection *gc;
+	PurpleConnection *pc;
 
-	g_return_val_if_fail(account != NULL, PURPLE_DISCONNECTED);
+	g_return_val_if_fail(account != NULL, PURPLE_CONNECTION_STATE_DISCONNECTED);
 
-	gc = purple_account_get_connection(account);
-	if (!gc)
-		return PURPLE_DISCONNECTED;
+	pc = purple_account_get_connection(account);
+	if (!pc)
+		return PURPLE_CONNECTION_STATE_DISCONNECTED;
 
-	return purple_connection_get_state(gc);
+	return purple_connection_get_state(pc);
 }
 
 gboolean
 purple_account_is_connected(const PurpleAccount *account)
 {
-	return (purple_account_get_state(account) == PURPLE_CONNECTED);
+	return (purple_account_get_state(account) ==
+			PURPLE_CONNECTION_STATE_CONNECTED);
 }
 
 gboolean
 purple_account_is_connecting(const PurpleAccount *account)
 {
-	return (purple_account_get_state(account) == PURPLE_CONNECTING);
+	return (purple_account_get_state(account) ==
+			PURPLE_CONNECTION_STATE_CONNECTING);
 }
 
 gboolean
 purple_account_is_disconnected(const PurpleAccount *account)
 {
-	return (purple_account_get_state(account) == PURPLE_DISCONNECTED);
+	return (purple_account_get_state(account) ==
+			PURPLE_CONNECTION_STATE_DISCONNECTED);
 }
 
 const char *
@@ -2042,99 +2048,84 @@ purple_account_add_buddy(PurpleAccount *
 void
 purple_account_add_buddy(PurpleAccount *account, PurpleBuddy *buddy)
 {
-	PurplePluginProtocolInfo *prpl_info = NULL;
-	PurpleConnection *gc = purple_account_get_connection(account);
+	GList *tmp = NULL;
 
-	if (gc != NULL && gc->prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
-
-	if (prpl_info != NULL && prpl_info->add_buddy != NULL)
-		prpl_info->add_buddy(gc, buddy, purple_buddy_get_group(buddy));
+	tmp = g_list_append(tmp, buddy);
+	purple_account_add_buddies(account, tmp);
+	g_list_free(tmp);
 }
 
 void
 purple_account_add_buddies(PurpleAccount *account, GList *buddies)
 {
 	PurplePluginProtocolInfo *prpl_info = NULL;
-	PurpleConnection *gc = purple_account_get_connection(account);
+	PurpleConnection *pc = purple_account_get_connection(account);
+	GList *cur, *groups = NULL;
 
-	if (gc != NULL && gc->prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	if(pc == NULL)
+		return;
 
-	if (prpl_info) {
-		GList *cur, *groups = NULL;
+	prpl_info = purple_connection_get_protocol(pc);
+	if(prpl_info == NULL)
+		return;
 
-		/* Make a list of what group each buddy is in */
-		for (cur = buddies; cur != NULL; cur = cur->next) {
-			PurpleBlistNode *node = cur->data;
-			groups = g_list_append(groups, node->parent->parent);
-		}
 
-		if (prpl_info->add_buddies != NULL)
-			prpl_info->add_buddies(gc, buddies, groups);
-		else if (prpl_info->add_buddy != NULL) {
-			GList *curb = buddies, *curg = groups;
+	/* Make a list of what group each buddy is in */
+	for (cur = buddies; cur != NULL; cur = cur->next) {
+		PurpleBlistNode *node = cur->data;
+		groups = g_list_append(groups, node->parent->parent);
+	}
 
-			while ((curb != NULL) && (curg != NULL)) {
-				prpl_info->add_buddy(gc, curb->data, curg->data);
-				curb = curb->next;
-				curg = curg->next;
-			}
-		}
+	prpl_info->add_buddies(pc, buddies, groups);
 
-		g_list_free(groups);
-	}
+	g_list_free(groups);
 }
 
 void
 purple_account_remove_buddy(PurpleAccount *account, PurpleBuddy *buddy,
 		PurpleGroup *group)
 {
-	PurplePluginProtocolInfo *prpl_info = NULL;
-	PurpleConnection *gc = purple_account_get_connection(account);
+	GList *b = NULL, *g = NULL;
 
-	if (gc != NULL && gc->prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	b = g_list_append(b, buddy);
+	g = g_list_append(g, group);
 
-	if (prpl_info && prpl_info->remove_buddy)
-		prpl_info->remove_buddy(gc, buddy, group);
+	purple_account_remove_buddies(account, b, g);
+
+	g_list_free(b);
+	g_list_free(g);
 }
 
 void
 purple_account_remove_buddies(PurpleAccount *account, GList *buddies, GList *groups)
 {
 	PurplePluginProtocolInfo *prpl_info = NULL;
-	PurpleConnection *gc = purple_account_get_connection(account);
+	PurpleConnection *pc = purple_account_get_connection(account);
 
-	if (gc != NULL && gc->prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	if(pc == NULL)
+		return;
 
-	if (prpl_info) {
-		if (prpl_info->remove_buddies)
-			prpl_info->remove_buddies(gc, buddies, groups);
-		else {
-			GList *curb = buddies;
-			GList *curg = groups;
-			while ((curb != NULL) && (curg != NULL)) {
-				purple_account_remove_buddy(account, curb->data, curg->data);
-				curb = curb->next;
-				curg = curg->next;
-			}
-		}
-	}
+	prpl_info = purple_connection_get_protocol(pc);
+	if(prpl_info == NULL)
+		return;
+
+	prpl_info->remove_buddies(pc, buddies, groups);
 }
 
 void
 purple_account_remove_group(PurpleAccount *account, PurpleGroup *group)
 {
 	PurplePluginProtocolInfo *prpl_info = NULL;
-	PurpleConnection *gc = purple_account_get_connection(account);
+	PurpleConnection *pc = purple_account_get_connection(account);
 
-	if (gc != NULL && gc->prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	if(pc == NULL)
+		return;
 
-	if (prpl_info && prpl_info->remove_group)
-		prpl_info->remove_group(gc, group);
+	prpl_info = purple_connection_get_protocol(pc);
+	if(prpl_info == NULL)
+		return;
+
+	prpl_info->remove_group(pc, group);
 }
 
 void
@@ -2142,33 +2133,40 @@ purple_account_change_password(PurpleAcc
 		const char *new_pw)
 {
 	PurplePluginProtocolInfo *prpl_info = NULL;
-	PurpleConnection *gc = purple_account_get_connection(account);
+	PurpleConnection *pc = purple_account_get_connection(account);
 
+	if(pc == NULL)
+		return;
+
+	prpl_info = purple_connection_get_protocol(pc);
+	if(prpl_info == NULL)
+		return;
+
 	purple_account_set_password(account, new_pw);
 
-	if (gc != NULL && gc->prpl != NULL)
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
-
-	if (prpl_info && prpl_info->change_passwd)
-		prpl_info->change_passwd(gc, orig_pw, new_pw);
+	prpl_info->change_passwd(pc, orig_pw, new_pw);
 }
 
-gboolean purple_account_supports_offline_message(PurpleAccount *account, PurpleBuddy *buddy)
+gboolean
+purple_account_supports_offline_message(PurpleAccount *account, PurpleBuddy *buddy)
 {
-	PurpleConnection *gc;
+	PurpleConnection *pc;
 	PurplePluginProtocolInfo *prpl_info;
 
 	g_return_val_if_fail(account, FALSE);
 	g_return_val_if_fail(buddy, FALSE);
 
-	gc = purple_account_get_connection(account);
-	if (gc == NULL)
+	pc = purple_account_get_connection(account);
+	if (pc == NULL)
 		return FALSE;
 
-	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	prpl_info = purple_connection_get_protocol(pc);
+	if(prpl_info == NULL)
+		return FALSE;
 
-	if (!prpl_info || !prpl_info->offline_message)
+	if(!prpl_info->offline_message)
 		return FALSE;
+
 	return prpl_info->offline_message(buddy);
 }
 
============================================================
--- libpurple/connection.h	8d14bca30077ad9598c06a2d9a763e81bf0a6566
+++ libpurple/connection.h	4b55882334a0217e309a1afa6471491cb3e382f7
@@ -280,6 +280,10 @@ const char *purple_connection_get_displa
  */
 const char *purple_connection_get_display_name(const PurpleConnection *gc);
 
+PurpleConnectionFlags purple_connection_get_flags(const PurpleConnection *pc);
+gboolean purple_connection_wants_to_die(const PurpleConnection *pc);
+PurplePluginProtocolInfo *purple_connection_get_protocol(const PurpleConnection *pc);
+
 /**
  * Updates the connection progress.
  *
============================================================
--- libpurple/marshallers.list	8be3d7c7f2f46ba7b29a957d38ab40fce9c57b1c
+++ libpurple/marshallers.list	2cb5a94c66da2eaaf8752ff83d2a1524e9e20da5
@@ -1 +1,4 @@ VOID:OBJECT
 VOID:OBJECT
+VOID:POINTER
+VOID:POINTER,POINTER
+VOID:POINTER,POINTER,POINTER


More information about the Commits mailing list