Sha256: 31e56886dc9a0d4f701a680f43506dbc5d8e91f21bd624d4d40bcacc1c19a9a7

Contents?: true

Size: 888 Bytes

Versions: 6

Compression:

Stored size: 888 Bytes

Contents

# encoding: UTF-8

module Vines
  class Stream
    class Server
      class Outbound
        class AuthDialbackResult < State
          RESULT, VALID, INVALID, TYPE = %w[result valid invalid type].map {|s| s.freeze }

          attr_accessor :dialback_secret

          def initialize(stream, success=Ready)
            super
          end

          def node(node)
            raise StreamErrors::NotAuthorized unless result?(node)

            case node[TYPE]
            when VALID
              advance
              stream.notify_connected
            when INVALID
              stream.close_connection
            else
              raise StreamErrors::NotAuthorized
            end
          end

          private

          def result?(node)
            node.name == RESULT && namespace(node) == NAMESPACES[:legacy_dialback]
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
diaspora-vines-0.2.0.develop.4 lib/vines/stream/server/outbound/auth_dialback_result.rb
diaspora-vines-0.2.0.develop.3 lib/vines/stream/server/outbound/auth_dialback_result.rb
diaspora-vines-0.2.0.develop.2 lib/vines/stream/server/outbound/auth_dialback_result.rb
diaspora-vines-0.2.0.develop.1 lib/vines/stream/server/outbound/auth_dialback_result.rb
diaspora-vines-0.1.28 lib/vines/stream/server/outbound/auth_dialback_result.rb
diaspora-vines-0.1.27 lib/vines/stream/server/outbound/auth_dialback_result.rb