From c8b25f37a55d11d823226f1e0130205676984c2e Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Mon, 25 Feb 2008 14:09:47 +0000 Subject: [PATCH] [shtrom] $S and $T in autoaway status message. fixes $3741 --- src/common/config.py | 4 ++-- src/gajim.py | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/common/config.py b/src/common/config.py index e1cd1aced..9b59aef40 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -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, '' ], diff --git a/src/gajim.py b/src/gajim.py index fe27c2a7d..75d1bc87c 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -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)