summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bookmark.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/bookmark.py b/src/bookmark.py
index fe926350..8b4fed27 100644
--- a/src/bookmark.py
+++ b/src/bookmark.py
@@ -1,11 +1,27 @@
+import os
+
from sleekxmpp.plugins.xep_0048 import *
+from core import JID
+from config import config
+
+preferred = config.get('use_bookmarks_method', 'pep').lower()
+if preferred not in ('pep', 'privatexml'):
+ preferred = 'pep'
+not_preferred = 'pep' if preferred is 'privatexml' else 'privatexml'
+methods = ('local', preferred, not_preferred)
+
class Bookmark(object):
- possible_methods = ('pep', 'privatexml', 'local')
+
+ possible_methods = methods
+
def __init__(self, jid, name=None, autojoin=False, nick=None, password=None, method=None):
self.jid = jid
self.name = name or jid
self.autojoin = autojoin
+ if not nick:
+ default = os.environ.get('USER') if os.environ.get('USER') else 'poezio'
+ nick = config.get('default_nick', '') or default
self.nick = nick
self.password = password
self._method = method
@@ -20,6 +36,9 @@ class Bookmark(object):
return
self._method = value
+ def __repr__(self):
+ return '<%s>' % self.jid
+
def stanza(self):
"""
Generate a <conference/> stanza from the instance