diff --git a/src/chat_control.py b/src/chat_control.py index 274d5b72d..5de4dcc34 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -1049,13 +1049,16 @@ class ChatControl(ChatControlBase): status_escaped = gtkgui_helpers.escape_for_pango_markup(status) font_attrs, font_attrs_small = self.get_font_attrs() - st = gajim.config.get('chat_state_notifications') + st = gajim.config.get('displayed_chat_state_notifications') cs = contact.chatstate if cs and st in ('composing_only', 'all'): if contact.show == 'offline': chatstate = '' elif contact.composing_jep == 'JEP-0085': - chatstate = helpers.get_uf_chatstate(cs) + if st == 'all' or cs == 'composing': + chatstate = helpers.get_uf_chatstate(cs) + else: + chatstate = '' elif contact.composing_jep == 'JEP-0022': if cs in ('composing', 'paused'): # only print composing, paused @@ -1128,7 +1131,8 @@ class ChatControl(ChatControlBase): encrypted = True - chatstates_on = gajim.config.get('chat_state_notifications') != 'disabled' + chatstates_on = gajim.config.get('outgoing_chat_state_notifications') != \ + 'disabled' chatstate_to_send = None if chatstates_on and contact is not None: if contact.composing_jep is None: @@ -1424,7 +1428,7 @@ class ChatControl(ChatControlBase): # do not send nothing if we have chat state notifications disabled # that means we won't reply to the from other peer # so we do not broadcast jep85 capabalities - chatstate_setting = gajim.config.get('chat_state_notifications') + chatstate_setting = gajim.config.get('outgoing_chat_state_notifications') if chatstate_setting == 'disabled': return elif chatstate_setting == 'composing_only' and state != 'active' and\ diff --git a/src/common/config.py b/src/common/config.py index 7f05f5264..412024df5 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -152,7 +152,8 @@ class Config: 'always_english_wiktionary': [opt_bool, True], 'remote_control': [opt_bool, True, _('If checked, Gajim can be controlled remotely using gajim-remote.'), True], 'networkmanager_support': [opt_bool, True, _('If True, listen to D-Bus signals from NetworkManager and change the status of accounts (provided they do not have listen_to_network_manager set to False and they sync with global status) based upon the status of the network connection.'), True], - 'chat_state_notifications': [opt_str, 'all'], # 'all', 'composing_only', 'disabled' + 'outgoing_chat_state_notifications': [opt_str, 'all', _('Sent chat state notifications. Can be one of all, composing_only, disabled.')], + 'displayed_chat_state_notifications': [opt_str, 'all', _('Displayed chat state notifications in chat windows. Can be one of all, composing_only, disabled.')], 'autodetect_browser_mailer': [opt_bool, False, '', True], 'print_ichat_every_foo_minutes': [opt_int, 5, _('When not printing time for every message (print_time==sometimes), print it every x minutes.')], 'confirm_close_muc': [opt_bool, True, _('Ask before closing a group chat tab/window.')], diff --git a/src/common/defs.py b/src/common/defs.py index 82d11b301..fab2b1836 100644 --- a/src/common/defs.py +++ b/src/common/defs.py @@ -2,7 +2,7 @@ docdir = '../' datadir = '../' -version = '0.10.1.7' +version = '0.10.1.8' import sys, os.path for base in ('.', 'common'): diff --git a/src/common/optparser.py b/src/common/optparser.py index c64446f90..53146de05 100644 --- a/src/common/optparser.py +++ b/src/common/optparser.py @@ -153,6 +153,8 @@ class OptionsParser: self.update_config_to_01016() if old < [0, 10, 1, 7] and new >= [0, 10, 1, 7]: self.update_config_to_01017() + if old < [0, 10, 1, 8] and new >= [0, 10, 1, 8]: + self.update_config_to_01018() gajim.logger.init_vars() gajim.config.set('version', new_version) @@ -345,5 +347,12 @@ class OptionsParser: trayicon_notification_on_events ''' if self.old_values.has_key('trayicon_notification_on_new_messages'): gajim.config.set('trayicon_notification_on_events', - self.old_values['trayicon_notification_on_new_messages']) + self.old_values['trayicon_notification_on_new_messages']) gajim.config.set('version', '0.10.1.7') + + def update_config_to_01018(self): + '''chat_state_notifications -> outgoing_chat_state_notifications''' + if self.old_values.has_key('chat_state_notifications'): + gajim.config.set('outgoing_chat_state_notifications', + self.old_values['chat_state_notifications']) + gajim.config.set('version', '0.10.1.8') diff --git a/src/config.py b/src/config.py index 557efbed9..67ef76e6d 100644 --- a/src/config.py +++ b/src/config.py @@ -224,47 +224,47 @@ class PreferencesWindow: else: self.xml.get_widget('time_always_radiobutton').set_active(True) - #before time + # before time st = gajim.config.get('before_time') st = helpers.from_one_line(st) self.xml.get_widget('before_time_textview').get_buffer().set_text(st) - #after time + # after time st = gajim.config.get('after_time') st = helpers.from_one_line(st) self.xml.get_widget('after_time_textview').get_buffer().set_text(st) - #before nickname + # before nickname st = gajim.config.get('before_nickname') st = helpers.from_one_line(st) self.xml.get_widget('before_nickname_textview').get_buffer().set_text(st) - #after nickanme + # after nickanme st = gajim.config.get('after_nickname') st = helpers.from_one_line(st) self.xml.get_widget('after_nickname_textview').get_buffer().set_text(st) - #Color for incomming messages + # Color for incomming messages colSt = gajim.config.get('inmsgcolor') self.xml.get_widget('incoming_msg_colorbutton').set_color( gtk.gdk.color_parse(colSt)) - #Color for outgoing messages + # Color for outgoing messages colSt = gajim.config.get('outmsgcolor') self.xml.get_widget('outgoing_msg_colorbutton').set_color( gtk.gdk.color_parse(colSt)) - #Color for status messages + # Color for status messages colSt = gajim.config.get('statusmsgcolor') self.xml.get_widget('status_msg_colorbutton').set_color( gtk.gdk.color_parse(colSt)) - #Color for hyperlinks + # Color for hyperlinks colSt = gajim.config.get('urlmsgcolor') self.xml.get_widget('url_msg_colorbutton').set_color( gtk.gdk.color_parse(colSt)) - #Font for messages + # Font for messages font = gajim.config.get('conversation_font') # try to set default font for the current desktop env fontbutton = self.xml.get_widget('conversation_fontbutton') @@ -286,25 +286,25 @@ class PreferencesWindow: if only_in_roster: self.xml.get_widget('only_in_roster_radiobutton').set_active(True) - #notify on online statuses + # notify on online statuses st = gajim.config.get('notify_on_signin') self.notify_on_signin_checkbutton.set_active(st) - #notify on offline statuses + # notify on offline statuses st = gajim.config.get('notify_on_signout') self.notify_on_signout_checkbutton.set_active(st) - #autopopupaway + # autopopupaway st = gajim.config.get('autopopupaway') self.auto_popup_away_checkbutton.set_active(st) - #Ignore messages from unknown contacts + # Ignore messages from unknown contacts self.xml.get_widget('ignore_events_from_unknown_contacts_checkbutton').\ set_active(gajim.config.get('ignore_unknown_contacts')) - # send chat state notifications - st = gajim.config.get('chat_state_notifications') - combo = self.xml.get_widget('chat_states_combobox') + # outgoing send chat state notifications + st = gajim.config.get('outgoing_chat_state_notifications') + combo = self.xml.get_widget('outgoing_chat_states_combobox') if st == 'all': combo.set_active(0) elif st == 'composing_only': @@ -312,7 +312,17 @@ class PreferencesWindow: else: # disabled combo.set_active(2) - #sounds + # displayed send chat state notifications + st = gajim.config.get('displayed_chat_state_notifications') + combo = self.xml.get_widget('displayed_chat_states_combobox') + if st == 'all': + combo.set_active(0) + elif st == 'composing_only': + combo.set_active(1) + else: # disabled + combo.set_active(2) + + # sounds if os.name == 'nt': # if windows, player must not become visible on show_all soundplayer_hbox = self.xml.get_widget('soundplayer_hbox') @@ -822,15 +832,24 @@ class PreferencesWindow: def on_ignore_events_from_unknown_contacts_checkbutton_toggled(self, widget): self.on_checkbutton_toggled(widget, 'ignore_unknown_contacts') - def on_chat_states_combobox_changed(self, widget): + def on_outgoing_chat_states_combobox_changed(self, widget): active = widget.get_active() if active == 0: # all - gajim.config.set('chat_state_notifications', 'all') + gajim.config.set('outgoing_chat_state_notifications', 'all') elif active == 1: # only composing - gajim.config.set('chat_state_notifications', 'composing_only') + gajim.config.set('outgoing_chat_state_notifications', 'composing_only') else: # disabled - gajim.config.set('chat_state_notifications', 'disabled') + gajim.config.set('outgoing_chat_state_notifications', 'disabled') + def on_displayed_chat_states_combobox_changed(self, widget): + active = widget.get_active() + if active == 0: # all + gajim.config.set('displayed_chat_state_notifications', 'all') + elif active == 1: # only composing + gajim.config.set('displayed_chat_state_notifications', + 'composing_only') + else: # disabled + gajim.config.set('displayed_chat_state_notifications', 'disabled') def on_play_sounds_checkbutton_toggled(self, widget): self.on_checkbutton_toggled(widget, 'sounds_on',