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.bare
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.bare.to_s}
storage(to.domain).save_offline_message(msg)
end
end
else
broadcast(recipients)
end
else
self[FROM] = stream.user.jid.to_s
route
end
end
|