summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2015-02-21 22:04:03 +0100
committermathieui <mathieui@mathieui.net>2015-02-21 22:04:03 +0100
commit2583b6a934fb9b9f4cbe3e669787101b991cd1d5 (patch)
tree4f718f169289da9cd64674c91da26b49a872a24f
parent60231c27c7f2d7c7258d2144fd3dae99bf846047 (diff)
downloadpoezio-2583b6a934fb9b9f4cbe3e669787101b991cd1d5.tar.gz
poezio-2583b6a934fb9b9f4cbe3e669787101b991cd1d5.tar.bz2
poezio-2583b6a934fb9b9f4cbe3e669787101b991cd1d5.tar.xz
poezio-2583b6a934fb9b9f4cbe3e669787101b991cd1d5.zip
Add a force_remote_bookmarks option
-rw-r--r--data/default_config.cfg4
-rw-r--r--doc/source/configuration.rst8
-rw-r--r--src/bookmarks.py21
-rw-r--r--src/config.py1
4 files changed, 30 insertions, 4 deletions
diff --git a/data/default_config.cfg b/data/default_config.cfg
index 66c4d8ce..27498871 100644
--- a/data/default_config.cfg
+++ b/data/default_config.cfg
@@ -127,6 +127,10 @@ use_bookmarks_method =
# possible values are: anything/false
use_remote_bookmarks = true
+# Force the retrieval of the remote bookmarks even when the server
+# doesn't advertise support for your method
+force_remote_bookmarks = false
+
# Whether you want all bookmarks, even those without
# autojoin, to be open on startup
open_all_bookmarks = false
diff --git a/doc/source/configuration.rst b/doc/source/configuration.rst
index 7a9a28fa..8d39a7de 100644
--- a/doc/source/configuration.rst
+++ b/doc/source/configuration.rst
@@ -348,6 +348,14 @@ to understand what is :ref:`carbons <carbons-details>` or
sender intended it as such. See :ref:`Message Correction <correct-feature>` for
more information.
+
+ force_remote_bookmarks
+
+ **Default value:** ``false``
+
+ Try to retrieve your remote bookmarks, even when your server doesn’t advertise
+ support.
+
use_bookmark_method
**Default value:** ``[empty]``
diff --git a/src/bookmarks.py b/src/bookmarks.py
index 47c40576..9a875217 100644
--- a/src/bookmarks.py
+++ b/src/bookmarks.py
@@ -243,13 +243,26 @@ class BookmarkList(object):
def get_remote(self, xmpp, information, callback):
"""Add the remotely stored bookmarks to the list."""
- if xmpp.anon or not any(self.available_storage.values()):
+ force = config.get('force_remote_bookmarks')
+ if xmpp.anon or not (any(self.available_storage.values()) or force):
information(_('No remote bookmark storage available'), 'Warning')
return
- if self.preferred == 'privatexml':
- self.get_privatexml(xmpp, callback=callback)
- else:
+
+ if force and not any(self.available_storage.values()):
+ old_callback = callback
+ method = 'pep' if self.preferred == 'pep' else 'privatexml'
+ def new_callback(result):
+ if result['type'] != 'error':
+ self.available_storage[method] = True
+ old_callback(result)
+ else:
+ information(_('No remote bookmark storage available'), 'Warning')
+ callback = new_callback
+
+ if self.preferred == 'pep':
self.get_pep(xmpp, callback=callback)
+ else:
+ self.get_privatexml(xmpp, callback=callback)
def get_local(self):
"""Add the locally stored bookmarks to the list."""
diff --git a/src/config.py b/src/config.py
index 2980e50b..ef5168e1 100644
--- a/src/config.py
+++ b/src/config.py
@@ -62,6 +62,7 @@ DEFAULT_CONFIG = {
'extract_inline_images': True,
'filter_info_messages': '',
'force_encryption': True,
+ 'force_remote_bookmarks': False,
'go_to_previous_tab_on_alt_number': False,
'group_corrections': True,
'hide_exit_join': -1,