soc.2012.statscollector: 2f057f79: MD5 account id to hide identity

sanket at sanketagarwal.com sanket at sanketagarwal.com
Mon May 14 13:27:51 EDT 2012


----------------------------------------------------------------------
Revision: 2f057f79c91c07c3dd9e1f8147bc0236c3f41382
Parent:   77e39db6e4cb203716ab6f1becb0e1bd15ed195e
Author:   sanket at sanketagarwal.com
Date:     05/14/12 07:23:43
Branch:   im.pidgin.soc.2012.statscollector
URL: http://d.pidgin.im/viewmtn/revision/info/2f057f79c91c07c3dd9e1f8147bc0236c3f41382

Changelog: 

MD5 account id to hide identity

Changes against parent 77e39db6e4cb203716ab6f1becb0e1bd15ed195e

  patched  pidgin/plugins/statscollector.c

-------------- next part --------------
============================================================
--- pidgin/plugins/statscollector.c	d62a7552cf3655b1265e07cb116356a87baaee82
+++ pidgin/plugins/statscollector.c	bdad01db736fb3fa9cc5d95d47a6892f0b7fbbba
@@ -9,6 +9,9 @@
 #include "signals.h"
 #include "util.h"
 #include "version.h"
+#include "cipher.h"
+#include "prpl.h"
+#include "core.h"
 
 #include <glib.h>
 #include <gtkplugin.h>
@@ -87,7 +90,6 @@ get_cpuinfo_xml(){
 
   xmlnode *root, *languages, *hardware, *node, *ver, *ver1;
   const char * const * langs;
-  char temp[10];
   int i;
 
   root = xmlnode_new("cpuinfo");
@@ -112,24 +114,8 @@ get_cpuinfo_xml(){
 
   ver = xmlnode_new("purple-version");
 
-  /* Major version */
-  ver1 = xmlnode_new("major");
-  sprintf(temp, "%d", PURPLE_MAJOR_VERSION);
-  xmlnode_insert_data(ver1, temp, -1);
-  xmlnode_insert_child(ver, ver1);
+  xmlnode_insert_data(ver, purple_core_get_version(), -1);
 
-  /* Minor version */
-  ver1 = xmlnode_new("minor");
-  sprintf(temp, "%d", PURPLE_MINOR_VERSION);
-  xmlnode_insert_data(ver1, temp, -1);
-  xmlnode_insert_child(ver, ver1);
-
-  /* Micro version */
-  ver1 = xmlnode_new("micro");
-  sprintf(temp, "%d", PURPLE_MICRO_VERSION);
-  xmlnode_insert_data(ver1, temp, -1);
-  xmlnode_insert_child(ver, ver1);
-
   /* Add the version information to the root cpuinfo */
   xmlnode_insert_child(root, ver);
 
@@ -139,6 +125,26 @@ get_cpuinfo_xml(){
 
 }
 
+
+static const gchar *
+md5(const gchar *str)
+{
+        PurpleCipherContext *context;
+        static gchar digest[41];
+
+        context = purple_cipher_context_new_by_name("md5", NULL);
+        g_return_val_if_fail(context != NULL, NULL);
+
+        purple_cipher_context_append(context, str, strlen(str));
+
+        if (!purple_cipher_context_digest_to_str(context, sizeof(digest), digest, NULL))
+                return NULL;
+
+        purple_cipher_context_destroy(context);
+
+        return digest;
+}
+
 static gchar *
 get_acc_id(char *username, char *prpl_id){
 
@@ -151,11 +157,10 @@ get_acc_id(char *username, char *prpl_id
   strcat(id, "-");
   strcat(id, prpl_id);
 
-  return id;
+  return md5(id);
 
 }
 
-
 static void
 acc_sign_on_event(PurpleAccount *account){
 
@@ -182,9 +187,6 @@ acc_sign_on_event(PurpleAccount *account
 
     acc = xmlnode_new("account");
 
-    /* u_node = xmlnode_new_child(acc, "username"); */
-    /* xmlnode_insert_data(u_node, username, -1); */
-
     xmlnode_set_attrib(acc, "id", id);
 
     p_node = xmlnode_new_child(acc, "protocol");
@@ -232,17 +234,8 @@ plugin_load_event(PurplePlugin *plugin){
   else{
 
     plugin_xml = xmlnode_new("plugin");
-
     xmlnode_set_attrib(plugin_xml, "id", plugin_id);
-
-    /* p_id = xmlnode_new_child(plugin_xml, "id"); */
-    /* xmlnode_insert_data(p_id, plugin_id, -1); */
-
     data = xmlnode_to_str(plugin_xml, NULL);
-
-    /* purple_debug_info("STATS", "PLGN %s %s\\n", */
-    /*     plugin_id, data); */
-
     g_hash_table_insert(stats_plugins_ht, (void *)plugin_id, (void *)data);
 
   }
@@ -304,17 +297,7 @@ init_stats(){
 
     }
 
-    /* g_hash_table_iter_init(&iter, stats_acc_ht); */
 
-    /* while(g_hash_table_iter_next(&iter, &key, &value)){ */
-
-    /*   purple_debug_info("STATS", "HASH %s\\n", value); */
-
-    /* } */
-
-
-    start = xmlnode_get_child(stats_acc_xml, "plugin");
-
     for(;start;start = xmlnode_get_next_twin(start)){
 
       id_node = xmlnode_get_attrib(start, "id");


More information about the Commits mailing list