Ugh this better work, for some reason tags aren't sticking
This commit is contained in:
parent
20cdc13c6c
commit
32d411c8b2
12
main.js
12
main.js
@ -358,7 +358,7 @@ client.login("m.login.password", {"user": settings.matrixuser, "password": setti
|
||||
ournumber = "1" + ournumber;
|
||||
}
|
||||
}
|
||||
logger.info("Got request to start new SMS conversation with " + tel + " from " + event.getSender() + ".");
|
||||
logger.info("Got request to start new SMS conversation with " + tel + " using " + ournumber + " from " + event.getSender() + ".");
|
||||
sendMatrixNotice(event.getRoomId(), "Starting conversation with " + tel);
|
||||
createOrJoinSMSRoom(tel, ournumber, function (roomid) {
|
||||
//client.setRoomTag(roomid, "com.netsyms.matrix-bridge-voxtelesys.sms", {tel: tel, ournumber: ournumber});
|
||||
@ -366,14 +366,20 @@ client.login("m.login.password", {"user": settings.matrixuser, "password": setti
|
||||
}
|
||||
return;
|
||||
}
|
||||
const matches = room.name.match(/([1-9][0-9]+)/g);
|
||||
const matches = room.name.match(/SMS_([1-9][0-9]+)_?([1-9][0-9]+)?/);
|
||||
if (matches.length == 1) {
|
||||
// old room pre-multi number support
|
||||
var tel = matches[0];
|
||||
logger.info("Got message for " + tel + " from " + event.getSender() + ", relaying.");
|
||||
sendSMS(tel, settings.smsfrom, sevent.getContent().body, function () {
|
||||
client.sendReadReceipt(event, {});
|
||||
});
|
||||
} else if (matches.length == 2) {
|
||||
var tel = matches[0];
|
||||
var from = matches[1];
|
||||
logger.info("Got message for " + tel + " from " + event.getSender() + ", relaying to " + from + ".");
|
||||
sendSMS(tel, from, sevent.getContent().body, function () {
|
||||
client.sendReadReceipt(event, {});
|
||||
});
|
||||
} else {
|
||||
client.getRoomTags(event.getRoomId()).then((response) => {
|
||||
if (typeof response.tags["com.netsyms.matrix-bridge-voxtelesys.sms"] != "undefined") {
|
||||
|
Loading…
x
Reference in New Issue
Block a user