Thanks Yanming.  I took a good long look at the code found at http://www.jabberstudio.org/cgi-bin/viewcvs.cgi/*checkout*/netjabber/examples/client.pl?rev=1.4&content-type=text/plain

What I still do not understand is why the $Connection->RosterGet(); call does not result in all of the roster entries being sent back from the server and hence triggering the sub InIQ routine.  If I manually enter the following XML "<iq type="get"><query xmlns="jabber:iq:roster"/></iq>, I get all the entries back.

The docs state "RosterGet() - sends an empty Net::Jabber::IQ::Roster tag to the server so the server will send the Roster to the client."

Any other ideas?

Regards,

Rebbaj

 Yanming Xiao <[EMAIL PROTECTED]> wrote:

Rabbaj,
 
It seems to me that you are using 2 different packages.  
 
There is a function called "RosterGet()" in Net::Jabber::Client.
find the sample code in:
http://jru.jabberstudio.org/
 
 
-Yanming
----- 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



With Yahoo! Mail you can get a bigger mailbox -- choose a size that fits your needs

Reply via email to