AnyEven...::Disco(3)
okay bestie, welcome to the AnyEven...::Disco(3) page β yes, that's the manual handle, and it's filed under User Contributed Perl Documentation. This is the whole vibe for AnyEvent::XMPP::Ext::Disco, aka your service discovery manager with main character energy. π
β¨ NAME β¨
AnyEvent::XMPP::Ext::Disco β service discovery manager class for XEP-0030. π°οΈ
π°οΈ SYNOPSIS π°οΈ
okay so here's the exact setup, no cap:
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 ...
}
}
);
π DESCRIPTION π
This module is literally 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 lets you setup a disco-info/items tree that others can walk, and it lets you publish disco information too. Obsessed with the flexibility, honestly. π¦
This class is derived from AnyEvent::XMPP::Ext and can be added as an extension to objects that implement the AnyEvent::XMPP::Extendable interface or derive from it. iykyk. π
π§ METHODS π§
πΈ new (%args)
Creates a new disco handle. Fresh handle, fresh vibes. β¨
πΈ set_identity ($category, $type, $name)
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. Periodt. π
For a list of valid identities look at:
http://www.xmpp.org/registrar/disco-categories.html
Valid identity $types for "$category = "client"" may be:
bot
console
handheld
pc
phone
web
πΈ unset_identity ($category, $type)
This function removes the identity $category and $type. Bye-bye, little identity node. π
πΈ enable_feature ($uri)
This method enables the feature $uri, where $uri should be one of the values from the Name 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! Slay that list. π
πΈ disable_feature ($uri)
This method disables the feature $uri β yes, the original text says βenablesβ right here, iconic little typo energy, but the method is literally named disable_feature β where $uri should be one of the values from the Name 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! π
πΈ request_items ($con, $dest, $node, $cb)
This method does send a items request to the JID entity $from β yep, the prose says $from even though the signature says $dest, so keep both in your notes, bestie. $node is the optional node to send the request to, which can be undef.
$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 ;_)
});
πΈ request_info ($con, $dest, $node, $cb)
This method does send a info request to the JID entity $from β same little $from / $dest plot twist as above, not me making it up. $node is the optional node to send the request to, which can be undef.
$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 ;_)
});
π AUTHOR π
Robin Redeker, "<elmex at ta-sa.org>", JID: "<elmex at jabber.org>" β author icon, fr fr. π
π COPYRIGHT & LICENSE π
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.
xoxo, this page was served with perl v5.42.2, dated 2026-02-15, and its footer manual handle is AnyEven...::Disco(3). stay slaying, bestie ππ¦
π¦ where this page comes from
- alpine 3.24: perl-anyevent-xmpp-doc 0.55-r1 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms