XMPP tools
Translation of the original in Catalan. Read it in: CatalàCastellano
Next I attach a small description of some tools for communicating with an XMPP network that can be very useful:
Idavoll
Implementation of XEP-0060, that is, of a publish-subscribe (PubSub) service, it is written with Python and Twisted. Basically what it allows is that on top of a standard XMPP server we can connect a service based on PubSub, that is, that we publish a series of information that a set of clients consult because they are subscribed to it. It is an event-based (no-polling) method that is very suitable for spreading certain kinds of information.
Switchboard
Sometimes we program shell scripts that need to send their result to the XMPP network, for example, imagine we want to report the failure of a service through GTalk, well this toolkit simplifies that task for us a great deal. It is programmed in ruby and apart from being usable from the CLI we can also integrate it as a library inside ruby code.
XMPP Poetry CLI tools
Its name says it all, they are a collection of tools that via the CLI let us interact with an XMPP network, some of their functions are:
-
disco: gathers information about services
-
pubsub-config: creates, configures and launches queries against pub-sub services
These tools are written with Python, Twisted and Wokkel.
XMPPPHP
PHP5 library with support for:
-
XMPP 1.0 (it can connect to: GTalk, LJTalk, jabber.org, etc)
-
It supports TLS
-
It processes various XML formats
It seems quite simple to use, for example, programming a bot is as easy as this:
<?php
include("xmpp.php");
$conn = new XMPP('talk.google.com', 5222, 'user', 'password', 'xmpphp', 'gmail.com', $printlog=True, $loglevel=LOGGING_INFO);
$conn->connect();
while(!$conn->disconnected) {
$payloads = $conn->processUntil(array('message', 'presence', 'end_stream', 'session_start'));
foreach($payloads as $event) {
$pl = $event[1];
switch($event[0]) {
case 'message':
print "---------------------------------------------------------------------------------\n";
print "Message from: {$pl['from']}\n";
if($pl['subject']) print "Subject: {$pl['subject']}\n";
print $pl['body'] . "\n";
print "---------------------------------------------------------------------------------\n";
$conn->message($pl['from'], $body="Thanks for sending me \"{$pl['body']}\".", $type=$pl['type']);
if($pl['body'] == 'quit') $conn->disconnect();
if($pl['body'] == 'break') $conn->send("");
break;
case 'presence':
print "Presence: {$pl['from']} [{$pl['show']}] {$pl['status']}\n";
break;
case 'session_start':
$conn->presence($status="Cheese!");
break;
}
}
}
?>