| Posted on 2005-11-28 12:28:06-08 by tschloss in response to 1412 |
| Re: Error during Auth ?? |
|
Solved. I am not sure why, but now it works.
I tried the same on a fresh SUSE10 (fresh regarding Perl and CPAN). I got some problems during install of Net::Jabber (some tests failed) and so I installed it with force.
Now the programm did not run into this error anymore although id did not work anyway.
So I went back a step and tried to get jabber with two normal clients running. I could not communicate between two instances of the same user with different resources!? So I registered a second user, authorized each other and tried the program with these users. And now it runs (with two different users for login and send-to).
Thx
The woring programm:
#!/usr/bin/perl
###########################################
# excerpt from ebaywatch
# Mike Schilli, 2003 (m@perlmeister.com)
###########################################
use warnings;
#use strict;
our $JABBER_ID = 'login-user';
our $JABBER_PASSWD = "xxxxxx";
our $JABBER_SERVER = "jabber.org";
our $JABBER_PORT = 5222;
our $JABBER_SENDTO = "send-to-user-name"
use Net::Jabber qw(Client);
print "START!";
jabber_send("Hello world!");
###########################################
sub jabber_send {
###########################################
my($message) = @_;
my $c = Net::Jabber::Client->new();
$c->SetCallBacks(presence => sub {});
my $status = $c->Connect(
hostname => $JABBER_SERVER,
port => $JABBER_PORT,
);
die "Can't connect: $!"
unless defined $status;
my @result = $c->AuthSend(
username => $JABBER_ID,
password => $JABBER_PASSWD,
resource => 'GAIM',
);
die "Can't log in: $!"
unless $result[0] eq "ok";
$c->PresenceSend();
my $m = Net::Jabber::Message->new();
my $jid = $JABBER_SENDTO . '@' .
"$JABBER_SERVER/GAIM";
$m->SetBody($message);
$m->SetTo($jid);
print "Jabber to $jid: $message";
my $rc = $c->Send($m, 1);
$c->Disconnect;
}
|
| Direct Responses: Write a response |