/soc/2012/sanket/statscollector-2.x.y: c5ec375d4da3: Read file X...
Sanket Agarwal
sanket at soc.pidgin.im
Tue Jul 10 00:36:22 EDT 2012
Changeset: c5ec375d4da3910b4cc7d938649da0c9a11b2c67
Author: Sanket Agarwal <sanket at soc.pidgin.im>
Date: 2012-05-14 18:12 +0000
Branch: soc.2012.statscollector
URL: http://hg.pidgin.im/soc/2012/sanket/statscollector-2.x.y/rev/c5ec375d4da3
Description:
Read file XML expicitly; avoid xmlnode_read_file
diffstat:
pidgin/plugins/statscollector.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diffs (58 lines):
diff --git a/pidgin/plugins/statscollector.c b/pidgin/plugins/statscollector.c
--- a/pidgin/plugins/statscollector.c
+++ b/pidgin/plugins/statscollector.c
@@ -88,7 +88,7 @@
/* 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 *
-md5(const gchar *str)
+md5(const guchar *str)
{
PurpleCipherContext *context;
static gchar digest[41];
@@ -170,7 +170,7 @@
* 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 @@
/* 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 @@
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