/soc/2013/ankitkv/gobjectification: b2c82de968f6: Backed out cha...

Ankit Vani a at nevitus.org
Sun Jul 14 11:14:02 EDT 2013


Changeset: b2c82de968f6c8ea8f1a77b67188e0dcb22e5b0e
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-07-14 20:41 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/b2c82de968f6

Description:

Backed out changeset b0ccef093327

diffstat:

 libpurple/Makefile.am |    6 +-
 libpurple/presence.c  |  582 --------------------------------------------------
 libpurple/presence.h  |  461 ---------------------------------------
 libpurple/status.c    |  566 ++++++++++++++++++++++++++++++++++++++++++++++++
 libpurple/status.h    |  370 +++++++++++++++++++++++++------
 5 files changed, 865 insertions(+), 1120 deletions(-)

diffs (truncated from 2122 to 300 lines):

diff --git a/libpurple/Makefile.am b/libpurple/Makefile.am
--- a/libpurple/Makefile.am
+++ b/libpurple/Makefile.am
@@ -79,7 +79,6 @@ purple_coresources = \
 	pluginpref.c \
 	pounce.c \
 	prefs.c \
-	presence.c \
 	proxy.c \
 	prpl.c \
 	request.c \
@@ -151,7 +150,6 @@ purple_coreheaders = \
 	pluginpref.h \
 	pounce.h \
 	prefs.h \
-	presence.h \
 	proxy.h \
 	prpl.h \
 	request.h \
@@ -232,8 +230,8 @@ dbus_headers  = dbus-bindings.h dbus-pur
 dbus_exported = dbus-useful.h dbus-define-api.h account.h accounts.h blistnodes.h \
                 blistnodetypes.h buddylist.h buddyicon.h connection.h conversation.h \
                 conversationtypes.h conversations.h core.h ft.h log.h notify.h \
-                prefs.h presence.h roomlist.h savedstatuses.h smiley.h status.h \
-                server.h util.h xmlnode.h prpl.h
+                prefs.h roomlist.h savedstatuses.h smiley.h status.h server.h util.h \
+                xmlnode.h prpl.h
 
 purple_build_coreheaders = $(addprefix $(srcdir)/, $(purple_coreheaders)) \
 		$(addprefix $(srcdir)/media/, $(purple_mediaheaders)) \
