AnyEvent::XMPP::Ext::Disco(3pm) | User Contributed Perl Documentation | AnyEvent::XMPP::Ext::Disco(3pm) |
AnyEvent::XMPP::Ext::Disco - Service discovery manager class for XEP-0030
use AnyEvent::XMPP::Ext::Disco; my $con = AnyEvent::XMPP::IM::Connection->new (...); $con->add_extension (my $disco = AnyEvent::XMPP::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 ... } } );
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 AnyEvent::XMPP::Ext and can be added as extension to objects that implement the AnyEvent::XMPP::Extendable interface or derive from it.
$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
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"!
http://www.xmpp.org/registrar/disco-features.html
You can pass also a list of features you want to disable to "disable_feature"!
$con must be an instance of AnyEvent::XMPP::Connection or a subclass of it. The callback $cb will be called when the request returns with 3 arguments: the disco handle, an AnyEvent::XMPP::Ext::Disco::Items object (or undef) and an AnyEvent::XMPP::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 ;_) });
$con must be an instance of AnyEvent::XMPP::Connection or a subclass of it. The callback $cb will be called when the request returns with 3 arguments: the disco handle, an AnyEvent::XMPP::Ext::Disco::Info object (or undef) and an AnyEvent::XMPP::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 ;_) });
Robin Redeker, "<elmex at ta-sa.org>", JID: "<elmex at jabber.org>"
Copyright 2007, 2008 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.
2022-12-06 | perl v5.36.0 |