[shtrom] $S and $T in autoaway status message. fixes $3741

This commit is contained in:
Yann Leboulanger 2008-02-25 14:09:47 +00:00
parent b0d3e1f123
commit c8b25f37a5
2 changed files with 16 additions and 2 deletions

View File

@ -77,10 +77,10 @@ class Config:
'show_transports_group': [ opt_bool, True ],
'autoaway': [ opt_bool, True ],
'autoawaytime': [ opt_int, 5, _('Time in minutes, after which your status changes to away.') ],
'autoaway_message': [ opt_str, _('Away as a result of being idle') ],
'autoaway_message': [ opt_str, _('$S (Away as a result of being idle more than $T min)'), _('$S with be replaced by current status message, $T by autoaway time.') ],
'autoxa': [ opt_bool, True ],
'autoxatime': [ opt_int, 15, _('Time in minutes, after which your status changes to not available.') ],
'autoxa_message': [ opt_str, _('Not available as a result of being idle') ],
'autoxa_message': [ opt_str, _('$S (Not available as a result of being idle more than $T min)'), _('$S with be replaced by current status message, $T by autoxa time.') ],
'ask_online_status': [ opt_bool, False ],
'ask_offline_status': [ opt_bool, False ],
'last_status_msg_online': [ opt_str, '' ],

View File

@ -2324,6 +2324,13 @@ class Interface:
auto_message = gajim.config.get('autoaway_message')
if not auto_message:
auto_message = gajim.connections[account].status
else:
auto_message = auto_message.replace('$S','%(status)s')
auto_message = auto_message.replace('$T','%(time)s')
auto_message = auto_message % {
'status': gajim.status_before_autoaway[account],
'time': gajim.config.get('autoawaytime')
}
self.roster.send_status(account, 'away', auto_message, auto=True)
gajim.sleeper_state[account] = 'autoaway'
elif state == common.sleepy.STATE_XA and (\
@ -2334,6 +2341,13 @@ class Interface:
auto_message = gajim.config.get('autoxa_message')
if not auto_message:
auto_message = gajim.connections[account].status
else:
auto_message = auto_message.replace('$S','%(status)s')
auto_message = auto_message.replace('$T','%(time)s')
auto_message = auto_message % {
'status': gajim.status_before_autoaway[account],
'time': gajim.config.get('autoxatime')
}
self.roster.send_status(account, 'xa', auto_message, auto=True)
gajim.sleeper_state[account] = 'autoxa'
return True # renew timeout (loop for ever)