plugin XEP-0045, quick frontend (app,chat): various chat improvments:
- (XEP-0045): join defered is now fired when room is full joined and history is available
- (XEP-0045): mucJOIN signature has changed, it now returns the same arguments as mucRoomJoined and a boolean which is True if the room was alread joined
- quick frontend (app, chat): adapted code to new changes
This commit is contained in:
parent
89cfefbacf
commit
42167b6ae9
2 changed files with 47 additions and 20 deletions
|
|
@ -526,8 +526,7 @@ class QuickApp(object):
|
|||
"""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)
|
||||
chat_widget = self.widgets.getOrCreateWidget(quick_chat.QuickChat, room_jid, type_=C.CHAT_GROUP, occupants=occupants, subject=subject, profile=profile)
|
||||
chat_widget.setUserNick(unicode(user_nick))
|
||||
self.widgets.getOrCreateWidget(quick_chat.QuickChat, room_jid, type_=C.CHAT_GROUP, nick=user_nick, occupants=occupants, subject=subject, profile=profile)
|
||||
self.contact_lists[profile].setSpecial(room_jid, C.CONTACT_SPECIAL_GROUP)
|
||||
# chat_widget.update()
|
||||
|
||||
|
|
|
|||
|
|
@ -218,10 +218,9 @@ class Occupant(object):
|
|||
|
||||
|
||||
class QuickChat(quick_widgets.QuickWidget):
|
||||
|
||||
visible_states = ['chat_state'] # FIXME: to be removed, used only in quick_games
|
||||
|
||||
def __init__(self, host, target, type_=C.CHAT_ONE2ONE, occupants=None, subject=None, profiles=None):
|
||||
def __init__(self, host, target, type_=C.CHAT_ONE2ONE, nick=None, occupants=None, subject=None, profiles=None):
|
||||
"""
|
||||
@param type_: can be C.CHAT_ONE2ONE for single conversation or C.CHAT_GROUP for chat à la IRC
|
||||
"""
|
||||
|
|
@ -236,12 +235,15 @@ class QuickChat(quick_widgets.QuickWidget):
|
|||
if type_ == C.CHAT_GROUP:
|
||||
if target.resource:
|
||||
raise exceptions.InternalError(u"a group chat entity can't have a resource")
|
||||
self.nick = None
|
||||
if nick is None:
|
||||
raise exceptions.InternalError(u"nick must not be None for group chat")
|
||||
|
||||
self.nick = nick
|
||||
self.occupants = {}
|
||||
self.setOccupants(occupants)
|
||||
else:
|
||||
if occupants is not None:
|
||||
raise exceptions.InternalError(u"only group chat can have occupants")
|
||||
if occupants is not None or nick is not None:
|
||||
raise exceptions.InternalError(u"only group chat can have occupants or nick")
|
||||
self.messages = OrderedDict() # key: uid, value: Message instance
|
||||
self.games = {} # key=game name (unicode), value=instance of quick_games.RoomGame
|
||||
self.subject = subject
|
||||
|
|
@ -290,6 +292,10 @@ class QuickChat(quick_widgets.QuickWidget):
|
|||
if self.type == C.CHAT_GROUP:
|
||||
kwargs['occupants'] = {o.nick: o.data for o in self.occupants.itervalues()}
|
||||
kwargs['subject'] = self.subject
|
||||
try:
|
||||
kwargs['nick'] = self.nick
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
def onPrivateCreated(self, widget):
|
||||
"""Method called when a new widget for private conversation (MUC) is created"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue