mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Added device state notifications to messaging applications.
This commit is contained in:
parent
1e45b69ca7
commit
1a6e78efed
3 changed files with 263 additions and 16 deletions
|
@ -2302,7 +2302,7 @@ function CreateMeshCentralServer(config, args) {
|
|||
const domainId = meshSplit[1];
|
||||
if (obj.config.domains[domainId] == null) return;
|
||||
const mailserver = obj.config.domains[domainId].mailserver;
|
||||
if (mailserver == null) return;
|
||||
if ((mailserver == null) && (obj.msgserver == null)) return;
|
||||
|
||||
// Get the device group for this device
|
||||
const mesh = obj.webserver.meshes[meshid];
|
||||
|
@ -2335,7 +2335,8 @@ function CreateMeshCentralServer(config, args) {
|
|||
if (user.notify[nodeid] != null) { notify |= user.notify[nodeid]; }
|
||||
}
|
||||
|
||||
if ((notify & 48) != 0) {
|
||||
// Email notifications
|
||||
if ((mailserver != null) && ((notify & 48) != 0)) {
|
||||
if (stateSet == true) {
|
||||
if ((notify & 16) != 0) {
|
||||
mailserver.notifyDeviceConnect(user, meshid, nodeid, connectTime, connectType, powerState, serverid, extraInfo);
|
||||
|
@ -2351,6 +2352,24 @@ function CreateMeshCentralServer(config, args) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Messaging notifications
|
||||
if ((obj.msgserver != null) && ((notify & 384) != 0)) {
|
||||
if (stateSet == true) {
|
||||
if ((notify & 128) != 0) {
|
||||
obj.msgserver.notifyDeviceConnect(user, meshid, nodeid, connectTime, connectType, powerState, serverid, extraInfo);
|
||||
} else {
|
||||
obj.msgserver.cancelNotifyDeviceDisconnect(user, meshid, nodeid, connectTime, connectType, powerState, serverid, extraInfo);
|
||||
}
|
||||
}
|
||||
else if (stateSet == false) {
|
||||
if ((notify & 256) != 0) {
|
||||
obj.msgserver.notifyDeviceDisconnect(user, meshid, nodeid, connectTime, connectType, powerState, serverid, extraInfo);
|
||||
} else {
|
||||
obj.msgserver.cancelNotifyDeviceConnect(user, meshid, nodeid, connectTime, connectType, powerState, serverid, extraInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue