Merge branch 'develop' of github.com:fritzy/SleekXMPP into develop

This commit is contained in:
Lance Stout 2010-10-24 12:11:34 -04:00
commit d9aff3d36f
2 changed files with 12 additions and 4 deletions

View file

@ -553,6 +553,7 @@ class BaseXMPP(XMLStream):
priority = presence['priority'] priority = presence['priority']
was_offline = False was_offline = False
got_online = False
old_roster = self.roster.get(jid, {}).get(resource, {}) old_roster = self.roster.get(jid, {}).get(resource, {})
# Create a new roster entry if needed. # Create a new roster entry if needed.
@ -569,7 +570,7 @@ class BaseXMPP(XMLStream):
# Determine if the user has just come online. # Determine if the user has just come online.
if not resource in connections: if not resource in connections:
if show == 'available' or show in presence.showtypes: if show == 'available' or show in presence.showtypes:
self.event("got_online", presence) got_online = True
was_offline = True was_offline = True
connections[resource] = {} connections[resource] = {}
@ -592,15 +593,16 @@ class BaseXMPP(XMLStream):
if not connections and not self.roster[jid]['in_roster']: if not connections and not self.roster[jid]['in_roster']:
del self.roster[jid] del self.roster[jid]
if not was_offline: self.event("got_offline", presence)
self.event("got_offline", presence) if was_offline:
else:
return False return False
name = '(%s) ' % name if name else '' name = '(%s) ' % name if name else ''
# Presence state has changed. # Presence state has changed.
self.event("changed_status", presence) self.event("changed_status", presence)
if got_online:
self.event("got_online", presence)
logging.debug("STATUS: %s%s/%s[%s]: %s" % (name, jid, resource, logging.debug("STATUS: %s%s/%s[%s]: %s" % (name, jid, resource,
show, status)) show, status))

View file

@ -92,6 +92,12 @@ class Presence(RootStanza):
return StanzaBase.setup(self, xml) return StanzaBase.setup(self, xml)
def exception(self, e):
"""
Override exception passback for presence.
"""
pass
def set_show(self, show): def set_show(self, show):
""" """
Set the value of the <show> element. Set the value of the <show> element.