These additional events can be registered on with "reg_cb":
In the following events $roster is the AnyEvent::XMPP::IM::Roster object you get by calling "get_roster".
NODE: The first argument to each callback is always the AnyEvent::XMPP::IM::Connection object itself.
Also see Object::Event for more information about registering callbacks.
session_ready
This event is generated when the session has been fully established and can be used to send around
messages and other stuff.
session_error => $error
If an error happened during establishment of the session this event will be generated. $error will be
an AnyEvent::XMPP::Error::IQ error object.
roster_update => $roster, $contacts
This event is emitted when a roster update has been received. $contacts is an array reference of
AnyEvent::XMPP::IM::Contact objects which have changed. If a contact was removed it will return
'remove' when you call the "subscription" method on it.
The first time this event is sent is when the roster was received for the first time.
roster_error => $error
If an error happened during retrieval of the roster this event will be generated. $error will be an
AnyEvent::XMPP::Error::IQ error object.
presence_update => $roster, $contact, $old_presence, $new_presence
This event is emitted when the presence of a contact has changed. $contact is the
AnyEvent::XMPP::IM::Contact object which presence status has changed. $old_presence is a
AnyEvent::XMPP::IM::Presence object which represents the presence prior to the change. $new_presence
is a AnyEvent::XMPP::IM::Presence object which represents the presence after to the change. The new
presence might be undef if the new presence is 'unavailable'.
presence_error => $error
This event is emitted when a presence stanza error was received. $error will be an
AnyEvent::XMPP::Error::Presence error object.
message => $msg
This event is emitted when a message was received. $msg is a AnyEvent::XMPP::IM::Message object.
message_error => $error
This event is emitted when a message stanza error was received. $error will be an
AnyEvent::XMPP::Error::Message error object.
contact_request_subscribe => $roster, $contact, $message
This event is generated when the $contact wants to subscribe to your presence.
If you want to accept or decline the request, call "send_subscribed" method of
AnyEvent::XMPP::IM::Contact or "send_unsubscribed" method of AnyEvent::XMPP::IM::Contact on $contact.
If you want to start a mutual subscription you have to call "send_subscribe" AFTER you accepted or
declined with "send_subscribed"/"send_unsubscribed". Calling it in the opposite order gets some
servers confused!
If a "status" element was transmitted with the subscription it's contents will be in $message. Which
is usually a text written from the one who requests subscription.
contact_subscribed => $roster, $contact, $message
This event is generated when $contact subscribed you to his presence successfully.
If a "status" element was transmitted with the subscribed presence it's contents will be in $message.
contact_did_unsubscribe => $roster, $contact, $message
This event is generated when $contact unsubscribes from your presence.
If you want to unsubscribe from him call the "send_unsubscribe" method of AnyEvent::XMPP::IM::Contact
on $contact.
If a "status" element was transmitted with the unsubscription it's contents will be in $message.
Which is usually a text written from the one who unsubscribes.
contact_unsubscribed => $roster, $contact, $message
This event is generated when $contact unsubscribed you from his presence.
If you want to unsubscribe him from your presence call the "send_unsubscribed" method of
AnyEvent::XMPP::IM::Contact on $contact.
If a "status" element was transmitted with the unsubscription it's contents will be in $message.