soc.2012.statscollector: 06d63da1: Add more plugin properties

sanket at soc.pidgin.im sanket at soc.pidgin.im
Thu Jun 7 09:17:46 EDT 2012


----------------------------------------------------------------------
Revision: 06d63da16f8eb512947f3d4d2a3de2ceef06e453
Parent:   018cfa65160d7d678c4d9a3f655558585d981de6
Author:   sanket at soc.pidgin.im
Date:     06/06/12 20:41:21
Branch:   im.pidgin.soc.2012.statscollector
URL: http://d.pidgin.im/viewmtn/revision/info/06d63da16f8eb512947f3d4d2a3de2ceef06e453

Changelog: 

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.

Changes against parent 018cfa65160d7d678c4d9a3f655558585d981de6

  patched  libpurple/plugins/statscollector.c

-------------- next part --------------
============================================================
--- libpurple/plugins/statscollector.c	c0e83fa342cbcbd86b4343623b85fbe1374a0b24
+++ libpurple/plugins/statscollector.c	a7dd7b2dfcf5c36844c2b88e1a7dbe02da924f79
@@ -726,32 +726,56 @@ plugin_load_event(PurplePlugin *plugin){
    * 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