aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2017-09-28 23:44:22 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2017-09-29 00:12:43 +0200
commit48ff600bf2afd8a38276e226a0ecb7aa30ff465b (patch)
tree0f647df8da0eebc6665482cd62d33360bf09f897 /wee_slack.py
parent7f7cebf2c70e827958f9e0ba72e846223002e5cd (diff)
downloadwee-slack-48ff600bf2afd8a38276e226a0ecb7aa30ff465b.tar.gz
refactor: Swap if conditions for performance
Since startswith is faster than in, it's better to check that first.
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 42b0dbe..42347b0 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -656,7 +656,7 @@ def input_text_for_buffer_cb(data, modifier, current_buffer, string):
if current_buffer not in EVENTROUTER.weechat_controller.buffers:
return string
message = decode_from_utf8(string)
- if "\n" in message and not message.startswith("/"):
+ if not message.startswith("/") and "\n" in message:
buffer_input_callback("EVENTROUTER", current_buffer, message)
return ""
return string