AnyEvent::XMPP::IM::Roster(3pm) | User Contributed Perl Documentation | AnyEvent::XMPP::IM::Roster(3pm) |
AnyEvent::XMPP::IM::Roster - Instant messaging roster for XMPP
my $con = AnyEvent::XMPP::IM::Connection->new (...); ... my $ro = $con->roster; if (my $c = $ro->get_contact ('test@example.com')) { $c->make_message ()->add_body ("Hello there!")->send; }
This module represents a class for roster objects which contain contact information.
It manages the roster of a JID connected by an AnyEvent::XMPP::IM::Connection. It manages also the presence information that is received.
You get the roster by calling the "roster" method on an AnyEvent::XMPP::IM::Connection object. There is no other way.
The callback in $cb will be called when the creation is finished. The first argument will be the "AnyEvent::XMPP::IM::Contact" object if no error occured. The second argument will be an AnyEvent::XMPP::Error::IQ object if the request resulted in an error.
Please note that the contact you are given in that callback might not yet be on the roster ("is_on_roster" still returns a false value), if the server did send the roster push after the iq result of the roster set, so don't rely on the fact that the contact is on the roster.
$cb will be called when the request was finished. The first argument to the callback might be a AnyEvent::XMPP::Error::IQ object if the request resulted in an error.
NOTE: This method will also return contacts that we have only presence for. To be sure the contact is on the users roster you need to call the "is_on_roster" method on the contact.
The return value is an instance of AnyEvent::XMPP::IM::Contact.
NOTE: This method only returns the contacts that have a roster item. If you haven't retrieved the roster yet the presence information is still stored but you have to get the contacts without a roster item with the "get_contacts_off_roster" method. See below.
See also documentation of "get_contacts" method of AnyEvent::XMPP::IM::Roster above.
Robin Redeker, "<elmex at ta-sa.org>", JID: "<elmex at jabber.org>"
AnyEvent::XMPP::IM::Connection, AnyEvent::XMPP::IM::Contact, AnyEvent::XMPP::IM::Presence
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 |