Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable userid escaping entirely #768

Merged
merged 3 commits into from
Jun 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/DataStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ DataStore.prototype.getIrcClientConfig = function(userId, domain) {
DataStore.prototype.storeIrcClientConfig = function(config) {
return this._userStore.getMatrixUser(config.getUserId()).then((user) => {
if (!user) {
user = new MatrixUser(config.getUserId(), undefined, false);
user = new MatrixUser(config.getUserId());
}
var userConfig = user.get("client_config") || {};
if (config.getPassword()) {
Expand Down Expand Up @@ -560,7 +560,7 @@ DataStore.prototype.getUserFeatures = function(userId) {
DataStore.prototype.storeUserFeatures = function(userId, features) {
return this._userStore.getMatrixUser(userId).then((matrixUser) => {
if (!matrixUser) {
matrixUser = new MatrixUser(userId, undefined, false);
matrixUser = new MatrixUser(userId);
}
matrixUser.set("features", features);
return this._userStore.setMatrixUser(matrixUser);
Expand Down
11 changes: 8 additions & 3 deletions lib/bridge/IrcBridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ function IrcBridge(config, registration) {
enablePresence: this.config.homeserver.enablePresence,
}
},
// See note below for ESCAPE_DEFAULT
escapeUserIds: false,
roomLinkValidation,
roomUpgradeOpts: {
consumeEvent: true,
Expand All @@ -109,6 +111,9 @@ function IrcBridge(config, registration) {
}
});

// By default the bridge will escape mxids, but the irc bridge isn't ready for this yet.
MatrixUser.ESCAPE_DEFAULT = false;

this._timers = null; // lazy map of Histogram instances used as metrics
if (this.config.ircService.metrics && this.config.ircService.metrics.enabled) {
this._initialiseMetrics();
Expand Down Expand Up @@ -617,8 +622,8 @@ IrcBridge.prototype._onEvent = Promise.coroutine(function*(baseRequest, context)
return BridgeRequest.ERR_NOT_MAPPED;
}
this.ircHandler.onMatrixMemberEvent(event);
var target = new MatrixUser(event.state_key, undefined, false);
var sender = new MatrixUser(event.user_id, undefined, false);
var target = new MatrixUser(event.state_key);
var sender = new MatrixUser(event.user_id);
if (event.content.membership === "invite") {
yield this.matrixHandler.onInvite(request, event, sender, target);
}
Expand Down Expand Up @@ -938,7 +943,7 @@ IrcBridge.prototype.getBridgedClient = Promise.coroutine(function*(server, userI
return bridgedClient;
}

let mxUser = new MatrixUser(userId, undefined, false);
let mxUser = new MatrixUser(userId);
mxUser.setDisplayName(displayName);

// check the database for stored config information for this irc client
Expand Down
2 changes: 1 addition & 1 deletion lib/provisioning/Provisioner.js
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ Provisioner.prototype._doLink = Promise.coroutine(
var bridgeReq = new BridgeRequest(
this._ircBridge._bridge.getRequestFactory().newRequest(), false
);
var target = new MatrixUser(userId, undefined, false);
var target = new MatrixUser(userId);
// inject a fake join event which will do M->I connections and
// therefore sync the member list
yield this._ircBridge.matrixHandler.onJoin(bridgeReq, {
Expand Down
Loading