diff src/plugins/plugin_xep_0054.py @ 587:952322b1d490

Remove trailing whitespaces.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 18 Jan 2013 17:55:34 +0100
parents ca13633d3b6b
children beaf6bec2fcd
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0054.py	Fri Jan 18 17:55:27 2013 +0100
+++ b/src/plugins/plugin_xep_0054.py	Fri Jan 18 17:55:34 2013 +0100
@@ -90,9 +90,9 @@
             x_elt = domish.Element((NS_VCARD_UPDATE, 'x'))
             x_elt.addElement('photo', content=self.avatars_cache[client.jid.userhost()])
             presence_elt.addChild(x_elt)
-       
+
         return True
-  
+
     def _fillCachedValues(self, result, client):
         #FIXME: this is really suboptimal, need to be reworked
         #       the current naive approach keeps a map between all jids of all profiles
@@ -101,11 +101,11 @@
         for _jid in client.roster.getBareJids() + [client.jid.userhost()]:
             if _jid in self.avatars_cache:
                 self.host.memory.updateEntityData(jid.JID(_jid), "avatar", self.avatars_cache[_jid], client.profile)
-        
+
     def profileConnected(self, profile):
         client = self.host.getClient(profile)
         client.roster.got_roster.addCallback(self._fillCachedValues, client)
-    
+
     def update_cache(self, jid, name, value, profile):
         """update cache value
         - save value in memory in case of change
@@ -122,7 +122,7 @@
             self.host.memory.updateEntityData(jid, name, value, profile)
             if name == "avatar":
                 self.avatars_cache[jid.userhost()] = value
-            
+
     def get_cache(self, jid, name, profile):
         """return cached value for jid
         @param jid: target contact
@@ -158,7 +158,7 @@
         """Convert a VCard to a dict, and save binaries"""
         debug (_("parsing vcard"))
         dictionary = {}
-        
+
         for elem in vcard.elements():
             if elem.name == 'FN':
                 dictionary['fullname'] = unicode(elem)
@@ -170,7 +170,7 @@
             elif elem.name == 'EMAIL':
                 dictionary['email'] = unicode(elem)
             elif elem.name == 'BDAY':
-                dictionary['birthday'] = unicode(elem) 
+                dictionary['birthday'] = unicode(elem)
             elif elem.name == 'PHOTO':
                 dictionary["avatar"] = yield threads.deferToThread(self.save_photo, elem)
                 if not dictionary["avatar"]:  #can happen in case of e.g. empty photo elem
@@ -202,7 +202,7 @@
         """Called when something is wrong with registration"""
         error (_("Can't find VCard of %s") % failure.value.stanza['from'])
         self.host.bridge.actionResult("SUPPRESS", failure.value.stanza['id'], {}, profile) #FIXME: maybe an error message would be better
-  
+
     def getCard(self, target_s, profile_key='@DEFAULT@'):
         """Ask server for VCard
         @param target_s: jid from which we want the VCard
@@ -219,7 +219,7 @@
         reg_request["to"] = to_jid.userhost()
         reg_request.addElement('vCard', NS_VCARD)
         reg_request.send(to_jid.userhost()).addCallbacks(self.vcard_ok, self.vcard_err, callbackArgs=[profile], errbackArgs=[profile])
-        return reg_request["id"] 
+        return reg_request["id"]
 
     def getAvatarFile(self, avatar_hash):
         """Give the full path of avatar from hash
@@ -258,38 +258,38 @@
         client = self.host.getClient(profile_key)
         if not client:
             raise exceptions.NotConnectedProfileError(_('Trying to set avatar for a non-existant or not connected profile'))
-        
+
         vcard_set = IQ(client.xmlstream,'set')
         d = threads.deferToThread(self._buildSetAvatar, vcard_set, filepath)
-        
+
         def elementBuilt(result):
             """Called once the image is at the right size/format, and the vcard set element is build"""
             set_avatar_elt, img_hash = result
             self.avatars_cache[client.jid.userhost()] = img_hash # we need to update the hash, so we can send a new presence
-                                                                 # element with the right hash 
+                                                                 # element with the right hash
             return set_avatar_elt.send().addCallback(lambda ignore: client.presence.available())
-        
+
         d.addCallback(elementBuilt)
-        
+
         return d
 
 
 class XEP_0054_handler(XMPPHandler):
     implements(iwokkel.IDisco)
-   
+
     def __init__(self, plugin_parent):
         self.plugin_parent = plugin_parent
         self.host = plugin_parent.host
 
     def connectionInitialized(self):
         self.xmlstream.addObserver(VCARD_UPDATE, self.update)
-    
+
     def getDiscoInfo(self, requestor, target, nodeIdentifier=''):
         return [disco.DiscoFeature(NS_VCARD)]
 
     def getDiscoItems(self, requestor, target, nodeIdentifier=''):
         return []
-    
+
     def update(self, presence):
         """Request for VCard's nickname
         return the cached nickname if exists, else get VCard