Class | Jabber::Session |
In: |
lib/jabber4r/session.rb
|
Parent: | Object |
connection | [R] | The Jabber::Protocol::Connection instance |
host | [R] | The host this session is connected to |
iqHandlers | [RW] | The iq handlers for this session |
jid | [R] | The Jabber::JID of the current session |
password | [RW] | The password to use for authenticating this session |
port | [R] | The port (defaults to 5222) that this session is connected to |
resource | [RW] | The resource id for this session |
roster | [R] | The Jabber::Roster instance |
session_id | [R] | The session id sent from the Jabber service upon connection |
username | [RW] | The username to use for authenticating this session |
Session creation factory that creates a session, logs in, requests the roster, registers message and presence filters and announces initial presence. Login is done via plaintext password authentication.
jid: | [String | JID] The account information ("account@host/resouce") |
password: | [String] The account password |
port: | [Integer = 5222] The host port |
digest: | [Boolean = false] Use digest authentication? |
return: | [Jabber::Session] The new session |
Session creation factory that creates a session, logs in, requests the roster, registers message and presence filters and announces initial presence. Login is done via digest (SHA) password authentication.
jid: | [String | JID] The account information ("account@host/resouce") |
password: | [String] The account password |
port: | [Integer = 5222] The host port |
return: | [Jabber::Session] The new session |
Creates a new session connected to the supplied host and port. The method attempts to build a Jabber::Protocol::Connection object and send the open_stream XML message. It then blocks to recieve the coorisponding reply open_stream and sets the session_id from that xml element.
host: | [String] The hostname of the Jabber service |
port: | [Integer=5222] The port of the Jabber service |
raise: | [RuntimeException] If connection fails |
Registers a listener for roster events
&block: | [Block] The listener block to process roster changes |
return: | [String] A roster ID to use when removing this listener |
Authenticate (logs into) this session with the supplied credentials. The method blocks waiting for a reply to the login message. Sets the authenticated attribute based on result.
username: | [String] The username to use for authentication |
password: | [String] The password to use for authentication |
resource: | [String] The resource ID for this session |
digest: | [Boolean=false] True to use digest authentication (not sending password in the clear) |
return: | [Boolean] Whether the authentication succeeded or failed |
Deletes a message listener
id: | [String] A messanger ID returned from add_message_listener |
Deletes the roster listener
id: | [String] A roster ID received from the add_roster_listener method |
Creates a new message addressed to the supplied JID of type CHAT
to: | [JID] Who to send the message to |
return: | [Jabber::Protocol::Message] The new (chat) message |
Creates a new message addressed to the supplied JID of type GROUPCHAT
to: | [JID] Who to send the message to |
return: | [Jabber::Protocol::Message] The new (group chat) message |
Creates a new message to the supplied JID of type NORMAL
to: | [Jabber::JID] Who to send the message to |
type: | [String = Jabber::Protocol::Message::NORMAL] The type of message to send (see Jabber::Protocol::Message) |
return: | [Jabber::Protocol::Message] The new message |
Notifies message listeners of the received message
message: | [Jabber::Protocol::Message] The received message |
Set a handler for session exceptions that get caught in communicating with the Jabber server.
Registers the roster filter with the Connection to forward IQ requests to the IQ listeners(they register by namespace)
Adds a filter to the Connection to manage tracking messages to forward to registered message listeners.
Releases the connection and resets the session. The Session instance is no longer usable after this method is called
Requests the Roster for the (authenticated) account. This method blocks until a reply to the roster request is received.