soc.2012.statscollector: 7132748e: Read file XML expicitly; avoid xmlnode_r...

sanket at soc.pidgin.im sanket at soc.pidgin.im
Mon May 14 13:28:01 EDT 2012


----------------------------------------------------------------------
Revision: 7132748e762d1c1ea8a44e67181eda069f9454fc
Parent:   2f057f79c91c07c3dd9e1f8147bc0236c3f41382
Author:   sanket at soc.pidgin.im
Date:     05/14/12 14:12:36
Branch:   im.pidgin.soc.2012.statscollector
URL: http://d.pidgin.im/viewmtn/revision/info/7132748e762d1c1ea8a44e67181eda069f9454fc

Changelog: 

Read file XML expicitly; avoid xmlnode_read_file

Changes against parent 2f057f79c91c07c3dd9e1f8147bc0236c3f41382

  patched  pidgin/plugins/statscollector.c

-------------- next part --------------
============================================================
--- pidgin/plugins/statscollector.c	bdad01db736fb3fa9cc5d95d47a6892f0b7fbbba
+++ pidgin/plugins/statscollector.c	ce362251cdab5bddd72081b8987b79356dd51c71
@@ -88,7 +88,7 @@ get_cpuinfo_xml(){
 
   /* Obtains a XML node containing the CPU info */
 
-  xmlnode *root, *languages, *hardware, *node, *ver, *ver1;
+  xmlnode *root, *languages, *node, *ver;
   const char * const * langs;
   int i;
 
@@ -127,7 +127,7 @@ static const gchar *
 
 
 static const gchar *
-md5(const gchar *str)
+md5(const guchar *str)
 {
         PurpleCipherContext *context;
         static gchar digest[41];
@@ -170,7 +170,7 @@ acc_sign_on_event(PurpleAccount *account
    * 1.1 If no, then add the account to the list of accounts used
    */
 
-  const char *username, *protocol, *data;
+  char *username, *protocol, *data;
   char *id;
 
   xmlnode *acc, *u_node, *p_node;
@@ -255,12 +255,17 @@ init_stats(){
 
   /* GHashTableIter *iter; */
   GList *loaded_plugins;
+  const gchar *file_contents, *filename;
+  int length;
+  GError *error = NULL;
   xmlnode *stats_acc_xml, *stats_plugins_xml;
   xmlnode *start, *id_node;
 
   /* Load the xml */
-  xmlnode *root = purple_util_read_xml_from_file("stats.xml",
-      "stats-collection");
+  filename = g_build_filename(purple_user_dir(), "stats.xml", NULL);
+  g_file_get_contents(filename, &file_contents, &length, &error);
+  purple_debug_info("STATS", "%s", file_contents);
+  xmlnode *root = xmlnode_from_str(file_contents, -1);
 
   stats_acc_ht = g_hash_table_new(g_str_hash, g_str_equal);
   stats_plugins_ht = g_hash_table_new(g_str_hash, g_str_equal);
@@ -292,6 +297,7 @@ init_stats(){
 
       id_node = xmlnode_get_attrib(start, "id");
 
+      purple_debug_info("STATS","%s %s", id_node, xmlnode_to_formatted_str(start, NULL));
       g_hash_table_insert(stats_acc_ht, (char *)id_node,
           (char *)xmlnode_to_formatted_str(start, NULL));
 


More information about the Commits mailing list