print_status_in_muc is not a string which can be 'all', 'none' or 'in_and_out'(default one). version is 0.10.0.1 to update this variable.

show_status becomes print_status in server (show_status is still read for transition)
This commit is contained in:
Yann Leboulanger 2006-05-10 16:25:57 +00:00
parent d008b51b64
commit d7d0e25d25
6 changed files with 39 additions and 33 deletions

View File

@ -134,7 +134,7 @@ class Config:
'send_on_ctrl_enter': [opt_bool, False, _('Send message on Ctrl+Enter and with Enter make new line (Mirabilis ICQ Client default behaviour).')],
'show_roster_on_startup': [opt_bool, True],
'key_up_lines': [opt_int, 25, _('How many lines to store for Ctrl+KeyUP.')],
'version': [ opt_str, '0.10' ], # which version created the config
'version': [ opt_str, '0.10.0.1' ], # which version created the config
'search_engine': [opt_str, 'http://www.google.com/search?&q=%s&sourceid=gajim'],
'dictionary_url': [opt_str, 'WIKTIONARY', _("Either custom url with %s in it where %s is the word/phrase or 'WIKTIONARY' which means use wiktionary.")],
'always_english_wikipedia': [opt_bool, False],
@ -181,7 +181,7 @@ class Config:
'show_avatars_in_roster': [opt_bool, True, '', True],
'ask_avatars_on_startup': [opt_bool, True, _('If True, Gajim will ask for avatar each contact that did not have an avatar last time or has one cached that is too old.')],
'print_status_in_chats': [opt_bool, True, _('If False, Gajim will no longer print status line in chats when a contact changes his or her status and/or his or her status message.')],
'print_status_in_muc': [opt_bool, True, _('If False, Gajim will no longer print status line in groupchats when a member changes his or her status and/or his or her status message.')],
'print_status_in_muc': [opt_str, 'in_and_out', _('can be "none", "all" or "in_and_out". If "none", Gajim will no longer print status line in groupchats when a member changes his or her status and/or his or her status message. If "all" Gajim will print all status messages. If "in_and_out", gajim will only print FOO enters/leaves room')],
'log_contact_status_changes': [opt_bool, False],
'restored_messages_color': [opt_str, 'grey'],
'hide_avatar_of_transport': [opt_bool, False, _('Don\'t show avatar for the transport itself.')],

View File

@ -838,8 +838,8 @@ class Connection(ConnectionHandlers):
iq5 = iq4.setTagData('nick', bm['nick'])
if bm['password']:
iq5 = iq4.setTagData('password', bm['password'])
if bm['show_status']:
iq5 = iq4.setTagData('show_status', bm['show_status'])
if bm['print_status']:
iq5 = iq4.setTagData('print_status', bm['print_status'])
self.connection.send(iq)
def get_metacontacts(self):

View File

@ -1100,12 +1100,15 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco)
autojoin_val = conf.getAttr('autojoin')
if autojoin_val is None: # not there (it's optional)
autojoin_val = False
print_status = conf.getTagData('print_status')
if not print_status:
print_status = conf.getTagData('show_status')
bm = {'name': conf.getAttr('name'),
'jid': conf.getAttr('jid'),
'autojoin': autojoin_val,
'password': conf.getTagData('password'),
'nick': conf.getTagData('nick'),
'show_status': conf.getTagData('show_status')}
'print_status': print_status}
self.bookmarks.append(bm)
self.dispatch('BOOKMARKS', self.bookmarks)

View File

@ -142,6 +142,8 @@ class OptionsParser:
self.update_config_x_to_09()
if old < [0, 10] and new >= [0, 10]:
self.update_config_09_to_010()
if old < [0, 10, 0, 1] and new >= [0, 10, 0, 1]:
self.update_config_to_01001()
def update_config_x_to_09(self):
# Var name that changed:
@ -255,3 +257,7 @@ class OptionsParser:
self.assert_unread_msgs_table_exists()
gajim.config.set('version', '0.10')
def update_config_to_01001(self):
gajim.config.set('print_status_in_muc', 'in_and_out')
gajim.config.set('version', '0.10.0.1')

View File

