From 4ab308d855742133105cf4ca0414e54e636c2990 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Mon, 21 Jun 2010 19:15:08 +0200 Subject: [PATCH] stop saving bookmarks in pubsub if server doesn't support #publish-options. see #5787 --- src/common/connection.py | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/common/connection.py b/src/common/connection.py index bb38832bf..74a5959c4 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -1899,21 +1899,19 @@ class Connection(CommonConnection, ConnectionHandlers): if bm.get('print_status', None): iq2.setTagData('print_status', bm['print_status']) - if self.pubsub_supported and storage_type != 'xml': - if self.pubsub_publish_options_supported: - options = common.xmpp.Node(common.xmpp.NS_DATA + ' x', - attrs={'type': 'submit'}) - f = options.addChild('field', attrs={'var': 'FORM_TYPE', - 'type': 'hidden'}) - f.setTagData('value', common.xmpp.NS_PUBSUB_PUBLISH_OPTIONS) - f = options.addChild('field', attrs={'var': 'pubsub#persist_items'}) - f.setTagData('value', 'true') - f = options.addChild('field', attrs={'var': 'pubsub#access_model'}) - f.setTagData('value', 'whitelist') - else: - options = None + if self.pubsub_supported and self.pubsub_publish_options_supported and \ + storage_type != 'xml': + options = common.xmpp.Node(common.xmpp.NS_DATA + ' x', + attrs={'type': 'submit'}) + f = options.addChild('field', attrs={'var': 'FORM_TYPE', + 'type': 'hidden'}) + f.setTagData('value', common.xmpp.NS_PUBSUB_PUBLISH_OPTIONS) + f = options.addChild('field', attrs={'var': 'pubsub#persist_items'}) + f.setTagData('value', 'true') + f = options.addChild('field', attrs={'var': 'pubsub#access_model'}) + f.setTagData('value', 'whitelist') self.send_pb_publish('', 'storage:bookmarks', iq, 'current', - options=options) + options=options) if storage_type != 'pubsub': iqA = common.xmpp.Iq(typ='set') iqB = iqA.addChild(name='query', namespace=common.xmpp.NS_PRIVATE)