I'm trying to post a message to a group on the usenet using the 'nntp' package for node. I can't get the example to work, the only example that works for me is "Get a list of all newsgroups beginning with 'alt.binaries.'".
Code for uploading example:
var NNTP = require('nntp'),
inspect = require('util').inspect;
var c = new NNTP();
c.on('ready', function() {
var msg = {
from: { name: 'Node User', email: '[email protected]' },
groups: 'alt.test',
subject: 'Just testing, do not mind me',
body: 'node.js rules!'
};
c.post(msg, function(err) {
if (err) throw err;
});
});
c.on('error', function(err) {
console.log('Error: ' + err);
});
c.on('close', function(had_err) {
console.log('Connection closed');
});
c.connect({
host: 'example.org',
user: 'foo',
password: 'bar'
});
Host, user and password are incorrect in the snippet above, but I'm sure they are correct (I can get the other example to work with these settings).
The error I'm getting is:
/Develop/node/Usenet/node_modules/nntp/lib/nntp.js:662
this._debug('> ' + this._curReq.cmd + ' ' + this._curReq.params);
^
TypeError: Property '_debug' of object #<NNTP> is not a function
If I add a debug function to the object in c.connect I get the following error:
/Develop/node/Usenet/node_modules/nntp/lib/nntp.js:265
self._curReq.cb(undefined, code, retval, type);
^
TypeError: Property 'cb' of object #<Object> is not a function
I'm using node v0.10.32. I hope someone can help me out. Thanks, Rik
just add "debug: function(){}" on options object at connect