From 4c9134815c7c9fd8360236b026a37f92a3859065 Mon Sep 17 00:00:00 2001 From: Rhea Parekh Date: Mon, 21 May 2018 20:48:30 +0530 Subject: [PATCH] Matrix: Make minor changes to README.md and config. --- zulip/integrations/matrix/README.md | 11 ++++++----- zulip/integrations/matrix/matrix_bridge.py | 4 ++-- zulip/integrations/matrix/matrix_bridge_config.py | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/zulip/integrations/matrix/README.md b/zulip/integrations/matrix/README.md index 6d6f1a4..67477b9 100644 --- a/zulip/integrations/matrix/README.md +++ b/zulip/integrations/matrix/README.md @@ -18,13 +18,14 @@ Hence, this can also be used as a IRC <--> Zulip bridge. ## Steps to configure the Matrix bridge ### 1. Zulip endpoint -1. Create a generic Zulip bot -2. (don't forget this step!) Make sure the bot is subscribed to the relevant stream -2. Enter the bot's email and `api_key` into `matrix_bridge_config.py` -3. Enter the destination subject, realm and site in `matrix_bridge_config.py` +1. Create a generic Zulip bot preferable with a formal name similar to `irc-bot`. +2. (Don't forget this step!) Make sure the bot is subscribed to the relevant stream +3. Enter the bot's email and `api_key` into `matrix_bridge_config.py` +4. Enter the destination topic, stream and site in `matrix_bridge_config.py` ### 2. Matrix endpoint -1. Create a user on [matrix.org](https://matrix.org/) +1. Create a user on [matrix.org](https://matrix.org/) preferably with a formal name +similar to `zulip-bot`. 2. Enter the user's username and password into `matrix_bridge_config.py` 3. Enter the host and `room_id` into `matrix_bridge_config.py` diff --git a/zulip/integrations/matrix/matrix_bridge.py b/zulip/integrations/matrix/matrix_bridge.py index 629a63d..4b4bda8 100644 --- a/zulip/integrations/matrix/matrix_bridge.py +++ b/zulip/integrations/matrix/matrix_bridge.py @@ -70,7 +70,7 @@ def matrix_to_zulip(zulip_client: zulip.Client, zulip_config: Dict[str, Any], "sender": zulip_client.email, "type": "stream", "to": zulip_config["stream"], - "subject": zulip_config["subject"], + "subject": zulip_config["topic"], "content": content, }) except MatrixRequestError as e: @@ -137,7 +137,7 @@ def zulip_to_matrix(config: Dict[str, Any], room: Any) -> Callable[[Dict[str, An def check_zulip_message_validity(msg: Dict[str, Any], config: Dict[str, Any]) -> bool: is_a_stream = msg["type"] == "stream" in_the_specified_stream = msg["display_recipient"] == config["stream"] - at_the_specified_subject = msg["subject"] == config["subject"] + at_the_specified_subject = msg["subject"] == config["topic"] # We do this to identify the messages generated from Matrix -> Zulip # and we make sure we don't forward it again to the Matrix. diff --git a/zulip/integrations/matrix/matrix_bridge_config.py b/zulip/integrations/matrix/matrix_bridge_config.py index 4b05ed8..ca8e251 100644 --- a/zulip/integrations/matrix/matrix_bridge_config.py +++ b/zulip/integrations/matrix/matrix_bridge_config.py @@ -10,6 +10,6 @@ config = { "api_key": "aPiKeY", "site": "https://chat.zulip.org", "stream": "test here", - "subject": "matrix" + "topic": "matrix" } }