From 131ea90c8fe94a8b05c2c76dbc3c64d3785725e1 Mon Sep 17 00:00:00 2001 From: Adhidarma Hadiwinoto <me@adhisimon.org> Date: Thu, 27 Oct 2016 14:22:51 +0700 Subject: [PATCH] jangan kirim pesan jika destination atau msg kosong --- adaptor-xmpp.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/adaptor-xmpp.js b/adaptor-xmpp.js index a278b85..871101f 100644 --- a/adaptor-xmpp.js +++ b/adaptor-xmpp.js @@ -102,6 +102,15 @@ function setOptions(options) { } function sendMessage(destination, msg) { + if (!destination) { + logger.warn('adaptorXmpp.sendMessage: Undefined destination, send message aborted', {destination: destination, msg: msg}); + } + + if (!msg) { + logger.warn('adaptorXmpp.sendMessage: Undefined message, send message aborted', {destination: destination, msg: msg}); + } + + if (destination.toLowerCase() != username.replace(/\/.*/, '').toLowerCase()) { logger.verbose('Sending message', {from: username, destination: destination, msg: msg}); } -- 1.9.0