Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Joachim Kainz committed May 4, 2012
1 parent 910a2f0 commit 7ce7cc6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion examples/room.js
Expand Up @@ -28,7 +28,7 @@
});

client.on('stanza', function (stanza) {
console.log("stanza: %j", stanza);
// console.log("stanza: %j", stanza);
});

client.on('chat', function (from, message) {
Expand Down
15 changes: 8 additions & 7 deletions lib/debug.js
Expand Up @@ -2,6 +2,10 @@
(function (module) {
"use strict";

var debug = process.env.NODE_DEBUG && /simpler-xmpp/.test(process.env.NODE_DEBUG),
util = require('util'),
logger;

function formatMessage() {
var args = Array.prototype.slice.call(arguments),
first = args.shift();
Expand All @@ -12,14 +16,11 @@
return util.format.apply(this, args);
}

var debug = process.env.NODE_DEBUG && /simpler-xmpp/.test(process.env.NODE_DEBUG),
util = require('util'),
logger = debug ?
function () {
var message = formatMessage.apply(this, arguments);
logger = debug ? function () {
var message = formatMessage.apply(this, arguments);

console.error(message);
} : function () {
console.error(message);
} : function () {
};

logger.debug = debug;
Expand Down
10 changes: 5 additions & 5 deletions lib/simple-xmpp.js
Expand Up @@ -312,24 +312,24 @@
return sendMessage(hidden, stanza);
};
this.discoverRoom = function (jid) {
var stanza = new xmpp.Message({
/*
var stanza = new xmpp.Message({
to:jid
}),
body = stanza.c('x', {xmlns:'jabber:x:data', type: 'submit'});
body.c('field', { var: 'FORM_TYPE'}).c('value').t('http://jabber.org/protocol/muc#request');
body.c('field', { var: 'muc#role', type: 'text-single', label: 'Requested role'}).c('value').t('participant');
/*
var stanza = new xmpp.Iq({
to:jid,
type:'get'
});
stanza.c('query', {xmlns:'http://jabber.org/protocol/disco#info', node: 'x-roomuser-item'});
var stanza = new xmpp.Presence({
to:jid
});
*/

var stanza = new xmpp.Presence({
to:jid
});
return sendMessage(hidden, stanza);
}
}
Expand Down

0 comments on commit 7ce7cc6

Please sign in to comment.