Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
d2d5a377 by Philipp Hörist at 2019-08-21T16:11:32Z
DiscoInfo: Rename attribute
- - - - -
36d685a8 by Philipp Hörist at 2019-08-21T19:10:12Z
DiscoInfo: Add muc_name property
- - - - -
1 changed file:
- nbxmpp/structs.py
Changes:
=====================================
nbxmpp/structs.py
=====================================
@@ -201,6 +201,17 @@ class DiscoInfo(namedtuple('DiscoInfo', 'stanza identities features dataforms ti
@property
def muc_name(self):
+ if self.muc_room_name:
+ return self.muc_room_name
+
+ if self.muc_identity_name:
+ return self.muc_identity_name
+
+ if self.jid is not None:
+ return self.jid.getNode()
+
+ @property
+ def muc_identity_name(self):
for identity in self.identities:
if identity.category == 'conference':
return identity.name
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/compare/8802bc7bb76bcf52dee7dfabe…
--
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/compare/8802bc7bb76bcf52dee7dfabe…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
5c7bbe76 by Philipp Hörist at 2019-08-19T20:51:52Z
Windows: Add Soup as dependency
- - - - -
1 changed file:
- win/_base.sh
Changes:
=====================================
win/_base.sh
=====================================
@@ -85,6 +85,7 @@ function install_deps {
mingw-w64-"${ARCH}"-goocanvas \
mingw-w64-"${ARCH}"-gspell \
mingw-w64-"${ARCH}"-hunspell \
+ mingw-w64-"${ARCH}"-libsoup \
mingw-w64-"${ARCH}"-"${PYTHON_ID}"-setuptools \
mingw-w64-"${ARCH}"-"${PYTHON_ID}"-pillow \
mingw-w64-"${ARCH}"-"${PYTHON_ID}"-setuptools-scm \
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/5c7bbe760d7618ae2670ba16abb222e940…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/5c7bbe760d7618ae2670ba16abb222e940…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
d4cbdcbb by Philipp Hörist at 2019-08-19T20:49:46Z
Bookmarks: Handle deleted and retracted events
- - - - -
1 changed file:
- gajim/common/modules/bookmarks.py
Changes:
=====================================
gajim/common/modules/bookmarks.py
=====================================
@@ -60,8 +60,20 @@ class Bookmarks(BaseModule):
self._bookmarks = value
@event_node(nbxmpp.NS_BOOKMARKS)
- def _bookmark_event_received(self, _con, _stanza, properties):
+ def _bookmark_event_received(self, _con, stanza, properties):
+ if properties.pubsub_event.retracted:
+ # Unsure how to handle that
+ return
+
bookmarks = properties.pubsub_event.data
+ if properties.pubsub_event.deleted:
+ self._log.info('Bookmark node deleted')
+ bookmarks = []
+
+ elif properties.pubsub_event.data is None:
+ self._log.warning('Invalid bookmark data')
+ self._log.warning(stanza)
+ return
if not properties.is_self_message:
self._log.warning('%s has an open access bookmarks node',
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/d4cbdcbbe6695bc8c450d82f2a05a00889…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/d4cbdcbbe6695bc8c450d82f2a05a00889…
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:
8802bc7b by Philipp Hörist at 2019-08-19T20:48:50Z
Bookmarks: Handle deleted and retracted events
- - - - -
1 changed file:
- nbxmpp/modules/bookmarks.py
Changes:
=====================================
nbxmpp/modules/bookmarks.py
=====================================
@@ -56,10 +56,18 @@ class Bookmarks:
if properties.pubsub_event.node != NS_BOOKMARKS:
return
+ if properties.pubsub_event.deleted or properties.pubsub_event.retracted:
+ return
+
item = properties.pubsub_event.item
+ if item is None:
+ return
- bookmarks = []
storage_node = item.getTag('storage', namespace=NS_BOOKMARKS)
+ if storage_node is None:
+ return
+
+ bookmarks = []
if storage_node.getChildren():
bookmarks = self._parse_bookmarks(storage_node)
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/commit/8802bc7bb76bcf52dee7dfabec…
--
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/commit/8802bc7bb76bcf52dee7dfabec…
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:
0391fb0f by Philipp Hörist at 2019-08-18T20:22:12Z
Presence: Add is_nickname_modified property
- - - - -
1 changed file:
- nbxmpp/structs.py
Changes:
=====================================
nbxmpp/structs.py
=====================================
@@ -588,6 +588,13 @@ class PresenceProperties:
self.muc_status_codes is not None and
StatusCode.SELF in self.muc_status_codes)
+ @property
+ def is_nickname_modified(self):
+ return (self.from_muc and
+ self.muc_status_codes is not None and
+ StatusCode.NICKNAME_MODIFIED in self.muc_status_codes and
+ self.type == PresenceType.AVAILABLE)
+
@property
def is_nickname_changed(self):
return (self.from_muc and
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/commit/0391fb0ff1b9c3f8d9a0586209…
--
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/commit/0391fb0ff1b9c3f8d9a0586209…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
573af5cd by Philipp Hörist at 2019-08-17T20:02:09Z
Remove obsolete code
- - - - -
6b010672 by Philipp Hörist at 2019-08-17T20:20:43Z
Update MUC name on disco update
- Update name in Roster
- Update name in MessageWindow
- Update name in GroupchatControl
- - - - -
d800ca8e by Philipp Hörist at 2019-08-17T20:24:15Z
Discovery: Make callback default to None
If disco_muc is called without callback, user_data is None.
If user_data is None, nbxmpp does not pass it as argument to the callback
- - - - -
7 changed files:
- gajim/common/contacts.py
- gajim/common/events.py
- gajim/common/modules/discovery.py
- gajim/groupchat_control.py
- gajim/message_window.py
- gajim/roster_window.py
- test/no_gui/unit/test_contacts.py
Changes:
=====================================
gajim/common/contacts.py
=====================================
@@ -301,13 +301,6 @@ class LegacyContactsAPI:
self._metacontact_manager = MetacontactManager(self)
self._accounts = {}
- def change_account_name(self, old_name, new_name):
- self._accounts[new_name] = self._accounts[old_name]
- self._accounts[new_name].name = new_name
- del self._accounts[old_name]
-
- self._metacontact_manager.change_account_name(old_name, new_name)
-
def add_account(self, account_name):
self._accounts[account_name] = Account(account_name, Contacts(),
GC_Contacts())
@@ -779,10 +772,6 @@ class MetacontactManager():
self._metacontacts_tags = {}
self._contacts = contacts
- def change_account_name(self, old_name, new_name):
- self._metacontacts_tags[new_name] = self._metacontacts_tags[old_name]
- del self._metacontacts_tags[old_name]
-
def add_account(self, account):
if account not in self._metacontacts_tags:
self._metacontacts_tags[account] = {}
=====================================
gajim/common/events.py
=====================================
@@ -215,11 +215,6 @@ class Events:
for listener in self._event_removed_listeners:
listener(event_list)
- def change_account_name(self, old_name, new_name):
- if old_name in self._events:
- self._events[new_name] = self._events[old_name]
- del self._events[old_name]
-
def add_account(self, account):
self._events[account] = {}
=====================================
gajim/common/modules/discovery.py
=====================================
@@ -206,7 +206,7 @@ class Discovery(BaseModule):
callback=self._muc_info_received,
user_data=callback)
- def _muc_info_received(self, result, callback):
+ def _muc_info_received(self, result, callback=None):
self._log.info('MUC info received: %s', result.jid)
if not is_error_result(result):
app.logger.set_last_disco_info(result.jid, result)
=====================================
gajim/groupchat_control.py
=====================================
@@ -642,6 +642,7 @@ class GroupchatControl(ChatControlBase):
return
win = self.parent_win.window
self.update_actions()
+ self.draw_banner_text()
# After the room has been created, reevaluate threshold
if self.disco_info.has_mam:
=====================================
gajim/message_window.py
=====================================
@@ -33,6 +33,7 @@ from gi.repository import Gio
from gajim import common
from gajim.common import app
+from gajim.common import ged
from gajim.common.i18n import Q_
from gajim.common.i18n import _
@@ -153,6 +154,9 @@ class MessageWindow:
self.notebook.set_show_border(app.config.get('tabs_border'))
self.show_icon()
+ app.ged.register_event_handler('muc-disco-update', ged.GUI1,
+ self._on_muc_disco_update)
+
def _add_actions(self):
actions = [
('change-nickname', ['<Control><Shift>n']),
@@ -269,17 +273,6 @@ class MessageWindow:
self.notebook.set_current_page(number - 1)
return
- def change_account_name(self, old_name, new_name):
- if old_name in self._controls:
- self._controls[new_name] = self._controls[old_name]
- del self._controls[old_name]
-
- for ctrl in self.controls():
- if ctrl.account == old_name:
- ctrl.account = new_name
- if self.account == old_name:
- self.account = new_name
-
def change_jid(self, account, old_jid, new_jid):
"""
Called when the full jid of the control is changed
@@ -299,6 +292,16 @@ class MessageWindow:
def resize(self, width, height):
resize_window(self.window, width, height)
+ def _on_muc_disco_update(self, event):
+ # If there is only one control in a window,
+ # the name is shown in the window title
+ if self.get_num_controls() != 1:
+ return
+ ctrl = self.get_active_control()
+ if ctrl.contact.jid != event.room_jid:
+ return
+ self.show_title()
+
def _on_window_focus(self, widget, event):
# on destroy() the window that was last focused gets the focus
# again. if destroy() is called from the StartChat Dialog, this
@@ -500,7 +503,7 @@ class MessageWindow:
urgent = False
if control.type_id == message_control.TYPE_GC:
- name = control.room_jid.split('@')[0]
+ name = control.contact.get_shown_name()
urgent = (control.attention_flag or
app.config.notify_for_muc(control.room_jid))
else:
@@ -905,10 +908,6 @@ class MessageWindowMgr(GObject.GObject):
Gtk.Window.set_default_icon_list(get_app_icon_list(parent_window))
- def change_account_name(self, old_name, new_name):
- for win in self.windows():
- win.change_account_name(old_name, new_name)
-
def _new_window(self, acct, type_):
parent_win = None
parent_paned = None
=====================================
gajim/roster_window.py
=====================================
@@ -2635,6 +2635,9 @@ class RosterWindow:
def _nec_muc_subject_received(self, event):
self.draw_contact(event.room_jid, event.account)
+ def _on_muc_disco_update(self, event):
+ self.draw_contact(str(event.room_jid), event.account)
+
def _nec_metacontacts_received(self, obj):
self.redraw_metacontacts(obj.conn.name)
@@ -5679,3 +5682,5 @@ class RosterWindow:
self._style_changed)
app.ged.register_event_handler('chatstate-received', ged.GUI1,
self._nec_chatstate_received)
+ app.ged.register_event_handler('muc-disco-update', ged.GUI1,
+ self._on_muc_disco_update)
=====================================
test/no_gui/unit/test_contacts.py
=====================================
@@ -99,7 +99,6 @@ class TestContacts(unittest.TestCase):
self.contacts.add_account("one")
self.contacts.add_account("two")
- self.contacts.change_account_name("two", "old")
self.contacts.remove_account("one")
self.assertEqual(["old"], self.contacts.get_accounts())
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/1a5395cf6f71269af9c22436a67965e2f…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/1a5395cf6f71269af9c22436a67965e2f…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
73fbb582 by Philipp Hörist at 2019-08-17T18:42:42Z
Logger: Add max_age argument for get_last_disco_info()
- - - - -
1a5395cf by Philipp Hörist at 2019-08-17T18:42:42Z
MUC: Use cached disco info on join
- - - - -
2 changed files:
- gajim/common/logger.py
- gajim/common/modules/muc.py
Changes:
=====================================
gajim/common/logger.py
=====================================
@@ -1498,17 +1498,26 @@ class Logger:
log.info('Set message archive info: %s %s', jid, kwargs)
self._timeout_commit()
- def get_last_disco_info(self, jid):
+ def get_last_disco_info(self, jid, max_age=0):
"""
Get last disco info from jid
- :param jid: The jid
+ :param jid: The jid
+
+ :param max_age: max age in seconds of the DiscoInfo record
"""
- if jid in self._disco_info_cache:
- return self._disco_info_cache[jid]
+ max_timestamp = time.time() - max_age if max_age else 0
+
+ # Try the cache
+ disco_info = self._disco_info_cache.get(jid)
+ if disco_info is not None:
+ if max_timestamp > disco_info.timestamp:
+ return None
+ return disco_info
+ # Try the database
sql = '''SELECT disco_info as "disco_info [disco_info]", last_seen FROM
last_seen_disco_info
WHERE jid = ?'''
@@ -1516,6 +1525,9 @@ class Logger:
if row is None:
return None
+ if max_timestamp > row.last_seen:
+ return None
+
disco_info = row.disco_info._replace(timestamp=row.last_seen)
self._disco_info_cache[jid] = disco_info
return disco_info
=====================================
gajim/common/modules/muc.py
=====================================
@@ -141,9 +141,13 @@ class MUC(BaseModule):
self._muc_data[muc_data.jid] = muc_data
- self._con.get_module('Discovery').disco_muc(
- muc_data.jid,
- callback=self._on_disco_result)
+ disco_info = app.logger.get_last_disco_info(muc_data.jid, max_age=60)
+ if disco_info is None:
+ self._con.get_module('Discovery').disco_muc(
+ muc_data.jid,
+ callback=self._on_disco_result)
+ else:
+ self._join(muc_data)
def _on_disco_result(self, result):
if is_error_result(result):
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/0520546c9925ba106be0fc0e00c1629ce…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/0520546c9925ba106be0fc0e00c1629ce…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
0520546c by Daniel Brötzmann at 2019-08-17T13:41:21Z
Fix show_subject_on_join setting being ignored
- - - - -
1 changed file:
- gajim/groupchat_control.py
Changes:
=====================================
gajim/groupchat_control.py
=====================================
@@ -1388,7 +1388,7 @@ class GroupchatControl(ChatControlBase):
text = '%s - %s' % (text, date)
if (app.config.get('show_subject_on_join') or
- self._muc_data.state != MUCJoinedState.JOINED):
+ self._muc_data.state != MUCJoinedState.JOINING):
self.add_info_message(text)
@event_filter(['account', 'room_jid'])
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/0520546c9925ba106be0fc0e00c1629ce7…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/0520546c9925ba106be0fc0e00c1629ce7…
You're receiving this email because of your account on dev.gajim.org.