diff --git a/libpurple/presence.c b/libpurple/presence.c
deleted file mode 100644
--- a/libpurple/presence.c
+++ /dev/null
@@ -1,582 +0,0 @@
-/* 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 "presence.h"
-
-/**
- * A list of statuses.
- */
-struct _PurplePresence
-{
-	PurplePresenceContext context;
-
-	gboolean idle;
-	time_t idle_time;
-	time_t login_time;
-
-	GList *statuses;
-	GHashTable *status_table;
-
-	PurpleStatus *active_status;
-
-	union
-	{
-		PurpleAccount *account;
-
-		struct
-		{
-			PurpleConversation *conv;
-			char *user;
-
-		} chat;
-
-		struct
-		{
-			PurpleAccount *account;
-			char *name;
-			PurpleBuddy *buddy;
-
-		} buddy;
-
-	} u;
-};
-
-
-/**************************************************************************
-* PurplePresence API
-**************************************************************************/
-PurplePresence *
-purple_presence_new(PurplePresenceContext context)
-{
-	PurplePresence *presence;
-
-	g_return_val_if_fail(context != PURPLE_PRESENCE_CONTEXT_UNSET, NULL);
-
-	presence = g_new0(PurplePresence, 1);
-	PURPLE_DBUS_REGISTER_POINTER(presence, PurplePresence);
-
-	presence->context = context;
-
-	presence->status_table =
-		g_hash_table_new_full(g_str_hash, g_str_equal,
-							  g_free, NULL);
-
-	return presence;
-}
-
-PurplePresence *
-purple_presence_new_for_account(PurpleAccount *account)
-{
-	PurplePresence *presence = NULL;
-	g_return_val_if_fail(account != NULL, NULL);
-
-	presence = purple_presence_new(PURPLE_PRESENCE_CONTEXT_ACCOUNT);
-	presence->u.account = account;
-	presence->statuses = purple_prpl_get_statuses(account, presence);
-
-	return presence;
-}
-
-PurplePresence *
-purple_presence_new_for_conv(PurpleConversation *conv)
-{
-	PurplePresence *presence;
-
-	g_return_val_if_fail(conv != NULL, NULL);
-
-	presence = purple_presence_new(PURPLE_PRESENCE_CONTEXT_CONV);
-	presence->u.chat.conv = conv;
-	/* presence->statuses = purple_prpl_get_statuses(purple_conversation_get_account(conv), presence); ? */
-
-	return presence;
-}
-
-PurplePresence *
-purple_presence_new_for_buddy(PurpleBuddy *buddy)
-{
-	PurplePresence *presence;
-	PurpleAccount *account;
-
-	g_return_val_if_fail(buddy != NULL, NULL);
-	account = purple_buddy_get_account(buddy);
-
-	presence = purple_buddy_presence_new();
-
-	presence->u.buddy.name    = g_strdup(purple_buddy_get_name(buddy));
-	presence->u.buddy.account = account;
-	presence->statuses = purple_prpl_get_statuses(account, presence);
-
-	presence->u.buddy.buddy = buddy;
-
-	return presence;
-}
-
-void
-purple_presence_destroy(PurplePresence *presence)
-{
-	g_return_if_fail(presence != NULL);
-
-	if (purple_presence_get_context(presence) == PURPLE_PRESENCE_CONTEXT_BUDDY)
-	{
-		g_free(presence->u.buddy.name);
-	}
-	else if (purple_presence_get_context(presence) == PURPLE_PRESENCE_CONTEXT_CONV)
-	{
-		g_free(presence->u.chat.user);
-	}
-
-	g_list_foreach(presence->statuses, (GFunc)purple_status_destroy, NULL);
-	g_list_free(presence->statuses);
-
-	g_hash_table_destroy(presence->status_table);
-
-	PURPLE_DBUS_UNREGISTER_POINTER(presence);
-	g_free(presence);
-}
-
-void
-purple_presence_set_status_active(PurplePresence *presence, const char *status_id,
-		gboolean active)
-{
-	PurpleStatus *status;
-
-	g_return_if_fail(presence  != NULL);
-	g_return_if_fail(status_id != NULL);
-
-	status = purple_presence_get_status(presence, status_id);
-
-	g_return_if_fail(status != NULL);
-	/* TODO: Should we do the following? */
-	/* g_return_if_fail(active == status->active); */
-
-	if (purple_status_is_exclusive(status))
-	{
-		if (!active)
-		{
-			purple_debug_warning("status",
-					"Attempted to set a non-independent status "
-					"(%s) inactive. Only independent statuses "
-					"can be specifically marked inactive.",
-					status_id);
-			return;
-		}
-	}
-
-	purple_status_set_active(status, active);
-}
-
-void
-purple_presence_switch_status(PurplePresence *presence, const char *status_id)
-{
-	purple_presence_set_status_active(presence, status_id, TRUE);
-}
-
-static void
-update_buddy_idle(PurpleBuddy *buddy, PurplePresence *presence,
-		time_t current_time, gboolean old_idle, gboolean idle)
-{
-	PurpleBListUiOps *ops = purple_blist_get_ui_ops();
-	PurpleAccount *account = purple_buddy_get_account(buddy);
-
-	if (!old_idle && idle)
-	{
-		if (purple_prefs_get_bool("/purple/logging/log_system"))
-		{
-			PurpleLog *log = purple_account_get_log(account, FALSE);
-
-			if (log != NULL)
-			{
-				char *tmp, *tmp2;
-				tmp = g_strdup_printf(_("%s became idle"),
-				purple_buddy_get_alias(buddy));
-				tmp2 = g_markup_escape_text(tmp, -1);
-				g_free(tmp);
-
-				purple_log_write(log, PURPLE_MESSAGE_SYSTEM,
-				purple_buddy_get_alias(buddy), current_time, tmp2);
-				g_free(tmp2);
-			}
-		}
-	}
-	else if (old_idle && !idle)
-	{
-		if (purple_prefs_get_bool("/purple/logging/log_system"))
-		{
-			PurpleLog *log = purple_account_get_log(account, FALSE);
-
-			if (log != NULL)
-			{
-				char *tmp, *tmp2;
-				tmp = g_strdup_printf(_("%s became unidle"),
-				purple_buddy_get_alias(buddy));
-				tmp2 = g_markup_escape_text(tmp, -1);
-				g_free(tmp);
-
-				purple_log_write(log, PURPLE_MESSAGE_SYSTEM,
-				purple_buddy_get_alias(buddy), current_time, tmp2);
-				g_free(tmp2);
-			}
-		}
-	}
-
-	if (old_idle != idle)
-		purple_signal_emit(purple_blist_get_handle(), "buddy-idle-changed", buddy,
-		                 old_idle, idle);
-
-	purple_contact_invalidate_priority_buddy(purple_buddy_get_contact(buddy));
-
-	/* Should this be done here? It'd perhaps make more sense to
-	 * connect to buddy-[un]idle signals and update from there
-	 */
-
-	if (ops != NULL && ops->update != NULL)
-		ops->update(purple_blist_get_buddy_list(), (PurpleBListNode *)buddy);
-}
-
-void
-purple_presence_set_idle(PurplePresence *presence, gboolean idle, time_t idle_time)
-{
-	gboolean old_idle;
-	time_t current_time;
-
-	g_return_if_fail(presence != NULL);
-
-	if (presence->idle == idle && presence->idle_time == idle_time)
-		return;
-
-	old_idle            = presence->idle;
-	presence->idle      = idle;



More information about the Commits mailing list