Philipp Hörist pushed to branch master at gajim / gajim
Commits:
211ed18e by Philipp Hörist at 2019-08-10T17:16:04Z
Fix return value
- - - - -
1 changed file:
- gajim/common/modules/bookmarks.py
Changes:
=====================================
gajim/common/modules/bookmarks.py
=====================================
@@ -225,7 +225,7 @@ class Bookmarks(BaseModule):
def get_name_from_bookmark(self, jid: str) -> str:
bookmark = self.get_bookmark_from_jid(jid)
if bookmark is None:
- return
+ return ''
return bookmark.name
def is_bookmark(self, jid: str) -> bool:
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/211ed18e47c6cd34edfcea14ffa5a85fbf…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/211ed18e47c6cd34edfcea14ffa5a85fbf…
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:
ecfed11e by Philipp Hörist at 2019-08-08T20:57:23Z
DiscoInfo: Add muc_room_name property
- - - - -
1 changed file:
- nbxmpp/structs.py
Changes:
=====================================
nbxmpp/structs.py
=====================================
@@ -183,6 +183,10 @@ class DiscoInfo(namedtuple('DiscoInfo', 'jid node identities features dataforms'
if identity.category == 'conference':
return identity.name
+ @property
+ def muc_room_name(self):
+ return self._get_form_value(NS_MUC_INFO, 'muc#roomconfig_roomname')
+
@property
def muc_description(self):
return self._get_form_value(NS_MUC_INFO, 'muc#roominfo_description')
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/commit/ecfed11e600c6e9d9be64ffd7b…
--
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/commit/ecfed11e600c6e9d9be64ffd7b…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
36805577 by Philipp Hörist at 2019-08-06T20:32:11Z
MAM: Minor code simplification
- - - - -
6b789e16 by Philipp Hörist at 2019-08-07T16:11:25Z
Groupchat: Update roster status icon on join/leave
- - - - -
2 changed files:
- gajim/common/modules/mam.py
- gajim/groupchat_control.py
Changes:
=====================================
gajim/common/modules/mam.py
=====================================
@@ -123,7 +123,7 @@ class MAM(BaseModule):
else:
archive_jid = self._con.get_own_jid().getBare()
- namespace = self._con.get_module('MAM').archiving_namespace
+ namespace = self.archiving_namespace
timestamp = None
if properties.stanza_id is None or namespace != nbxmpp.NS_MAM_2:
@@ -132,8 +132,7 @@ class MAM(BaseModule):
if not archive_jid == properties.stanza_id.by:
return
- if not self._con.get_module('MAM').is_catch_up_finished(
- archive_jid):
+ if not self.is_catch_up_finished(archive_jid):
return
app.logger.set_archive_infos(archive_jid,
=====================================
gajim/groupchat_control.py
=====================================
@@ -1496,6 +1496,9 @@ class GroupchatControl(ChatControlBase):
if self.parent_win:
self.parent_win.redraw_tab(self)
+ # Update Roster
+ app.interface.roster.draw_contact(self.room_jid, self.account)
+
formattings_button = self.xml.get_object('formattings_button')
formattings_button.set_sensitive(True)
@@ -1524,10 +1527,8 @@ class GroupchatControl(ChatControlBase):
con = app.connections[self.account]
con.get_module('Chatstate').remove_delay_timeout(self.contact)
- contact = app.contacts.get_groupchat_contact(self.account,
- self.room_jid)
- if contact is not None:
- app.interface.roster.draw_contact(self.room_jid, self.account)
+ # Update Roster
+ app.interface.roster.draw_contact(self.room_jid, self.account)
# We don't redraw the whole banner here, because only icon change
self._update_banner_state_image()
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/a6b4d993bd9b08b2686165bec72678b72…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/a6b4d993bd9b08b2686165bec72678b72…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
922fa4f1 by Philipp Hörist at 2019-08-05T20:49:00Z
MUC: Add log message when requesting MUC history
- timestamp() makes it necessary to use timezone aware datetime objects
- - - - -
dce96b5f by Philipp Hörist at 2019-08-05T21:05:30Z
Logger: Improve log message
- - - - -
ca1b2091 by Philipp Hörist at 2019-08-05T21:58:16Z
MAM: Improve MAM efficiency
This looks at all messages incoming and saves the stanza-id if there is one.
Previously this was only done for messages of type=chat, which left out muc invites
and captcha messages, leading to fetching these messages later again.
- - - - -
5 changed files:
- gajim/common/logger.py
- gajim/common/modules/mam.py
- gajim/common/modules/message.py
- gajim/common/modules/muc.py
- gajim/session.py
Changes:
=====================================
gajim/common/logger.py
=====================================
@@ -1463,5 +1463,5 @@ class Logger:
sql = '''UPDATE last_archive_message SET {}
WHERE jid_id = ?'''.format(args)
self._con.execute(sql, tuple(kwargs.values()) + (jid_id,))
- log.info('Save archive infos: %s', kwargs)
+ log.info('Set message archive info: %s %s', jid, kwargs)
self._timeout_commit()
=====================================
gajim/common/modules/mam.py
=====================================
@@ -40,6 +40,9 @@ class MAM(BaseModule):
BaseModule.__init__(self, con)
self.handlers = [
+ StanzaHandler(name='message',
+ callback=self._set_message_archive_info,
+ priority=41),
StanzaHandler(name='message',
callback=self._mam_message_received,
priority=51),
@@ -101,6 +104,42 @@ class MAM(BaseModule):
# A message we received
return properties.mam.id, None
+ def _set_message_archive_info(self, _con, _stanza, properties):
+ if (properties.is_mam_message or
+ properties.is_pubsub or
+ properties.is_muc_subject):
+ return
+
+ if properties.type.is_groupchat:
+ archive_jid = properties.jid.getBare()
+ namespace = muc_caps_cache.get_mam_namespace(archive_jid)
+ timestamp = properties.timestamp
+ if namespace is None:
+ # MUC History
+ app.logger.set_archive_infos(
+ archive_jid,
+ last_muc_timestamp=timestamp)
+ return
+
+ else:
+ archive_jid = self._con.get_own_jid().getBare()
+ namespace = self._con.get_module('MAM').archiving_namespace
+ timestamp = None
+
+ if properties.stanza_id is None or namespace != nbxmpp.NS_MAM_2:
+ return
+
+ if not archive_jid == properties.stanza_id.by:
+ return
+
+ if not self._con.get_module('MAM').is_catch_up_finished(
+ archive_jid):
+ return
+
+ app.logger.set_archive_infos(archive_jid,
+ last_mam_id=properties.stanza_id.id,
+ last_muc_timestamp=timestamp)
+
def _mam_message_received(self, _con, stanza, properties):
if not properties.is_mam_message:
return
=====================================
gajim/common/modules/message.py
=====================================
@@ -293,16 +293,6 @@ class Message(BaseModule):
stanza_id=event.stanza_id,
message_id=event.message_id)
- if muc_caps_cache.has_mam(event.room_jid):
- finished = self._con.get_module('MAM').is_catch_up_finished(
- event.room_jid)
- if not finished:
- return
-
- app.logger.set_archive_infos(event.room_jid,
- last_mam_id=event.stanza_id,
- last_muc_timestamp=event.timestamp)
-
def _check_for_mam_compliance(self, room_jid, stanza_id):
namespace = caps_cache.muc_caps_cache.get_mam_namespace(room_jid)
if stanza_id is None and namespace == nbxmpp.NS_MAM_2:
=====================================
gajim/common/modules/muc.py
=====================================
@@ -19,6 +19,7 @@ import time
import logging
from datetime import datetime
from datetime import timedelta
+from datetime import timezone
from functools import partial
import nbxmpp
@@ -302,13 +303,16 @@ class MUC(BaseModule):
if archive is not None and archive.last_muc_timestamp is not None:
since_epoch = float(archive.last_muc_timestamp)
- since_date = datetime.utcfromtimestamp(since_epoch)
+ since_date = datetime.fromtimestamp(since_epoch, timezone.utc)
if threshold != SyncThreshold.NO_THRESHOLD:
- threshold_date = datetime.utcnow() - timedelta(days=threshold)
+ now = datetime.now(timezone.utc)
+ threshold_date = now - timedelta(days=threshold)
since_date = max(threshold_date, since_date)
date_string = since_date.strftime('%Y-%m-%dT%H:%M:%SZ')
muc_x.setTag('history', {'since': date_string})
+ self._log.info('Request MUC history since: %s (%s)',
+ date_string, since_date.timestamp())
self._log.info('Threshold for %s: %s', room_jid, threshold)
def _on_error_presence(self, _con, _stanza, properties):
=====================================
gajim/session.py
=====================================
@@ -139,12 +139,6 @@ class ChatControlSession:
stanza_id=obj.unique_id,
message_id=obj.message_id)
- jid = self.conn.get_own_jid().getStripped()
- if self.conn.get_module('MAM').is_catch_up_finished(jid):
- app.logger.set_archive_infos(jid,
- last_mam_id=obj.stanza_id,
- last_muc_timestamp=obj.timestamp)
-
if obj.muc_pm and not obj.gc_control:
# This is a carbon of a PM from a MUC we are not currently
# joined. We log it silently without notification.
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/66fc682605b7812d4b4c7a3b4833f7d1f…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/66fc682605b7812d4b4c7a3b4833f7d1f…
You're receiving this email because of your account on dev.gajim.org.