plugin XEP-0045: handle MUC presence
This commit is contained in:
parent
1f602f33cb
commit
100ba3969e
1 changed files with 13 additions and 2 deletions
|
|
@ -28,6 +28,7 @@ from sat.core import exceptions
|
|||
from sat.memory import memory
|
||||
|
||||
import uuid
|
||||
import copy
|
||||
|
||||
from wokkel import muc
|
||||
from sat.tools import xml_tools
|
||||
|
|
@ -85,6 +86,8 @@ class XEP_0045(object):
|
|||
except KeyError:
|
||||
log.info(_("Text commands not available"))
|
||||
|
||||
host.trigger.add("presence_available", self.presenceTrigger)
|
||||
|
||||
def profileConnected(self, profile):
|
||||
def assign_service(service):
|
||||
client = self.host.getClient(profile)
|
||||
|
|
@ -639,6 +642,15 @@ class XEP_0045(object):
|
|||
if user.show:
|
||||
whois_msg.append(_("Show: %s") % user.show)
|
||||
|
||||
def presenceTrigger(self, presence_elt, client):
|
||||
# XXX: shouldn't it be done by the server ?!!
|
||||
muc_client = self.clients[client.profile]
|
||||
for room_jid_s, room in muc_client.joined_rooms.items():
|
||||
elt = copy.deepcopy(presence_elt)
|
||||
elt['to'] = room_jid_s + '/' + room.nick
|
||||
client.presence.send(elt)
|
||||
return True
|
||||
|
||||
|
||||
class SatMUCClient (muc.MUCClient):
|
||||
#implements(iwokkel.IDisco)
|
||||
|
|
@ -712,8 +724,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):
|
||||
print("FIXME: MUC status not managed yet")
|
||||
#FIXME:
|
||||
self.host.bridge.presenceUpdate(room.roomJID.userhost() + '/' + user.nick, show or '', 0, {'default': status or ''}, self.parent.profile)
|
||||
|
||||
def receivedSubject(self, room, user, subject):
|
||||
log.debug(_("New subject for room (%(room_id)s): %(subject)s") % {'room_id': room.roomJID.full(), 'subject': subject})
|
||||
|
|
|
|||
Loading…
Reference in a new issue