diff options
author | Ryan Huber <rhuber@gmail.com> | 2014-10-23 18:36:17 -0700 |
---|---|---|
committer | Ryan Huber <rhuber@gmail.com> | 2014-10-23 18:36:17 -0700 |
commit | 3e4757db6688c94294f72374b480efb589883c47 (patch) | |
tree | a6da6daff09b8a6da4e84224bb8e66d5b2cb73eb | |
parent | f4e734d998daa6a0edb54bf8c3e6891895b5aeed (diff) | |
download | wee-slack-3e4757db6688c94294f72374b480efb589883c47.tar.gz |
more cleanup
-rw-r--r-- | wee_slack.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/wee_slack.py b/wee_slack.py index e196325..0831fc2 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -21,7 +21,7 @@ SCRIPT_VERSION = "0.7" SCRIPT_LICENSE = "MIT" SCRIPT_DESC = "Extends weechat for typing notification/search/etc on slack.com" -BACKLOG_SIZE = 100 +BACKLOG_SIZE = 200 SLACK_API_TRANSLATOR = { "channel": { @@ -723,10 +723,16 @@ def async_queue_cb(data, remaining_calls): url_processor_lock=True if len(queue) > 0: item = queue.pop() + try: + query = urlparse.parse_qs(item[-1]) + if query.has_key("channel") and item[0].find('history') > -1: + channel = query["channel"][0] + dbg("downloading channel history for %s" % (channels.find(channel).name)) + except: + pass if item.__class__ == list: w.hook_process_hashtable(*item) else: - #dbg(item) item.mark_read(False) url_processor_lock=False else: @@ -734,14 +740,12 @@ def async_queue_cb(data, remaining_calls): return w.WEECHAT_RC_OK def url_processor_cb(data, command, return_code, out, err): - global url_processor_lock + global url_processor_lock, big_data if return_code == 0: url_processor_lock=False - #dbg(return_code) - query = urlparse.parse_qs(data) - if query.has_key("channel"): - channel = channels.find(query["channel"][0]).name - global big_data +# query = urlparse.parse_qs(data) +# if query.has_key("channel"): +# channel = channels.find(query["channel"][0]).name identifier = sha.sha(str(data) + command).hexdigest() if not big_data.has_key(identifier): big_data[identifier] = '' @@ -751,9 +755,6 @@ def url_processor_cb(data, command, return_code, out, err): except: my_json = False if my_json: -# try: - #dbg('%-10s %-10s success %s %s' % (channel, len(big_data[identifier]), big_data[identifier][:5], big_data[identifier][-5:] )) -# dbg('%s %s success' % (big_data.keys(), identifier)) query = urlparse.parse_qs(data) if query.has_key("channel"): channel = query["channel"][0] @@ -764,7 +765,6 @@ def url_processor_cb(data, command, return_code, out, err): for message in message_json["messages"]: message["channel"] = channels.find(channel) process_message(message) - return w.WEECHAT_RC_OK def slack_api_request(request, data): |