Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// console.log(req);
if (!isAuthenticated(req)) {
res.end();
return;
}
// console.log(req.body);
SELECTED_CHATTER = req.body.to;
message = req.body.message;
if (SELECTED_CHATTER.indexOf('chat') > -1) {
getChatFriendlyName(req, SELECTED_CHATTER, function(friendlyChatterName) {
imessagemodule.sendMessage(friendlyChatterName, message);
}.bind(this))
} else {
imessagemodule.sendMessage(SELECTED_CHATTER, message);
}
res.send("true");
});
function sendMessage(to, message) {
if (sending) { return; }
sending = true;
if (GROUPCHAT_SELECTED) {
imessagemodule.sendMessage(SELECTED_GROUP.split('-chat')[0], message);
} else {
imessagemodule.sendMessage(to, message);
}
sending = false;
}
function sendMessage(to, message) {
if (sending) { return; }
sending = true;
if (GROUPCHAT_SELECTED) {
imessagemodule.sendMessage(SELECTED_GROUP.split('-chat')[0], message);
} else {
imessagemodule.sendMessage(to, message);
}
sending = false;
}
getChatFriendlyName(req, SELECTED_CHATTER, function(friendlyChatterName) {
imessagemodule.sendMessage(friendlyChatterName, message);
}.bind(this))
} else {