[JDEV] Perl code sample needed...

Curtis Hawthorne cghawthorne at yahoo.com
Mon Jan 27 23:22:30 CST 2003


Rebbaj,

I don't know about 1.0028, but I pretty much got that
example out of the 1.28 (current release) documentation. 
More information here:

http://search.cpan.org/author/REATMON/Net-Jabber-1.28/Jabber/Protocol.pm#IQ_Roster_Functions.

(Also, scroll down a ways for a more in depth description
of the Roster methods).

Curtis H.

--- rebbaj rebbaj <rebbaj2000 at yahoo.co.uk> wrote:
> 
> Thanks Curtis,
> I have not seen any referenced to the RosterParse in
> Jabber::Net 1.0028.  It only seems to show up in the
> 1.0024 documentation.  Is there a way to do this using
> 1.0028?
>  Curtis Hawthorne <cghawthorne at yahoo.com> wrote:Rebbaj,
> 
> I think what you want is the RosterParse method in
> Net::Jabber. It returns a hash with all the information
> you need. For instance:
> 
> sub InIQ {
> my $sid = shift;
> my $iq = shift;
> 
> my %rosterupdate = $iq->RosterParse($iq);
> 
> foreach (keys %rosterupdate) {
> print "Name: ", $_->{name}, "\n";
> print "Subscription: ", $_->{subscription}, "\n";
> print "Ask: ", $_->{ask}, "\n";
> print "Groups: ", $_->{groups}, "\n";
> }
> }
> 
> From there you could turn it into an array if you wanted,
> but I would think a hash would be easier to work with.
> 
> Curtis H.
> 
> --- rebbaj rebbaj wrote:
> > 
> > After some more testing, I got the impression that the
> > following callback logic would work. Getting the 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
> > }
> > } 
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
> _______________________________________________
> jdev mailing list
> jdev at jabber.org
> http://mailman.jabber.org/listinfo/jdev
> 
> 
> 
> ---------------------------------
> With Yahoo! Mail you can get a bigger mailbox -- choose a
> size that fits your needs
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



More information about the JDev mailing list