1AnyEvent::XMPP::Ext::DiUssceor(3C)ontributed Perl DocumeAnntyaEtvieonnt::XMPP::Ext::Disco(3)
2
3
4

NAME

6       AnyEvent::XMPP::Ext::Disco - Service discovery manager class for
7       XEP-0030
8

SYNOPSIS

10          use AnyEvent::XMPP::Ext::Disco;
11
12          my $con = AnyEvent::XMPP::IM::Connection->new (...);
13          $con->add_extension (my $disco = AnyEvent::XMPP::Ext::Disco->new);
14          $disco->request_items ($con, 'romeo@montague.net', undef,
15             sub {
16                my ($disco, $items, $error) = @_;
17                if ($error) { print "ERROR:" . $error->string . "\n" }
18                else {
19                   ... do something with the $items ...
20                }
21             }
22          );
23

DESCRIPTION

25       This module represents a service discovery manager class.  You make
26       instances of this class and get a handle to send discovery requests
27       like described in XEP-0030.
28
29       It also allows you to setup a disco-info/items tree that others can
30       walk and also lets you publish disco information.
31
32       This class is derived from AnyEvent::XMPP::Ext and can be added as
33       extension to objects that implement the AnyEvent::XMPP::Extendable
34       interface or derive from it.
35

METHODS

37       new (%args)
38           Creates a new disco handle.
39
40       set_identity ($category, $type, $name)
41           This sets the identity of the top info node.
42
43           $name is optional and can be undef.  Please note that $name will
44           overwrite all previous set names! If $name is undefined then no
45           previous set name is overwritten.
46
47           For a list of valid identites look at:
48
49              http://www.xmpp.org/registrar/disco-categories.html
50
51           Valid identity $types for "$category = "client"" may be:
52
53              bot
54              console
55              handheld
56              pc
57              phone
58              web
59
60       unset_identity ($category, $type)
61           This function removes the identity $category and $type.
62
63       enable_feature ($uri)
64           This method enables the feature $uri, where $uri should be one of
65           the values from the Name column on:
66
67              http://www.xmpp.org/registrar/disco-features.html
68
69           These features are enabled by default:
70
71              http://jabber.org/protocol/disco#info
72              http://jabber.org/protocol/disco#items
73
74           You can pass also a list of features you want to enable to
75           "enable_feature"!
76
77       disable_feature ($uri)
78           This method enables the feature $uri, where $uri should be one of
79           the values from the Name column on:
80
81              http://www.xmpp.org/registrar/disco-features.html
82
83           You can pass also a list of features you want to disable to
84           "disable_feature"!
85
86       request_items ($con, $dest, $node, $cb)
87           This method does send a items request to the JID entity $from.
88           $node is the optional node to send the request to, which can be
89           undef.
90
91           $con must be an instance of AnyEvent::XMPP::Connection or a
92           subclass of it.  The callback $cb will be called when the request
93           returns with 3 arguments: the disco handle, an
94           AnyEvent::XMPP::Ext::Disco::Items object (or undef) and an
95           AnyEvent::XMPP::Error::IQ object when an error occured and no items
96           were received.
97
98           The timeout of the request is the IQ timeout of the connection
99           $con.
100
101              $disco->request_items ($con, 'a@b.com', undef, sub {
102                 my ($disco, $items, $error) = @_;
103                 die $error->string if $error;
104
105                 # do something with the items here ;_)
106              });
107
108       request_info ($con, $dest, $node, $cb)
109           This method does send a info request to the JID entity $from.
110           $node is the optional node to send the request to, which can be
111           undef.
112
113           $con must be an instance of AnyEvent::XMPP::Connection or a
114           subclass of it.  The callback $cb will be called when the request
115           returns with 3 arguments: the disco handle, an
116           AnyEvent::XMPP::Ext::Disco::Info object (or undef) and an
117           AnyEvent::XMPP::Error::IQ object when an error occured and no items
118           were received.
119
120           The timeout of the request is the IQ timeout of the connection
121           $con.
122
123              $disco->request_info ($con, 'a@b.com', undef, sub {
124                 my ($disco, $info, $error) = @_;
125                 die $error->string if $error;
126
127                 # do something with info here ;_)
128              });
129

AUTHOR

131       Robin Redeker, "<elmex at ta-sa.org>", JID: "<elmex at jabber.org>"
132
134       Copyright 2007, 2008 Robin Redeker, all rights reserved.
135
136       This program is free software; you can redistribute it and/or modify it
137       under the same terms as Perl itself.
138
139
140
141perl v5.36.0                      2022-07-22     AnyEvent::XMPP::Ext::Disco(3)
Impressum