diff --git a/changelog.d/1663.feature b/changelog.d/1663.feature new file mode 100644 index 000000000..7092275bf --- /dev/null +++ b/changelog.d/1663.feature @@ -0,0 +1,2 @@ +- New PM rooms are configured to disable calls, reactions, redactions, and stickers; + as they could not be bridged anyway. diff --git a/changelog.d/1683.feature b/changelog.d/1683.feature new file mode 100644 index 000000000..d2c29d2e3 --- /dev/null +++ b/changelog.d/1683.feature @@ -0,0 +1 @@ +* Implement MSC2346 (bridge info state event) for PMs diff --git a/changelog.d/1709.bugfix b/changelog.d/1709.bugfix new file mode 100644 index 000000000..b22188042 --- /dev/null +++ b/changelog.d/1709.bugfix @@ -0,0 +1 @@ +Fix the bridge pooling so it supports TLS. \ No newline at end of file diff --git a/changelog.d/1711.bugfix b/changelog.d/1711.bugfix new file mode 100644 index 000000000..3dfd1ae74 --- /dev/null +++ b/changelog.d/1711.bugfix @@ -0,0 +1 @@ +Fix setup widget failing to authenticate. diff --git a/changelog.d/1715.bugfix b/changelog.d/1715.bugfix new file mode 100644 index 000000000..3cca2e732 --- /dev/null +++ b/changelog.d/1715.bugfix @@ -0,0 +1 @@ +Sort the list of channels in !listrooms output. diff --git a/package.json b/package.json index 27383b11b..e492e555e 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "matrix-appservice-bridge": "^9.0.0", "matrix-bot-sdk": "npm:@vector-im/matrix-bot-sdk@^0.6.6-element.1", "matrix-org-irc": "^2.0.0", - "matrix-widget-api": "^1.1.1", + "matrix-widget-api": "^1.4.0", "nopt": "^6.0.0", "p-queue": "^6.6.2", "pg": "^8.8.0", diff --git a/spec/integ/pm.spec.js b/spec/integ/pm.spec.js index 48aff4f46..b5a7e7c85 100644 --- a/spec/integ/pm.spec.js +++ b/spec/integ/pm.spec.js @@ -24,7 +24,7 @@ describe("Matrix-to-IRC PMing", () => { afterEach(async () => test.afterEach(env)); - it("should join 1:1 rooms invited from matrix", async () => { + async function testJoinPmRoom(enableBrigeInfoState) { // get the ball rolling const requestPromise = env.mockAppService._trigger("type:m.room.member", { content: { @@ -64,6 +64,33 @@ describe("Matrix-to-IRC PMing", () => { await joinRoomPromise; await requestPromise; + + if (enableBrigeInfoState) { + expect(intent.underlyingClient.sendStateEvent).toHaveBeenCalledWith( + roomMapping.roomId, + "uk.half-shot.bridge", + "org.matrix.appservice-irc:/irc.example/someone", + { + bridgebot: '@monkeybot:some.home.server', + protocol: { id: 'irc', displayname: 'IRC' }, + channel: { id: 'someone' }, + network: { id: 'irc.example', displayname: '', avatar_url: undefined }} + ); + } + else { + expect(intent.underlyingClient.sendStateEvent).not.toHaveBeenCalled(); + } + } + + it("should join 1:1 rooms invited from matrix (without bridge info)", async () => { + await testJoinPmRoom(false); + }); + + it("should join 1:1 rooms invited from matrix (with bridge info)", async () => { + config.ircService.bridgeInfoState = {enabled: true, initial: false}; + await env.ircBridge.onConfigChanged(config); + + await testJoinPmRoom(true); }); it("should join group chat rooms invited from matrix then leave them", async () => { @@ -262,33 +289,59 @@ describe("IRC-to-Matrix PMing", () => { afterEach(async () => test.afterEach(env)); - it("should create a 1:1 matrix room and invite the real matrix user when " + - "it receives a PM directed at a virtual user from a real IRC user", async () => { + async function testPmRoomCreation(enableBrigeInfoState) { // mock create room impl + const expectedInitialState = [{ + type: "m.room.power_levels", + state_key: "", + content: { + users: { + "@alice:anotherhomeserver": 10, + "@irc.example_bob:some.home.server": 100 + }, + events: { + "m.room.avatar": 10, + "m.room.name": 10, + "m.room.canonical_alias": 100, + "m.room.history_visibility": 100, + "m.room.power_levels": 100, + "m.room.encryption": 100, + "org.matrix.msc3401.call": 100, + "org.matrix.msc3401.call.member": 100, + "im.vector.modular.widgets": 100, + "io.element.voice_broadcast_info": 100, + "m.call.invite": 100, + "m.call.candidate": 100, + "m.reaction": 100, + "m.room.redaction": 100, + "m.sticker": 100, + }, + invite: 100, + redact: 100, + }, + }]; + if (enableBrigeInfoState) { + expectedInitialState.push({ + type: "uk.half-shot.bridge", + state_key: "org.matrix.appservice-irc:/irc.example/bob", + content: { + bridgebot: '@monkeybot:some.home.server', + protocol: { id: 'irc', displayname: 'IRC' }, + channel: { id: 'bob' }, + network: { + id: 'irc.example', + displayname: '', + avatar_url: undefined, + } + } + }); + } const createRoomPromise = new Promise((resolve) => { sdk.createRoom.and.callFake((opts) => { expect(opts.visibility).toEqual("private"); expect(opts.creation_content["m.federate"]).toEqual(true); expect(opts.preset).not.toBeDefined(); - expect(opts.initial_state).toEqual([{ - type: "m.room.power_levels", - state_key: "", - content: { - users: { - "@alice:anotherhomeserver": 10, - "@irc.example_bob:some.home.server": 100 - }, - events: { - "m.room.avatar": 10, - "m.room.name": 10, - "m.room.canonical_alias": 100, - "m.room.history_visibility": 100, - "m.room.power_levels": 100, - "m.room.encryption": 100 - }, - invite: 100 - }, - }]); + expect(opts.initial_state).toEqual(expectedInitialState); resolve(); return tCreatedRoomId; }); @@ -318,6 +371,19 @@ describe("IRC-to-Matrix PMing", () => { await createRoomPromise; await sentMessagePromise; + } + + it("should create a 1:1 matrix room and invite the real matrix user when " + + "it receives a PM directed at a virtual user from a real IRC user (without bridge info)", async () => { + await testPmRoomCreation(false) + }); + + it("should create a 1:1 matrix room and invite the real matrix user when " + + "it receives a PM directed at a virtual user from a real IRC user (with bridge info)", async () => { + config.ircService.bridgeInfoState = {enabled: true, initial: false}; + await env.ircBridge.onConfigChanged(config); + + await testPmRoomCreation(true) }); it("should not create multiple matrix rooms when several PMs are received in quick succession", async () => { diff --git a/src/bridge/AdminRoomHandler.ts b/src/bridge/AdminRoomHandler.ts index 1fc9a5c28..2a13898c7 100644 --- a/src/bridge/AdminRoomHandler.ts +++ b/src/bridge/AdminRoomHandler.ts @@ -601,7 +601,7 @@ export class AdminRoomHandler { let chanList = `You are joined to ${client.chanList.size} rooms: \n\n`; let chanListHTML = `

You are joined to ${client.chanList.size} rooms: