Commit graph

182 commits

Author SHA1 Message Date
rht 2d9cf64db8 slack-bridge: Use slack_sdk instead of the deprecated slackclient. 2021-05-24 14:17:38 -07:00
Anders Kaseorg 83d4a0c217 sync-public-streams: Rewrite using an event queue.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-06 23:36:35 -07:00
Anders Kaseorg 15c46dce46 sync-public-streams: Fix for Python 3.
bytes are not JSON serializable.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-06 23:36:35 -07:00
Tim Abbott 4627b07396 zephyr: Decrease update frequency of sync-public-streams. 2021-04-06 15:15:42 -07:00
rht 57e8886dfe API: Rename list_subscriptions to get_subscriptions. 2021-03-11 00:00:56 -08:00
Anders Kaseorg 503e8ed82d zephyr: Attempt to fix types.
The mirror has some chance of running on Python 3 now, once the
python-zephyr patch is rebased on 0.2.1, though it’s untested.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-10 23:59:15 -08:00
Anders Kaseorg 34012a4015 mypy: Add stubs for zephyr.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-10 23:59:15 -08:00
Anders Kaseorg 717a549f4b mypy: Prohibit unreachable code.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-04 15:17:09 -08:00
Anders Kaseorg 30f241a126 mypy: Remove unused type: ignore comments.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-04 15:09:58 -08:00
Anders Kaseorg 5b5fda2354 Fix % formatting without a tuple.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-04 15:04:38 -08:00
Unam LN 984d9151d5
bots: Fix RSS bot for Python 3.x support.
- Call `super()` in the init method.
- Change return hashlib.md5 syntax to encode properly for Python 3

Signed-off-by: Manu LN <manu+github@lacavernedemanu.fr>
2020-12-22 16:34:32 -08:00
Tim Abbott 59a0a912a8 process_ccache: Update path to Zulip supervisord files. 2020-12-20 11:46:24 -08:00
Steve Howell f100ab07aa jabber mirror: Remove code for occupy/vacate events.
The server no longer sends occupy/vacate events
for streams.

The mirror should continue to work fine by processing
subsription-related events.
2020-10-20 11:21:44 -07:00
rht e992f14522 slack-bridge: Use WebClient to post message in Slack. 2020-08-25 15:55:25 -07:00
rht 47a4f258d7 slack-bridge: Update processing of members list according to new API. 2020-08-25 15:55:25 -07:00
rht 89d0dd56b9 slack-bridge: Fall back to real_name when display_name is empty.
This will intentionally raise exception when a real_name field of a user
is empty.
2020-08-25 15:55:25 -07:00
rht 02867979ee bridge: Initialize bridge_with_slack. 2020-08-25 15:55:25 -07:00
rht f529bc0d01 IRC bridge: Add documentation on nick password. 2020-08-10 17:12:04 -07:00
rht fe2a4d6fe8 [BUGFIX] IRC bridge: Use connection initialized from aio_reactor.
Additionally, pin the irc library version to 18.0 because the newer
version has an error in the AioReactor:
```
  File "/home/rht/code/venv/lib/python3.8/site-packages/irc/bot.py", line 108, in run
    self.bot.reactor.scheduler.execute_after(intvl, self.check)
AttributeError: 'AioReactor' object has no attribute 'scheduler'
```
2020-08-10 17:12:04 -07:00
Alex Vandiver 7a7cfe637e zephyr: Mark the infinite loops as NoReturn. 2020-08-10 15:07:01 -07:00
Alex Vandiver a20c9cc6d7 zephyr: Use exponential backoffs in retry loops.
This reduces the number of retries that might spam APIs.

There is some complexity here which is left un-managed -- for
instance, maybe_restart_mirroring_script does a number of restart
attempts, and then fails, but will be retried every 15s by the
surrounding `process_loop`.  Previously, it would merely have looped
forever inside maybe_restart_mirroring_script.

Three loops are intentionally left as infinite `while True` loops,
that merely cap their backoff at the default 90s.  Their callers do
not expect, or have any way to handle more gracefully, a failure of
the expected-infinite-loop in `process_loop` or `zulip_to_zephyr`.
They maintain their previous behavior of retrying forever, albeit more
slowly.
2020-08-10 15:07:01 -07:00
rht 8670cce8e9 Matrix bridge: Change the condition of not_from_zulip_bot. 2020-08-07 08:15:07 -04:00
Anders Kaseorg 396ef1d11a Update zulipchat.com emails to zulip.com.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-11 21:06:58 -07:00
Anders Kaseorg 5f81eb3a70 Update zulipchat.com links to zulip.com.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-11 21:06:58 -07:00
Anders Kaseorg f616b9259e irc_mirror_backend: Remove repeated dictionary key.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg 17cf26aa1f cleanup: Move line breaks before binary operators.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg bd9bb0a4e8 cleanup: Fix indentation.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg 54b2578204 cleanup: Remove unused variables.
Generated by autoflake.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg 2f6623bbc4 cleanup: Remove unused imports.
Generated by autoflake.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg 5428c5f296 typing: Convert function type annotations to Python 3 style.
Generated by com2ann (slightly patched to avoid also converting
assignment type annotations, which require Python 3.6), followed by
some manual whitespace adjustment, and two fixes for use-before-define
issues:

-    def set_zulip_client(self, zulipToJabberClient: ZulipToJabberBot) -> None:
+    def set_zulip_client(self, zulipToJabberClient: 'ZulipToJabberBot') -> None:

-def init_from_options(options: Any, client: Optional[str] = None) -> Client:
+def init_from_options(options: Any, client: Optional[str] = None) -> 'Client':

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg fe72f3b131 typing: Remove ‘if False’ guard for typing imports.
typing is in the Python 3.5 standard library.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg 953709fdd5 log2zulip: Adjust for zulip setup_path_on_import → setup_path change.
687553a661

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg d68437d5f5 Rewrite some strings using raw string syntax.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 15:04:36 -07:00
Anders Kaseorg e30b3b094b Modernize legacy Python 2 syntax with pyupgrade.
Generated by `pyupgrade --py3-plus --keep-percent-format` followed by
manual indentation fixes.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 15:04:36 -07:00
rht f47559e68d bridge_between_zulips: Replace "subject" with "topic" in doc. 2020-04-07 16:20:19 -07:00
rht ceda54b50c bridge_between_zulips: Add explanation of --stream to README.md. 2020-04-07 16:20:19 -07:00
rht 439c096eac Remove all remaining six imports. 2020-04-03 08:18:08 -04:00
rht 9ee8461b9d bridges: Remove sender field from message data.
For the reason why, see
https://chat.zulip.org/#narrow/stream/127-integrations/topic/bridge.20between.20zulips
2020-04-03 06:19:22 -04:00
rht 46c78ce7b5 integrations: Remove usage of six. 2020-04-02 13:02:28 -04:00
rht 1412403037 integrations: Remove from __future__ imports. 2020-04-02 13:02:28 -04:00
rht a465467388 integrations: Switch to python3. 2020-04-02 13:02:28 -04:00
orientor d8157d6b80 bridge_with_irc: Initialize IRC bot after checking Zulip bot.
Confirm whether Zulip bot is subscribed to the required stream
first and then Initialize IRC bot object.
2020-03-30 17:41:14 -04:00
orientor de40005f5e bridge_with_irc: Improve user-friendliness.
Edit error and success messages of zulip-irc bridge to be more
user friendly.
2020-03-30 17:41:14 -04:00
rht b771bacac0 bridge_with_irc: Check if bot is subscribed to stream at startup. 2020-03-27 06:59:29 -04:00
neiljp (Neil Pilgrim) 60984ab2fa mypy: Add type ignores for mixing of str & bytes in zephyr mirror.
In principle these should be fixed properly, but the zephyr code is
difficult to test except in a production setting and is unlikely to be
heavily developed in future.
2020-03-24 21:25:45 -07:00
neiljp (Neil Pilgrim) 436b619021 integrations: Use universal_newlines in check_output to output as str.
Picked up by mypy; otherwise output is in bytes (at least on python 3).
2020-03-24 21:25:45 -07:00
neiljp (Neil Pilgrim) f81843f189 mypy: Clarify type hints in zulip/integrations/. 2020-03-24 21:25:45 -07:00
rht 8a74f576a3 python: Remove per-file copyright notices.
These notices are redundant and obscure what are often very short
example scripts.
2020-03-23 12:52:52 -07:00
orientor 731eb23c9a bridge_with_irc: Print message on successful connection. 2020-03-02 05:51:54 -05:00
Sutou Kouhei 843b21769a twitter: Add support for phrase.
Twitter supports phrase search by quoting terms such as "Zulip API".

If we use the feature, the current twitter-bot can't detect used
search phrase. We can detect used search phrase with this change.
2020-01-14 15:58:08 -08:00