summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Fritz <nathan@andyet.net>2010-10-21 16:59:15 -0700
committerNathan Fritz <nathan@andyet.net>2010-10-21 16:59:15 -0700
commit27ebb6e8f69d7b491b99044296a8b881195a21f6 (patch)
treec2f9e66d6e0d589c7499ad6f6fe00155a7bd1deb
parent8f55704928ac16599a62678fc1c3a83d83f43a21 (diff)
downloadslixmpp-27ebb6e8f69d7b491b99044296a8b881195a21f6.tar.gz
slixmpp-27ebb6e8f69d7b491b99044296a8b881195a21f6.tar.bz2
slixmpp-27ebb6e8f69d7b491b99044296a8b881195a21f6.tar.xz
slixmpp-27ebb6e8f69d7b491b99044296a8b881195a21f6.zip
presence no longer replies when exception is caught and tweaks to presence events
-rw-r--r--sleekxmpp/basexmpp.py10
-rw-r--r--sleekxmpp/stanza/presence.py6
2 files changed, 12 insertions, 4 deletions
diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py
index 802f44cc..4ec0ac2a 100644
--- a/sleekxmpp/basexmpp.py
+++ b/sleekxmpp/basexmpp.py
@@ -553,6 +553,7 @@ class BaseXMPP(XMLStream):
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 @@ class BaseXMPP(XMLStream):
# 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 @@ class BaseXMPP(XMLStream):
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))
diff --git a/sleekxmpp/stanza/presence.py b/sleekxmpp/stanza/presence.py
index 964ef11a..7dcd8f90 100644
--- a/sleekxmpp/stanza/presence.py
+++ b/sleekxmpp/stanza/presence.py
@@ -92,6 +92,12 @@ class Presence(RootStanza):
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.