frontends: printInfo and printMessage timestamp attribute defaults to None instead of ''
This commit is contained in:
parent
4f339272b7
commit
7a344fcf5d
2 changed files with 15 additions and 11 deletions
|
|
@ -308,9 +308,9 @@ class QuickApp(object):
|
|||
|
||||
timestamp = extra.get('archive')
|
||||
if type_ == C.MESS_TYPE_INFO:
|
||||
self.chat_wins[win.bare].printInfo( msg, timestamp = float(timestamp) if timestamp else '')
|
||||
self.chat_wins[win.bare].printInfo(msg, timestamp=float(timestamp) if timestamp else None)
|
||||
else:
|
||||
self.chat_wins[win.bare].printMessage(from_jid, msg, profile, float(timestamp) if timestamp else '')
|
||||
self.chat_wins[win.bare].printMessage(from_jid, msg, profile, float(timestamp) if timestamp else None)
|
||||
|
||||
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):
|
||||
|
|
|
|||
|
|
@ -134,9 +134,9 @@ class QuickChat(object):
|
|||
return unescaped.resource
|
||||
return jid.resource if self.type == "group" else (self.host.contact_list.getCache(jid,'nick') or self.host.contact_list.getCache(jid,'name') or jid.node)
|
||||
|
||||
def printMessage(self, from_jid, msg, profile, timestamp = ''):
|
||||
def printMessage(self, from_jid, msg, profile, timestamp=None):
|
||||
"""Print message in chat window. Must be implemented by child class"""
|
||||
jid=JID(from_jid)
|
||||
jid = JID(from_jid)
|
||||
nick = self._get_nick(jid)
|
||||
mymess = (jid.resource == self.nick) if self.type == "group" else (jid.bare == self.host.profiles[profile]['whoami'].bare) #mymess = True if message comes from local user
|
||||
if msg.startswith('/me '):
|
||||
|
|
@ -144,12 +144,13 @@ class QuickChat(object):
|
|||
return
|
||||
return jid, nick, mymess
|
||||
|
||||
def printInfo(self, msg, type_='normal'):
|
||||
def printInfo(self, msg, type_='normal', timestamp=None):
|
||||
"""Print general info
|
||||
@param msg: message to print
|
||||
@type_: one of:
|
||||
normal: general info like "toto has joined the room"
|
||||
me: "/me" information like "/me clenches his fist" ==> "toto clenches his fist"
|
||||
@param timestamp (float): number of seconds since epoch
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue