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."
This commit is contained in:
parent
59fd4f070a
commit
c41ead698f
|
@ -39,10 +39,10 @@ class Bridge_ZulipFatalException(Exception):
|
||||||
|
|
||||||
def matrix_login(matrix_client: Any, matrix_config: Dict[str, Any]) -> None:
|
def matrix_login(matrix_client: Any, matrix_config: Dict[str, Any]) -> None:
|
||||||
try:
|
try:
|
||||||
matrix_client.login_with_password(matrix_config["username"], matrix_config["password"])
|
matrix_client.login_with_password(matrix_config["mxid"], matrix_config["password"])
|
||||||
except MatrixRequestError as exception:
|
except MatrixRequestError as exception:
|
||||||
if exception.code == 403:
|
if exception.code == 403:
|
||||||
raise Bridge_FatalMatrixException("Bad username or password.")
|
raise Bridge_FatalMatrixException("Bad mxid or password.")
|
||||||
else:
|
else:
|
||||||
raise Bridge_FatalMatrixException("Check if your server details are correct.")
|
raise Bridge_FatalMatrixException("Check if your server details are correct.")
|
||||||
except MissingSchema:
|
except MissingSchema:
|
||||||
|
@ -77,7 +77,7 @@ def matrix_to_zulip(
|
||||||
"""
|
"""
|
||||||
content = get_message_content_from_event(event, no_noise)
|
content = get_message_content_from_event(event, no_noise)
|
||||||
|
|
||||||
zulip_bot_user = matrix_config["username"]
|
zulip_bot_user = matrix_config["mxid"]
|
||||||
# We do this to identify the messages generated from Zulip -> Matrix
|
# We do this to identify the messages generated from Zulip -> Matrix
|
||||||
# and we make sure we don't forward it again to the Zulip stream.
|
# and we make sure we don't forward it again to the Zulip stream.
|
||||||
not_from_zulip_bot = event["sender"] != zulip_bot_user
|
not_from_zulip_bot = event["sender"] != zulip_bot_user
|
||||||
|
@ -237,7 +237,7 @@ def write_sample_config(target_path: str, zuliprc: Optional[str]) -> None:
|
||||||
OrderedDict(
|
OrderedDict(
|
||||||
(
|
(
|
||||||
("host", "https://matrix.org"),
|
("host", "https://matrix.org"),
|
||||||
("username", "@username:matrix.org"),
|
("mxid", "@username:matrix.org"),
|
||||||
("password", "password"),
|
("password", "password"),
|
||||||
("room_id", "#zulip:matrix.org"),
|
("room_id", "#zulip:matrix.org"),
|
||||||
)
|
)
|
||||||
|
|
|
@ -18,7 +18,7 @@ sample_config_path = "matrix_test.conf"
|
||||||
|
|
||||||
sample_config_text = """[matrix]
|
sample_config_text = """[matrix]
|
||||||
host = https://matrix.org
|
host = https://matrix.org
|
||||||
username = @username:matrix.org
|
mxid = @username:matrix.org
|
||||||
password = password
|
password = password
|
||||||
room_id = #zulip:matrix.org
|
room_id = #zulip:matrix.org
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue