From 57e4c75a8304cf498e123224e0a1b0648bc30227 Mon Sep 17 00:00:00 2001 From: Jean-Marie Traissard Date: Sun, 5 Nov 2006 22:09:19 +0000 Subject: [PATCH] [junglecow] Bookmarked groupchat rooms to follow global print_status_in_muc setting if print_status unspecified by user. Fixes #2641. --- src/common/connection.py | 6 +++--- src/config.py | 9 ++++----- src/groupchat_control.py | 7 +++---- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/common/connection.py b/src/common/connection.py index 2a556e674..251d49139 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -926,11 +926,11 @@ class Connection(ConnectionHandlers): # Only add optional elements if not empty # Note: need to handle both None and '' as empty # thus shouldn't use "is not None" - if bm['nick']: + if bm.get('nick', None): iq5 = iq4.setTagData('nick', bm['nick']) - if bm['password']: + if bm.get('password', None): iq5 = iq4.setTagData('password', bm['password']) - if bm['print_status']: + if bm.get('print_status', None): iq5 = iq4.setTagData('print_status', bm['print_status']) self.connection.send(iq) diff --git a/src/config.py b/src/config.py index aa5314cbb..a73fe151d 100644 --- a/src/config.py +++ b/src/config.py @@ -2564,10 +2564,9 @@ class ManageBookmarksWindow: autojoin = helpers.from_xs_boolean_to_python_boolean( bookmark['autojoin']) - if bookmark.has_key('print_status'): - print_status = bookmark['print_status'] - if not print_status: - print_status = gajim.config.get('print_status_in_muc') + print_status = bookmark.get('print_status', '') + if print_status not in ('', 'all', 'in_and_out', 'none'): + print_status = '' self.treestore.append( iter, [ account, bookmark['name'], @@ -2580,7 +2579,7 @@ class ManageBookmarksWindow: self.print_status_combobox = self.xml.get_widget('print_status_combobox') model = gtk.ListStore(str, str) - self.option_list = {'all': _('All'), + self.option_list = {'': _('Default'), 'all': _('All'), 'in_and_out': _('Enter and leave only'), 'none': _('None')} opts = self.option_list.keys() opts.sort() diff --git a/src/groupchat_control.py b/src/groupchat_control.py index 3192f0e2a..5ded9f69f 100644 --- a/src/groupchat_control.py +++ b/src/groupchat_control.py @@ -874,9 +874,9 @@ class GroupchatControl(ChatControlBase): print_status = None for bookmark in gajim.connections[self.account].bookmarks: if bookmark['jid'] == self.room_jid: - print_status = bookmark['print_status'] + print_status = bookmark.get('print_status', None) break - if print_status is None: + if not print_status: print_status = gajim.config.get('print_status_in_muc') nick_jid = nick if jid: @@ -1374,8 +1374,7 @@ class GroupchatControl(ChatControlBase): 'jid': self.room_jid, 'autojoin': '0', 'password': '', - 'nick': self.nick, - 'print_status' : gajim.config.get('print_status_in_muc') + 'nick': self.nick } for bookmark in gajim.connections[self.account].bookmarks: