This method adds a jabber account for connection with the JID $jid and the password $password.

$host and $port can be undef and their default will be the domain of the $jid and the default for the port parameter to the constructor of AnyEvent::XMPP::Connection (look there for details about DNS-SRV lookups).

$connection_args must either be undef or a hash reference to additional arguments for the constructor of the AnyEvent::XMPP::IM::Connection that will be used to connect the account.

Sets the set of (to be connected) accounts. $accounts must be a hash reference which contains the JIDs of the accounts as keys and the values for $password, $domain, $port and $connection_args as described in add_account above.

If the account is not yet connected it will be connected on the next call to update_connections and if an account is connected that is not in $accounts it will be disconnected.

Sends a message to the destination $dest_jid. $msg can either be a string or a AnyEvent::XMPP::IM::Message object. If $msg is such an object $dest_jid is optional, but will, when passed, override the destination of the message.

NOTE: $dest_jid is transformed into a bare JID and the routing is done by the conversation tracking mechanism which keeps track of which resource should get the message.

$src is optional. It specifies which account to use to send the message. If it is not passed AnyEvent::XMPP::Client will try to find an account itself. First it will look through all rosters to find $dest_jid and if none found it will pick any of the accounts that are connected.

This method tries to find any account that has the contact $jid on his roster. If no account with $jid on his roster was found it takes the first one that is connected. (Return value is a AnyEvent::XMPP::IM::Account object).

This event is emitted when any error occured while communicating over the connection to the $account - after a connection was established.

$error is an error object which is derived from AnyEvent::XMPP::Error. It will reveal human readable information about the error by calling the string () method (which returns a descriptive error string about the nature of the error).