Sha256: bb1540acb1ba80a303c5473ca78cd1e4d71e2bf3e6064c632362bdeb1e4ab976

Contents?: true

Size: 1.04 KB

Versions: 18

Compression:

Stored size: 1.04 KB

Contents

require 'adhearsion/xmpp/connection.rb'

module Adhearsion
  class Initializer
    class XMPPInitializer

      cattr_accessor :config, :jid, :password, :server, :port
      class << self

        def start
          require_dependencies
          XMPP::Connection.extend Blather::DSL
          ahn_config    = Adhearsion::AHN_CONFIG
          self.config   = ahn_config.xmpp
          self.jid      = config.jid
          self.password = config.password
          self.server   = config.server
          self.port     = config.port

          XMPP::Connection.start(jid, password, server, port)
        end

        def stop
          XMPP::Connection.stop
        end

        private

        def require_dependencies
          begin
            require 'blather/client/client'
            require 'blather/client/dsl'
          rescue LoadError
            ahn_log.fatal "XMPP support requires the \"blather\" gem."
            # Silence the abort so we don't get an ugly backtrace
            abort ""
          end
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 3 rubygems

Version Path
adhearsion-1.2.6 lib/adhearsion/initializer/xmpp.rb
adhearsion-1.2.5 lib/adhearsion/initializer/xmpp.rb
adhearsion-1.2.4 lib/adhearsion/initializer/xmpp.rb
adhearsion-1.2.3 lib/adhearsion/initializer/xmpp.rb
adhearsion-1.2.1 lib/adhearsion/initializer/xmpp.rb
adhearsion-1.2.0 lib/adhearsion/initializer/xmpp.rb
adhearsion-1.1.1 lib/adhearsion/initializer/xmpp.rb
adhearsion-1.1.0 lib/adhearsion/initializer/xmpp.rb
adhearsion-1.0.3 lib/adhearsion/initializer/xmpp.rb
adhearsion-1.0.2 lib/adhearsion/initializer/xmpp.rb
adhearsion-cw-1.0.2.3 lib/adhearsion/initializer/xmpp.rb
adhearsion-cw-1.0.2.2 lib/adhearsion/initializer/xmpp.rb
adhearsion-cw-1.0.2.1 lib/adhearsion/initializer/xmpp.rb
adhearsion-1.0.1 lib/adhearsion/initializer/xmpp.rb
adhearsion-1.0.0 lib/adhearsion/initializer/xmpp.rb
rene-adhearsion-0.8.6 lib/adhearsion/initializer/xmpp.rb
adhearsion-0.8.6 lib/adhearsion/initializer/xmpp.rb
adhearsion-0.8.5 lib/adhearsion/initializer/xmpp.rb