# HG changeset patch # User Goffi # Date 1409938170 -7200 # Node ID e15d8a01cf6a287940f8d30871d86d842762e4d2 # Parent 0abce7f17782b9ef9bb7421b7e878c158584c820 frontends: use of new "info" type in newMessage diff -r 0abce7f17782 -r e15d8a01cf6a frontends/src/quick_frontend/quick_app.py --- a/frontends/src/quick_frontend/quick_app.py Fri Sep 05 19:29:30 2014 +0200 +++ b/frontends/src/quick_frontend/quick_app.py Fri Sep 05 19:29:30 2014 +0200 @@ -271,16 +271,20 @@ _groups = list(groups) self.contact_list.replace(entity, _groups, attributes) - def _newMessage(self, from_jid_s, msg, _type, to_jid_s, extra, profile): + def _newMessage(self, from_jid_s, msg, type_, to_jid_s, extra, profile): """newMessage premanagement: a dirty hack to manage private messages - if a private MUC message is detected, from_jid or to_jid is prefixed and resource is escaped""" + + if a private MUC message is detected, from_jid or to_jid is prefixed and resource is escaped + """ + # FIXME: must be refactored for 0.6 from_jid = JID(from_jid_s) to_jid = JID(to_jid_s) from_me = from_jid.bare == self.profiles[profile]['whoami'].bare win = to_jid if from_me else from_jid - if _type != "groupchat" and self.contact_list.getSpecial(win) == "MUC": + if ((type_ != "groupchat" and self.contact_list.getSpecial(win) == "MUC") and + (type_ != C.MESS_TYPE_INFO or (type_ == C.MESS_TYPE_INFO and win.resource))): #we have a private message in a MUC room #XXX: normaly we use bare jid as key, here we need the full jid # so we cheat by replacing the "/" before the resource by @@ -293,9 +297,9 @@ if new_jid not in self.contact_list: self.contact_list.add(new_jid, [C.GROUP_NOT_IN_ROSTER]) - self.newMessageHandler(from_jid, to_jid, msg, _type, extra, profile) + self.newMessageHandler(from_jid, to_jid, msg, type_, extra, profile) - def newMessageHandler(self, from_jid, to_jid, msg, _type, extra, profile): + def newMessageHandler(self, from_jid, to_jid, msg, type_, extra, profile): from_me = from_jid.bare == self.profiles[profile]['whoami'].bare win = to_jid if from_me else from_jid @@ -303,7 +307,10 @@ self.current_action_ids_cb = {} timestamp = extra.get('archive') - self.chat_wins[win.bare].printMessage(from_jid, msg, profile, float(timestamp) if timestamp else '') + if type_ == C.MESS_TYPE_INFO: + self.chat_wins[win.bare].printInfo( msg, timestamp = float(timestamp) if timestamp else '') + else: + self.chat_wins[win.bare].printMessage(from_jid, msg, profile, float(timestamp) if timestamp else '') def sendMessage(self, to_jid, message, subject='', mess_type="auto", extra={}, callback=None, errback=None, profile_key="@NONE@"): if to_jid.startswith(C.PRIVATE_PREFIX): diff -r 0abce7f17782 -r e15d8a01cf6a frontends/src/wix/chat.py --- a/frontends/src/wix/chat.py Fri Sep 05 19:29:30 2014 +0200 +++ b/frontends/src/wix/chat.py Fri Sep 05 19:29:30 2014 +0200 @@ -238,7 +238,7 @@ if not mymess: self.__blink() - def printInfo(self, msg, type_='normal'): + def printInfo(self, msg, type_='normal', timestamp=""): """Print general info @param msg: message to print @type_: one of: