1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Integrated MeshMessenger for user-to-user.

This commit is contained in:
Ylian Saint-Hilaire 2018-12-01 23:41:57 -08:00
parent e26b643d1d
commit f110a3b61b
9 changed files with 80 additions and 31 deletions

View file

@ -592,6 +592,25 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
var sessions = obj.parent.wssessions[command.userid];
if (sessions != null) { for (i in sessions) { try { sessions[i].send(JSON.stringify(notification)); } catch (ex) { } } }
if (obj.parent.parent.multiServer != null) {
// TODO: Add multi-server support
}
break;
}
case 'meshmessenger':
{
// Send a notification message to a user
if ((user.siteadmin & 2) == 0) break;
if (obj.common.validateString(command.userid, 1, 2048) == false) break;
// Create the notification message
var notification = {
"action": "msg", "type": "notify", "value": "<b>" + user.name + "</b>: Chat Request, Click here to accept.", "userid": user._id, "username": user.name, "tag": 'meshmessenger/' + encodeURIComponent(command.userid) + '/' + encodeURIComponent(user._id) };
// Get the list of sessions for this user
var sessions = obj.parent.wssessions[command.userid];
if (sessions != null) { for (i in sessions) { try { sessions[i].send(JSON.stringify(notification)); } catch (ex) { } } }
if (obj.parent.parent.multiServer != null) {
// TODO: Add multi-server support
}