/soc/2012/sanket/statscollector-2.x.y: 98ee6ca07431: Add more pl...

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


Changeset: 98ee6ca0743108d07e30284731f030bbe857261c
Author:	 Sanket Agarwal <sanket at soc.pidgin.im>
Date:	 2012-06-07 00:41 +0000
Branch:	 soc.2012.statscollector
URL: http://hg.pidgin.im/soc/2012/sanket/statscollector-2.x.y/rev/98ee6ca07431

Description:

Add more plugin properties

Plugin has a host of other nice to print-and-show properties like
plugin-id, plugin-authorname, description and summary etc. We should
report them too(!) and use them in prettifying our final layout.

diffstat:

 libpurple/plugins/statscollector.c |  46 ++++++++++++++++++++++++++++---------
 1 files changed, 35 insertions(+), 11 deletions(-)

diffs (71 lines):

diff --git a/libpurple/plugins/statscollector.c b/libpurple/plugins/statscollector.c
--- a/libpurple/plugins/statscollector.c
+++ b/libpurple/plugins/statscollector.c
@@ -726,32 +726,56 @@
    * 1.1 If no, then add the account to the list of accounts used
    */
 
-  const char *plugin_id, *data;
-  xmlnode *plugin_xml;
+  const char *id, *name, *version, *author, *summary, *description, *data;
+  xmlnode *plugin_xml, *name_xml, *v_xml, *author_xml, *summary_xml, \
+    *description_xml;
   PurplePluginType plugin_type;
 
-  plugin_id = purple_plugin_get_id(plugin);
+  id = purple_plugin_get_id(plugin);
+  name = purple_plugin_get_name(plugin);
+  version = purple_plugin_get_version(plugin);
+  author = purple_plugin_get_author(plugin);
+  summary = purple_plugin_get_summary(plugin);
+  description = purple_plugin_get_description(plugin);
 
   plugin_type = (PurplePluginType) plugin->info->type;
 
-  /* purple_debug_info("STATS", "Plugin %s %d\\n", plugin_id, plugin_type); */
-
-
   /* check if the account already exist in our XML file */
 
-  if(g_hash_table_lookup(stats_plugins_ht, plugin_id))
-    purple_debug_info("STATS", "Plugin %s already exists!", plugin_id);
+  if(g_hash_table_lookup(stats_plugins_ht, id))
+    purple_debug_info("STATS", "Plugin %s already exists!", id);
 
   else if(plugin_type != PURPLE_PLUGIN_STANDARD)
     /* We don't need no prpl plugins */
-    purple_debug_info("STATS", "Plugin %s is *not* a standard plugin\n", plugin_id);
+    purple_debug_info("STATS", "Plugin %s is *not* a standard plugin\n", id);
 
   else{
 
     plugin_xml = xmlnode_new("plugin");
-    xmlnode_set_attrib(plugin_xml, "id", plugin_id);
+    xmlnode_set_attrib(plugin_xml, "id", id);
+
+    name_xml = xmlnode_new("name");
+    xmlnode_insert_data(name_xml, name, -1);
+    xmlnode_insert_child(plugin_xml, name_xml);
+
+    v_xml = xmlnode_new("version");
+    xmlnode_insert_data(v_xml, version, -1);
+    xmlnode_insert_child(plugin_xml, v_xml);
+
+    author_xml = xmlnode_new("author");
+    xmlnode_insert_data(author_xml, author, -1);
+    xmlnode_insert_child(plugin_xml, author_xml);
+
+    summary_xml = xmlnode_new("summary");
+    xmlnode_insert_data(summary_xml, summary, -1);
+    xmlnode_insert_child(plugin_xml, summary_xml);
+
+    description_xml = xmlnode_new("description");
+    xmlnode_insert_data(description_xml, description, -1);
+    xmlnode_insert_child(plugin_xml, description_xml);
+
     data = xmlnode_to_str(plugin_xml, NULL);
-    g_hash_table_insert(stats_plugins_ht, (void *)plugin_id, (void *)data);
+    g_hash_table_insert(stats_plugins_ht, (void *)id, (void *)data);
 
   }
 



More information about the Commits mailing list