Class: Vines::Stanza::Dialback
- Inherits:
-
Vines::Stanza
- Object
- Vines::Stanza
- Vines::Stanza::Dialback
- Defined in:
- lib/vines/stanza/dialback.rb
Constant Summary collapse
- NS =
NAMESPACES[:legacy_dialback]
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
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/vines/stanza/dialback.rb', line 11 def process id, from, to = %w[id from to].map {|a| @node[a] } key = @node.text outbound_stream = router.stream_by_id(id) unless outbound_stream && outbound_stream.state.is_a?(Stream::Server::Outbound::AuthDialbackResult) @stream.write(%Q{<db:verify from="#{to}" to="#{from}" id="#{id}" type="error"><error type="cancel"><item-not-found xmlns="#{NAMESPACES[:stanzas]}"/></error></db:verify>}) return end secret = outbound_stream.state.dialback_secret type = Kit.dialback_key(secret, from, to, id) == key ? VALID_TYPE : INVALID_TYPE @stream.write(%Q{<db:verify from="#{to}" to="#{from}" id="#{id}" type="#{type}"/>}) end |