diff --git a/lib/xmpp-client/client.js b/lib/xmpp-client/client.js index 6b19ae2..f74d1c7 100644 --- a/lib/xmpp-client/client.js +++ b/lib/xmpp-client/client.js @@ -95,6 +95,14 @@ Client.prototype._debug = function(txt) { } }; +Client.prototype.message = function(to, message) { + this.xmpp.send(new xmpp.Element('message', { + to: to, + type: 'chat'}). + c('body'). + t(message)); +}; + Client.prototype.iq = function(iq, callback) { var n = this._iq++; this._iqCallback[n] = callback; diff --git a/test/test.js b/test/test.js index 7fbdaf5..ffe6cbc 100644 --- a/test/test.js +++ b/test/test.js @@ -28,6 +28,7 @@ exports.testClient = function(test) { c.debug = true; c.addListener('online', function() { test.ok(true); + c.message(conf.to, "Beuha de test!"); test.done(); }); };