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:
parent
a28bb7be8f
commit
04515e5013
1 changed files with 296 additions and 309 deletions
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
from sat.core.i18n import _
|
||||
from sat.core.constants import Const as C
|
||||
from sat.core import exceptions
|
||||
from sat.core.log import getLogger
|
||||
log = getLogger(__name__)
|
||||
from twisted.words.xish import domish
|
||||
|
|
@ -136,6 +137,7 @@ class XEP_0249(object):
|
|||
@param message: message element
|
||||
@profile: %(doc_profile)s
|
||||
"""
|
||||
client = self.host.getClient(profile)
|
||||
try:
|
||||
room_jid_s = message.firstChildElement()['jid']
|
||||
log.info(_(u'Invitation received for room %(room)s [%(profile)s]') % {'room': room_jid_s, 'profile': profile})
|
||||
|
|
@ -144,9 +146,14 @@ class XEP_0249(object):
|
|||
return
|
||||
from_jid_s = message["from"]
|
||||
room_jid = jid.JID(room_jid_s)
|
||||
if room_jid in self.host.plugins["XEP-0045"].clients[profile].joined_rooms:
|
||||
log.info(_("Invitation silently discarded because user is already in the room."))
|
||||
try:
|
||||
self.host.plugins["XEP-0045"].checkRoomJoined(client, room_jid)
|
||||
except exceptions.NotFound:
|
||||
pass
|
||||
else:
|
||||
log.info(_(u"Invitation silently discarded because user is already in the room."))
|
||||
return
|
||||
|
||||
autojoin = self.host.memory.getParamA(AUTOJOIN_NAME, AUTOJOIN_KEY, profile_key=profile)
|
||||
|
||||
def accept_cb(conf_id, accepted, data, profile):
|
||||
|
|
|
|||
Loading…
Reference in a new issue