Skip to content
tdebarochez edited this page Sep 13, 2010 · 17 revisions

Welcome to the lepote wiki.

Summary :

About

LePote is an IM bot and the beginning of a library that implements the basics of xmpp protocol

Requirements

Don’t forget updating submodules after clone :

git submodule init
git submodule update

Usage

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

API :

Constructor

Usage

var client = new xmpp.Client([hash conf]);

Params

conf is a hash with following keys : login, password, domain, host1, port1, resource1, status1
If conf is omitted, it will try to load parameters from this following file ~/.sendxmpprc. Example of content :

test@localhost:5222 password

addListener

When event is emit, func is called with client binds on.

Usage

client.addListener(string event, function func);

Params

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

push

Send instant message.

Usage

client.push(string to, string str);

Params

to : receiver jid (ex: ‘[email protected]’)
str : message to send (ex: ‘Hello World’)

subscribe

add somebody to your roaster

Usage

client.subscribe(string to, string group, string name);

Params

to : contact jid (ex: ‘[email protected]’)
group1 : group (ex: ‘friends’)
name1 : alias (ex: ‘John Doe’)

write

write raw datas

Usage

client.write(string xml_stream);

Params

xml_stream : some xml stuff

1 optional

Todo

  • add TLS communication support
  • add more and more events…

Contributes

Every good contributions are welcome, please send me them via github