aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2019-03-26 18:51:41 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2019-03-26 18:52:42 +0100
commit00093fa633b3a602384864f54167e90f7cffe336 (patch)
tree5dcd366045b281885aed30d99dc2de14256f307b
parent0f4b2c4c2b7305fd41d405a8f7ce755d27867eef (diff)
downloadwee-slack-00093fa633b3a602384864f54167e90f7cffe336.tar.gz
Implement -all parameter for /away command
Away/back will be set for all slack teams if -all is used. Closes #596
-rw-r--r--wee_slack.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 331972a..dd79234 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -3846,12 +3846,17 @@ def command_upload(data, current_buffer, args):
@utf8_decode
def away_command_cb(data, current_buffer, args):
- # TODO: reimplement all.. maybe
- (all, message) = re.match("^/away(?:\s+(-all))?(?:\s+(.+))?", args).groups()
- if message is None:
- command_back(data, current_buffer, args)
+ all_servers, message = re.match('^/away( -all)? ?(.*)', args).groups()
+ if all_servers:
+ team_buffers = [team.channel_buffer for team in EVENTROUTER.teams.values()]
else:
- command_away(data, current_buffer, args)
+ team_buffers = [current_buffer]
+
+ for team_buffer in team_buffers:
+ if message:
+ command_away(data, team_buffer, args)
+ else:
+ command_back(data, team_buffer, args)
return w.WEECHAT_RC_OK