From 0588e020da7b52d98d235eb20db03d5f733347b8 Mon Sep 17 00:00:00 2001 From: Matthieu Lalonde Date: Wed, 4 Aug 2010 22:44:22 +0200 Subject: [PATCH] send a message --- lib/xmpp-client/client.js | 8 ++++++++ test/test.js | 1 + 2 files changed, 9 insertions(+) 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(); }); };