Pass invites to the receive object
This commit passes a room invite to the receive node, so you can react to it. Sample invitation: HDsvcHGiTYFxxxxxxx:mydomain.de : msg : Object object type: "r.invite" payload: "Invitation" userId: "@relay:mydomain.de" topic: "!HDsvcHGiTYFxxxxxxx:mydomain.de" _msgid: "ef1fd7f3c8ae82e6"
This commit is contained in:
parent
4c17a21008
commit
908d60835d
@ -32,6 +32,12 @@ module.exports = function(RED) {
|
|||||||
node.status({ fill: "green", shape: "ring", text: "connected" });
|
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) {
|
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 has a room ID set we only listen on that room
|
||||||
if(node.roomIds.length && node.roomIds.indexOf(room.roomId) === -1) {
|
if(node.roomIds.length && node.roomIds.indexOf(room.roomId) === -1) {
|
||||||
|
@ -239,6 +239,13 @@ module.exports = function(RED) {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
node.log("Got invite to join room " + member.roomId);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user