@ -1,4 +1,4 @@
## config.py
#i# config.py
##
## Copyright (C) 2003-2006 Yann Le Boulanger <asterix@lagaule.org>
## Copyright (C) 2005-2006 Nikos Kouremenos <nkour@jabber.org>
@ -2248,6 +2248,9 @@ class ManageBookmarksWindow:
autojoin = helpers.from_xs_boolean_to_python_boolean(
bookmark['autojoin'])
print_status = bookmark['print_status']
if not print_status:
print_status = gajim.config.get('print_status_in_muc')
self.treestore.append( iter, [
account,
bookmark['name'],
@ -2255,20 +2258,20 @@ class ManageBookmarksWindow:
autojoin,
bookmark['password'],
bookmark['nick'],
bookmark['show_status'] ])
print_status ])
self.show_status_combobox = self.xml.get_widget('show_status_combobox')
self.print_status_combobox = self.xml.get_widget('print_status_combobox')
model = gtk.ListStore(str, str)
self.option_list = {'': '', 'all': _('All'),
self.option_list = {'all': _('All'),
'in_and_out': _('Enter and leave only'), 'none': _('None')}
opts = self.option_list.keys()
opts.sort()
for opt in opts:
model.append([self.option_list[opt], opt])
self.show_status_combobox.set_model(model)
self.show_status_combobox.set_active(0)
self.print_status_combobox.set_model(model)
self.print_status_combobox.set_active(1)
self.view = self.xml.get_widget('bookmarks_treeview')
self.view.set_model(self.treestore)
@ -2332,7 +2335,7 @@ class ManageBookmarksWindow:
account = model[add_to][1].decode('utf-8')
nick = gajim.nicks[account]
self.treestore.append(add_to, [account, _('New Room'), '', False, '',
nick, 'all'])
nick, 'in_and_out'])
self.view.expand_row(model.get_path(add_to), True)
@ -2389,7 +2392,7 @@ _('Please be sure to fill out server and room fields or remove this bookmark.'))
#create the bookmark-dict
bmdict = { 'name': bm[1], 'jid': bm[2], 'autojoin': autojoin,
'password': bm[4], 'nick': bm[5], 'show_status': bm[6]}
'password': bm[4], 'nick': bm[5], 'print_status': bm[6]}
gajim.connections[account_unicode].bookmarks.append(bmdict)
@ -2413,7 +2416,7 @@ _('Please be sure to fill out server and room fields or remove this bookmark.'))
widgets = [ self.title_entry, self.nick_entry, self.room_entry,
self.server_entry, self.pass_entry, self.autojoin_checkbutton,
self.show_status_combobox]
self.print_status_combobox]
if model.iter_parent(iter):
# make the fields sensitive
@ -2456,13 +2459,10 @@ _('Please be sure to fill out server and room fields or remove this bookmark.'))
else:
self.nick_entry.set_text('')
show_status = model[iter][6]
print_status = model[iter][6]
opts = self.option_list.keys()
opts.sort()
if show_status:
self.show_status_combobox.set_active(opts.index(show_status))
else:
self.show_status_combobox.set_active(0)
self.print_status_combobox.set_active(opts.index(print_status))
def on_title_entry_changed(self, widget):
(model, iter) = self.selection.get_selected()
@ -2500,13 +2500,13 @@ _('Please be sure to fill out server and room fields or remove this bookmark.'))
if iter:
model[iter][3] = self.autojoin_checkbutton.get_active()
def on_show_status_combobox_changed(self, widget):
def on_print_status_combobox_changed(self, widget):
active = widget.get_active()
model = widget.get_model()
show_status = model[active][1]
print_status = model[active][1]
(model2, iter) = self.selection.get_selected()
if iter:
model2[iter][6] = show_status
model2[iter][6] = print_status
def clear_fields(self):
widgets = [ self.title_entry, self.nick_entry, self.room_entry,
@ -2514,7 +2514,7 @@ _('Please be sure to fill out server and room fields or remove this bookmark.'))
for field in widgets:
field.set_text('')
self.autojoin_checkbutton.set_active(False)
self.show_status_combobox.set_active(0)
self.print_status_combobox.set_active(1)
class AccountCreationWizardWindow:
def __init__(self):

View File

@ -845,22 +845,19 @@ class GroupchatControl(ChatControlBase):
if bookmark['jid'] == self.room_jid:
found = True
break
show_status = None
print_status = None
if found:
show_status = bookmark['show_status']
if not show_status:
if gajim.config.get('print_status_in_muc'):
show_status = 'all'
else:
show_status = 'none'
if show == 'offline' and show_status in ('all', 'in_and_out'):
print_status = bookmark['print_status']
else:
print_status = gajim.config.get('print_status_in_muc')
if show == 'offline' and print_status in ('all', 'in_and_out'):
st = _('%s has left') % nick
if reason:
st += ' [%s]' % reason
else:
if newly_created and show_status in ('all', 'in_and_out'):
if newly_created and print_status in ('all', 'in_and_out'):
st = _('%s has joined the room') % nick
elif show_status == 'all':
elif print_status == 'all':
st = _('%s is now %s') % (nick, helpers.get_uf_show(show))
if st:
if status: