add GUI option to ignore incoming XHTML tag. fixes #2522

This commit is contained in:
Yann Leboulanger 2006-10-18 08:20:49 +00:00
parent ac0682e991
commit 06609bcb89
4 changed files with 39 additions and 5 deletions

View File

@ -493,6 +493,26 @@ Per type</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="xhtml_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Ignore incoming _XHTML tags</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_xhtml_checkbutton_toggled" last_modification_time="Wed, 18 Oct 2006 08:17:45 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox2947">
<property name="visible">True</property>

View File

@ -86,6 +86,7 @@ class Config:
'sort_by_show': [ opt_bool, True, '', True ],
'enable_zeroconf': [opt_bool, False, _('Enable link-local/zeroconf messaging')],
'use_speller': [ opt_bool, False, ],
'ignore_incoming_xhtml': [ opt_bool, False, ],
'speller_language': [ opt_str, '', _('Language used by speller')],
'print_time': [ opt_str, 'always', _('\'always\' - print time for every message.\n\'sometimes\' - print time every print_ichat_every_foo_minutes minute.\n\'never\' - never print time.')],
'print_time_fuzzy': [ opt_int, 0, _('Print time in chats using Fuzzy Clock. Value of fuzziness from 1 to 4, or 0 to disable fuzzyclock. 1 is the most precise clock, 4 the less precise one. This is used only if print_time is \'sometimes\'.') ],

View File

@ -190,7 +190,7 @@ class PreferencesWindow:
theme_combobox.set_active(i)
i += 1
#use speller
# use speller
if os.name == 'nt':
self.xml.get_widget('speller_checkbutton').set_no_show_all(True)
else:
@ -200,7 +200,11 @@ class PreferencesWindow:
else:
self.xml.get_widget('speller_checkbutton').set_sensitive(False)
#Print time
# Ignore XHTML
st = gajim.config.get('ignore_incoming_xhtml')
self.xml.get_widget('xhtml_checkbutton').set_active(st)
# Print time
st = gajim.config.get('print_ichat_every_foo_minutes')
text = _('Every %s _minutes') % st
self.xml.get_widget('time_sometimes_radiobutton').set_label(text)
@ -663,6 +667,9 @@ class PreferencesWindow:
else:
self.remove_speller()
def on_xhtml_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'ignore_incoming_xhtml')
def _set_sensitivity_for_before_after_time_widgets(self, sensitive):
self.xml.get_widget('before_time_label').set_sensitive(sensitive)
self.xml.get_widget('before_time_textview').set_sensitive(sensitive)

View File

@ -511,6 +511,9 @@ class Interface:
chatstate = array[6]
msg_id = array[7]
composing_jep = array[8]
xhtml = array[10]
if gajim.config.get('ignore_incoming_xhtml'):
xhtml = None
if gajim.jid_is_transport(jid):
jid = jid.replace('@', '')
@ -590,7 +593,7 @@ class Interface:
nickname = resource
msg_type = 'pm'
groupchat_control.on_private_message(nickname, message, array[2],
array[10])
xhtml)
else:
# array: (jid, msg, time, encrypted, msg_type, subject)
if encrypted:
@ -601,7 +604,7 @@ class Interface:
# xhtml in last element
self.roster.on_message(jid, message, array[2], account, array[3],
msg_type, subject, resource, msg_id, array[9],
advanced_notif_num, xhtml = array[10])
advanced_notif_num, xhtml = xhtml)
nickname = gajim.get_name_from_jid(account, jid)
# Check and do wanted notifications
msg = message
@ -904,13 +907,16 @@ class Interface:
gc_control = self.msg_win_mgr.get_control(room_jid, account)
if not gc_control:
return
xhtml = array[4]
if gajim.config.get('ignore_incoming_xhtml'):
xhtml = None
if len(jids) == 1:
# message from server
nick = ''
else:
# message from someone
nick = jids[1]
gc_control.on_message(nick, array[1], array[2], array[3], array[4])
gc_control.on_message(nick, array[1], array[2], array[3], xhtml)
if self.remote_ctrl:
self.remote_ctrl.raise_signal('GCMessage', (account, array))