Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

presence no longer replies when exception is caught and tweaks to pre…

…sence events
  • Loading branch information...
commit 27ebb6e8f69d7b491b99044296a8b881195a21f6 1 parent 8f55704
@fritzy fritzy authored
Showing with 12 additions and 4 deletions.
  1. +6 −4 sleekxmpp/basexmpp.py
  2. +6 −0 sleekxmpp/stanza/presence.py
View
10 sleekxmpp/basexmpp.py
@@ -553,6 +553,7 @@ def _handle_presence(self, presence):
priority = presence['priority']
was_offline = False
+ got_online = False
old_roster = self.roster.get(jid, {}).get(resource, {})
# Create a new roster entry if needed.
@@ -569,7 +570,7 @@ def _handle_presence(self, presence):
# Determine if the user has just come online.
if not resource in connections:
if show == 'available' or show in presence.showtypes:
- self.event("got_online", presence)
+ got_online = True
was_offline = True
connections[resource] = {}
@@ -592,15 +593,16 @@ def _handle_presence(self, presence):
if not connections and not self.roster[jid]['in_roster']:
del self.roster[jid]
- if not was_offline:
- self.event("got_offline", presence)
- else:
+ self.event("got_offline", presence)
+ if was_offline:
return False
name = '(%s) ' % name if name else ''
# Presence state has changed.
self.event("changed_status", presence)
+ if got_online:
+ self.event("got_online", presence)
logging.debug("STATUS: %s%s/%s[%s]: %s" % (name, jid, resource,
show, status))
View
6 sleekxmpp/stanza/presence.py
@@ -92,6 +92,12 @@ def setup(self, xml=None):
return StanzaBase.setup(self, xml)
+ def exception(self, e):
+ """
+ Override exception passback for presence.
+ """
+ pass
+
def set_show(self, show):
"""
Set the value of the <show> element.
Please sign in to comment.
Something went wrong with that request. Please try again.