add an option to define the chatstate we want to show in char window. fixes #2706
This commit is contained in:
parent
eed1a0c75e
commit
5e6f9d0118
|
@ -1049,13 +1049,16 @@ class ChatControl(ChatControlBase):
|
||||||
status_escaped = gtkgui_helpers.escape_for_pango_markup(status)
|
status_escaped = gtkgui_helpers.escape_for_pango_markup(status)
|
||||||
|
|
||||||
font_attrs, font_attrs_small = self.get_font_attrs()
|
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
|
cs = contact.chatstate
|
||||||
if cs and st in ('composing_only', 'all'):
|
if cs and st in ('composing_only', 'all'):
|
||||||
if contact.show == 'offline':
|
if contact.show == 'offline':
|
||||||
chatstate = ''
|
chatstate = ''
|
||||||
elif contact.composing_jep == 'JEP-0085':
|
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':
|
elif contact.composing_jep == 'JEP-0022':
|
||||||
if cs in ('composing', 'paused'):
|
if cs in ('composing', 'paused'):
|
||||||
# only print composing, paused
|
# only print composing, paused
|
||||||
|
@ -1128,7 +1131,8 @@ class ChatControl(ChatControlBase):
|
||||||
encrypted = True
|
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
|
chatstate_to_send = None
|
||||||
if chatstates_on and contact is not None:
|
if chatstates_on and contact is not None:
|
||||||
if contact.composing_jep is 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
|
# do not send nothing if we have chat state notifications disabled
|
||||||
# that means we won't reply to the <active/> from other peer
|
# that means we won't reply to the <active/> from other peer
|
||||||
# so we do not broadcast jep85 capabalities
|
# 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':
|
if chatstate_setting == 'disabled':
|
||||||
return
|
return
|
||||||
elif chatstate_setting == 'composing_only' and state != 'active' and\
|
elif chatstate_setting == 'composing_only' and state != 'active' and\
|
||||||
|
|
|
@ -152,7 +152,8 @@ class Config:
|
||||||
'always_english_wiktionary': [opt_bool, True],
|
'always_english_wiktionary': [opt_bool, True],
|
||||||
'remote_control': [opt_bool, True, _('If checked, Gajim can be controlled remotely using gajim-remote.'), 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],
|
'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],
|
'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.')],
|
'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.')],
|
'confirm_close_muc': [opt_bool, True, _('Ask before closing a group chat tab/window.')],
|
||||||
|
|
|
@ -2,7 +2,7 @@ docdir = '../'
|
||||||
|
|
||||||
datadir = '../'
|
datadir = '../'
|
||||||
|
|
||||||
version = '0.10.1.7'
|
version = '0.10.1.8'
|
||||||
|
|
||||||
import sys, os.path
|
import sys, os.path
|
||||||
for base in ('.', 'common'):
|
for base in ('.', 'common'):
|
||||||
|
|
|
@ -153,6 +153,8 @@ class OptionsParser:
|
||||||
self.update_config_to_01016()
|
self.update_config_to_01016()
|
||||||
if old < [0, 10, 1, 7] and new >= [0, 10, 1, 7]:
|
if old < [0, 10, 1, 7] and new >= [0, 10, 1, 7]:
|
||||||
self.update_config_to_01017()
|
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.logger.init_vars()
|
||||||
gajim.config.set('version', new_version)
|
gajim.config.set('version', new_version)
|
||||||
|
@ -345,5 +347,12 @@ class OptionsParser:
|
||||||
trayicon_notification_on_events '''
|
trayicon_notification_on_events '''
|
||||||
if self.old_values.has_key('trayicon_notification_on_new_messages'):
|
if self.old_values.has_key('trayicon_notification_on_new_messages'):
|
||||||
gajim.config.set('trayicon_notification_on_events',
|
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')
|
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')
|
||||||
|
|
|
@ -224,47 +224,47 @@ class PreferencesWindow:
|
||||||
else:
|
else:
|
||||||
self.xml.get_widget('time_always_radiobutton').set_active(True)
|
self.xml.get_widget('time_always_radiobutton').set_active(True)
|
||||||
|
|
||||||
#before time
|
# before time
|
||||||
st = gajim.config.get('before_time')
|
st = gajim.config.get('before_time')
|
||||||
st = helpers.from_one_line(st)
|
st = helpers.from_one_line(st)
|
||||||
self.xml.get_widget('before_time_textview').get_buffer().set_text(st)
|
self.xml.get_widget('before_time_textview').get_buffer().set_text(st)
|
||||||
|
|
||||||
#after time
|
# after time
|
||||||
st = gajim.config.get('after_time')
|
st = gajim.config.get('after_time')
|
||||||
st = helpers.from_one_line(st)
|
st = helpers.from_one_line(st)
|
||||||
self.xml.get_widget('after_time_textview').get_buffer().set_text(st)
|
self.xml.get_widget('after_time_textview').get_buffer().set_text(st)
|
||||||
|
|
||||||
#before nickname
|
# before nickname
|
||||||
st = gajim.config.get('before_nickname')
|
st = gajim.config.get('before_nickname')
|
||||||
st = helpers.from_one_line(st)
|
st = helpers.from_one_line(st)
|
||||||
self.xml.get_widget('before_nickname_textview').get_buffer().set_text(st)
|
self.xml.get_widget('before_nickname_textview').get_buffer().set_text(st)
|
||||||
|
|
||||||
#after nickanme
|
# after nickanme
|
||||||
st = gajim.config.get('after_nickname')
|
st = gajim.config.get('after_nickname')
|
||||||
st = helpers.from_one_line(st)
|
st = helpers.from_one_line(st)
|
||||||
self.xml.get_widget('after_nickname_textview').get_buffer().set_text(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')
|
colSt = gajim.config.get('inmsgcolor')
|
||||||
self.xml.get_widget('incoming_msg_colorbutton').set_color(
|
self.xml.get_widget('incoming_msg_colorbutton').set_color(
|
||||||
gtk.gdk.color_parse(colSt))
|
gtk.gdk.color_parse(colSt))
|
||||||
|
|
||||||
#Color for outgoing messages
|
# Color for outgoing messages
|
||||||
colSt = gajim.config.get('outmsgcolor')
|
colSt = gajim.config.get('outmsgcolor')
|
||||||
self.xml.get_widget('outgoing_msg_colorbutton').set_color(
|
self.xml.get_widget('outgoing_msg_colorbutton').set_color(
|
||||||
gtk.gdk.color_parse(colSt))
|
gtk.gdk.color_parse(colSt))
|
||||||
|
|
||||||
#Color for status messages
|
# Color for status messages
|
||||||
colSt = gajim.config.get('statusmsgcolor')
|
colSt = gajim.config.get('statusmsgcolor')
|
||||||
self.xml.get_widget('status_msg_colorbutton').set_color(
|
self.xml.get_widget('status_msg_colorbutton').set_color(
|
||||||
gtk.gdk.color_parse(colSt))
|
gtk.gdk.color_parse(colSt))
|
||||||
|
|
||||||
#Color for hyperlinks
|
# Color for hyperlinks
|
||||||
colSt = gajim.config.get('urlmsgcolor')
|
colSt = gajim.config.get('urlmsgcolor')
|
||||||
self.xml.get_widget('url_msg_colorbutton').set_color(
|
self.xml.get_widget('url_msg_colorbutton').set_color(
|
||||||
gtk.gdk.color_parse(colSt))
|
gtk.gdk.color_parse(colSt))
|
||||||
|
|
||||||
#Font for messages
|
# Font for messages
|
||||||
font = gajim.config.get('conversation_font')
|
font = gajim.config.get('conversation_font')
|
||||||
# try to set default font for the current desktop env
|
# try to set default font for the current desktop env
|
||||||
fontbutton = self.xml.get_widget('conversation_fontbutton')
|
fontbutton = self.xml.get_widget('conversation_fontbutton')
|
||||||
|
@ -286,25 +286,25 @@ class PreferencesWindow:
|
||||||
if only_in_roster:
|
if only_in_roster:
|
||||||
self.xml.get_widget('only_in_roster_radiobutton').set_active(True)
|
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')
|
st = gajim.config.get('notify_on_signin')
|
||||||
self.notify_on_signin_checkbutton.set_active(st)
|
self.notify_on_signin_checkbutton.set_active(st)
|
||||||
|
|
||||||
#notify on offline statuses
|
# notify on offline statuses
|
||||||
st = gajim.config.get('notify_on_signout')
|
st = gajim.config.get('notify_on_signout')
|
||||||
self.notify_on_signout_checkbutton.set_active(st)
|
self.notify_on_signout_checkbutton.set_active(st)
|
||||||
|
|
||||||
#autopopupaway
|
# autopopupaway
|
||||||
st = gajim.config.get('autopopupaway')
|
st = gajim.config.get('autopopupaway')
|
||||||
self.auto_popup_away_checkbutton.set_active(st)
|
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').\
|
self.xml.get_widget('ignore_events_from_unknown_contacts_checkbutton').\
|
||||||
set_active(gajim.config.get('ignore_unknown_contacts'))
|
set_active(gajim.config.get('ignore_unknown_contacts'))
|
||||||
|
|
||||||
# send chat state notifications
|
# outgoing send chat state notifications
|
||||||
st = gajim.config.get('chat_state_notifications')
|
st = gajim.config.get('outgoing_chat_state_notifications')
|
||||||
combo = self.xml.get_widget('chat_states_combobox')
|
combo = self.xml.get_widget('outgoing_chat_states_combobox')
|
||||||
if st == 'all':
|
if st == 'all':
|
||||||
combo.set_active(0)
|
combo.set_active(0)
|
||||||
elif st == 'composing_only':
|
elif st == 'composing_only':
|
||||||
|
@ -312,7 +312,17 @@ class PreferencesWindow:
|
||||||
else: # disabled
|
else: # disabled
|
||||||
combo.set_active(2)
|
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 os.name == 'nt':
|
||||||
# if windows, player must not become visible on show_all
|
# if windows, player must not become visible on show_all
|
||||||
soundplayer_hbox = self.xml.get_widget('soundplayer_hbox')
|
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):
|
def on_ignore_events_from_unknown_contacts_checkbutton_toggled(self, widget):
|
||||||
self.on_checkbutton_toggled(widget, 'ignore_unknown_contacts')
|
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()
|
active = widget.get_active()
|
||||||
if active == 0: # all
|
if active == 0: # all
|
||||||
gajim.config.set('chat_state_notifications', 'all')
|
gajim.config.set('outgoing_chat_state_notifications', 'all')
|
||||||
elif active == 1: # only composing
|
elif active == 1: # only composing
|
||||||
gajim.config.set('chat_state_notifications', 'composing_only')
|
gajim.config.set('outgoing_chat_state_notifications', 'composing_only')
|
||||||
else: # disabled
|
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):
|
def on_play_sounds_checkbutton_toggled(self, widget):
|
||||||
self.on_checkbutton_toggled(widget, 'sounds_on',
|
self.on_checkbutton_toggled(widget, 'sounds_on',
|
||||||
|
|
Loading…
Reference in New Issue