aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Fix broken testsTrygve Aaberge2019-05-053-11/+7
| | | | | I forgot to make some required changes in the tests after commit f3d880e and commit 49d481c.
* Release v2.3.0v2.3.0Trygve Aaberge2019-05-052-2/+23
|
* Update copyright noticeTrygve Aaberge2019-05-052-2/+6
| | | | | | | | I included it in the script as well, since it is included in the script in weechats repo. I also removed the coding comment from wee_slack.py since the file is in ascii.
* Support subteams in resolve_refTrygve Aaberge2019-05-051-0/+5
|
* Simplify resolve_refTrygve Aaberge2019-05-051-20/+10
|
* Increase pong timeout to 30 secondsTrygve Aaberge2019-05-051-1/+1
| | | | | | | | Even after the last two changes, I have still experienced a disconnect because of missing pong once where I think I possibly shouldn't have been disconnected. Hopefully 30 seconds is a good compromise between not disconnecting when it isn't necessary and not waiting too long before disconnecting a dead connection.
* Only check for pong responses when ping has been recently sentTrygve Aaberge2019-05-031-1/+5
| | | | | | | | With large teams on a slow computer, wee-slack may unfortunately hang for a while at times while processing data. When this happen, it doesn't get a chance to send pings. When it's finished processing, it previously might have disconnected if the pong checker runs before sending a ping, since it's a long time since a ping has been sent.
* Process the entire websocket queue in receive_ws_callbackTrygve Aaberge2019-05-031-24/+25
| | | | | | | | | | | | | | | | | | When we receive many lines over the websocket, receive_ws_callback seems to be called periodically (10 times per second or so) until all lines have been read. Since we previously only read one line per invocation of receive_ws_callback, it would take a long time to read all the lines. In addition to making events processed slower than necessary, this caused a problem for the pong watcher. Since the lines was processed so slow, it might take a long time until we process the pong message when the queue was large. This caused the script to disconnect the websocket since it didn't see the pong messages in time. To fix this, we run websocket receive in receive_ws_callback until there are no more messages. The messages are just added to the eventrouter queue, not processed right away, so this shouldn't cause performance issues.
* Reconnect if no pong is received for 12 secondsTrygve Aaberge2019-04-232-7/+25
| | | | | | | 12 seconds is a bit more than twice the amount of time between the pings we send. Fixes #238, fixes #480, fixes #561
* Don't connect to rtm multiple times simultaneouslyTrygve Aaberge2019-04-231-9/+11
|
* Call rtm.connect instead of rtm.start on reconnectTrygve Aaberge2019-04-231-5/+18
|
* Close websocket connection on shutdownTrygve Aaberge2019-04-231-0/+2
|
* Print connected message after websocket is connectedTrygve Aaberge2019-04-231-4/+4
|
* Connect explicitly in handle_rtmstartTrygve Aaberge2019-04-231-1/+2
| | | | Instead of waiting for reconnect_if_disconnected to call connect.
* Catch socket errors when sending pingTrygve Aaberge2019-04-231-2/+5
| | | | | | Also check that the team is connected before sending ping. Fixes #687
* Create helper for socket error handlingTrygve Aaberge2019-04-231-13/+16
| | | | | Changes send_to_websocket to handle the same errors as receive_ws_callback.
* Catch socket errors in receive_ws_callbackTrygve Aaberge2019-04-231-6/+11
|
* Enable testing in python 3 on TravisTrygve Aaberge2019-04-081-0/+2
| | | | | Use Ubuntu Xenial (16.04), since the default (Trusty, 14.04) doesn't have python 3.7.
* Use default python for generate_docs.pyTrygve Aaberge2019-04-081-1/+1
| | | | It can now be run with either python 2 or 3.
* Various fixes for python 3Trygve Aaberge2019-04-081-3/+3
|
* Use raw strings for regexesTrygve Aaberge2019-04-081-4/+4
|
* Cleanup tests and make them compatible with python 3Trygve Aaberge2019-04-0814-254/+157
| | | | | | This mainly adds team, channel_general and user_alice as fixtures, so we can use those directly instead of picking arbitrary ones from the lists. It also adds assertions to some tests which where missing it.
* Delete testsTrygve Aaberge2019-04-086-126/+0
| | | | These tests don't do any assertions, so they are not very useful.
* Miscellaneous Python 3 compatibility fixesSamuel Holland2019-04-081-2/+9
|
* Don't use iter or view functionsTrygve Aaberge2019-04-081-17/+15
| | | | | | Python 3 doesn't have these functions, but returns iterables and views by default. For python 2 this may have a small performance impact, but probably not much.
* Make encode_to/decode_from_utf8 noop in python 3Trygve Aaberge2019-04-082-51/+76
| | | | | | | Python 3 receives unicode strings as arguments in weechat callbacks, websocet receive etc. and we can send unicode strings to weechat functions, websocket etc., so we don't need to do any of this converting.
* Implement the new comparison methods for SlackTSSamuel Holland2019-04-081-0/+15
| | | | | | Python 3 no longer respects __cmp__, as it has more fine-grained hooks for ordering/comparison. To minimize code changes, implement them in terms of the existing __cmp__ method.
* Make PluginConfig getattr compatible with Python 3Samuel Holland2019-04-081-7/+10
| | | | | | __getattr__ is expected to raise AttributeError, not KeyError. The removal of the call to hasattr() also speeds up fetch_setting().
* Remember plugin config values in FakeWeechatSamuel Holland2019-04-081-3/+4
| | | | | | PluginConfig uses round-tripping through wee_slack.w to coerce the its default values to the correct type. Without this, the normal getters fail, as '' cannot be converted to an integer/boolean.
* Make SHA1 hashing work on both Python 2 and 3Samuel Holland2019-04-081-5/+7
| | | | | Use sha1 from the hashlib module, and factor out a helper function that makes sure the argument to sha1 is a bytestring.
* Import urllib classes in a way compatible with Python 3Samuel Holland2019-04-081-2/+6
| | | | Try both the old and the new locations.
* Use StringIO from ioTrygve Aaberge2019-04-082-4/+3
| | | | | This is compatible with python 3, which StringIO from StringIO or cStringIO is not.
* Import print_function and unicode_literals in all test filesTrygve Aaberge2019-04-0824-15/+34
|
* Always use the print function from Python 3Samuel Holland2019-04-0814-62/+84
| | | | Comments are updated as well as live code.
* Don't serialize request metadataTrygve Aaberge2019-04-082-28/+17
| | | | | It seems pointless to serialize request metadata first with pickle, then pack it into json, just to unpack both afterwards.
* Delete useless testTrygve Aaberge2019-04-081-54/+0
| | | | | This test doesn't do any assertions, and is as far as I can see completely useless.
* Add @user-groups support (#680)Nana Amfo2019-04-089-10/+287
| | | Add @user-groups with tab-completion. @user-groups will be unfurl into format <!subteam^{ID}|handle> message before sending message via linktext method.
* Inform about retry limit in failed connection messageTrygve Aaberge2019-04-041-3/+5
| | | | | | If wee-slack has tried to connect too many times, it will give up. Inform about this in the error message, instead of keep saying that it will try to reconnect.
* Remove channel parameter from linkify_textTrygve Aaberge2019-04-032-18/+11
| | | | This parameter is not used in the function.
* Keep text directly after @channel/group/here when linkifyingTrygve Aaberge2019-04-022-1/+17
| | | | Previously, when writing e.g. `@channel: test` the colon would be lost.
* Sort options when generating Options.mdTrygve Aaberge2019-04-023-84/+91
|
* Implement -all parameter for /away commandTrygve Aaberge2019-03-261-5/+10
| | | | | | Away/back will be set for all slack teams if -all is used. Closes #596
* Improve detection of incoming formatting charactersTrygve Aaberge2019-03-261-6/+8
| | | | | | | | | | This replaces the trailing whitespace match with a non-consuming lookahead so that strings like '*one* *two*' match correctly, and uses \w instead of hard coded ascii characters. This is taken from #359 and updated. Closes #359
* Correctly handle group join/leave eventsDavid Vo2019-03-261-1/+5
|
* Upload file to thread instead of channel when in thread bufferEric Wang2019-03-261-2/+12
| | | | | | | | Currently files are always uploaded to the main channel, even when `/slack upload` is run in a thread buffer. This happens because the `thread_ts` field isn't included in the upload request. Fixes #672
* Ping websocket connection every five secondsTrygve Aaberge2019-03-131-1/+10
| | | | | | | | | | | | | | | | | | | | | Thanks to @celsworth and @micolous for pointing out that Slack now requires this for some teams. From https://github.com/slackapi/python-slackclient/issues/118#issuecomment-348731791: I've observed that some Slack teams have (recently) been opted into an experiment (by SlackHQ) which requires that ping messages are sent by RTM clients, otherwise they will be disconnected after 2-3 minutes. This is more frequently than the other reporters, and has only become an issue in the last 4 days for me. However, this experiment has only been applied to a limited number of teams (I see only one team with the issue and all others without, even when running the same bot code), which don't appear to correlate with age of the team. May partly fix #679, but that seems to also be caused by an issue in websocket-client.
* Check if user exists before updating statusTrygve Aaberge2019-03-051-4/+6
| | | | | | The team may have external users (i.e. guests or users from other teams), which we don't store in the team user list, so ignore status updates for those.
* Add ability to open last thread in channel without specifying message idTomas Varneckas2019-02-232-8/+21
|
* Decode formatted exceptions from utf8Trygve Aaberge2019-02-191-11/+20
| | | | | | | | | Trying to concat exceptions containing non-ascii chars with our own message failed with a UnicodeDecodeError. We have to decode them to unicode strings first. This includes some helper methods for that, one which includes the traceback, and one which only has the error. Fixes #593
* Only print one line after connecting to a teamTrygve Aaberge2019-02-151-8/+2
|