Skip to content

Commit 83e444d

Browse files
committed
[WIP] Enhanced matrix bridge.
1 parent 1ca696e commit 83e444d

File tree

6 files changed

+504
-236
lines changed

6 files changed

+504
-236
lines changed
Lines changed: 53 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
# Matrix <--> Zulip bridge
22

3-
This acts as a bridge between Matrix and Zulip. It also enables a
4-
Zulip topic to be federated between two Zulip servers.
3+
This acts as a bridge between Matrix and Zulip.
54

6-
## Usage
5+
### Enhanced Features
6+
- Supporting multiple (Zulip topic, Matrix channel)-pairs.
7+
- Handling files according to their mimetype.
78

8-
### For IRC bridges
99

10-
Matrix has been bridged to the listed
11-
[IRC networks](https://github.com/matrix-org/matrix-appservice-irc/wiki/Bridged-IRC-networks),
12-
where the 'Room alias format' refers to the `room_id` for the corresponding IRC channel.
10+
## Installation
1311

14-
For example, for the freenode channel `#zulip-test`, the `room_id` would be
15-
`#freenode_#zulip-test:matrix.org`.
12+
In case you'd like encryption to work, you need pip to install the `matrix-nio`
13+
package with e2e support: `matrix-nio[e2e]`. Caution: you have to install the
14+
development files of the `libolm` C-library first! Please refer to [the
15+
corresponding documentation of matrix-nio](https://github.com/poljar/matrix-nio#installation).
1616

17-
Hence, this can also be used as a IRC <--> Zulip bridge.
1817

1918
## Steps to configure the Matrix bridge
2019

@@ -27,20 +26,37 @@ details mentioned below. For example:
2726
* If you are running from the Zulip GitHub repo: `python matrix_bridge.py --write-sample-config matrix_bridge.conf`
2827

2928
### 1. Zulip endpoint
30-
1. Create a generic Zulip bot, with a full name like `IRC Bot` or `Matrix Bot`.
31-
2. Subscribe the bot user to the stream you'd like to bridge your IRC or Matrix
32-
channel into.
29+
1. Create a generic Zulip bot, with a full name such as `Matrix Bot`.
30+
2. The bot is able to subscribe to the necessary streams itself if they are
31+
public. (It may even create them if they do not exist and if the bot user
32+
has enough rights to create streams.)
33+
Otherwise, you need to add the bot manually.
3334
3. In the `zulip` section of the configuration file, enter the bot's `zuliprc`
3435
details (`email`, `api_key`, and `site`).
3536
4. In the same section, also enter the Zulip `stream` and `topic`.
3637

3738
### 2. Matrix endpoint
38-
1. Create a user on [matrix.org](https://matrix.org/), preferably with
39-
a formal name like to `zulip-bot`.
39+
1. Create a user on the matrix server of your choice, e.g. [matrix.org](https://matrix.org/),
40+
preferably with a formal name like to `zulip-bot`.
4041
2. In the `matrix` section of the configuration file, enter the user's username
41-
and password.
42+
and password. Please use the Matrix user ID ([MXID](https://matrix.org/faq/#what-is-a-mxid%3F))
43+
as format for the username!
4244
3. Also enter the `host` and `room_id` into the same section.
4345

46+
### Adding more (Zulip topic, Matrix channel)-pairs
47+
1. Create a new section with a name starting with `additional_bridge`.
48+
2. Add a `room_id` for the Matrix side and a `stream` and a `topic` for the
49+
Zulip side.
50+
51+
Example:
52+
```
53+
[additional_bridge1]
54+
room_id = #zulip:matrix.org
55+
stream = matrix test
56+
topic = matrix test topic
57+
```
58+
59+
4460
## Running the bridge
4561

4662
After the steps above have been completed, assuming you have the configuration
@@ -50,9 +66,29 @@ in a file called `matrix_bridge.conf`:
5066

5167
* If you are running from the Zulip GitHub repo: run `python matrix_bridge.py -c matrix_bridge.conf`
5268

53-
## Caveats for IRC mirroring
69+
70+
## Notes regarding IRC
71+
72+
### Usage for IRC bridges
73+
74+
Matrix has been bridged to the listed
75+
[IRC networks](https://github.com/matrix-org/matrix-appservice-irc/wiki/Bridged-IRC-networks),
76+
where the 'Room alias format' refers to the `room_id` for the corresponding IRC channel.
77+
78+
For example, for the freenode channel `#zulip-test`, the `room_id` would be
79+
`#freenode_#zulip-test:matrix.org`.
80+
81+
Hence, this can also be used as a IRC <--> Zulip bridge.
82+
83+
### Caveats for IRC mirroring
5484

5585
There are certain
5686
[IRC channels](https://github.com/matrix-org/matrix-appservice-irc/wiki/Channels-from-which-the-IRC-bridge-is-banned)
5787
where the Matrix.org IRC bridge has been banned for technical reasons.
5888
You can't mirror those IRC channels using this integration.
89+
90+
91+
## TODO
92+
93+
- Adding support for editing and deleting messages?
94+
- Handling encryption on the Matrix side (may need further discussion).
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[matrix]
2+
host = https://matrix.org
3+
mxid = @username:matrix.org
4+
password = password
5+
room_id = #zulip:matrix.org
6+
7+
[zulip]
8+
9+
api_key = aPiKeY
10+
site = https://chat.zulip.org
11+
stream = test here
12+
topic = matrix
13+

0 commit comments

Comments
 (0)