we can now configure autoaway/xa messages

This commit is contained in:
Yann Leboulanger 2005-08-06 15:17:20 +00:00
parent 5177472406
commit d00a039ba6
4 changed files with 72 additions and 5 deletions

View File

@ -48,8 +48,10 @@ class Config:
'showoffline': [ opt_bool, False ],
'autoaway': [ opt_bool, True ],
'autoawaytime': [ opt_int, 5 ],
'autoaway_message': [ opt_str, _('Away as a result of beind idle') ],
'autoxa': [ opt_bool, True ],
'autoxatime': [ opt_int, 15 ],
'autoxa_message': [ opt_str, _('Not available as a result of beind idle') ],
'ask_online_status': [ opt_bool, False ],
'ask_offline_status': [ opt_bool, False ],
'last_status_msg_online': [ opt_str, '' ],

View File

@ -84,9 +84,12 @@ class PreferencesWindow:
self.auto_away_checkbutton = self.xml.get_widget('auto_away_checkbutton')
self.auto_away_time_spinbutton = self.xml.get_widget \
('auto_away_time_spinbutton')
self.auto_away_message_entry = self.xml.get_widget \
('auto_away_message_entry')
self.auto_xa_checkbutton = self.xml.get_widget('auto_xa_checkbutton')
self.auto_xa_time_spinbutton = self.xml.get_widget \
('auto_xa_time_spinbutton')
self.auto_xa_message_entry = self.xml.get_widget('auto_xa_message_entry')
self.trayicon_checkbutton = self.xml.get_widget('trayicon_checkbutton')
self.notebook = self.xml.get_widget('preferences_notebook')
@ -325,6 +328,11 @@ class PreferencesWindow:
self.auto_away_time_spinbutton.set_value(st)
self.auto_away_time_spinbutton.set_sensitive(gajim.config.get('autoaway'))
#autoaway message
st = gajim.config.get('autoaway_message')
self.auto_away_message_entry.set_text(st)
self.auto_away_message_entry.set_sensitive(gajim.config.get('autoaway'))
#Autoxa
st = gajim.config.get('autoxa')
self.auto_xa_checkbutton.set_active(st)
@ -334,6 +342,11 @@ class PreferencesWindow:
self.auto_xa_time_spinbutton.set_value(st)
self.auto_xa_time_spinbutton.set_sensitive(gajim.config.get('autoxa'))
#autoxa message
st = gajim.config.get('autoxa_message')
self.auto_xa_message_entry.set_text(st)
self.auto_xa_message_entry.set_sensitive(gajim.config.get('autoxa'))
#ask_status when online / offline
st = gajim.config.get('ask_online_status')
self.xml.get_widget('prompt_online_status_message_checkbutton').\
@ -751,7 +764,7 @@ class PreferencesWindow:
def on_auto_away_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'autoaway',
[self.auto_away_time_spinbutton])
[self.auto_away_time_spinbutton, self.auto_away_message_entry])
def on_auto_away_time_spinbutton_value_changed(self, widget):
aat = widget.get_value_as_int()
@ -761,9 +774,12 @@ class PreferencesWindow:
gajim.config.get('autoxatime') * 60)
self.plugin.save_config()
def on_auto_away_message_entry_changed(self, widget):
gajim.config.set('autoaway_message', widget.get_text())
def on_auto_xa_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'autoxa',
[self.auto_xa_time_spinbutton])
[self.auto_xa_time_spinbutton, self.auto_xa_message_entry])
def on_auto_xa_time_spinbutton_value_changed(self, widget):
axt = widget.get_value_as_int()
@ -773,6 +789,9 @@ class PreferencesWindow:
gajim.config.get('autoxatime') * 60)
self.plugin.save_config()
def on_auto_xa_message_entry_changed(self, widget):
gajim.config.set('autoxa_message', widget.get_text())
def save_status_messages(self, model):
for msg in gajim.config.get_per('statusmsg'):
gajim.config.del_per('statusmsg', msg)

View File

@ -801,14 +801,16 @@ class Interface:
gajim.status_before_autoaway[account] = \
gajim.connections[account].status
#we go away
self.roster.send_status(account, 'away', 'auto away (idle)')
self.roster.send_status(account, 'away',
gajim.config.get('autoaway_message'))
gajim.sleeper_state[account] = 'autoaway'
elif state == common.sleepy.STATE_XAWAY and (\
gajim.sleeper_state[account] == 'autoaway' or \
gajim.sleeper_state[account] == 'online') and \
gajim.config.get('autoxa'):
#we go extended away
self.roster.send_status(account, 'xa', 'auto away (idle)')
self.roster.send_status(account, 'xa',
gajim.config.get('autoxa_message'))
gajim.sleeper_state[account] = 'autoxa'
return True # renew timeout (loop for ever)

View File

@ -4649,7 +4649,7 @@
<widget class="GtkTable" id="table19">
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_columns">3</property>
<property name="n_columns">4</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
@ -4823,6 +4823,50 @@
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="auto_away_message_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
<signal name="changed" handler="on_auto_away_message_entry_changed" last_modification_time="Sat, 06 Aug 2005 14:25:55 GMT"/>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="auto_xa_message_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
<signal name="changed" handler="on_auto_xa_message_entry_changed" last_modification_time="Sat, 06 Aug 2005 14:29:09 GMT"/>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>