Skip to content

Commit c41ead6

Browse files
rhttimabbott
authored andcommitted
Matrix bridge: Rename username to mxid.
The username doesn't include the Matrix homeserver domain name, while the mxid does. Since we change the usage of the old "username" to include the domain, it is incorrect to remain saying it as "username."
1 parent 59fd4f0 commit c41ead6

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

zulip/integrations/bridge_with_matrix/matrix_bridge.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ class Bridge_ZulipFatalException(Exception):
3939

4040
def matrix_login(matrix_client: Any, matrix_config: Dict[str, Any]) -> None:
4141
try:
42-
matrix_client.login_with_password(matrix_config["username"], matrix_config["password"])
42+
matrix_client.login_with_password(matrix_config["mxid"], matrix_config["password"])
4343
except MatrixRequestError as exception:
4444
if exception.code == 403:
45-
raise Bridge_FatalMatrixException("Bad username or password.")
45+
raise Bridge_FatalMatrixException("Bad mxid or password.")
4646
else:
4747
raise Bridge_FatalMatrixException("Check if your server details are correct.")
4848
except MissingSchema:
@@ -77,7 +77,7 @@ def _matrix_to_zulip(room: Any, event: Dict[str, Any]) -> None:
7777
"""
7878
content = get_message_content_from_event(event, no_noise)
7979

80-
zulip_bot_user = matrix_config["username"]
80+
zulip_bot_user = matrix_config["mxid"]
8181
# We do this to identify the messages generated from Zulip -> Matrix
8282
# and we make sure we don't forward it again to the Zulip stream.
8383
not_from_zulip_bot = event["sender"] != zulip_bot_user
@@ -237,7 +237,7 @@ def write_sample_config(target_path: str, zuliprc: Optional[str]) -> None:
237237
OrderedDict(
238238
(
239239
("host", "https://matrix.org"),
240-
("username", "@username:matrix.org"),
240+
("mxid", "@username:matrix.org"),
241241
("password", "password"),
242242
("room_id", "#zulip:matrix.org"),
243243
)

zulip/integrations/bridge_with_matrix/test_matrix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
sample_config_text = """[matrix]
2020
host = https://matrix.org
21-
username = @username:matrix.org
21+
mxid = @username:matrix.org
2222
password = password
2323
room_id = #zulip:matrix.org
2424

0 commit comments

Comments
 (0)