Class | Jabber::Message |
In: |
lib/xmpp4r/message.rb
|
Parent: | XMPPStanza |
The Message class manages the <message/> stanzas, which is used for all messaging communication.
Create a new message
>to: | a JID or a String object to send the message to. |
>body: | the message‘s body |
# File lib/xmpp4r/message.rb, line 23 23: def initialize(to = nil, body = nil) 24: super() 25: if not to.nil? 26: set_to(to) 27: end 28: if !body.nil? 29: add_element(REXML::Element::new("body").add_text(body)) 30: end 31: end
Sets the message‘s body
b: | [String] body to set |
return: | [REXML::Element] self for chaining |
# File lib/xmpp4r/message.rb, line 96 96: def set_body(b) 97: self.body = b 98: self 99: end
sets the message‘s subject
s: | [String] subject to set |
return: | [REXML::Element] self for chaining |
# File lib/xmpp4r/message.rb, line 114 114: def set_subject(s) 115: self.subject = s 116: self 117: end
Get the type of the Message stanza
The following Symbols are allowed:
result: | [Symbol] or nil |
# File lib/xmpp4r/message.rb, line 43 43: def type 44: case super 45: when 'chat' then :chat 46: when 'error' then :error 47: when 'groupchat' then :groupchat 48: when 'headline' then :headline 49: when 'normal' then :normal 50: else nil 51: end 52: end
Set the type of the Message stanza (see Message#type for details)
v: | [Symbol] or nil |
# File lib/xmpp4r/message.rb, line 57 57: def type=(v) 58: case v 59: when :chat then super('chat') 60: when :error then super('error') 61: when :groupchat then super('groupchat') 62: when :headline then super('headline') 63: when :normal then super('normal') 64: else super(nil) 65: end 66: end