GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  NET::XMPP2::EXT::DISCO (3)

.ds Aq ’

NAME

Net::XMPP2::Ext::Disco - Service discovery manager class for XEP-0030

CONTENTS

SYNOPSIS



   use Net::XMPP2::Ext::Disco;

   my $con = Net::XMPP2::IM::Connection->new (...);
   $con->add_extension (my $disco = Net::XMPP2::Ext::Disco->new);
   $disco->request_items ($con, romeo@montague.net, undef,
      sub {
         my ($disco, $items, $error) = @_;
         if ($error) { print "ERROR:" . $error->string . "\n" }
         else {
            ... do something with the $items ...
         }
      }
   );



DESCRIPTION

This module represents a service discovery manager class. You make instances of this class and get a handle to send discovery requests like described in XEP-0030.

It also allows you to setup a disco-info/items tree that others can walk and also lets you publish disco information.

This class is derived from Net::XMPP2::Ext and can be added as extension to objects that implement the Net::XMPP2::Extendable interface or derive from it.

METHODS

<B>new (%args)B> Creates a new disco handle.
<B>set_identity ($category, B>$type<B>, B>$name<B>)B> This sets the identity of the top info node.

$name is optional and can be undef. Please note that $name will overwrite all previous set names! If $name is undefined then no previous set name is overwritten.

For a list of valid identites look at:



   http://www.xmpp.org/registrar/disco-categories.html



Valid identity $types for $category = "client" may be:



   bot
   console
   handheld
   pc
   phone
   web



<B>unset_identity ($category, B>$type<B>)B> This function removes the identity $category and $type.
<B>enable_feature ($uri)B> This method enables the feature $uri, where $uri should be one of the values from the <B>NameB> column on:



   http://www.xmpp.org/registrar/disco-features.html



These features are enabled by default:



   http://jabber.org/protocol/disco#info
   http://jabber.org/protocol/disco#items



You can pass also a list of features you want to enable to enable_feature!

<B>disable_feature ($uri)B> This method enables the feature $uri, where $uri should be one of the values from the <B>NameB> column on:



   http://www.xmpp.org/registrar/disco-features.html



You can pass also a list of features you want to disable to disable_feature!

<B>request_items ($con, B>$dest<B>, B>$node<B>, B>$cb<B>)B> This method does send a items request to the JID entity $from. $node is the optional node to send the request to, which can be undef.

$con must be an instance of Net::XMPP2::Connection or a subclass of it. The callback $cb will be called when the request returns with 3 arguments: the disco handle, an Net::XMPP2::Ext::Disco::Items object (or undef) and an Net::XMPP2::Error::IQ object when an error occured and no items were received.

The timeout of the request is the IQ timeout of the connection $con.



   $disco->request_items ($con, a@b.com, undef, sub {
      my ($disco, $items, $error) = @_;
      die $error->string if $error;

      # do something with the items here ;_)
   });



<B>request_info ($con, B>$dest<B>, B>$node<B>, B>$cb<B>)B> This method does send a info request to the JID entity $from. $node is the optional node to send the request to, which can be undef.

$con must be an instance of Net::XMPP2::Connection or a subclass of it. The callback $cb will be called when the request returns with 3 arguments: the disco handle, an Net::XMPP2::Ext::Disco::Info object (or undef) and an Net::XMPP2::Error::IQ object when an error occured and no items were received.

The timeout of the request is the IQ timeout of the connection $con.



   $disco->request_info ($con, a@b.com, undef, sub {
      my ($disco, $info, $error) = @_;
      die $error->string if $error;

      # do something with info here ;_)
   });



AUTHOR

Robin Redeker, <elmex at ta-sa.org>, JID: <elmex at jabber.org>

COPYRIGHT & LICENSE

Copyright 2007 Robin Redeker, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 NET::XMPP2::EXT::DISCO (3) 2008-03-24

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.