aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorRyan Huber <rhuber@gmail.com>2014-11-02 19:59:26 -0800
committerRyan Huber <rhuber@gmail.com>2014-11-02 19:59:26 -0800
commite51f58336742dacd3a7a2642d7ea88dd8634b67c (patch)
tree0211c7a780c0e0dde27ace329b5b71ece4140d69 /wee_slack.py
parentf2dcc3443583ab6e9420efd1b4cac8d72da7db77 (diff)
downloadwee-slack-e51f58336742dacd3a7a2642d7ea88dd8634b67c.tar.gz
config dynamically reloads
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py31
1 files changed, 19 insertions, 12 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 1f45f58..57abc20 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -769,6 +769,8 @@ def process_message(message_json):
text = text.replace("\t", " ")
name = get_user(message_json, server)
+ channel.unset_typing(name)
+
server.channels.find(channel).buffer_prnt(name, text, time)
def unwrap_message(message_json):
@@ -1082,7 +1084,20 @@ def create_slack_debug_buffer():
debug_string = None
slack_debug = w.buffer_new("slack-debug", "", "", "closed_slack_debug_buffer_cb", "")
w.buffer_set(slack_debug, "notify", "0")
-# w.buffer_set(slack_debug, "display", "1")
+
+def config_changed_cb(data, option, value):
+ global slack_api_token, channels_always_marked_read, channels_not_on_current_server_color, colorize_nicks, slack_debug, debug_mode
+ slack_api_token = w.config_get_plugin("slack_api_token")
+ channels_always_marked_read = [x.strip() for x in w.config_get_plugin("channels_always_marked_read").split(',')]
+ channels_not_on_current_server_color = w.config_get_plugin("channels_not_on_current_server_color")
+ if channels_not_on_current_server_color == "0":
+ channels_not_on_current_server_color = False
+ colorize_nicks = w.config_get_plugin('colorize_nicks') == "1"
+ slack_debug = None
+ debug_mode = w.config_get_plugin("debug_mode").lower()
+ if debug_mode != '' or debug_mode != 'false':
+ create_slack_debug_buffer()
+ return w.WEECHAT_RC_OK
### END Utility Methods
@@ -1110,17 +1125,8 @@ if __name__ == "__main__":
legacy_mode = True
### Global var section
- slack_api_token = w.config_get_plugin("slack_api_token")
- channels_always_marked_read = [x.strip() for x in w.config_get_plugin("channels_always_marked_read").split(',')]
- channels_not_on_current_server_color = w.config_get_plugin("channels_not_on_current_server_color")
- if channels_not_on_current_server_color == "0":
- channels_not_on_current_server_color = False
- colorize_nicks = w.config_get_plugin('colorize_nicks') == "1"
-
- slack_debug = None
- debug_mode = w.config_get_plugin("debug_mode").lower()
- if debug_mode != '' or debug_mode != 'false':
- create_slack_debug_buffer()
+ config_changed_cb("", "", "")
+
cmds = {k[8:]: v for k, v in globals().items() if k.startswith("command_")}
proc = {k[8:]: v for k, v in globals().items() if k.startswith("process_")}
@@ -1144,6 +1150,7 @@ if __name__ == "__main__":
users = Meta('users', servers)
+ w.hook_config("plugins.var.python." + SCRIPT_NAME + ".*", "config_changed_cb", "")
w.hook_timer(10, 0, 0, "async_queue_cb", "")
w.hook_timer(6000, 0, 0, "slack_connection_persistence_cb", "")