Sha256: f7ad49c4f0b9485ad35f181859239f3f1343ec08ddda2ec8619ce5f6eb64d206
Contents?: true
Size: 1.63 KB
Versions: 2
Compression:
Stored size: 1.63 KB
Contents
module Adhearsion class XMPP class Plugin < Adhearsion::Plugin # Default configuration for XMPP connection. config :xmpp do use_punchblock true, :desc => "Re-use Punchblock's XMPP connection. Boolean." jid nil, :desc => "Client/component JID to connect to. String." password nil, :desc => "Password identifier. String." server nil, :desc => "XMPP server hostname. May be omitted if server can be determined from JID. String." port nil, :desc => "XMPP server port. May be omitted if server can be determined from JID. Integer." end # Include the XMPP service in plugins initialization process init :xmpp, :after => :punchblock do Adhearsion::XMPP.plugin = Adhearsion::XMPP::Plugin.new Adhearsion::XMPP.handlers.each do |handler| Adhearsion::XMPP.connection.instance_eval &handler end unless Adhearsion::XMPP.handlers.nil? end delegate :config, :to => self delegate :use_punchblock, :to => :config def initialize init_blather config.jid, config.password, config.server, config.port unless use_punchblock end def init_blather(jid, password, server, port) raise "Must supply a jid to the XMPP configuration" unless jid.present? raise "Must supply a password to the XMPP configuration" unless password.present? connection.setup jid, password, server, port end def connection if use_punchblock PunchblockPlugin.connection else @connection ||= Connection.new end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
adhearsion-xmpp-1.0.2 | lib/adhearsion/xmpp/plugin.rb |
adhearsion-xmpp-1.0.1 | lib/adhearsion/xmpp/plugin.rb |