.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "AnyEvent::XMPP::IM::Contact 3pm" .TH AnyEvent::XMPP::IM::Contact 3pm "2022-12-06" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" AnyEvent::XMPP::IM::Contact \- Instant messaging roster contact .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 6 \& my $con = AnyEvent::XMPP::IM::Connection\->new (...); \& ... \& my $ro = $con\->roster; \& if (my $c = $ro\->get_contact (\*(Aqtest@example.com\*(Aq)) { \& $c\->make_message ()\->add_body ("Hello there!")\->send; \& } .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module represents a class for contact objects which populate a roster (AnyEvent::XMPP::IM::Roster. .PP There are two types of 'contacts' that are managed by this class. The first are contacts that are on the users roster, and the second are contacts that are \fBnot\fR on the users roster. .PP To find our whether this is a contact which is actually available as roster item in the users roster, you should consult the \f(CW\*(C`is_on_roster\*(C'\fR method (see below). .PP Another special kind of contact is the contact which stands for ourself and is mostly only used for keeping track of our own presences and resources. But note that even if the \f(CW\*(C`is_me\*(C'\fR method returns true, the \f(CW\*(C`is_on_roster\*(C'\fR 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 :). .PP You can get an instance of this class only by calling the \f(CW\*(C`get_contact\*(C'\fR function on a roster object. .SH "METHODS" .IX Header "METHODS" .IP "\fBsend_update ($cb, \f(CB%upd\fB)\fR" 4 .IX Item "send_update ($cb, %upd)" This method updates a contact. If the request is finished it will call \f(CW$cb\fR. If it resulted in an error the first argument of that callback will be a AnyEvent::XMPP::Error::IQ object. .Sp The \f(CW%upd\fR hash should have one of the following keys and defines what parts of the contact to update: .RS 4 .ie n .IP "name => $name" 4 .el .IP "name => \f(CW$name\fR" 4 .IX Item "name => $name" Updates the name of the contact. \f(CW$name\fR = '' erases the contact. .ie n .IP "add_group => $groups" 4 .el .IP "add_group => \f(CW$groups\fR" 4 .IX Item "add_group => $groups" Adds the contact to the groups in the array reference \f(CW$groups\fR. .ie n .IP "remove_group => $groups" 4 .el .IP "remove_group => \f(CW$groups\fR" 4 .IX Item "remove_group => $groups" Removes the contact from the groups in the array reference \f(CW$groups\fR. .ie n .IP "groups => $groups" 4 .el .IP "groups => \f(CW$groups\fR" 4 .IX Item "groups => $groups" This sets the groups of the contact. \f(CW$groups\fR should be an array reference of the groups. .RE .RS 4 .RE .IP "\fBsend_subscribe ()\fR" 4 .IX Item "send_subscribe ()" This method sends this contact a subscription request. .IP "\fBsend_subscribed ()\fR" 4 .IX Item "send_subscribed ()" This method accepts a contact's subscription request. .IP "\fBsend_unsubscribe ()\fR" 4 .IX Item "send_unsubscribe ()" This method sends this contact a unsubscription request. .IP "\fBsend_unsubscribed ()\fR" 4 .IX Item "send_unsubscribed ()" This method sends this contact a unsubscription request which unsubscribes ones own presence from him (he wont get any further presence from us). .IP "\fBupdate ($item)\fR" 4 .IX Item "update ($item)" This method wants a AnyEvent::XMPP::Node in \f(CW$item\fR which should be a roster item received from the server. The method will update the contact accordingly and return it self. .IP "\fBupdate_presence ($presence)\fR" 4 .IX Item "update_presence ($presence)" This method updates the presence of contacts on the roster. \&\f(CW$presence\fR must be a AnyEvent::XMPP::Node object and should be a presence packet. .IP "\fBget_presence ($jid)\fR" 4 .IX Item "get_presence ($jid)" This method returns a presence of this contact if it is available. The return value is an instance of AnyEvent::XMPP::IM::Presence or undef if no such presence exists. .IP "\fBget_presences\fR" 4 .IX Item "get_presences" Returns all presences of this contact in form of AnyEvent::XMPP::IM::Presence objects. .IP "\fBget_priority_presence\fR" 4 .IX Item "get_priority_presence" Returns the presence with the highest priority. .IP "\fBgroups\fR" 4 .IX Item "groups" Returns the list of groups (strings) this contact is in. .IP "\fBjid\fR" 4 .IX Item "jid" Returns the bare \s-1JID\s0 of this contact. .IP "\fBname\fR" 4 .IX Item "name" Returns the (nick)name of this contact. .IP "\fBis_on_roster ()\fR" 4 .IX Item "is_on_roster ()" Returns 1 if this is a contact that is officially on the roster and not just a contact we've received presence information for. .IP "\fBis_me\fR" 4 .IX Item "is_me" Returns a true value when this contacts stands for ourself and is only used for receiving presences of our own resources. .IP "\fBsubscription\fR" 4 .IX Item "subscription" Returns the subscription state of this contact, which can be one of: .Sp .Vb 1 \& \*(Aqnone\*(Aq, \*(Aqto\*(Aq, \*(Aqfrom\*(Aq, \*(Aqboth\*(Aq .Ve .Sp If the contact isn't on the roster anymore this method returns: .Sp .Vb 1 \& \*(Aqremove\*(Aq .Ve .IP "\fBask\fR" 4 .IX Item "ask" Returns 'subscribe' if we asked this contact for subscription. .IP "\fBsubscription_pending\fR" 4 .IX Item "subscription_pending" Returns true if this contact has a pending subscription. That means: the contact has to aknowledge the subscription. .IP "\fBnickname\fR" 4 .IX Item "nickname" Returns the nickname of this contact (or, if none is set in the roster, it returns the node part of the \s-1JID\s0) .IP "\fBmake_message (%args)\fR" 4 .IX Item "make_message (%args)" This method returns a AnyEvent::XMPP::IM::Message object with the to field set to this contacts \s-1JID.\s0 .Sp \&\f(CW%args\fR are further arguments for the message constructor. .SH "AUTHOR" .IX Header "AUTHOR" Robin Redeker, \f(CW\*(C`\*(C'\fR, \s-1JID:\s0 \f(CW\*(C`\*(C'\fR .SH "COPYRIGHT & LICENSE" .IX Header "COPYRIGHT & LICENSE" Copyright 2007, 2008 Robin Redeker, all rights reserved. .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.