frontends: use of new "info" type in newMessage
This commit is contained in:
parent
a20e3e2cb8
commit
b41bda0a18
2 changed files with 14 additions and 7 deletions
|
|
@ -271,16 +271,20 @@ class QuickApp(object):
|
|||
_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 @@ class QuickApp(object):
|
|||
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 @@ class QuickApp(object):
|
|||
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):
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ class Chat(wx.Frame, QuickChat):
|
|||
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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue