aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2020-05-08 18:16:31 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2020-05-30 21:13:21 +0200
commit31a998681d597bb29e5c3b66715a8757a310324d (patch)
treee9e789aba424851b762d6f18dcfd236859f5628e /wee_slack.py
parent2b1c16362a3a1d64ff9d4e4bd08901d437b57af0 (diff)
downloadwee-slack-31a998681d597bb29e5c3b66715a8757a310324d.tar.gz
Combine receive and receive_slow
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py28
1 files changed, 7 insertions, 21 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 098c693..0580f3a 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -635,25 +635,17 @@ class EventRouter(object):
self.receive(request_metadata)
return w.WEECHAT_RC_OK
- def receive(self, dataobj):
+ def receive(self, dataobj, slow=False):
"""
- complete
Receives a raw object and places it on the queue for
processing. Object must be known to handle_next or
be JSON.
"""
dbg("RECEIVED FROM QUEUE")
- self.queue.append(dataobj)
-
- def receive_slow(self, dataobj):
- """
- complete
- Receives a raw object and places it on the slow queue for
- processing. Object must be known to handle_next or
- be JSON.
- """
- dbg("RECEIVED FROM QUEUE")
- self.slow_queue.append(dataobj)
+ if slow:
+ self.slow_queue.append(dataobj)
+ else:
+ self.queue.append(dataobj)
def handle_next(self):
"""
@@ -2034,10 +2026,7 @@ class SlackChannel(SlackChannelCommon):
tag(backlog=True, no_log=True), '\tgetting channel history...')
s = SlackRequest(self.team, self.team.slack_api_translator[self.type]["history"],
post_data, channel=self, metadata={"no_log": no_log})
- if not slow_queue:
- self.eventrouter.receive(s)
- else:
- self.eventrouter.receive_slow(s)
+ self.eventrouter.receive(s, slow_queue)
self.got_history = True
self.history_needs_update = False
@@ -2429,10 +2418,7 @@ class SlackThreadChannel(SlackChannelCommon):
s = SlackRequest(self.team, "conversations.replies",
post_data, channel=self.parent_channel,
metadata={"thread_channel": self, "no_log": no_log})
- if slow_queue:
- self.eventrouter.receive_slow(s)
- else:
- self.eventrouter.receive(s)
+ self.eventrouter.receive(s, slow_queue)
def main_message_keys_reversed(self):
return reversed(self.messages)