After some more testing, I got the impression that the following callback logic would work.  Getting the <item>s does not seem to work.  Has anybody ever made this work before??

sub InIQ
{
 my $sid = shift;
 my $iq = shift;

 my $id = $iq->GetID();
 print "id = $id\n"; # works

 my $type = $iq->GetType();
 print "type = $type\n"; #works

 my $xmlns = $iq->GetQueryXMLNS();
 print "xmlns = $xmlns\n"; #works

 foreach my $query ($iq->GetQuery->GetItems) {
  print ("JID = $query->GetItem()->GetJID\n"); # prints a hash
  print ("Name = $query->GetItem()->GetName\n");  # prints a hash
  print ("Subscription = $query->GetItem()->GetSubscription\n"); # prints a hash
  print ("Group = $query->GetItem()->GetGroup[0]\n"); # prints a hash
 }
}

 rebbaj rebbaj <[EMAIL PROTECTED]> wrote:

Thanks Matt and Chris for the replies.

It seemed reasonable that one could write an algorighm as follows with the Net::Jabber pm.  What would the XXXX's be?  I would also like to do this with the returned presence data...
---------------------------------- 
use Net::Jabber qw();

my $Connection = new Net::Jabber::Client();
$Connection->SetCallBacks(iq=>\&InIQ);

#  request the roster from the server
my $iq_req = Net::Jabber::IQ->new();
$iq_req->SetIQ(type=>"get", id=>"mpt_1");

# is there a native call to do this?
$iq_req->InsertRawXML('<query xmlns="jabber:iq:roster"/>');

$Connection->Send($iq_req);

while(defined($Connection->Process())) { }

sub InIQ # callback routine
{
 my $sid = shift;
 my $iq = shift;
 $roster = $iq->XXXXXX(); # what should I be calling here?

 foreach $item (XXXXXXX) {
      print $item->XXXXX, "\n"; # print jid
      print $item->XXXXX, "\n"; # print name
      print $item->XXXXX, "\n"; # print ask
      print $item->XXXXX, "\n"; # print subscribe
      print $item->XXXXX, "\n"; # print group
}

}

 Chris Wilkes <[EMAIL PROTECTED]> wrote:

On Sat, Jan 25, 2003 at 11:55:46PM +0000, rebbaj rebbaj wrote:
>
> I am trying to write a routine in Perl where I can send a iq roster
> request and then parse through all the responses such that I can put
> them in an array. While I could do this with a call such as "my
> $roster = $iq->GetXML()" followed by a bunch of regular expressions,
> this seems painfull.

What Perl module are you using to do the "$iq->GetXML()"? If you send
me your code that does that I can add code to split out the results.



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