Protocol::XMPP::Stream - handle XMPP protocol stream
Version 0.006
Instantiate a stream object. Used for interacting with the underlying XMPP stream.
Takes the following parameters as callbacks:
on_queued_write - this will be called whenever there is data queued to be written to the socket
on_starttls - this will be called when we want to switch to TLS mode
and the following scalar parameters:
user - username (not the full JID, just the first part)
pass - password
Data has been received, pass it over to the SAX parser to trigger any required events.
Queue up a write for this stream. Adds to the existing send buffer array if there is one.
When a write is queued, this will send a notification to the on_queued_write callback if one was defined.
Returns the contents of the current write buffer without changing it.
Retrieves next pending message from the write buffer and removes it from the list.
Returns true if there's data ready to be written.
Reset this stream.
Clears out the existing SAX parsing information and sets up a new Protocol::XMPP::Handler ready to accept events. Used when we expect a new <stream> element, for example after authentication or TLS upgrade.
<stream
Call the appropriate event handler.
Currently defined events:
features - we have received the features list from the server
login - login was completed successfully
message - a message was received
presence - a presence notification was received
subscription - a presence notification was received
transfer_request - a file transfer request has been received
file - a file was received
Returns the XML header and opening stream preamble.
Returns the full JID for our user.
If given a parameter, will set the JID to that value, extracting hostname and user by splitting the domain.
Username for SASL authentication.
Password for SASL authentication.
Name of the host
Fragment used to differentiate this client from any other active clients for this user (as defined by bare JID).
Write a chunk of XML to the stream, converting from the internal representation to XML text stanzas.
Write raw text to the output stream.
Process the login.
Takes optional named parameters:
user - username (not the full JID, just the user part)
password - password or passphrase to use in SASL authentication
Returns true if we are authorised already.
Returns true if we are logged in already.
Override the ->stream method from the base class so that we pick up our own methods directly.
Returns the next ID in the sequence for outgoing requests.
Continues the next part of the connection when TLS is complete.
Compose a new outgoing message.
Subscribe to a new contact. Takes a single JID as target.
Unsubscribe from the given contact. Takes a single JID as target.
Grant authorisation to the given contact. Takes a single JID as target.
Revokes auth for the given contact. Takes a single JID as target.
debug, new_future
add_handler_for_event, clear_event_handlers, event_handlers, invoke_event, subscribe_to_event, unsubscribe_from_event
Tom Molesworth <cpan@entitymodel.com>
Copyright Tom Molesworth 2010-2014. Licensed under the same terms as Perl itself.
To install Protocol::XMPP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Protocol::XMPP
CPAN shell
perl -MCPAN -e shell install Protocol::XMPP
For more information on module installation, please visit the detailed CPAN module installation guide.