Daniel Brötzmann pushed to branch mainwindow at gajim / gajim
Commits:
6c9ba7ff by wurstsalat at 2021-10-16T16:45:22+02:00
Remove obsolete app.last_message_time
- - - - -
5 changed files:
- gajim/common/app.py
- gajim/gtk/controls/base.py
- gajim/gtk/controls/chat.py
- gajim/gui_interface.py
- test/lib/gajim_mocks.py
Changes:
=====================================
gajim/common/app.py
=====================================
@@ -81,10 +81,6 @@ def __init__(self):
transport_type = {} # type: Dict[str, str]
-# dict of time of the latest incoming message per jid
-# {acct1: {jid1: time1, jid2: time2}, }
-last_message_time = {} # type: Dict[str, Dict[str, float]]
-
contacts = cast(LegacyContactsAPIT, None)
# tell if we are connected to the room or not
=====================================
gajim/gtk/controls/base.py
=====================================
@@ -121,8 +121,6 @@ def __init__(self, widget_name, account, jid):
self.control_id = str(uuid.uuid4())
self.session = None
- app.last_message_time[self.account][self.contact.jid] = 0
-
self.xml = get_builder('%s.ui' % widget_name)
self.xml.connect_signals(self)
self.widget = self.xml.get_object('%s_hbox' % widget_name)
=====================================
gajim/gtk/controls/chat.py
=====================================
@@ -87,7 +87,6 @@ def __init__(self, account, jid):
self.last_recv_message_id = None
self.last_recv_message_marks = None
- self.last_message_timestamp = None
self.toggle_emoticons()
@@ -638,10 +637,13 @@ def shutdown(self):
app.check_finalize(self)
def allow_shutdown(self, _method, on_yes, on_no):
- # TODO: app.last_message_time is not set anywhere
- time_ = app.last_message_time[self.account][self.contact.jid]
- # 2 seconds
- if time.time() - time_ < 2:
+ row = self.conversation_view.get_last_message_row()
+ if row is None:
+ on_yes(self)
+ return
+
+ if time.time() - row.timestamp < 2:
+ # Under 2 seconds since last message
no_log_for = app.settings.get_account_setting(
self.account, 'no_log_for').split()
more = ''
=====================================
gajim/gui_interface.py
=====================================
@@ -165,7 +165,6 @@ def __init__(self):
app.to_be_removed[a] = []
app.nicks[a] = app.settings.get_account_setting(a, 'name')
app.block_signed_in_notifications[a] = True
- app.last_message_time[a] = {}
if sys.platform not in ('win32', 'darwin'):
logind.enable()
@@ -240,7 +239,6 @@ def handle_event(self, account, jid, type_):
elif type_ in ('chat-message', ''):
# '' is for log in/out notifications
app.window.select_chat(account, jid.bare)
- app.last_message_time[account][jid] = 0 # long time ago
elif type_ == 'jingle-incoming':
app.window.select_chat(account, jid.bare)
elif type_ in ('subscription-request',
@@ -821,7 +819,6 @@ def enable_account(self, account):
app.nicks[account] = app.settings.get_account_setting(account,
'name')
app.block_signed_in_notifications[account] = True
- app.last_message_time[account] = {}
app.settings.set_account_setting(account, 'active', True)
gui_menu_builder.build_accounts_menu()
@@ -866,7 +863,6 @@ def disable_account(self, account):
del app.automatic_rooms[account]
del app.to_be_removed[account]
del app.newly_added[account]
- del app.last_message_time[account]
def remove_account(self, account):
if app.settings.get_account_setting(account, 'active'):
=====================================
test/lib/gajim_mocks.py
=====================================
@@ -36,7 +36,6 @@ def __init__(self, account, *args):
app.to_be_removed[account] = []
app.nicks[account] = app.settings.get_account_setting(account, 'name')
app.block_signed_in_notifications[account] = True
- app.last_message_time[account] = {}
app.connections[account] = self
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/6c9ba7ff22fb4a47b7b1f7f6b25c23d2c89826b8
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/6c9ba7ff22fb4a47b7b1f7f6b25c23d2c89826b8
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits