AnyEven...:Contact(3)
π AnyEvent::XMPP::IM::Contact(3) π
okay so bestie, welcome to the manual page for AnyEvent::XMPP::IM::Contact β it's a User Contributed Perl Documentation situation, from the AnyEven...:Contact(3) corner of the perl-verse, and we're about to make it make sense. π«Ά
β¨ NAME β¨
AnyEvent::XMPP::IM::Contact β like, the instant messaging roster contact class. that's the whole vibe. π
πΈ SYNOPSIS πΈ
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;
}
see? grab the roster, grab the contact, send them a little "Hello there!" and you're literally done. iconic behavior. β¨
π¦ DESCRIPTION π¦
So this module is a class for contact objects β y'know, the little guys that populate a roster (AnyEvent::XMPP::IM::Roster). π
There are two types of 'contacts' that get managed by this class, and yes you need to know the difference:
- the first are contacts that are on the user's roster
- the second are contacts that are not on the user's roster
To find out whether a contact is actually available as a roster item in the user's roster, you should consult the "is_on_roster" method (peep it below π). no guessing, bestie, ask the method.
Then there's another special kind of contact: the one that stands for ourself, mostly only used for keeping track of our own presences and resources. main character energy fr fr. But β and this is important β even if the "is_me" method returns true, the "is_on_roster" method might also return a true value, in case we have a roster item of ourself on the roster (which might happen in rare cases :). so like, both can be true, it's giving nuanced.
You can only get an instance of this class by calling the "get_contact" function on a roster object. no shortcuts, that's the door. πͺ
π METHODS π
send_update ($cb, %upd)β this method updates a contact. If the request is finished it will call$cb. If it resulted in an error, the first argument of that callback will be anAnyEvent::XMPP::Error::IQobject. π
The %upd hash should have one of the following keys, and it defines what parts of the contact to update:
name => $nameβ updates the name of the contact.$name = ''erases the contact. poof. πadd_group => $groupsβ adds the contact to the groups in the array reference$groups.remove_group => $groupsβ removes the contact from the groups in the array reference$groups.groups => $groupsβ this sets the groups of the contact.$groupsshould be an array reference of the groups.
send_subscribe ()β this method sends this contact a subscription request. π¨send_subscribed ()β this method accepts a contact's subscription request. yes queen, approved. πsend_unsubscribe ()β this method sends this contact an unsubscription request.send_unsubscribed ()β this method sends this contact an unsubscription request which unsubscribes one's own presence from him (he won't get any further presence from us). bye bestie, no more presence for you πupdate ($item)β this method wants anAnyEvent::XMPP::Nodein$item, which should be a roster item received from the server. The method will update the contact accordingly and return itself. self-returning slay β¨update_presence ($presence)β this method updates the presence of contacts on the roster.$presencemust be anAnyEvent::XMPP::Nodeobject and should be a presence packet.get_presence ($jid)β this method returns a presence of this contact if it's available. The return value is an instance ofAnyEvent::XMPP::IM::Presence, orundefif no such presence exists.get_presencesβ returns all presences of this contact in the form ofAnyEvent::XMPP::IM::Presenceobjects. the whole collection πget_priority_presenceβ returns the presence with the highest priority. it's giving ranking system πgroupsβ returns the list of groups (strings) this contact is in.jidβ returns the bare JID of this contact.nameβ returns the (nick)name of this contact.is_on_roster ()β returns1if this is a contact that's officially on the roster and not just a contact we've received presence information for. official official. πis_meβ returns a true value when this contact stands for ourself and is only used for receiving presences of our own resources. it's me, hi, I'm the contact, it's me π«Άsubscriptionβ returns the subscription state of this contact, which can be one of:
'none', 'to', 'from', 'both'
If the contact isn't on the roster anymore, this method returns:
'remove'
askβ returns'subscribe'if we asked this contact for subscription.subscription_pendingβ returns true if this contact has a pending subscription. That means: the contact has to acknowledge the subscription. (the original says "aknowledge" and honestly, spelling is a vibe not a rule π)nicknameβ returns the nickname of this contact (or, if none is set in the roster, it returns the node part of the JID). fallback queen πmake_message (%args)β this method returns anAnyEvent::XMPP::IM::Messageobject with thetofield set to this contact's JID.
%args are further arguments for the message constructor. easy peasy π
π AUTHOR π
Robin Redeker, "<elmex at ta-sa.org>", JID: "<elmex at jabber.org>"
β 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.
ngl bestie, that's the whole page β every method, every option, every little undef. no cap. π§
and that's the tea: this was perl v5.42.2, dated 2026-02-15, and it's AnyEven...:Contact(3) signing off. mwah πβ¨
π¦ 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