diff options
author | Ryan Huber <rhuber@gmail.com> | 2014-11-21 14:27:20 -0800 |
---|---|---|
committer | Ryan Huber <rhuber@gmail.com> | 2014-11-21 14:27:20 -0800 |
commit | 1f773560d3881c61cca496b6c2d6a13e66c207c7 (patch) | |
tree | 60b2f751e8e3141770adfd7989354ac4e328a59a /wee_slack.py | |
parent | 74db46c152d0dd815e3b8c5d1a19f2bc8ff527e3 (diff) | |
download | wee-slack-1f773560d3881c61cca496b6c2d6a13e66c207c7.tar.gz |
only send typing notification after 8 chars (go script fix)
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/wee_slack.py b/wee_slack.py index 033e3ff..676e8e8 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -949,15 +949,16 @@ def buffer_switch_cb(signal, sig_type, data): return w.WEECHAT_RC_OK def typing_notification_cb(signal, sig_type, data): - global typing_timer - now = time.time() - if typing_timer + 4 < now: - channel = channels.find(current_buffer_name()) - if channel: - identifier = channel.identifier - request = {"type":"typing", "channel":identifier} - channel.server.ws.send(json.dumps(request)) - typing_timer = now + if len(w.buffer_get_string(data, "input")) > 8: + global typing_timer + now = time.time() + if typing_timer + 4 < now: + channel = channels.find(current_buffer_name()) + if channel: + identifier = channel.identifier + request = {"type":"typing", "channel":identifier} + channel.server.ws.send(json.dumps(request)) + typing_timer = now return w.WEECHAT_RC_OK #NOTE: figured i'd do this because they do |