diff src/core/xmpp.py @ 562:0bb2e0d1c878

core, plugin XEP-0054: avatar upload: - plugin XEP-0054: new setAvatar bridge method - new "presence_available" trigger - new DataError
author Goffi <goffi@goffi.org>
date Fri, 28 Dec 2012 01:00:31 +0100
parents 2c5ef983f2ef
children 01569aa4d7aa
line wrap: on
line diff
--- a/src/core/xmpp.py	Wed Dec 19 23:22:10 2012 +0100
+++ b/src/core/xmpp.py	Fri Dec 28 01:00:31 2012 +0100
@@ -297,18 +297,22 @@
         
     
     def available(self, entity=None, show=None, statuses=None, priority=0):
-	if not statuses:
-	    statuses = {}
-        # default for us is None for wokkel
-        # so we must temporarily switch to wokkel's convention...	
-        if 'default' in statuses:
-            statuses[None] = statuses['default']
+        if not statuses:
+            statuses = {}
+            # default for us is None for wokkel
+            # so we must temporarily switch to wokkel's convention...	
+            if 'default' in statuses:
+                statuses[None] = statuses['default']
 
-        xmppim.PresenceClientProtocol.available(self, entity, show, statuses, priority)
+            xmppim.PresenceClientProtocol.available(self, entity, show, statuses, priority)
+            presence_elt = xmppim.AvailablePresence(entity, show, statuses, priority)
+            if not self.host.trigger.point("presence_available", presence_elt, self.parent):
+                return
+            self.send(presence_elt)
 
-	# ... before switching back
-	if None in statuses:
-	    del statuses[None]
+        # ... before switching back
+        if None in statuses:
+            del statuses[None]
 
     def subscribed(self, entity):
         xmppim.PresenceClientProtocol.subscribed(self, entity)