we can now desactivate the history logging for all contacts in an account

This commit is contained in:
Yann Leboulanger 2005-03-06 19:19:21 +00:00
parent 6ec9c12f61
commit f33b9f9fb6
3 changed files with 45 additions and 3 deletions

View File

@ -849,6 +849,10 @@ class account_window:
if infos.has_key('autoconnect'):
self.xml.get_widget('autoconnect_checkbutton').set_active(\
infos['autoconnect'])
if infos.has_key('no_log_for'):
list_no_log_for = infos['no_log_for'].split()
if infos['accname'] in list_no_log_for:
self.xml.get_widget('log_history_checkbutton').set_active(0)
def on_save_button_clicked(self, widget):
"""When save button is clicked : Save informations in config file"""
@ -864,6 +868,16 @@ class account_window:
autoconnect = 0
if self.xml.get_widget('autoconnect_checkbutton').get_active():
autoconnect = 1
if not self.infos.has_key('no_log_for'):
self.infos['no_log_for'] = ''
list_no_log_for = self.infos['no_log_for'].split()
if self.account in list_no_log_for:
list_no_log_for.remove(self.account)
if not self.xml.get_widget('log_history_checkbutton').get_active():
list_no_log_for.append(name)
self.infos['no_log_for'] = ' '.join(list_no_log_for)
use_proxy_checkbutton = self.xml.get_widget('use_proxy_checkbutton')
if use_proxy_checkbutton.get_active():
use_proxy = 1
@ -940,7 +954,8 @@ class account_window:
'autoconnect': autoconnect, 'use_proxy': use_proxy, 'proxyhost': \
proxyhost, 'proxyport': proxyport, 'keyid': keyID, \
'keyname': key_name, 'savegpgpass': save_gpg_password, \
'gpgpassword': gpg_password, 'active': active}
'gpgpassword': gpg_password, 'active': active, 'no_log_for': \
self.infos['no_log_for']}
self.plugin.send('CONFIG', None, ('accounts', self.plugin.accounts, \
'GtkGui'))
if save_password:
@ -967,7 +982,7 @@ class account_window:
'use_proxy': use_proxy, 'proxyhost': proxyhost, \
'proxyport': proxyport, 'keyid': keyID, 'keyname': key_name, \
'savegpgpass': save_gpg_password, 'gpgpassword': gpg_password,\
'active': 1}
'active': 1, 'no_log_for': self.infos['no_log_for']}
self.plugin.send('CONFIG', None, ('accounts', self.plugin.accounts, \
'GtkGui'))
if save_password:
@ -1081,11 +1096,13 @@ class account_window:
self.plugin = plugin
self.account = ''
self.modify = False
self.infos = infos
self.xml.get_widget('gpg_key_label').set_text('No key selected')
self.xml.get_widget('gpg_name_label').set_text('')
self.xml.get_widget('gpg_save_password_checkbutton').set_sensitive(False)
self.xml.get_widget('gpg_password_entry').set_sensitive(False)
self.xml.get_widget('password_entry').set_sensitive(False)
self.xml.get_widget('log_history_checkbutton').set_active(1)
self.xml.signal_autoconnect(self)
if infos:
self.modify = True

View File

@ -1085,7 +1085,7 @@ Alex Podaras (bigpod@jabber.org)</property>
<widget class="GtkVBox" id="vbox38">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<property name="spacing">2</property>
<child>
<widget class="GtkCheckButton" id="autoconnect_checkbutton">
@ -1105,6 +1105,25 @@ Alex Podaras (bigpod@jabber.org)</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="log_history_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Log history for all contacts in this account</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>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>

View File

@ -79,6 +79,8 @@ class plugin:
jid = string.split(ev[2][0], '/')[0]
if jid in self.no_log_for[ev[1]]:
break
if ev[1] in self.no_log_for[ev[1]]:
break
status = ev[2][2]
if not status:
status = ""
@ -97,6 +99,8 @@ class plugin:
jid = string.split(ev[2][0], '/')[0]
if jid in self.no_log_for[ev[1]]:
break
if ev[1] in self.no_log_for[ev[1]]:
break
msg = string.replace(ev[2][1], '\n', '\\n')
fic = open(LOGPATH + jid, "a")
t = time.mktime(ev[2][2])
@ -106,6 +110,8 @@ class plugin:
jid = string.split(ev[2][0], '/')[0]
if jid in self.no_log_for[ev[1]]:
break
if ev[1] in self.no_log_for[ev[1]]:
break
msg = string.replace(ev[2][1], '\n', '\\n')
fic = open(LOGPATH + jid, "a")
fic.write("%s:sent:%s\n" % (tim, msg))