Class Jabber::Protocol::Message
In: lib/jabber4r/protocol.rb
Parent: Object
Methods
from_element    new    reply    request    send    session=    set_body    set_error    set_outofband    set_subject    set_thread    set_x    set_xhtml    to_s    to_xml   
Attributes
body  [RW] 
error  [RW] 
errorcode  [RW] 
from  [RW] 
id  [RW] 
oobData  [RW] 
subject  [RW] 
thread  [RW] 
to  [RW] 
type  [RW] 
x  [RW] 
xhtml  [RW] 
Public Class methods
from_element(session, element)

Factory to build a Message from an XMLElement

session:[Jabber::Session] The Jabber session instance
element:[Jabber::Protocol::ParsedXMLElement] The received XML object
return:[Jabber::Protocol::Message] The newly created Message object
new(to, type=NORMAL)

Creates a Message

to:[String | Jabber::JID] The jabber id to send this message to (or from)
type:[Integer=NORMAL] The type of message...Message::(NORMAL, CHAT, GROUPCHAT, HEADLINE)
Public Instance methods
set_body(body)

Chaining method...sets the body of the message

body:[String] The message body
return:[Jabber::Protocol::Message] The current Message object
set_subject(subject)

Chaining method...sets the subject of the message

subject:[String] The message subject
return:[Jabber::Protocol::Message] The current Message object
set_xhtml(xhtml)

Chaining method...sets the XHTML body of the message

body:[String] The message body
return:[Jabber::Protocol::Message] The current message object
set_thread(thread)

Chaining method...sets the thread of the message

thread:[String] The message thread id
return:[Jabber::Protocol::Message] The current Message object
set_outofband(data)

Chaining method...sets the OOB data of the message

data:[String] The message OOB data
return:[Jabber::Protocol::Message] The current Message object
set_x(x)

Chaining method...sets the extended data of the message

x:[String] The message x data
return:[Jabber::Protocol::Message] The current Message object
set_error(code,reason)

Sets an error code to be returned(chaining method)

code:[Integer] the jabber error code
reason:[String] Why the error was reported
return:[Jabber::Protocol::Message] The current Message object
request(ttl=nil, &block)

Convenience method for send(true)

ttl:[Integer = nil] The time (in seconds) to wait for a reply before assuming nil
&block:[Block] A block to process the message replies
send(wait=false, ttl=nil, &block)

Sends the message to the Jabber service for delivery

wait:[Boolean = false] Wait for reply before return?
ttl:[Integer = nil] The time (in seconds) to wait for a reply before assuming nil
&block:[Block] A block to process the message replies
session=(session)

Sets the session instance

session:[Jabber::Session] The session instance
return:[Jabber::Protocol::Message] The current Message object
reply()

Builds a reply to an existing message by setting:

  1. to = from
  2. id = id
  3. thread = thread
  4. type = type
  5. session = session
return:[Jabber::Protocol::Message] The reply message
to_xml()

Generates XML that complies with the Jabber protocol for sending the message through the Jabber service.

return:[String] The XML string.
to_s()

see to_xml