core, quick_frontend, primitivus, wixi, bridge: fixed delayed message timestamp:

- new "extra" parameter in newMessage signal
This commit is contained in:
Goffi 2012-10-20 17:23:56 +02:00
commit 65103362a6
4 changed files with 39 additions and 28 deletions

View file

@ -303,8 +303,8 @@ class PrimitivusApp(QuickApp):
self.notify(_("Error while sending message"))
editBar.set_edit_text('')
def newMessage(self, from_jid, to_jid, msg, _type, profile):
QuickApp.newMessage(self, from_jid, to_jid, msg, _type, profile)
def newMessage(self, from_jid, to_jid, msg, _type, extra, profile):
QuickApp.newMessage(self, from_jid, to_jid, msg, _type, extra, profile)
if not from_jid in self.contact_list and from_jid.short != self.profiles[profile]['whoami'].short:
#XXX: needed to show entities which haven't sent any

View file

@ -235,7 +235,7 @@ class QuickApp():
_groups = list(groups)
self.contact_list.replace(entity, _groups, attributes)
def _newMessage(self, from_jid_s, msg, _type, to_jid_s, 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 not self.check_profile(profile):
@ -259,16 +259,17 @@ class QuickApp():
if new_jid not in self.contact_list:
self.contact_list.add(new_jid)
self.newMessage(from_jid, to_jid, msg, _type, profile)
self.newMessage(from_jid, to_jid, msg, _type, extra, profile)
def newMessage(self, from_jid, to_jid, msg, _type, profile):
def newMessage(self, from_jid, to_jid, msg, _type, extra, profile):
from_me = from_jid.short == self.profiles[profile]['whoami'].short
win = to_jid if from_me else from_jid
self.current_action_ids = set()
self.current_action_ids_cb = {}
self.chat_wins[win.short].printMessage(from_jid, msg, profile)
timestamp = extra.get('archive')
self.chat_wins[win.short].printMessage(from_jid, msg, profile, float(timestamp) if timestamp else '')
def sendMessage(self, to_jid, message, subject='', mess_type="auto", profile_key="@DEFAULT@"):
if to_jid.startswith(const_PRIVATE_PREFIX):

View file

@ -124,7 +124,7 @@ class QuickChat():
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 = ''):
"""Print message in chat window. Must be implemented by child class"""
jid=JID(from_jid)
nick = self._get_nick(jid)

View file

@ -180,8 +180,8 @@ class MainWindow(wx.Frame, QuickApp):
wx.EVT_MENU(self, idFIND_GATEWAYS, self.onFindGateways)
def newMessage(self, from_jid, to_jid, msg, _type, profile):
QuickApp.newMessage(self, from_jid, to_jid, msg, _type, profile)
def newMessage(self, from_jid, to_jid, msg, _type, extra, profile):
QuickApp.newMessage(self, from_jid, to_jid, msg, _type, extra, profile)
def showAlert(self, message):
# TODO: place this in a separate class