/soc/2013/ankitkv/gobjectification: b496dd569514: Refactored lib...

Ankit Vani a at nevitus.org
Mon Jul 8 14:39:28 EDT 2013


Changeset: b496dd56951486db77a4ac337a9d09894c700277
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-07-09 00:09 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/b496dd569514

Description:

Refactored libpurple plugins and protocols according to the blist API changes

diffstat:

 libpurple/plugins/perl/common/BuddyList.xs |  57 +++++++++++++++++++++++------
 libpurple/plugins/perl/common/module.h     |   1 +
 libpurple/plugins/perl/common/typemap      |   1 +
 libpurple/protocols/gg/roster.c            |   2 +-
 libpurple/protocols/sametime/sametime.c    |   2 +-
 5 files changed, 48 insertions(+), 15 deletions(-)

diffs (120 lines):

diff --git a/libpurple/plugins/perl/common/BuddyList.xs b/libpurple/plugins/perl/common/BuddyList.xs
--- a/libpurple/plugins/perl/common/BuddyList.xs
+++ b/libpurple/plugins/perl/common/BuddyList.xs
@@ -198,15 +198,6 @@ void
 purple_blist_remove_account(account)
 	Purple::Account account
 
-int
-purple_blist_get_group_size(group, offline)
-	Purple::BuddyList::Group  group
-	gboolean offline
-
-int
-purple_blist_get_group_online_count(group)
-	Purple::BuddyList::Group  group
-
 void
 purple_blist_schedule_save()
 
@@ -277,10 +268,50 @@ purple_blist_node_remove_setting(node, k
 	Purple::BuddyList::Node node
 	const char * key
 
-Purple::BuddyList::Node
-purple_blist_node_next(node, offline)
-	Purple::BuddyList::Node node
-	gboolean offline
+MODULE = Purple::BuddyList  PACKAGE = Purple::BuddyList::CountingNode  PREFIX = purple_counting_node_
+PROTOTYPES: ENABLE
+
+int
+purple_counting_node_get_total_size(counter);
+	Purple::BuddyList::CountingNode counter
+
+int
+purple_counting_node_get_current_size(counter);
+	Purple::BuddyList::CountingNode counter
+
+int
+purple_counting_node_get_online_count(counter);
+	Purple::BuddyList::CountingNode counter
+
+void
+purple_counting_node_change_total_size(counter, delta);
+	Purple::BuddyList::CountingNode counter
+	int delta
+
+void
+purple_counting_node_change_current_size(counter, delta);
+	Purple::BuddyList::CountingNode counter
+	int delta
+
+void
+purple_counting_node_change_online_count(counter, delta);
+	Purple::BuddyList::CountingNode counter
+	int delta
+
+void
+purple_counting_node_set_total_size(counter, totalsize);
+	Purple::BuddyList::CountingNode counter
+	int totalsize
+
+void
+purple_counting_node_set_current_size(counter, currentsize);
+	Purple::BuddyList::CountingNode counter
+	int currentsize
+
+void
+purple_counting_node_set_online_count(counter, onlinecount);
+	Purple::BuddyList::CountingNode counter
+	int onlinecount
 
 MODULE = Purple::BuddyList  PACKAGE = Purple::BuddyList::Chat  PREFIX = purple_chat_
 PROTOTYPES: ENABLE
diff --git a/libpurple/plugins/perl/common/module.h b/libpurple/plugins/perl/common/module.h
--- a/libpurple/plugins/perl/common/module.h
+++ b/libpurple/plugins/perl/common/module.h
@@ -85,6 +85,7 @@ typedef PurpleAccountPrivacyType		Purple
 
 /* buddylist.h */
 typedef PurpleBListNode *			Purple__BuddyList__Node;
+typedef PurpleCountingNode *			Purple__BuddyList__CountingNode;
 typedef PurpleBuddyList *			Purple__BuddyList;
 typedef PurpleBuddy *			Purple__BuddyList__Buddy;
 typedef PurpleChat *			Purple__BuddyList__Chat;
diff --git a/libpurple/plugins/perl/common/typemap b/libpurple/plugins/perl/common/typemap
--- a/libpurple/plugins/perl/common/typemap
+++ b/libpurple/plugins/perl/common/typemap
@@ -52,6 +52,7 @@ Purple::BuddyList::Chat			T_PurpleObj
 Purple::BuddyList::Contact		T_PurpleObj
 Purple::BuddyList::Group			T_PurpleObj
 Purple::BuddyList::Node			T_PurpleObj
+Purple::BuddyList::CountingNode		T_PurpleObj
 
 Purple::Cipher				T_PurpleObj
 Purple::Hash				T_PurpleObj
diff --git a/libpurple/protocols/gg/roster.c b/libpurple/protocols/gg/roster.c
--- a/libpurple/protocols/gg/roster.c
+++ b/libpurple/protocols/gg/roster.c
@@ -733,7 +733,7 @@ static void ggp_roster_reply_list(Purple
 	{
 		PurpleGroup *group = it->data;
 		it = g_list_next(it);
-		if (purple_blist_get_group_size(group, TRUE) != 0)
+		if (purple_counting_node_get_total_size(PURPLE_COUNTING_NODE(group)) != 0)
 			continue;
 		purple_debug_info("gg", "ggp_roster_reply_list: "
 			"removing group %s\n", purple_group_get_name(group));
diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c
--- a/libpurple/protocols/sametime/sametime.c
+++ b/libpurple/protocols/sametime/sametime.c
@@ -1050,7 +1050,7 @@ static void group_clear(PurpleGroup *gro
   DEBUG_INFO("cleared buddies\n");
 
   /* optionally remove group from blist */
-  if(del && !purple_blist_get_group_size(group, TRUE)) {
+  if(del && !purple_counting_node_get_total_size(PURPLE_COUNTING_NODE(group))) {
     DEBUG_INFO("removing empty group\n");
     purple_blist_remove_group(group);
   }



More information about the Commits mailing list