-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the lepote wiki.
LePote is an IM bot and the beginning of a library that implements the basics of xmpp protocol
Don’t forget updating submodules after clone :
git submodule init git submodule update
var xmpp = require('xmpp'); var conf = {login: 'user', password: 'pass', domain: 'server.com'}; var bot = new xmpp.Client(conf); bot.addListener('message.receive', doSomeStuff);
You can put your events directly in the plugins subdirectory and look in the test.js example the usage
var client = new xmpp.Client([hash conf]);
conf
is a hash with following keys : login
, password
, domain
, host
1, port
1, resource
1, status
1
If conf
is omitted, it will try to load parameters from this following file ~/.sendxmpprc
. Example of content :
test@localhost:5222 password
When event
is emit, func
is called with client binds on.
client.addListener(string event, function func);
This events are :
"message.receive"
parameters : from
, message
, receiver
, message_type
, message_id
"message.sent"
parameters : to
, message
"presence.receive"
parameters : from
, to
, status
, priority
, type
"resources.binded"
no parameters, called when session start
Send instant message.
client.push(string to, string str);
to
: receiver jid (ex: ‘[email protected]’)
str
: message to send (ex: ‘Hello World’)
add somebody to your roaster
client.subscribe(string to, string group, string name);
to
: contact jid (ex: ‘[email protected]’)
group
1 : group (ex: ‘friends’)
name
1 : alias (ex: ‘John Doe’)
write raw datas
client.write(string xml_stream);
xml_stream
: some xml stuff
1 optional
- add TLS communication support
- add more and more events…
Every good contributions are welcome, please send me them via github