views:

6476

answers:

7

I need a simple scriptable/commandline jabber client. What is the best and/or simplest one to install?

Clarification: I'm looking for a simple way to send messages from within a script.

+1  A: 

Pidgin (formerly Gaim) has a command-line client.

JonathanMueller
It's called Finch
Nick Stinemates
+12  A: 

Here are some options:

List of Jabber Console Clients

Some Scripting Options

Not sure what language you're looking to do your scripting in or what platform, but the above should hopefully get you started.

Jay
+4  A: 

Using the Net::Jabber perl module, I wrote the following script which sends the message from stdin to all the users listed on the command line.

#!/usr/local/bin/perl

use Net::Jabber qw(Client);

my $server = "jabber.de";
my $port = "5222";
my $username = "Sec";
my $password = "<pw>";
my $resource = "autosend";
my @recipients = @ARGV;

my $clnt = new Net::Jabber::Client;

my $status = $clnt->Connect(hostname=>$server, port=>$port);

if (!defined($status)) {
    die "Jabber connect error ($!)\n";
}

my @result = $clnt->AuthSend(username=>$username,
        password=>$password,
        resource=>$resource);

if ($result[0] ne "ok") {
    die "Jabber auth error: @result\n";
}

my $body = '';
while (<STDIN>) {
    $body .= $_;
}
chomp($body);

foreach my $to (@recipients) {
    $clnt->MessageSend(to=>$to,
            subject=>"",
            body=>$body,
            type=>"chat",
            priority=>10);
}

$clnt->Disconnect();
Sec
+3  A: 

Another library option: XMPP4R is a very feature-rich Ruby library for XMPP(Jabber). It uses the built-in Ruby XML handling, which is very nice. If you just need basic messaging, there is also XMPP4R-Simple.

Here's a bit of example code using XMPP4R-Simple, just to show how simple it is (stolen from here):

jabber = Jabber::Simple.new('[email protected]', 'password')
jabber.deliver("[email protected]", "Hey! I'm thinking of going Vegetarian - Any suggestions?")
Neall
A: 

CJC (Console Jabber Client) ( cjc.jajcus.net ) is a very good client with feels very IRC-like.

EKG2 ( ekg2.org ) project also has good Jabber protocol support and is remote controllable.

smoku
+3  A: 

Was looking at this myself, and found this snippet at http://snippets.dzone.com/posts/show/618

In python, needs python and python-xmpp libraries

#!/usr/bin/python
import xmpp

login = 'Your.Login' # @gmail.com 
pwd   = 'YourPassword'

cnx = xmpp.Client('gmail.com')
cnx.connect( server=('talk.google.com',5223) )
cnx.auth(login,pwd, 'botty')

cnx.send( xmpp.Message( "[email protected]" ,"Hello World form Python" ) )
Igy
+1  A: 

sendxmpp is doing this for me. Based on Net::XMPP Perl library.

sendxmpp is a perl-script to send xmpp (jabber), similar to what mail(1) does for mail.

if test "$cpuload" -gt "$CPULOADMAX"; then
  top -b -n 1 | sendxmpp -s "wake up! cpu load $cpuload at `hostname`" [email protected]  
fi

'~/.sendxmpprc' configuration file with JID and password required for operation.