[ejabberd] need help with command-line messaging like sendxmpp

Adam Kalsey adam at imified.com
Thu Jun 26 21:02:31 MSD 2008


On Thu, Jun 26, 2008 at 8:52 AM, Eric Wood <eric at interplas.com> wrote:
> 'componentname' argument in many places in the Net::XMPP files as well as
> the sendxmpp perl script.  I just don't see exactly how to do it.  Maybe my

You do it in the Connect method of Net::Jabber::Client.

# connect to user at example.com on server 'jabber.example.com'

my $user = 'user';
my $password = 'secret';
my $host = 'example.com';
my $resource = 'perlbot';
my $server = 'jabber.example.com';

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

my $client = new Net::Jabber::Client();
my $status = $client->Connect(hostname=>$host,componentname=>$server);
die 'Cannot connect ' . $user . '@' . $host . '/' . $resource . ' on
server ' . $server . ' - ' .getError($client->GetErrorCode())
  unless defined($status);

my @result = $client->AuthSend(
			username=>$user,
			password=>$password,
			resource=>$resource
			);
die 'Could not login to bot:' . $user . '@' . $host . '/' . $resource
. ' on server ' . $server . ' - ' .getError($client->GetErrorCode())
  unless $result[0] eq "ok";


-- 

Adam Kalsey
http://imified.com | 916.600.2497 | aim/skype: akalsey


More information about the ejabberd mailing list