diff --git a/src/matrix-receive.js b/src/matrix-receive.js index f69225b..27c7ce9 100644 --- a/src/matrix-receive.js +++ b/src/matrix-receive.js @@ -32,6 +32,12 @@ module.exports = function(RED) { node.status({ fill: "green", shape: "ring", text: "connected" }); }); + + node.server.on("Room.invite", async function(msg) { + node.send(msg); + }); + + node.server.on("Room.timeline", async function(event, room, toStartOfTimeline, removed, data, msg) { // if node has a room ID set we only listen on that room if(node.roomIds.length && node.roomIds.indexOf(room.roomId) === -1) { diff --git a/src/matrix-server-config.js b/src/matrix-server-config.js index cd3510c..61ea712 100644 --- a/src/matrix-server-config.js +++ b/src/matrix-server-config.js @@ -260,6 +260,13 @@ module.exports = function(RED) { }); } else { node.log("Got invite to join room " + member.roomId); + let msg = { + type : 'r.invite', + payload : 'Invitation', + userId : member.userId, + topic : member.roomId + }; + node.emit("Room.invite", msg); } } });