Class: Vines::Stream::Component
- Inherits:
-
Vines::Stream
- Object
- EventMachine::Connection
- Vines::Stream
- Vines::Stream::Component
- Defined in:
- lib/vines/stream/component.rb,
lib/vines/stream/component/ready.rb,
lib/vines/stream/component/start.rb,
lib/vines/stream/component/handshake.rb
Overview
Implements the XMPP protocol for trusted, external component (XEP-0114) streams. This serves connected streams using the jabber:component:accept namespace.
Defined Under Namespace
Classes: Handshake, Ready, Start
Constant Summary
Constants inherited from Vines::Stream
Instance Attribute Summary collapse
-
#remote_domain ⇒ Object
readonly
Returns the value of attribute remote_domain.
Attributes inherited from Vines::Stream
Instance Method Summary collapse
-
#initialize(config) ⇒ Component
constructor
A new instance of Component.
- #max_stanza_size ⇒ Object
- #ready? ⇒ Boolean
- #secret ⇒ Object
- #start(node) ⇒ Object
- #stream_type ⇒ Object
Methods inherited from Vines::Stream
#advance, #available_resources, #cert_domain_matches?, #close_connection, #connected_resources, #create_parser, #encrypt, #encrypt?, #error, #interested_resources, #post_init, #receive_data, #reset, #router, #ssl_verify_peer, #storage, #unbind, #update_user_streams, #vhost, #write
Methods included from Log
Constructor Details
Instance Attribute Details
#remote_domain ⇒ Object (readonly)
Returns the value of attribute remote_domain.
10 11 12 |
# File 'lib/vines/stream/component.rb', line 10 def remote_domain @remote_domain end |
Instance Method Details
#max_stanza_size ⇒ Object
19 20 21 |
# File 'lib/vines/stream/component.rb', line 19 def max_stanza_size config[:component].max_stanza_size end |
#ready? ⇒ Boolean
23 24 25 |
# File 'lib/vines/stream/component.rb', line 23 def ready? state.class == Component::Ready end |
#secret ⇒ Object
40 41 42 43 |
# File 'lib/vines/stream/component.rb', line 40 def secret password = config.component_password(@remote_domain) Digest::SHA1.hexdigest(@stream_id + password) end |
#start(node) ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/vines/stream/component.rb', line 31 def start(node) @remote_domain = node['to'] send_stream_header raise StreamErrors::ImproperAddressing unless valid_address?(@remote_domain) raise StreamErrors::HostUnknown unless config.component?(@remote_domain) raise StreamErrors::InvalidNamespace unless node.namespaces['xmlns'] == NAMESPACES[:component] raise StreamErrors::InvalidNamespace unless node.namespaces['xmlns:stream'] == NAMESPACES[:stream] end |
#stream_type ⇒ Object
27 28 29 |
# File 'lib/vines/stream/component.rb', line 27 def stream_type :component end |