From 2e9de7702f913cddf0571e1a2ed0094b49ceb425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Sun, 15 Oct 2017 01:56:52 +0200 Subject: [PATCH] Remove discovery of generic pubsub support We use PubSub only on our account jid, this use case is what PEP was made for. If PEP is discovered we know that certain PubSub features are supported, see: https://xmpp.org/extensions/xep-0163.html#defaults The current check for is pretty useless, as it just tells us that there is a PubSub implementation but not much about the features. Only `publish` and `subscribe` are MUST in XEP-0060 which is not enough for our needs. If there is ever need to discover a generic PubSub implementation that is not PEP we should check for all the PubSub features we need instead of only for --- gajim/common/connection.py | 9 ++------- gajim/groupchat_control.py | 4 ++-- gajim/server_info.py | 3 +-- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/gajim/common/connection.py b/gajim/common/connection.py index f21e4af79..0c12f5048 100644 --- a/gajim/common/connection.py +++ b/gajim/common/connection.py @@ -670,7 +670,6 @@ class Connection(CommonConnection, ConnectionHandlers): self.music_track_info = 0 self.location_info = {} - self.pubsub_supported = False self.register_supported = False self.pubsub_publish_options_supported = False # Do we auto accept insecure connection @@ -1933,8 +1932,6 @@ class Connection(CommonConnection, ConnectionHandlers): get_action(self.name + '-profile').set_enabled(True) if nbxmpp.NS_REGISTER in obj.features: self.register_supported = True - if nbxmpp.NS_PUBSUB in obj.features: - self.pubsub_supported = True if nbxmpp.NS_BLOCKING in obj.features: self.blocking_supported = True if nbxmpp.NS_ADDRESS in obj.features: @@ -2363,8 +2360,7 @@ class Connection(CommonConnection, ConnectionHandlers): return if storage_type != 'xml': - pubsub = self.pubsub_supported or self.pep_supported - if pubsub and self.pubsub_publish_options_supported: + if self.pep_supported and self.pubsub_publish_options_supported: self.send_pb_retrieve('', 'storage:bookmarks') app.log('bookmarks').info('Request Bookmarks (PubSub)') # some server (ejabberd) are so slow to answer that we @@ -2422,8 +2418,7 @@ class Connection(CommonConnection, ConnectionHandlers): storage_node = self.get_bookmarks_storage_node() if storage_type != 'xml': - pubsub = self.pubsub_supported or self.pep_supported - if pubsub and self.pubsub_publish_options_supported: + if self.pep_supported and self.pubsub_publish_options_supported: self.send_pb_publish( '', 'storage:bookmarks', storage_node, 'current', options=self.get_bookmark_publish_options()) diff --git a/gajim/groupchat_control.py b/gajim/groupchat_control.py index bd5c9402e..19f8d4350 100644 --- a/gajim/groupchat_control.py +++ b/gajim/groupchat_control.py @@ -354,7 +354,7 @@ class GroupchatControl(ChatControlBase): img.set_from_icon_name('bookmark-new', Gtk.IconSize.MENU) widget.set_sensitive( app.connections[self.account].private_storage_supported or \ - (app.connections[self.account].pubsub_supported and \ + (app.connections[self.account].pep_supported and \ app.connections[self.account].pubsub_publish_options_supported)) widget.show() @@ -971,7 +971,7 @@ class GroupchatControl(ChatControlBase): notify_menuitem.set_active(app.config.get_per('rooms', self.contact.jid, 'notify_on_all_messages')) conn = app.connections[self.account] - if not conn.private_storage_supported and (not conn.pubsub_supported or \ + if not conn.private_storage_supported and (not conn.pep_supported or \ not conn.pubsub_publish_options_supported): bookmark_room_menuitem.set_sensitive(False) if app.gc_connected[self.account][self.room_jid]: diff --git a/gajim/server_info.py b/gajim/server_info.py index 1289fbea8..0addfea5d 100644 --- a/gajim/server_info.py +++ b/gajim/server_info.py @@ -118,9 +118,8 @@ class ServerInfoDialog(Gtk.Dialog): Feature('XEP-0016: Privacy Lists', con.privacy_rules_supported, None), Feature('XEP-0045: Multi-User Chat', con.muc_jid, None), Feature('XEP-0054: vcard-temp', con.vcard_supported, None), - Feature('XEP-0060: PubSub', con.pubsub_supported, None), - Feature('XEP-0060: Publish Options', con.pubsub_publish_options_supported, None), Feature('XEP-0163: Personal Eventing Protocol', con.pep_supported, None), + Feature('XEP-0163: #publish-options', con.pubsub_publish_options_supported, None), Feature('XEP-0191: Blocking Command', con.blocking_supported, nbxmpp.NS_BLOCKING), Feature('XEP-0198: Stream Management', con.sm.enabled, nbxmpp.NS_STREAM_MGMT), Feature('XEP-0280: Message Carbons', con.carbons_enabled, nbxmpp.NS_CARBONS),