Sha256: 58068c21b34f3992031846236d7bddcf9d0dd0784b65c0dfe4321af36166d620

Contents?: true

Size: 807 Bytes

Versions: 32

Compression:

Stored size: 807 Bytes

Contents

# encoding: UTF-8

module Vines
  class Stream
    class Http
      class Bind < Client::Bind
        FEATURES = %Q{<stream:features xmlns:stream="#{NAMESPACES[:stream]}"/>}.freeze

        def initialize(stream, success=Ready)
          super
        end

        def node(node)
          unless stream.valid_session?(node['sid']) && body?(node) && node['rid']
            raise StreamErrors::NotAuthorized
          end
          nodes = stream.parse_body(node)
          raise StreamErrors::NotAuthorized unless nodes.size == 1
          super(nodes.first)
        end

        private

        # Override Client::Bind#send_empty_features to properly namespace the
        # empty features element.
        def send_empty_features
          stream.write(FEATURES)
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 4 rubygems

Version Path
diaspora-vines-0.2.0.develop.4 lib/vines/stream/http/bind.rb
diaspora-vines-0.2.0.develop.3 lib/vines/stream/http/bind.rb
diaspora-vines-0.2.0.develop.2 lib/vines/stream/http/bind.rb
diaspora-vines-0.2.0.develop.1 lib/vines/stream/http/bind.rb
diaspora-vines-0.1.28 lib/vines/stream/http/bind.rb
lygneo-vines-0.1.5 lib/vines/stream/http/bind.rb
lygneo-vines-0.1.1 lib/vines/stream/http/bind.rb
diaspora-vines-0.1.27 lib/vines/stream/http/bind.rb
diaspora-vines-0.1.26 lib/vines/stream/http/bind.rb
diaspora-vines-0.1.25 lib/vines/stream/http/bind.rb
diaspora-vines-0.1.24 lib/vines/stream/http/bind.rb
vines-0.4.10 lib/vines/stream/http/bind.rb
diaspora-vines-0.1.22 lib/vines/stream/http/bind.rb
diaspora-vines-0.1.21 lib/vines/stream/http/bind.rb
diaspora-vines-0.1.2 lib/vines/stream/http/bind.rb
vines-0.4.9 lib/vines/stream/http/bind.rb
vines-0.4.8 lib/vines/stream/http/bind.rb
vines-0.4.7 lib/vines/stream/http/bind.rb
vines-0.4.6 lib/vines/stream/http/bind.rb
vinesmod-0.4.5.2 lib/vines/stream/http/bind.rb