# HG changeset patch # User souliane # Date 1450781091 -3600 # Node ID 33c815c17fe6e5468b3221a309e8d15d43cf9a4f # Parent 9b557e76a5a84ff87fe29682cf5e67a1ee0bdd30 quick_frontend (chat): temporary fix for bug 12: - avoid duplicate one2one message (before the history + as a part of it) - do not display "=> has joined the room" for each occupant when we have just joined a MUC diff -r 9b557e76a5a8 -r 33c815c17fe6 frontends/src/quick_frontend/quick_chat.py --- a/frontends/src/quick_frontend/quick_chat.py Tue Dec 22 11:43:02 2015 +0100 +++ b/frontends/src/quick_frontend/quick_chat.py Tue Dec 22 11:44:51 2015 +0100 @@ -55,6 +55,9 @@ if type_ == C.CHAT_ONE2ONE: self.historyPrint(profile=self.profile) + # FIXME: has been introduced to temporarily fix http://bugs.goffi.org/show_bug.cgi?id=12 + self.initialised = False + def __str__(self): return u"Chat Widget [target: {}, type: {}, profile: {}]".format(self.target, self.type, self.profile) @@ -109,6 +112,8 @@ def addUser(self, nick): """Add user if it is not in the group list""" + if not self.initialised: + return # FIXME: tmp fix for bug 12, do not flood the room with the messages when we've just entered it self.printInfo("=> %s has joined the room" % nick) def removeUser(self, nick): @@ -148,6 +153,7 @@ target = self.target.bare def onHistory(history): + self.initialised = True # FIXME: tmp fix for bug 12 day_format = "%A, %d %b %Y" # to display the day change previous_day = datetime.now().strftime(day_format) for line in history: @@ -166,6 +172,7 @@ def onHistoryError(err): log.error(_("Can't get history")) + self.initialised = False # FIXME: tmp fix for bug 12, here needed for :history and :search commands self.host.bridge.getHistory(unicode(self.host.profiles[profile].whoami.bare), unicode(target), size, True, search, profile, callback=onHistory, errback=onHistoryError) def _get_nick(self, entity): @@ -198,9 +205,15 @@ timestamp = float(extra['timestamp']) except KeyError: timestamp = None + + if not self.initialised and self.type == C.CHAT_ONE2ONE: + return # FIXME: tmp fix for bug 12, do not display the first one2one message which is already in the local history + if type_ == C.MESS_TYPE_INFO: self.printInfo(msg, extra=extra) else: + self.initialised = True # FIXME: tmp fix for bug 12, do not discard any message from now + nick = self._get_nick(from_jid) if msg.startswith('/me '): self.printInfo('* %s %s' % (nick, msg[4:]), type_='me', extra=extra)