/soc/2012/sanket/www-statscollector: 5e8fe84ce2ca: Add additiona...

sanket sanket at soc.pidgin.im
Tue Jul 10 01:30:20 EDT 2012


Changeset: 5e8fe84ce2ca0d63194b6e164f1fae785e8ea7c9
Author:	 sanket <sanket at soc.pidgin.im>
Date:	 2012-07-09 22:25 +0530
Branch:	 default
URL: http://hg.pidgin.im/soc/2012/sanket/www-statscollector/rev/5e8fe84ce2ca

Description:

Add additional information to prpl-protocols

prpl-jabber and prpl-irc can have connect-server/server information
which can be added to make the server richer. These fields have now been added
to the statscollector.model.Accounts table.

diffstat:

 pidgin_stats_collector/statscollector/process.py |  24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diffs (46 lines):

diff --git a/pidgin_stats_collector/statscollector/process.py b/pidgin_stats_collector/statscollector/process.py
--- a/pidgin_stats_collector/statscollector/process.py
+++ b/pidgin_stats_collector/statscollector/process.py
@@ -105,24 +105,36 @@
 
       # Set the foreign key
       acc.raw_xml = this.raw_xml
+      acc.service = "unknown"
 
       prpl_name = prpl_plugin.xpath('protocol')[0].text
       prpl_count=0
-      prpl_connect = None
-      prpl_domain  = None
+      jabber_connect = None
+      jabber_domain  = None
+      irc_server = None
       try:
         prpl_count = int(prpl_plugin.xpath('buddies')[0].text.strip())
       except: prpl_count = 0
 
       # Determines the actual connect server in case of jabber protocol
       try:
-        prpl_connect = prpl_plugin.xpath('connect-server')[0].text.strip()
+        jabber_connect = prpl_plugin.xpath('connect-server')[0].text.strip()
       except: pass
       try:
-        prpl_domain = prpl_plugin.xpath('Domain')[0].text.strip()
+        jabber_domain = prpl_plugin.xpath('Domain')[0].text.strip()
       except: pass
-      if prpl_connect: acc.service = prpl_connect
-      elif prpl_domain: acc.service = prpl_domain
+      try:
+        irc_server = prpl_plugin.xpath('Server')[0].text.strip()
+      except: pass
+      print prpl_name, irc_server, jabber_connect, jabber_domain
+      pdb.set_trace()
+
+      if prpl_name == 'prpl-jabber':
+        if jabber_connect: acc.service = jabber_connect
+        elif jabber_domain: acc.service = jabber_domain
+
+      elif prpl_name == 'prpl-irc':
+        acc.service = irc_server
 
       acc.prpl_name = prpl_name
       acc.buddies = prpl_count



More information about the Commits mailing list