/soc/2013/ankitkv/gobjectification: 1aca7f52f1ef: Backed out the...

Ankit Vani a at nevitus.org
Thu Oct 10 16:01:47 EDT 2013


Changeset: 1aca7f52f1ef62fe029939ed3436347ab7bfb277
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-10-11 01:26 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/1aca7f52f1ef

Description:

Backed out the previous 4 changesets. GSignals do not seem feasible with pidgin's architecture using any method.
I think we should keep using purple signals for class events and use gsignals for instance events.

diffstat:

 ChangeLog.API                          |     2 +-
 libpurple/Makefile.am                  |     6 +-
 libpurple/Makefile.mingw               |     2 +-
 libpurple/account-manager.c            |  1250 --------------------------------
 libpurple/account-manager.h            |   279 -------
 libpurple/account.c                    |    80 +-
 libpurple/accounts.c                   |  1022 ++++++++++++++++++++++++++
 libpurple/accounts.h                   |   225 +++++
 libpurple/connection.c                 |     4 +-
 libpurple/dbus-useful.c                |     2 +-
 libpurple/internal.h                   |     2 +-
 libpurple/plugins/perl/common/module.h |     2 +-
 libpurple/protocols.c                  |     8 +-
 libpurple/purple.h.in                  |     2 +-
 libpurple/server.c                     |     7 +-
 libpurple/server.h                     |     2 +-
 libpurple/status.c                     |     2 +-
 pidgin/gtkaccount.h                    |     2 +-
 18 files changed, 1310 insertions(+), 1589 deletions(-)

diffs (truncated from 3245 to 300 lines):

diff --git a/ChangeLog.API b/ChangeLog.API
--- a/ChangeLog.API
+++ b/ChangeLog.API
@@ -173,7 +173,7 @@ version 3.0.0 (??/??/????):
 
 		Changed:
 		* account.h has been split into account.h (PurpleAccount GObject) and
-		  account-manager.h (PurpleAccountManager GObject)
+		  accounts.h (Accounts subsystem)
 		* blist.h has been split into buddylist.h (PurpleBuddyList and
 		  subsystem), blistnode.h (PurpleBlistNode and PurpleCountingNode
 		  GObjects), blistnodetypes (Buddy, Chat, Contact, Group GObjects)
diff --git a/libpurple/Makefile.am b/libpurple/Makefile.am
--- a/libpurple/Makefile.am
+++ b/libpurple/Makefile.am
@@ -47,7 +47,7 @@ endif
 
 purple_coresources = \
 	account.c \
-	account-manager.c \
+	accounts.c \
 	accountopt.c \
 	blistnode.c \
 	blistnodetypes.c \
@@ -133,7 +133,7 @@ purple_builtsources = \
 
 purple_coreheaders = \
 	account.h \
-	account-manager.h \
+	accounts.h \
 	accountopt.h \
 	blistnode.h \
 	blistnodetypes.h \
@@ -269,7 +269,7 @@ CLEANFILES += \
 dbus_sources  = dbus-server.c dbus-useful.c
 dbus_headers  = dbus-server.h dbus-bindings.h dbus-purple.h dbus-useful.h dbus-define-api.h dbus-types.h
 
-dbus_exported = dbus-useful.h dbus-define-api.h account.h account-manager.h blistnode.h \
+dbus_exported = dbus-useful.h dbus-define-api.h account.h accounts.h blistnode.h \
                 blistnodetypes.h buddylist.h buddyicon.h connection.h conversation.h \
                 conversationtypes.h conversations.h core.h xfer.h log.h notify.h \
                 prefs.h presence.h roomlist.h savedstatuses.h smiley.h status.h \
diff --git a/libpurple/Makefile.mingw b/libpurple/Makefile.mingw
--- a/libpurple/Makefile.mingw
+++ b/libpurple/Makefile.mingw
@@ -63,7 +63,7 @@ BUILT_SRC = marshallers.c enums.c
 C_SRC =	\
 			$(BUILT_SRC) \
 			account.c \
