Class: Vines::Stanza::Message
- Inherits:
-
Vines::Stanza
- Object
- Vines::Stanza
- Vines::Stanza::Message
- Defined in:
- lib/vines/stanza/message.rb
Constant Summary collapse
- VALID_TYPES =
%w[chat error groupchat headline normal].freeze
Constants inherited from Vines::Stanza
Instance Attribute Summary
Attributes inherited from Vines::Stanza
Instance Method Summary collapse
Methods inherited from Vines::Stanza
#broadcast, from_node, #initialize, #local?, #local_jid?, #method_missing, register, #route, #router, #send_unavailable, #storage, #to_pubsub_domain?, #unavailable, #validate_from, #validate_to
Constructor Details
This class inherits a constructor from Vines::Stanza
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Vines::Stanza
Instance Method Details
#process ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/vines/stanza/message.rb', line 17 def process unless self[TYPE].nil? || VALID_TYPES.include?(self[TYPE]) raise StanzaErrors::BadRequest.new(self, 'modify') end if local? to = validate_to || stream.user.jid. recipients = stream.connected_resources(to) if recipients.empty? if user = storage(to.domain).find_user(to) msg_body = self.css('body').inner_text unless msg_body=="" msg = {:from => stream.user.jid.to_s,:body=>msg_body,:to => to..to_s} storage(to.domain).(msg) end end else broadcast(recipients) end else self[FROM] = stream.user.jid.to_s route end end |