last_message_time is now indexed by full_jid. for [1697]
This commit is contained in:
parent
dab9943bc2
commit
51d57ba717
5 changed files with 17 additions and 11 deletions
|
@ -391,7 +391,8 @@ class ChatControlBase(MessageControl):
|
||||||
if not count_as_new:
|
if not count_as_new:
|
||||||
return
|
return
|
||||||
if kind == 'incoming_queue':
|
if kind == 'incoming_queue':
|
||||||
gajim.last_message_time[self.account][jid] = time.time()
|
gajim.last_message_time[self.account][self.get_full_jid()] = \
|
||||||
|
time.time()
|
||||||
urgent = True
|
urgent = True
|
||||||
if (not self.parent_win.get_active_jid() or \
|
if (not self.parent_win.get_active_jid() or \
|
||||||
jid != self.parent_win.get_active_jid() or \
|
jid != self.parent_win.get_active_jid() or \
|
||||||
|
@ -1254,7 +1255,8 @@ class ChatControl(ChatControlBase):
|
||||||
|
|
||||||
def allow_shutdown(self):
|
def allow_shutdown(self):
|
||||||
jid = self.contact.jid
|
jid = self.contact.jid
|
||||||
if time.time() - gajim.last_message_time[self.account][jid] < 2:
|
if time.time() - gajim.last_message_time[self.account]\
|
||||||
|
[self.get_full_jid()] < 2:
|
||||||
# 2 seconds
|
# 2 seconds
|
||||||
dialog = dialogs.ConfirmationDialog(
|
dialog = dialogs.ConfirmationDialog(
|
||||||
#%s is being replaced in the code with JID
|
#%s is being replaced in the code with JID
|
||||||
|
|
|
@ -1502,8 +1502,9 @@ class Interface:
|
||||||
else:
|
else:
|
||||||
contact = gajim.contacts.get_first_contact_from_jid(account, jid)
|
contact = gajim.contacts.get_first_contact_from_jid(account, jid)
|
||||||
self.roster.new_chat(contact, account)
|
self.roster.new_chat(contact, account)
|
||||||
gajim.last_message_time[account][jid] = 0 # long time ago
|
|
||||||
w = gajim.interface.msg_win_mgr.get_window(jid, account)
|
w = gajim.interface.msg_win_mgr.get_window(jid, account)
|
||||||
|
ctrl = w.get_control
|
||||||
|
gajim.last_message_time[account][jid] = 0 # long time ago
|
||||||
elif typ == message_control.TYPE_PM:
|
elif typ == message_control.TYPE_PM:
|
||||||
if gajim.interface.msg_win_mgr.has_window(jid, account):
|
if gajim.interface.msg_win_mgr.has_window(jid, account):
|
||||||
w = gajim.interface.msg_win_mgr.get_window(jid, account)
|
w = gajim.interface.msg_win_mgr.get_window(jid, account)
|
||||||
|
|
|
@ -52,7 +52,7 @@ class MessageControl:
|
||||||
self.print_time_timeout_id = None
|
self.print_time_timeout_id = None
|
||||||
self.resource = resource
|
self.resource = resource
|
||||||
|
|
||||||
gajim.last_message_time[self.account][contact.jid] = 0
|
gajim.last_message_time[self.account][self.get_full_jid()] = 0
|
||||||
|
|
||||||
self.xml = gtk.glade.XML(GTKGUI_GLADE, widget_name, APP)
|
self.xml = gtk.glade.XML(GTKGUI_GLADE, widget_name, APP)
|
||||||
self.widget = self.xml.get_widget(widget_name)
|
self.widget = self.xml.get_widget(widget_name)
|
||||||
|
|
|
@ -248,7 +248,8 @@ class MessageWindow:
|
||||||
ctrl_page = self.notebook.page_num(ctrl.widget)
|
ctrl_page = self.notebook.page_num(ctrl.widget)
|
||||||
self.notebook.set_current_page(ctrl_page)
|
self.notebook.set_current_page(ctrl_page)
|
||||||
|
|
||||||
def remove_tab(self, ctrl,reason=None): # reason is only for gc (offline status message)
|
def remove_tab(self, ctrl, reason = None):
|
||||||
|
'''reason is only for gc (offline status message)'''
|
||||||
# Shutdown the MessageControl
|
# Shutdown the MessageControl
|
||||||
if not ctrl.allow_shutdown():
|
if not ctrl.allow_shutdown():
|
||||||
return
|
return
|
||||||
|
@ -261,12 +262,12 @@ class MessageWindow:
|
||||||
if gajim.interface.systray_enabled:
|
if gajim.interface.systray_enabled:
|
||||||
gajim.interface.systray.remove_jid(ctrl.contact.jid, ctrl.account,
|
gajim.interface.systray.remove_jid(ctrl.contact.jid, ctrl.account,
|
||||||
ctrl.type_id)
|
ctrl.type_id)
|
||||||
del gajim.last_message_time[ctrl.account][ctrl.contact.jid]
|
del gajim.last_message_time[ctrl.account][ctrl.get_full_jid()]
|
||||||
|
|
||||||
self.disconnect_tab_dnd(ctrl.widget)
|
self.disconnect_tab_dnd(ctrl.widget)
|
||||||
self.notebook.remove_page(self.notebook.page_num(ctrl.widget))
|
self.notebook.remove_page(self.notebook.page_num(ctrl.widget))
|
||||||
|
|
||||||
fjid = control.get_full_jid()
|
fjid = ctrl.get_full_jid()
|
||||||
del self._controls[ctrl.account][fjid]
|
del self._controls[ctrl.account][fjid]
|
||||||
if len(self._controls[ctrl.account]) == 0:
|
if len(self._controls[ctrl.account]) == 0:
|
||||||
del self._controls[ctrl.account]
|
del self._controls[ctrl.account]
|
||||||
|
|
|
@ -2188,9 +2188,9 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
|
||||||
break
|
break
|
||||||
|
|
||||||
for ctrl in win.controls():
|
for ctrl in win.controls():
|
||||||
jid = ctrl.contact.jid
|
fjid = ctrl.get_full_jid()
|
||||||
if gajim.last_message_time[acct].has_key(jid):
|
if gajim.last_message_time[acct].has_key(fjid):
|
||||||
if time.time() - gajim.last_message_time[acct][jid] < 2:
|
if time.time() - gajim.last_message_time[acct][fjid] < 2:
|
||||||
recent = True
|
recent = True
|
||||||
break
|
break
|
||||||
if unread:
|
if unread:
|
||||||
|
@ -2249,8 +2249,10 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
|
||||||
win = gajim.interface.msg_win_mgr.get_window(fjid, account)
|
win = gajim.interface.msg_win_mgr.get_window(fjid, account)
|
||||||
if not win:
|
if not win:
|
||||||
self.new_chat(contact, account, resource = resource)
|
self.new_chat(contact, account, resource = resource)
|
||||||
gajim.last_message_time[account][contact.jid] = 0 # long time ago
|
|
||||||
win = gajim.interface.msg_win_mgr.get_window(fjid, account)
|
win = gajim.interface.msg_win_mgr.get_window(fjid, account)
|
||||||
|
ctrl = win.get_control(fjid, account)
|
||||||
|
# last message is long time ago
|
||||||
|
gajim.last_message_time[account][ctrl.get_full_jid()] = 0
|
||||||
win.set_active_tab(fjid, account)
|
win.set_active_tab(fjid, account)
|
||||||
win.window.present()
|
win.window.present()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue