----- Original Message -----
Sent: Tuesday, January 07, 2003 9:40
AM
Subject: [JDEV] Proper use of Perl
Net::Jabber calls
Hello jabber people.
I am hoping that someone can help me out with how the Perl Net::Jabber
library should be used. Note that I am also somewhat new to perl so if I
get confused by some of the syntax, you will have to excuse me. The
examples in the Oreily book were rather helpful but I seem to be having
problems in calling and receiving IQ information.
Here is what I am trying to send and receive in XML:
SENT:
<iq id="jcl_9" type="get">
<query
xmlns="jabber:iq:roster"/>
</iq>
RECV:
<iq from='[EMAIL PROTECTED]/Perl'
id='jcl_9' type='result'>
<query
xmlns='jabber:iq:roster'>
<item jid='[EMAIL PROTECTED]'
name='rebbaj' subscription='both'/>
<item jid='[EMAIL PROTECTED]'
name='rebbaj2' subscription='both'/>
</query>
</iq>
The code stub that I have written to do this is as follows. I suspect
that I have the flow a bit wrong and I am not using the optimal calls to parse
the resulting returned roster data... Any help would be
appreciated....
rebbaj
------------------------------------------------
#!/usr/bin/perl
use
Net::Jabber qw(Client);
use strict;
my
$c=Net::Jabber::Client->new();
$c->Connect('hostname'=>
'jabber.org', 'port'=>5222);
$c->AuthSend('username'=> 'rebbaj',
'password'=> 'secret',
'resource'=>
'Perl');
$c->SetCallBacks('presence'=>
\&handle_presence);
$c->SetCallBacks('iq'=>
\&handle_iq);
$c->PresenceSend();
My $IQ = new
Net::Jabber::IQ();
$IQ->NewQuery("jabber:iq:roster"); # Does this
actually make the IQ get request?$c->Send($IQ); # is this call
necessary?
print "involking process\n";
$c->Process();
$c->Disconnect;
exit(0);
sub handle_presence {
my ($sid, $presence) = @_;
my $show = $presence->GetShow() ||
'online';
print "presence packet received
$show\n";
}
sub handle_iq {
my ($sid, $iq) = @_;
my $querytag = $iq->GetQuery();
print "iq packet received $querytag\n";
}
With Yahoo! Mail you can get a bigger mailbox -- choose a
size that fits your needs