Tom Molesworth > Protocol-XMPP-0.006 > Protocol::XMPP::Stream

Download:
Protocol-XMPP-0.006.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.006   Source  

NAME ^

Protocol::XMPP::Stream - handle XMPP protocol stream

VERSION ^

Version 0.006

SYNOPSIS ^

DESCRIPTION ^

METHODS ^

new

Instantiate a stream object. Used for interacting with the underlying XMPP stream.

Takes the following parameters as callbacks:

and the following scalar parameters:

on_data

Data has been received, pass it over to the SAX parser to trigger any required events.

queue_write

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.

write_buffer

Returns the contents of the current write buffer without changing it.

extract_write

Retrieves next pending message from the write buffer and removes it from the list.

ready_to_send

Returns true if there's data ready to be written.

reset

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.

dispatch_event

Call the appropriate event handler.

Currently defined events:

preamble

Returns the XML header and opening stream preamble.

jid

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.

user

Username for SASL authentication.

pass

Password for SASL authentication.

hostname

Name of the host

resource

Fragment used to differentiate this client from any other active clients for this user (as defined by bare JID).

write_xml

Write a chunk of XML to the stream, converting from the internal representation to XML text stanzas.

write_text

Write raw text to the output stream.

login

Process the login.

Takes optional named parameters:

is_authorised

Returns true if we are authorised already.

is_loggedin

Returns true if we are logged in already.

stream

Override the ->stream method from the base class so that we pick up our own methods directly.

next_id

Returns the next ID in the sequence for outgoing requests.

on_tls_complete

Continues the next part of the connection when TLS is complete.

compose

Compose a new outgoing message.

subscribe

Subscribe to a new contact. Takes a single JID as target.

unsubscribe

Unsubscribe from the given contact. Takes a single JID as target.

authorise

Grant authorisation to the given contact. Takes a single JID as target.

deauthorise

Revokes auth for the given contact. Takes a single JID as target.

INHERITED METHODS ^

Protocol::XMPP::Base

debug, new_future

Mixin::Event::Dispatch

add_handler_for_event, clear_event_handlers, event_handlers, invoke_event, subscribe_to_event, unsubscribe_from_event

AUTHOR ^

Tom Molesworth <cpan@entitymodel.com>

LICENSE ^

Copyright Tom Molesworth 2010-2014. Licensed under the same terms as Perl itself.

syntax highlighting: