core, plugin XEP-0045, frontends: change frontend method "setStatusOnline" for "setPresenceStatus":
- remove parameter "online" (can be guess from "presence" value)
- process "statuses" dict in quick_frontend, so this method can get a simple unicode "status"
- add C.PRESENCE_STATUSES_DEFAULT to define the key to use for fallback status
This commit is contained in:
parent
e4cb7f59d3
commit
41b549f7ae
4 changed files with 30 additions and 38 deletions
|
|
@ -98,6 +98,7 @@ class Const(object):
|
|||
PRESENCE_SHOW_XA = 'xa'
|
||||
PRESENCE_SHOW = 'show'
|
||||
PRESENCE_STATUSES = 'statuses'
|
||||
PRESENCE_STATUSES_DEFAULT = 'default'
|
||||
PRESENCE_PRIORITY = 'priority'
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -603,8 +603,7 @@ class SAT(service.Service):
|
|||
self.profiles[profile].presence.available(to_jid, show, statuses, priority)
|
||||
#XXX: FIXME: temporary fix to work around openfire 3.7.0 bug (presence is not broadcasted to generating resource)
|
||||
if '' in statuses:
|
||||
statuses['default'] = statuses['']
|
||||
del statuses['']
|
||||
statuses[C.PRESENCE_STATUSES_DEFAULT] = statuses.pop('')
|
||||
self.bridge.presenceUpdate(self.profiles[profile].jid.full(), show,
|
||||
int(priority), statuses, profile)
|
||||
|
||||
|
|
|
|||
|
|
@ -315,8 +315,7 @@ class SatPresenceProtocol(xmppim.PresenceClientProtocol):
|
|||
statuses = {}
|
||||
|
||||
if None in statuses: # we only want string keys
|
||||
statuses["default"] = statuses[None]
|
||||
del statuses[None]
|
||||
statuses[C.PRESENCE_STATUSES_DEFAULT] = statuses.pop(None)
|
||||
|
||||
self.host.memory.setPresenceStatus(entity, show or "",
|
||||
int(priority), statuses,
|
||||
|
|
@ -334,8 +333,7 @@ class SatPresenceProtocol(xmppim.PresenceClientProtocol):
|
|||
statuses = {}
|
||||
|
||||
if None in statuses: # we only want string keys
|
||||
statuses["default"] = statuses[None]
|
||||
del statuses[None]
|
||||
statuses[C.PRESENCE_STATUSES_DEFAULT] = statuses.pop(None)
|
||||
self.host.memory.setPresenceStatus(entity, "unavailable", 0, statuses, self.parent.profile)
|
||||
|
||||
if not self.host.trigger.point("presenceReceived", entity, "unavailable", 0, statuses, self.parent.profile):
|
||||
|
|
@ -356,16 +354,14 @@ class SatPresenceProtocol(xmppim.PresenceClientProtocol):
|
|||
|
||||
# default for us is None for wokkel
|
||||
# so we must temporarily switch to wokkel's convention...
|
||||
if 'default' in statuses:
|
||||
statuses[None] = statuses['default']
|
||||
del statuses['default']
|
||||
if C.PRESENCE_STATUSES_DEFAULT in statuses:
|
||||
statuses[None] = statuses.pop(C.PRESENCE_STATUSES_DEFAULT)
|
||||
|
||||
presence_elt = xmppim.AvailablePresence(entity, show, statuses, priority)
|
||||
|
||||
# ... before switching back
|
||||
if None in statuses:
|
||||
statuses['default'] = statuses[None]
|
||||
del statuses[None]
|
||||
statuses['default'] = statuses.pop(None)
|
||||
|
||||
if not self.host.trigger.point("presence_available", presence_elt, self.parent):
|
||||
return
|
||||
|
|
|
|||
|
|
@ -734,7 +734,7 @@ class SatMUCClient (muc.MUCClient):
|
|||
self.host.bridge.roomUserChangedNick(room.roomJID.userhost(), user.nick, new_nick, self.parent.profile)
|
||||
|
||||
def userUpdatedStatus(self, room, user, show, status):
|
||||
self.host.bridge.presenceUpdate(room.roomJID.userhost() + '/' + user.nick, show or '', 0, {'default': status or ''}, self.parent.profile)
|
||||
self.host.bridge.presenceUpdate(room.roomJID.userhost() + '/' + user.nick, show or '', 0, {C.PRESENCE_STATUSES_DEFAULT: status or ''}, self.parent.profile)
|
||||
|
||||
def receivedGroupChat(self, room, user, body):
|
||||
log.debug(u'receivedGroupChat: room=%s user=%s body=%s' % (room.roomJID.full(), user, body))
|
||||
|
|
|
|||
Loading…
Reference in a new issue