-			account-manager.c \
+			accounts.c \
 			accountopt.c \
 			blistnode.c \
 			blistnodetypes.c \
diff --git a/libpurple/account-manager.c b/libpurple/account-manager.c
deleted file mode 100644
--- a/libpurple/account-manager.c
+++ /dev/null
@@ -1,1250 +0,0 @@
-/**
- * @file account-manager.c Account Manager API
- * @ingroup core
- */
-
-/* purple
- *
- * Purple is the legal property of its developers, whose names are too numerous
- * to list here.  Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
- */
-#include "internal.h"
-#include "account-manager.h"
-#include "core.h"
-#include "dbus-maybe.h"
-#include "debug.h"
-#include "enums.h"
-#include "network.h"
-#include "pounce.h"
-
-#define PURPLE_ACCOUNT_MANAGER_GET_PRIVATE(obj) \
-	(G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_ACCOUNT_MANAGER, PurpleAccountManagerPrivate))
-
-/** @copydoc _PurpleAccountManagerPrivate */
-typedef struct _PurpleAccountManagerPrivate  PurpleAccountManagerPrivate;
-
-/** Private data of an account manager */
-struct _PurpleAccountManagerPrivate {
-	PurpleAccountUiOps *account_ui_ops;
-
-	GList   *accounts;
-	guint    save_timer;
-	gboolean accounts_loaded;
-};
-
-static PurpleAccountManager        *account_manager = NULL;
-static PurpleAccountManagerPrivate *priv            = NULL;
-
-static GObjectClass *parent_class = NULL;
-
-/* Account Manager property enums */
-enum
-{
-	PROP_0,
-	PROP_UI_OPS,
-	PROP_LAST
-};
-
-/* Account Manager signal enums */
-enum
-{
-	SIG_ACC_CONNECTING,
-	SIG_ACC_DISABLED,
-	SIG_ACC_ENABLED,
-	SIG_ACC_SETTING_INFO,
-	SIG_ACC_SET_INFO,
-	SIG_ACC_CREATED,
-	SIG_ACC_DESTROYING,
-	SIG_ACC_ADDED,
-	SIG_ACC_REMOVED,
-	SIG_ACC_STATUS_CHANGED,
-	SIG_ACC_ACTIONS_CHANGED,
-	SIG_ACC_ALIAS_CHANGED,
-	SIG_ACC_AUTH_REQUESTED,
-	SIG_ACC_AUTH_DENIED,
-	SIG_ACC_AUTH_GRANTED,
-	SIG_ACC_ERROR_CHANGED,
-	SIG_ACC_SIGNED_ON,
-	SIG_ACC_SIGNED_OFF,
-	SIG_ACC_CONNECTION_ERROR,
-	SIG_LAST
-};
-static guint signals[SIG_LAST] = { 0 };
-
-void _purple_account_set_current_error(PurpleAccount *account,
-		PurpleConnectionErrorInfo *new_err);
-
-/*********************************************************************
- * Writing to disk                                                   *
- *********************************************************************/
-static PurpleXmlNode *
-accounts_to_xmlnode(void)
-{
-	PurpleXmlNode *node, *child;
-	GList *cur;
-
-	node = purple_xmlnode_new("account");
-	purple_xmlnode_set_attrib(node, "version", "1.0");
-
-	for (cur = purple_accounts_get_all(); cur != NULL; cur = cur->next)
-	{
-		child = purple_account_to_xmlnode(cur->data);
-		purple_xmlnode_insert_child(node, child);
-	}
-
-	return node;
-}
-
-static void
-sync_accounts(void)
-{
-	PurpleXmlNode *node;
-	char *data;
-
-	g_return_if_fail(priv != NULL);
-
-	if (!priv->accounts_loaded)
-	{
-		purple_debug_error("account", "Attempted to save accounts before "
-						 "they were read!\n");
-		return;
-	}
-
-	node = accounts_to_xmlnode();
-	data = purple_xmlnode_to_formatted_str(node, NULL);
-	purple_util_write_data_to_file("accounts.xml", data, -1);
-	g_free(data);
-	purple_xmlnode_free(node);
-}
-
-static gboolean
-save_cb(gpointer data)
-{
-	g_return_val_if_fail(priv != NULL, FALSE);
-
-	sync_accounts();
-	priv->save_timer = 0;
-	return FALSE;
-}
-
-void
-purple_accounts_schedule_save(void)
-{
-	g_return_if_fail(priv != NULL);
-
-	if (priv->save_timer == 0)
-		priv->save_timer = purple_timeout_add_seconds(5, save_cb, NULL);
-}
-
-/*********************************************************************
- * Reading from disk                                                 *
- *********************************************************************/
-static void
-migrate_yahoo_japan(PurpleAccount *account)
-{
-	/* detect a Yahoo! JAPAN account that existed prior to 2.6.0 and convert it
-	 * to use the new yahoojp protocol.  Also remove the account-specific settings
-	 * we no longer need */
-
-	if(purple_strequal(purple_account_get_protocol_id(account), "yahoo")) {
-		if(purple_account_get_bool(account, "yahoojp", FALSE)) {
-			const char *serverjp = purple_account_get_string(account, "serverjp", NULL);
-			const char *xferjp_host = purple_account_get_string(account, "xferjp_host", NULL);
-
-			g_return_if_fail(serverjp != NULL);
-			g_return_if_fail(xferjp_host != NULL);
-
-			purple_account_set_string(account, "server", serverjp);
-			purple_account_set_string(account, "xfer_host", xferjp_host);
-
-			purple_account_set_protocol_id(account, "yahoojp");
-		}
-
-		/* these should always be nuked */
-		purple_account_remove_setting(account, "yahoojp");
-		purple_account_remove_setting(account, "serverjp");
-		purple_account_remove_setting(account, "xferjp_host");
-
-	}
-}
-
-static void
-migrate_icq_server(PurpleAccount *account)
-{
-	/* Migrate the login server setting for ICQ accounts.  See
-	 * 'mtn log --last 1 --no-graph --from b6d7712e90b68610df3bd2d8cbaf46d94c8b3794'
-	 * for details on the change. */
-
-	if(purple_strequal(purple_account_get_protocol_id(account), "icq")) {
-		const char *tmp = purple_account_get_string(account, "server", NULL);
-
-		/* Non-secure server */
-		if(purple_strequal(tmp,	"login.messaging.aol.com") ||
-				purple_strequal(tmp, "login.oscar.aol.com"))
-			purple_account_set_string(account, "server", "login.icq.com");
-
-		/* Secure server */
-		if(purple_strequal(tmp, "slogin.oscar.aol.com"))
-			purple_account_set_string(account, "server", "slogin.icq.com");
-	}
-}
-
-static void
-migrate_xmpp_encryption(PurpleAccount *account)
-{
-	/* When this is removed, nuke the "old_ssl" and "require_tls" settings */
-	if (g_str_equal(purple_account_get_protocol_id(account), "jabber")) {
-		const char *sec = purple_account_get_string(account, "connection_security", "");
-
-		if (g_str_equal("", sec)) {
-			const char *val = "require_tls";
-			if (purple_account_get_bool(account, "old_ssl", FALSE))
-				val = "old_ssl";
-			else if (!purple_account_get_bool(account, "require_tls", TRUE))
-				val = "opportunistic_tls";
-
-			purple_account_set_string(account, "connection_security", val);
-		}
-	}
-}
-
-static void
-parse_settings(PurpleXmlNode *node, PurpleAccount *account)
-{
-	const char *ui;
-	PurpleXmlNode *child;
-
-	/* Get the UI string, if these are UI settings */
-	ui = purple_xmlnode_get_attrib(node, "ui");
-
-	/* Read settings, one by one */
-	for (child = purple_xmlnode_get_child(node, "setting"); child != NULL;
-			child = purple_xmlnode_get_next_twin(child))
-	{
-		const char *name, *str_type;
-		PurplePrefType type;
-		char *data;



More information about the Commits mailing list