From 2583b6a934fb9b9f4cbe3e669787101b991cd1d5 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sat, 21 Feb 2015 22:04:03 +0100 Subject: Add a force_remote_bookmarks option --- src/bookmarks.py | 21 +++++++++++++++++---- src/config.py | 1 + 2 files changed, 18 insertions(+), 4 deletions(-) (limited to 'src') 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, -- cgit v1.2.3