summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bookmark.py15
-rw-r--r--src/connection.py2
-rw-r--r--src/core.py4
3 files changed, 13 insertions, 8 deletions
diff --git a/src/bookmark.py b/src/bookmark.py
index b63ddbdf..9f633ba5 100644
--- a/src/bookmark.py
+++ b/src/bookmark.py
@@ -1,10 +1,13 @@
import os
+import logging
from sys import version_info
from sleekxmpp.plugins.xep_0048 import *
from core import JID
from config import config
+log = logging.getLogger(__name__)
+
def iter(xml, tag=''):
if version_info[1] >= 2:
return xml.iter(tag)
@@ -14,15 +17,14 @@ def iter(xml, tag=''):
preferred = config.get('use_bookmarks_method', 'pep').lower()
if preferred not in ('pep', 'privatexml'):
preferred = 'privatexml'
-not_preferred = 'privatexml' if preferred is 'pep' else 'privatexml'
+not_preferred = 'privatexml' if preferred == 'pep' else 'privatexml'
methods = ('local', preferred, not_preferred)
class Bookmark(object):
-
possible_methods = methods
- def __init__(self, jid, name=None, autojoin=False, nick=None, password=None, method=None):
+ def __init__(self, jid, name=None, autojoin=False, nick=None, password=None, method='privatexml'):
self.jid = jid
self.name = name or jid
self.autojoin = autojoin
@@ -40,6 +42,7 @@ class Bookmark(object):
@method.setter
def method(self, value):
if value not in self.possible_methods:
+ log.debug('Could not set bookmark storing method: %s', value)
return
self._method = value
@@ -131,6 +134,8 @@ def save_remote(xmpp, method="privatexml"):
else:
xmpp.plugin['xep_0048'].set_bookmarks(stanza_storage('pep'))
except:
+ import traceback
+ log.debug("Could not save the bookmarks:\n%s" % traceback.format_exc())
return False
return True
@@ -146,9 +151,9 @@ def save(xmpp, core=None):
preferred = config.get('use_bookmarks_method', 'privatexml')
if not save_remote(xmpp, method=preferred) and core:
core.information('Could not save bookmarks.', 'Error')
+ return False
elif core:
- core.information('Could not save bookmarks.', 'Error')
- return False
+ core.information('Bookmarks saved', 'Info')
return True
def get_pep(xmpp):
diff --git a/src/connection.py b/src/connection.py
index 6ffa1cf7..e4e2cfb2 100644
--- a/src/connection.py
+++ b/src/connection.py
@@ -53,8 +53,8 @@ class Connection(sleekxmpp.ClientXMPP):
self.register_plugin('xep_0030')
self.register_plugin('xep_0004')
self.register_plugin('xep_0045')
- self.register_plugin('xep_0048')
self.register_plugin('xep_0060')
+ self.register_plugin('xep_0048')
self.register_plugin('xep_0071')
self.register_plugin('xep_0085')
if config.get('send_poezio_info', 'true') == 'true':
diff --git a/src/core.py b/src/core.py
index 5c350b59..ccf8262c 100644
--- a/src/core.py
+++ b/src/core.py
@@ -1935,14 +1935,14 @@ class Core(object):
bookmark.remove(tab.get_name())
bookmark.save(self.xmpp)
if bookmark.save(self.xmpp):
- self.core.information('Bookmark deleted', 'Info')
+ self.information('Bookmark deleted', 'Info')
else:
self.information('No bookmark to remove', 'Info')
else:
if bookmark.get_by_jid(args[0]):
bookmark.remove(args[0])
if bookmark.save(self.xmpp):
- self.core.information('Bookmark deleted', 'Info')
+ self.information('Bookmark deleted', 'Info')
else:
self.information('No bookmark to remove', 'Info')