/soc/2012/sanket/statscollector-2.x.y: c317ad0c5bdf: Add the num...

Sanket Agarwal sanket at soc.pidgin.im
Tue Jul 10 00:36:24 EDT 2012


Changeset: c317ad0c5bdf90431772317ced352542aa1f22ff
Author:	 Sanket Agarwal <sanket at soc.pidgin.im>
Date:	 2012-05-24 10:35 +0000
Branch:	 soc.2012.statscollector
URL: http://hg.pidgin.im/soc/2012/sanket/statscollector-2.x.y/rev/c317ad0c5bdf

Description:

Add the number of buddies to stats

diffstat:

 libpurple/plugins/statscollector.c |  10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diffs (31 lines):

diff --git a/libpurple/plugins/statscollector.c b/libpurple/plugins/statscollector.c
--- a/libpurple/plugins/statscollector.c
+++ b/libpurple/plugins/statscollector.c
@@ -585,8 +585,9 @@
 
   const char *username, *protocol, *data;
   char *id;
+  xmlnode *acc, *p_node, *len_node;
+  int len;
 
-  xmlnode *acc, *p_node;
   username = purple_account_get_username(account);
   protocol = purple_account_get_protocol_id(account);
 
@@ -602,9 +603,16 @@
 
     xmlnode_set_attrib(acc, "id", id);
 
+    /* Protocol information */
     p_node = xmlnode_new_child(acc, "protocol");
     xmlnode_insert_data(p_node, protocol, -1);
 
+    /* Number of buddies in account list */
+    len = g_slist_length(purple_find_buddies(account, NULL));
+    len_node = xmlnode_new("buddies");
+    xmlnode_insert_data(len_node, g_strdup_printf("%d", len), -1);
+    xmlnode_insert_child(acc, len_node);
+
     data = xmlnode_to_str(acc, NULL);
 
     g_hash_table_insert(stats_acc_ht, (void *)id, (void *)data);



More information about the Commits mailing list