Version 0.2.4

- Can now configure a room on the invite-room node (instead of having to pass it in on the msg)
- Changed how the connection event was handled by nodes
- matrix-synapse-join-room node was broken (was trying to access a variable that was never defined).
- olm library updated to 3.2.1 to hopefully fix "account.generate_fallback_key is not a function" Fixes #26
- Added description to the server configuration node that describes how to create a user for use with this module
- Update link to create room api for matrix-create-room.html
This commit is contained in:
2021-09-20 09:24:40 -06:00
parent aaecaaec39
commit cf1bd78ee1
9 changed files with 700 additions and 647 deletions
+18 -7
View File
@@ -43,9 +43,13 @@ module.exports = function(RED) {
} else if(!this.userId) {
node.log("Matrix connection failed: missing user ID.");
} else {
node.setConnected = function(connected) {
node.setConnected = function(connected, cb) {
if (node.connected !== connected) {
node.connected = connected;
if(typeof cb === 'function') {
cb(connected);
}
if (connected) {
node.log("Matrix server connection ready.");
node.emit("connected");
@@ -131,20 +135,27 @@ module.exports = function(RED) {
node.matrixClient.on("sync", async function(state, prevState, data) {
switch (state) {
case "ERROR":
node.error("Connection to Matrix server lost");
node.setConnected(false);
node.setConnected(false, function(){
node.error("Connection to Matrix server lost");
});
break;
case "RECONNECTING":
node.setConnected(false, function(){
node.log("Trying to reconnect to matrix server");
});
break;
case "STOPPED":
node.setConnected(false);
node.setConnected(false, function(){
node.log("Matrix client stopped");
});
break;
case "SYNCING":
break;
case "PREPARED":
node.setConnected(true);
node.setConnected(true, function(){
node.log("Matrix client connected");
});
break;
// case "PREPARED":