I finally got it to work and it is not so difficult with the right packages (Net::XMPP) and parameters …
#! /usr/bin/perl
use strict;
use warnings;
use Net::XMPP;
#################
# Config params #
#################
my $hostName = 'jaim.at';
my $portNumber = 5222;
my $componentName = 'jaim.at';
my $userName = 'totosk1008';
my $passWord = 'totosk1008';
my $resource = 'NiceLittleBot';
my $tls = 0;
my $connectionType = 'tcpip';
my $debugLevel = 0;
# Create the client
my $bot = new Net::XMPP::Client(debuglevel => $debugLevel);
$bot->SetCallBacks(
onconnect => &connectedCB, # gets called when connected
onauth => &authedCB, # when authenticated
ondisconnect => &disconnectedCB, # when disconnected
);
$bot->SetMessageCallBacks( # callback for messages
chat => &messageCB, # chat-type messages
);
$bot->Execute( # entering the main loop
hostname => $hostName,
port => $portNumber,
tls => $tls,
username => $userName,
password => $passWord,
resource => $resource,
register => 0,
connectiontype => $connectionType,
);
##############
# Callbacks #
##############
sub messageCB { # call back implementing the echo
my $sid = shift;
my $msg = shift;
my $from = $msg->GetFrom;
my $to = $msg->GetTo;
my $name;
my $data;
print "From : ", $from, "\n",
"Subject : ", $msg->GetSubject, "\n",
$msg->GetBody, "\n";
$name = $msg->GetBody;
$data = $msg->GetBody;
print ">>$name<<\n";
print $data, "\n";
$bot->MessageSend(
to => $from,
from => $to,
resource => 'Gaim',
type => $msg->GetType,
subject => $msg->GetSubject,
body => $data,
);
}
sub connectedCB {
print "Connected\n";
}
sub authedCB {
print "Authed\n";
$bot->PresenceSend;
}
sub disconnectedCB {
print "Disconnected\n";
}