Sha256: cd9235230a22bac938c8dbedfb4fafc1b477b8e9b5c8ea8524f2c6eb4a4f7f6d

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

# I know this isn't completely proper, but for some reason my lib wasn't on the loadpath, and i SHOULD be able to assume it is
unless $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__)))
  $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
end

require 'rubygems'

require 'logger'
require 'forwardable'

require 'xmpp4r'
require 'xmpp4r/muc'
require 'xmpp4r/roster'

require 'botfly/callback_context'
require 'botfly/common_block_acceptor'
require 'botfly/responder'
require 'botfly/bot'
require 'botfly/matcher'
require 'botfly/muc_client'


Thread.abort_on_exception = true

module Botfly
  def Botfly.logger
    @logger ||= Logger.new(@logfile)
    return @logger
  end
  def Botfly.login(jid,pass,opts={},logfile=STDOUT,&block)
    @logfile = logfile
    Botfly.logger.info("BOTFLY: #login")
    bot = Botfly::Bot.new(jid,pass,opts)
    bot.connect # Must connect first, since MUC requires an active connection to initiate
    bot.instance_exec(&block)
    return bot # At this point doesn't get returned, as the thread is stopped
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
botfly-0.3.6 lib/botfly.rb
botfly-0.3.5 lib/botfly.rb
botfly-0.3.4 lib/botfly.rb