Skip to content
Snippets Groups Projects
Commit 4d8454a2 authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

request bookmarks via XML if server announce it supports pubsub but doesn't...

request bookmarks via XML if server announce it supports pubsub but doesn't answer in the next 30 seconds. Fixes #5198
parent c5b63d94
No related branches found
No related tags found
No related merge requests found
......@@ -1603,6 +1603,16 @@ class Connection(ConnectionHandlers):
iq2.addChild(name='gajim', namespace='gajim:prefs')
self.connection.send(iq)
def _request_bookmarks_xml(self):
iq = common.xmpp.Iq(typ='get')
iq2 = iq.addChild(name='query', namespace=common.xmpp.NS_PRIVATE)
iq2.addChild(name='storage', namespace='storage:bookmarks')
self.connection.send(iq)
def _check_bookmarks_received(self):
if not self.bookmarks:
self._request_bookmarks_xml()
def get_bookmarks(self, storage_type=None):
'''Get Bookmarks from storage or PubSub if supported as described in
XEP 0048
......@@ -1611,11 +1621,11 @@ class Connection(ConnectionHandlers):
return
if self.pubsub_supported and storage_type != 'xml':
self.send_pb_retrieve('', 'storage:bookmarks')
# some server (ejabberd) are so slow to answer that we request via XML
# if we don't get answer in the next 30 seconds
gajim.idlequeue.set_alarm(self._check_bookmarks_received, 30)
else:
iq = common.xmpp.Iq(typ='get')
iq2 = iq.addChild(name='query', namespace=common.xmpp.NS_PRIVATE)
iq2.addChild(name='storage', namespace='storage:bookmarks')
self.connection.send(iq)
self._request_bookmarks_xml()
def store_bookmarks(self, storage_type=None):
''' Send bookmarks to the storage namespace or PubSub if supported
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment