Philipp Hörist pushed to branch master at gajim / gajim
Commits:
8744bc0e by lovetox at 2020-03-31T22:20:49+02:00
MAM: Refactor handling query result
- - - - -
af663ca7 by lovetox at 2020-03-31T22:20:49+02:00
MAM: Always include JID in logging messages
- - - - -
798a9812 by lovetox at 2020-03-31T22:20:49+02:00
MAM: Refactor handling interval query result
- - - - -
1 changed file:
- gajim/common/modules/mam.py
Changes:
=====================================
gajim/common/modules/mam.py
=====================================
@@ -264,7 +264,7 @@ class MAM(BaseModule):
own_jid = self._con.get_own_jid().getBare()
if own_jid in self._mam_query_ids:
- self._log.warning('MAM request for %s already running', own_jid)
+ self._log.warning('Request already running: %s', own_jid)
return
archive = app.logger.get_archive_infos(own_jid)
@@ -281,12 +281,14 @@ class MAM(BaseModule):
start_date = None
queryid = self._get_query_id(own_jid)
if mam_id:
- self._log.info('MAM query after: %s', mam_id)
+ self._log.info('Request archive: %s, after mam-id %s',
+ own_jid, mam_id)
else:
# First Start, we request the last week
start_date = datetime.utcnow() - timedelta(days=7)
- self._log.info('First start: query archive start: %s', start_date)
+ self._log.info('Request archive: %s, after date %s',
+ own_jid, start_date)
self._nbxmpp('MAM').make_query(own_jid,
queryid,
@@ -310,14 +312,14 @@ class MAM(BaseModule):
if archive is None or archive.last_mam_id is None:
# First join
start_date = datetime.utcnow() - timedelta(days=1)
- self._log.info('First join: query archive %s from: %s',
+ self._log.info('Request archive: %s, after date %s',
jid, start_date)
elif threshold == SyncThreshold.NO_THRESHOLD:
# Not our first join and no threshold set
mam_id = archive.last_mam_id
- self._log.info('Request from archive: %s, after mam-id %s',
+ self._log.info('Request archive: %s, after mam-id %s',
jid, archive.last_mam_id)
else:
@@ -325,7 +327,7 @@ class MAM(BaseModule):
# last join and check against threshold
last_timestamp = archive.last_muc_timestamp
if last_timestamp is None:
- self._log.info('No last muc timestamp found')
+ self._log.info('No last muc timestamp found: %s', jid)
last_timestamp = 0
last = datetime.utcfromtimestamp(float(last_timestamp))
@@ -333,13 +335,13 @@ class MAM(BaseModule):
# To much time has elapsed since last join, apply threshold
start_date = datetime.utcnow() - timedelta(days=threshold)
self._log.info('Too much time elapsed since last join, '
- 'request from: %s, threshold: %s',
- start_date, threshold)
+ 'request archive: %s, after date %s, '
+ 'threshold: %s', jid, start_date, threshold)
else:
# Request from last mam-id
mam_id = archive.last_mam_id
- self._log.info('Request from archive %s after %s:',
+ self._log.info('Request archive: %s, after mam-id %s:',
jid, archive.last_mam_id)
if jid in self._catch_up_finished:
@@ -368,12 +370,28 @@ class MAM(BaseModule):
self.request_archive_on_signin()
return
- if result.rsm.last is None:
- self._log.info('MAM catchup finished: %s', result.jid)
+ if result.complete:
self._catch_up_finished.append(result.jid)
- return
+ self._log.info('Request finished: %s, last mam id: %s',
+ result.jid, result.rsm.last)
+
+ if result.rsm.last is not None:
+ # <last> is not provided if the requested page was empty
+ # so this means we did not get anything hence we only need
+ # to update the archive info if <last> is present
+ app.logger.set_archive_infos(result.jid,
+ last_mam_id=result.rsm.last,
+ last_muc_timestamp=time.time())
- if not result.complete:
+ if start_date is not None and not groupchat:
+ # Record the earliest timestamp we request from
+ # the account archive. For the account archive we only
+ # set start_date at the very first request.
+ app.logger.set_archive_infos(
+ result.jid,
+ oldest_mam_timestamp=start_date.timestamp())
+
+ else:
app.logger.set_archive_infos(result.jid,
last_mam_id=result.rsm.last)
queryid = self._get_query_id(result.jid)
@@ -386,36 +404,20 @@ class MAM(BaseModule):
'start': None,
'groupchat': groupchat})
- else:
- app.logger.set_archive_infos(result.jid,
- last_mam_id=result.rsm.last,
- last_muc_timestamp=time.time())
-
- if start_date is not None and not groupchat:
- # Record the earliest timestamp we request from
- # the account archive. For the account archive we only
- # set start_date at the very first request.
- app.logger.set_archive_infos(
- result.jid,
- oldest_mam_timestamp=start_date.timestamp())
-
- self._catch_up_finished.append(result.jid)
- self._log.info('End of MAM query, last mam id: %s',
- result.rsm.last)
-
def request_archive_interval(self,
start_date,
end_date,
after=None,
queryid=None):
+ jid = self._con.get_own_jid().getBare()
+
if after is None:
- self._log.info('Request interval from %s to %s',
- start_date, end_date)
+ self._log.info('Request interval: %s, from %s to %s',
+ jid, start_date, end_date)
else:
- self._log.info('Query page after %s', after)
+ self._log.info('Request page: %s, after %s', jid, after)
- jid = self._con.get_own_jid().getBare()
if queryid is None:
queryid = self._get_query_id(jid)
self._mam_query_ids[jid] = queryid
@@ -443,30 +445,21 @@ class MAM(BaseModule):
else:
timestamp = ArchiveState.ALL
- if result.rsm.last is None:
+ if result.complete:
+ self._log.info('Request finished: %s, last mam id: %s',
+ result.jid, result.rsm.last)
+ app.logger.set_archive_infos(result.jid,
+ oldest_mam_timestamp=timestamp)
app.nec.push_incoming_event(NetworkEvent(
'archiving-interval-finished',
account=self._account,
query_id=queryid))
- app.logger.set_archive_infos(result.jid,
- oldest_mam_timestamp=timestamp)
- self._log.info('End of MAM request, no items retrieved')
- return
-
- if not result.complete:
+ else:
self.request_archive_interval(start_date,
end_date,
result.rsm.last,
queryid)
- else:
- self._log.info('Request finished')
- app.logger.set_archive_infos(result.jid,
- oldest_mam_timestamp=timestamp)
- app.nec.push_incoming_event(NetworkEvent(
- 'archiving-interval-finished',
- account=self._account,
- query_id=queryid))
def get_instance(*args, **kwargs):
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/36940440f9bbfaac71d3f94d60ebce2…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/36940440f9bbfaac71d3f94d60ebce2…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
36940440 by Daniel Brötzmann at 2020-03-29T09:14:30+02:00
ChatControlBase: Don’t allow dropping data on message input
- - - - -
1 changed file:
- gajim/chat_control_base.py
Changes:
=====================================
gajim/chat_control_base.py
=====================================
@@ -201,6 +201,7 @@ class ChatControlBase(ChatCommandProcessor, CommandTools, EventHelper):
# add MessageInputTextView to UI and connect signals
self.msg_textview = MessageInputTextView()
+ self.msg_textview.drag_dest_unset()
self.msg_scrolledwindow = ScrolledWindow()
self.msg_scrolledwindow.add(self.msg_textview)
@@ -217,15 +218,6 @@ class ChatControlBase(ChatCommandProcessor, CommandTools, EventHelper):
self.on_msg_textview_populate_popup)
self.handlers[id_] = self.msg_textview
- # Setup DND
- id_ = self.msg_textview.connect('drag_data_received',
- self._on_drag_data_received)
- self.handlers[id_] = self.msg_textview
- self.msg_textview.drag_dest_set(
- Gtk.DestDefaults.ALL,
- self.dnd_list,
- Gdk.DragAction.COPY)
-
# the following vars are used to keep history of user's messages
self.sent_history = []
self.sent_history_pos = 0
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/36940440f9bbfaac71d3f94d60ebce2c…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/36940440f9bbfaac71d3f94d60ebce2c…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
29b5abc7 by lovetox at 2020-03-29T09:11:11+02:00
Interface: Close all account related windows on disable
- - - - -
2 changed files:
- gajim/gtk/util.py
- gajim/gui_interface.py
Changes:
=====================================
gajim/gtk/util.py
=====================================
@@ -700,6 +700,15 @@ def make_href_markup(string):
return URL_REGEX.sub(_to_href, string)
+def get_app_windows(account):
+ windows = []
+ for win in app.app.get_windows():
+ if hasattr(win, 'account'):
+ if win.account == account:
+ windows.append(win)
+ return windows
+
+
def get_app_window(name, account=None, jid=None):
for win in app.app.get_windows():
if type(win).__name__ != name:
=====================================
gajim/gui_interface.py
=====================================
@@ -105,6 +105,7 @@ from gajim.gtk.util import get_show_in_roster
from gajim.gtk.util import get_show_in_systray
from gajim.gtk.util import open_window
from gajim.gtk.util import get_app_window
+from gajim.gtk.util import get_app_windows
from gajim.gtk.const import ControlType
@@ -1751,6 +1752,11 @@ class Interface:
for jid in self.minimized_controls[account]:
ctrl = self.minimized_controls[account][jid]
ctrl.shutdown()
+
+ for win in get_app_windows(account):
+ # Close all account specific windows
+ win.destroy()
+
if account == app.ZEROCONF_ACC_NAME:
app.connections[account].disable_account()
app.connections[account].cleanup()
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/29b5abc70e12055c1da3962ea830665a…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/29b5abc70e12055c1da3962ea830665a…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
038bb408 by lovetox at 2020-03-28T18:06:51+01:00
MAM: Make queryid argument optional
- - - - -
5e6bb0f9 by lovetox at 2020-03-28T18:06:51+01:00
MAM: Parse complete attribute correctly
- - - - -
c6b3a7a5 by lovetox at 2020-03-28T18:13:01+01:00
TCP: Add comment
- - - - -
2 changed files:
- nbxmpp/modules/mam.py
- nbxmpp/tcp.py
Changes:
=====================================
nbxmpp/modules/mam.py
=====================================
@@ -44,7 +44,7 @@ class MAM(BaseModule):
@call_on_response('_query_result')
def make_query(self,
jid,
- queryid,
+ queryid=None,
start=None,
end=None,
with_=None,
@@ -52,7 +52,8 @@ class MAM(BaseModule):
max_=70):
iq = Iq(typ='set', to=jid, queryNS=NS_MAM_2)
- iq.getQuery().setAttr('queryid', queryid)
+ if queryid is not None:
+ iq.getQuery().setAttr('queryid', queryid)
payload = [
self._make_query_form(start, end, with_),
@@ -117,7 +118,7 @@ class MAM(BaseModule):
'stanza-malformed',
'rsm set missing')
- complete = bool(fin.getAttr('complete'))
+ complete = fin.getAttr('complete') == 'true'
return MAMQueryData(jid=jid,
complete=complete,
=====================================
nbxmpp/tcp.py
=====================================
@@ -241,6 +241,10 @@ class TCPConnection(Connection):
except Exception:
self._log.exception('Error while executing data-received:')
+ # Call next async read only after the received data is processed
+ # otherwise this can lead to problems if we call
+ # start_tls_negotiation() while we have a pending read which is
+ # the case for START TLS because its triggered by <proceed>
self._read_async()
def _write_stanzas(self):
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/compare/78da85211708d6c1c87e7d2…
--
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/compare/78da85211708d6c1c87e7d2…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
78da8521 by Philipp Hörist at 2020-03-28T17:30:13+01:00
Revert "TCP: Initiate new read before data-received signal"
This reverts commit 80ec5753de06bc8e92dd49b2aec4f8b13ec8401d
- - - - -
1 changed file:
- nbxmpp/tcp.py
Changes:
=====================================
nbxmpp/tcp.py
=====================================
@@ -236,13 +236,13 @@ class TCPConnection(Connection):
self._log_stanza(data, received=True)
- self._read_async()
-
try:
self.notify('data-received', data)
except Exception:
self._log.exception('Error while executing data-received:')
+ self._read_async()
+
def _write_stanzas(self):
self._write_stanza_buffer = self._write_queue
self._write_queue = deque([])
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/commit/78da85211708d6c1c87e7d23…
--
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/commit/78da85211708d6c1c87e7d23…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
087a2798 by lovetox at 2020-03-28T08:50:53+01:00
RSM: Parse correct node
- - - - -
1 changed file:
- nbxmpp/modules/rsm.py
Changes:
=====================================
nbxmpp/modules/rsm.py
=====================================
@@ -21,8 +21,8 @@ from nbxmpp.structs import RSMData
def parse_rsm(stanza):
- set_ = stanza.getTag('set', namespace=NS_RSM)
- if set_ is None:
+ stanza = stanza.getTag('set', namespace=NS_RSM)
+ if stanza is None:
return None
after = stanza.getTagData('after') or None
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/commit/087a2798bb13d1840972184b…
--
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/commit/087a2798bb13d1840972184b…
You're receiving this email because of your account on dev.gajim.org.