xs:boolean is '0', '1', 'true', 'false'. so update bookmark to handle the last two
This commit is contained in:
parent
c5a389f687
commit
bd0a5230d9
|
@ -1117,9 +1117,12 @@ class Connection:
|
|||
confs = storage.getTags('conference')
|
||||
urls = storage.getTags('url')
|
||||
for conf in confs:
|
||||
autojoin_val = conf.getAttr('autojoin')
|
||||
if autojoin_val is None: # not there (it's optional)
|
||||
autojoin_val == False
|
||||
bm = { 'name': conf.getAttr('name'),
|
||||
'jid': conf.getAttr('jid'),
|
||||
'autojoin': conf.getAttr('autojoin'),
|
||||
'autojoin': autojoin_val,
|
||||
'password': conf.getTagData('password'),
|
||||
'nick': conf.getTagData('nick') }
|
||||
|
||||
|
|
|
@ -274,3 +274,14 @@ def get_file_path_from_dnd_dropped_uri(uri):
|
|||
elif path.startswith('file:'): # xffm
|
||||
path = path[5:] # 5 is len('file:')
|
||||
return path
|
||||
|
||||
def from_xs_boolean_to_python_boolean(value):
|
||||
# this is xs:boolean so 'true','false','1','0'
|
||||
# convert those to True/False (python booleans)
|
||||
if val in ('1', 'true'):
|
||||
val = True
|
||||
else: # '0', 'false' or anything else
|
||||
val = False
|
||||
|
||||
return val
|
||||
|
||||
|
|
|
@ -2505,8 +2505,9 @@ class ManageBookmarksWindow:
|
|||
name = bookmark['jid'].split("@")[0]
|
||||
bookmark['name'] = name
|
||||
|
||||
#Convert '1'/'0' to True/False
|
||||
autojoin = bool(int(bookmark['autojoin']))
|
||||
# make '1', '0', 'true', 'false' (or other) to True/False
|
||||
autojoin = helpers.from_xs_boolean_to_python_boolean(
|
||||
bookmark['autojoin'])
|
||||
|
||||
self.treestore.append( iter, [
|
||||
account,
|
||||
|
|
|
@ -689,7 +689,7 @@ class Interface:
|
|||
# We received a bookmark item from the server (JEP48)
|
||||
# Auto join GC windows if neccessary
|
||||
for bm in bms:
|
||||
if bm['autojoin'] == '1':
|
||||
if bm['autojoin'] in ('1', 'true'):
|
||||
self.roster.join_gc_room(account, bm['jid'], bm['nick'],
|
||||
bm['password'])
|
||||
self.roster.make_menu()
|
||||
|
|
Loading…
Reference in New Issue