log conversation history better string and catch change on the fly

This commit is contained in:
Nikos Kouremenos 2005-12-07 14:32:42 +00:00
parent 9e85df37b1
commit b06a5718c4
2 changed files with 22 additions and 19 deletions

View File

@ -6758,17 +6758,18 @@ Custom</property>
</child>
<child>
<widget class="GtkCheckButton" id="log_checkbutton">
<widget class="GtkCheckButton" id="log_history_checkbutton">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Log history</property>
<property name="label" translatable="yes">_Log conversation history</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">True</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_log_history_checkbutton_toggled" last_modification_time="Wed, 07 Dec 2005 14:24:05 GMT"/>
</widget>
<packing>
<property name="left_attach">0</property>

View File

@ -108,6 +108,22 @@ class VcardWindow:
if event.keyval == gtk.keysyms.Escape:
self.window.destroy()
def on_log_history_checkbutton_toggled(self, widget):
#log conversation history?
oldlog = True
no_log_for = gajim.config.get_per('accounts', self.account,
'no_log_for').split()
if self.contact.jid in no_log_for:
oldlog = False
log = widget.get_active()
if not log and not self.contact.jid in no_log_for:
no_log_for.append(self.contact.jid)
if log and self.contact.jid in no_log_for:
no_log_for.remove(self.contact.jid)
if oldlog != log:
gajim.config.set_per('accounts', self.account, 'no_log_for',
' '.join(no_log_for))
def on_close_button_clicked(self, widget):
'''Save contact information and update the roster on the Jabber server'''
if self.vcard:
@ -123,20 +139,6 @@ class VcardWindow:
gajim.interface.roster.tree.get_model().set_value(i, 1, new_name)
gajim.connections[self.account].update_contact(self.contact.jid,
self.contact.name, self.contact.groups)
#log history ?
oldlog = True
no_log_for = gajim.config.get_per('accounts', self.account,
'no_log_for').split()
if self.contact.jid in no_log_for:
oldlog = False
log = self.xml.get_widget('log_checkbutton').get_active()
if not log and not self.contact.jid in no_log_for:
no_log_for.append(self.contact.jid)
if log and self.contact.jid in no_log_for:
no_log_for.remove(self.contact.jid)
if oldlog != log:
gajim.config.set_per('accounts', self.account, 'no_log_for',
' '.join(no_log_for))
self.window.destroy()
def on_clear_button_clicked(self, widget):
@ -298,11 +300,11 @@ class VcardWindow:
tooltips.set_tip(eb,
_("You are waiting contact's answer about your subscription request"))
self.xml.get_widget('nickname_entry').set_text(self.contact.name)
log = 1
log = True
if self.contact.jid in gajim.config.get_per('accounts', self.account,
'no_log_for').split(' '):
log = 0
self.xml.get_widget('log_checkbutton').set_active(log)
log = False
self.xml.get_widget('log_history_checkbutton').set_active(log)
resources = '%s (%s)' % (self.contact.resource, unicode(
self.contact.priority))
uf_resources = self.contact.resource + _(' resource with priority ')\