Thilo Molitor pushed to branch gajim_0.16 at gajim / gajim
Commits:
35b6f3c1 by Thilo Molitor at 2016-12-23T15:33:40+01:00
Correctly search for chat_control when message receipts are received (XEP-0184) and chat_control is not currently bound to a session
- - - - -
1 changed file:
- src/common/connection_handlers.py
Changes:
=====================================
src/common/connection_handlers.py
=====================================
--- a/src/common/connection_handlers.py
+++ b/src/common/connection_handlers.py
@@ -1219,11 +1219,12 @@ class ConnectionHandlersBase:
self.name, 'request_receipt'):
ctrl = obj.session.control
if not ctrl:
- # Received <message> doesn't have the <thread> element?
- # search in all sessions
- for s in self.get_sessions(obj.jid):
- if s.control:
- ctrl = s.control
+ # Received <message> doesn't have the <thread> element
+ # or control is not bound to session?
+ # --> search for it
+ ctrl = gajim.interface.msg_win_mgr.search_control(obj.jid,
+ obj.conn.name, obj.resource)
+
if ctrl:
id_ = obj.receipt_received_tag.getAttr('id')
if not id_:
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/35b6f3c1fdd0940fa5b5ee17f354b8fcd9…
Thilo Molitor pushed to branch master at gajim / gajim
Commits:
55eaf70f by Thilo Molitor at 2016-12-16T21:53:51+01:00
Correctly search for chat_control when message receipts are received (XEP-0184) and chat_control is not currently bound to a session
- - - - -
c48f0419 by Thilo Molitor at 2016-12-18T04:22:08+01:00
Merge branch 'master' of dev.gajim.org:gajim/gajim
- - - - -
f15497b0 by Thilo Molitor at 2016-12-23T15:21:03+01:00
Merge branch 'master' of dev.gajim.org:gajim/gajim
- - - - -
1 changed file:
- src/common/connection_handlers.py
Changes:
=====================================
src/common/connection_handlers.py
=====================================
--- a/src/common/connection_handlers.py
+++ b/src/common/connection_handlers.py
@@ -1203,11 +1203,12 @@ class ConnectionHandlersBase:
self.name, 'request_receipt'):
ctrl = obj.session.control
if not ctrl:
- # Received <message> doesn't have the <thread> element?
- # search in all sessions
- for s in self.get_sessions(obj.jid):
- if s.control:
- ctrl = s.control
+ # Received <message> doesn't have the <thread> element
+ # or control is not bound to session?
+ # --> search for it
+ ctrl = gajim.interface.msg_win_mgr.search_control(obj.jid,
+ obj.conn.name, obj.resource)
+
if ctrl:
id_ = obj.receipt_received_tag.getAttr('id')
if not id_:
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/ac4859fb87ef74564e1514a8789031616…
Yann Leboulanger pushed to branch gajim_0.16 at gajim / gajim
Commits:
8781f5aa by Philipp Hörist at 2016-12-18T23:08:54+01:00
Allow for a no limit option on restore_timeout
- - - - -
29861e80 by Philipp Hörist at 2016-12-18T23:15:17+01:00
Change defaults on history restore options
- - - - -
9920a2b2 by Yann Leboulanger at 2016-12-19T13:59:46+01:00
Merge branch 'restore' into 'gajim_0.16'
Change history restore options
- `No limit` option on 'restore_timeout' with `restore_timeout=0`
- Change default values on restore values
Current values of `restore_lines=4`, `restore_timeout=60` means in most cases no restore at all
In recent years through Smartphone use of IM Clients, many people expect to always see at least the last X messages.
With the current settings in most cases there is no history shown, and people think the Client is not capable of it.
I think changing it to `restore_lines=10`, `restore_timeout=0` is sensible
See merge request !7
- - - - -
3 changed files:
- src/chat_control.py
- src/common/config.py
- src/common/logger.py
Changes:
=====================================
src/chat_control.py
=====================================
--- a/src/chat_control.py
+++ b/src/chat_control.py
@@ -2991,12 +2991,6 @@ class ChatControl(ChatControlBase):
if gajim.jid_is_transport(jid):
return
- # How many lines to restore and when to time them out
- restore_how_many = gajim.config.get('restore_lines')
- if restore_how_many <= 0:
- return
- timeout = gajim.config.get('restore_timeout') # in minutes
-
# number of messages that are in queue and are already logged, we want
# to avoid duplication
pending_how_many = len(gajim.events.get_events(self.account, jid,
@@ -3006,8 +3000,8 @@ class ChatControl(ChatControlBase):
self.contact.get_full_jid(), ['chat', 'pm']))
try:
- rows = gajim.logger.get_last_conversation_lines(jid, restore_how_many,
- pending_how_many, timeout, self.account)
+ rows = gajim.logger.get_last_conversation_lines(
+ jid, pending_how_many, self.account)
except exceptions.DatabaseMalformed:
import common.logger
dialogs.ErrorDialog(_('Database Error'),
=====================================
src/common/config.py
=====================================
--- a/src/common/config.py
+++ b/src/common/config.py
@@ -175,8 +175,8 @@ class Config:
'notify_on_new_gmail_email_command': [ opt_str, '', _('Specify the command to run when new mail arrives, e.g.: /usr/bin/getmail -q') ],
'use_gpg_agent': [ opt_bool, False ],
'change_roster_title': [ opt_bool, True, _('Add * and [n] in roster title?')],
- 'restore_lines': [opt_int, 4, _('How many lines to remember from previous conversation when a chat tab/window is reopened?')],
- 'restore_timeout': [opt_int, 60, _('How many minutes should last lines from previous conversation last.')],
+ 'restore_lines': [opt_int, 10, _('How many history messages should be restored when a chat tab/window is reopened?')],
+ 'restore_timeout': [opt_int, 0, _('How far back in time (minutes) history is restored. 0 means no limit.')],
'muc_restore_lines': [opt_int, 20, _('How many lines to request from server when entering a groupchat. -1 means no limit')],
'muc_restore_timeout': [opt_int, 60, _('How many minutes back to request logs when entering a groupchat. -1 means no limit')],
'muc_autorejoin_timeout': [opt_int, 1, _('How many seconds to wait before trying to autorejoin to a conference you are being disconnected from. Set to 0 to disable autorejoining.')],
=====================================
src/common/logger.py
=====================================
--- a/src/common/logger.py
+++ b/src/common/logger.py
@@ -579,8 +579,7 @@ class Logger:
message_col, subject_col)
return self.commit_to_db(values, write_unread)
- def get_last_conversation_lines(self, jid, restore_how_many_rows,
- pending_how_many, timeout, account):
+ def get_last_conversation_lines(self, jid, pending_how_many, account):
"""
Accept how many rows to restore and when to time them out (in minutes)
(mark them as too old) and number of messages that are in queue and are
@@ -595,8 +594,15 @@ class Logger:
return []
where_sql, jid_tuple = self._build_contact_where(account, jid)
+ # How many lines to restore and when to time them out
+ restore_how_many = gajim.config.get('restore_lines')
+ if restore_how_many <= 0:
+ return
+ timeout = gajim.config.get('restore_timeout') # in minutes
+
now = int(float(time.time()))
- timed_out = now - (timeout * 60) # before that they are too old
+ if timeout != 0:
+ timeout = now - (timeout * 60) # before that they are too old
# so if we ask last 5 lines and we have 2 pending we get
# 3 - 8 (we avoid the last 2 lines but we still return 5 asked)
try:
@@ -606,8 +612,8 @@ class Logger:
ORDER BY time DESC LIMIT %d OFFSET %d
''' % (where_sql, constants.KIND_SINGLE_MSG_RECV,
constants.KIND_CHAT_MSG_RECV, constants.KIND_SINGLE_MSG_SENT,
- constants.KIND_CHAT_MSG_SENT, constants.KIND_ERROR, timed_out,
- restore_how_many_rows, pending_how_many), jid_tuple)
+ constants.KIND_CHAT_MSG_SENT, constants.KIND_ERROR, timeout,
+ restore_how_many, pending_how_many), jid_tuple)
results = self.cur.fetchall()
except sqlite.DatabaseError:
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/50c3e9476c2043bc8be217a8713f869b9…