plugin XEP-0045, quick_frontend + primitivus (chat): cleaning of XEP-0045 (first pass):

- bridge methods/signals now all start with "muc" to follow new convention
    - internal method use client instead of profile to follow new convention
    - removed excetpions from plugin XEP-0045 in favor of core.exceptions, NotReady added
    - cleaned/simplified several part of the code. checkClient removed as it is not needed anymore
    - self.clients map removed, muc data are now stored directly in client
    - getRoomEntityNick and getRoomNicksOfUsers are removed as they don't look sane.
        /!\ This break all room game plugins for the moment
    - use of uuid4 instead of uuid1 for getUniqueName, as host ID and current time are used for uuid1
This commit is contained in:
Goffi 2016-06-27 21:45:11 +02:00
commit 04515e5013

View file

@ -116,12 +116,12 @@ class ProfileManager(object):
for sub in waiting_sub:
self.host.subscribeHandler(waiting_sub[sub], sub, self.profile)
self.bridge.getRoomsJoined(self.profile, callback=self._plug_profile_gotRoomsJoined)
self.bridge.mucGetRoomsJoined(self.profile, callback=self._plug_profile_gotRoomsJoined)
def _plug_profile_gotRoomsJoined(self, rooms_args):
#Now we open the MUC window where we already are:
for room_args in rooms_args:
self.host.roomJoinedHandler(*room_args, profile=self.profile)
self.host.mucRoomJoinedHandler(*room_args, profile=self.profile)
#Presence must be requested after rooms are filled
self.host.bridge.getPresenceStatuses(self.profile, callback=self._plug_profile_gotPresences)
@ -254,10 +254,10 @@ class QuickApp(object):
self.registerSignal("progressFinished")
self.registerSignal("progressError")
self.registerSignal("actionResultExt", self.actionResultHandler)
self.registerSignal("roomJoined", iface="plugin")
self.registerSignal("roomLeft", iface="plugin")
self.registerSignal("roomUserChangedNick", iface="plugin")
self.registerSignal("roomNewSubject", iface="plugin")
self.registerSignal("mucRoomJoined", iface="plugin")
self.registerSignal("mucRoomLeft", iface="plugin")
self.registerSignal("mucRoomUserChangedNick", iface="plugin")
self.registerSignal("mucRoomNewSubject", iface="plugin")
self.registerSignal("chatStateReceived", iface="plugin")
self.registerSignal("psEvent", iface="plugin")
@ -548,7 +548,7 @@ class QuickApp(object):
self.callListeners('presence', entity, show, priority, statuses, profile=profile)
def roomJoinedHandler(self, room_jid_s, occupants, user_nick, subject, profile):
def mucRoomJoinedHandler(self, room_jid_s, occupants, user_nick, subject, profile):
"""Called when a MUC room is joined"""
log.debug(u"Room [{room_jid}] joined by {profile}, users presents:{users}".format(room_jid=room_jid_s, profile=profile, users=occupants.keys()))
room_jid = jid.JID(room_jid_s)
@ -557,7 +557,7 @@ class QuickApp(object):
self.contact_lists[profile].setSpecial(room_jid, C.CONTACT_SPECIAL_GROUP)
# chat_widget.update()
def roomLeftHandler(self, room_jid_s, profile):
def mucRoomLeftHandler(self, room_jid_s, profile):
"""Called when a MUC room is left"""
log.debug(u"Room [%(room_jid)s] left by %(profile)s" % {'room_jid': room_jid_s, 'profile': profile})
room_jid = jid.JID(room_jid_s)
@ -566,14 +566,14 @@ class QuickApp(object):
self.widgets.deleteWidget(chat_widget)
self.contact_lists[profile].removeContact(room_jid)
def roomUserChangedNickHandler(self, room_jid_s, old_nick, new_nick, profile):
def mucRoomUserChangedNickHandler(self, room_jid_s, old_nick, new_nick, profile):
"""Called when an user joined a MUC room"""
room_jid = jid.JID(room_jid_s)
chat_widget = self.widgets.getOrCreateWidget(quick_chat.QuickChat, room_jid, type_=C.CHAT_GROUP, profile=profile)
chat_widget.changeUserNick(old_nick, new_nick)
log.debug(u"user [%(old_nick)s] is now known as [%(new_nick)s] in room [%(room_jid)s]" % {'old_nick': old_nick, 'new_nick': new_nick, 'room_jid': room_jid})
def roomNewSubjectHandler(self, room_jid_s, subject, profile):
def mucRoomNewSubjectHandler(self, room_jid_s, subject, profile):
"""Called when subject of MUC room change"""
room_jid = jid.JID(room_jid_s)
chat_widget = self.widgets.getOrCreateWidget(quick_chat.QuickChat, room_jid, type_=C.CHAT_GROUP, profile=profile)