summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTom Gilbert <tom@linuxbrit.co.uk>2005-08-02 15:28:36 +0000
committerTom Gilbert <tom@linuxbrit.co.uk>2005-08-02 15:28:36 +0000
commit5940baa7fb81196925d692d4e4fe6d6cab73d1ed (patch)
tree787348f8d4739d0c46b94a60494ddafdf5929618 /lib
parentca1105be02e1baf867eaeb2c56049f87d8a9ecd3 (diff)
* Fixed the new http.proxy* settings, they work!
* Fixed a bug with auth-checking for the config module * misc tweaks
Diffstat (limited to 'lib')
-rw-r--r--lib/rbot/auth.rb3
-rw-r--r--lib/rbot/config.rb3
-rw-r--r--lib/rbot/httputil.rb6
-rw-r--r--lib/rbot/ircbot.rb3
-rw-r--r--lib/rbot/messagemapper.rb6
5 files changed, 14 insertions, 7 deletions
diff --git a/lib/rbot/auth.rb b/lib/rbot/auth.rb
index ae7199e1..cc11a5a2 100644
--- a/lib/rbot/auth.rb
+++ b/lib/rbot/auth.rb
@@ -20,7 +20,8 @@ module Irc
# on hostmask and userlevel.
class IrcAuth
BotConfig.register BotConfigStringValue.new('auth.password',
- :default => "Your password for maxing your auth with the bot (used to associate new hostmasks with your owner-status etc)")
+ :default => "rbotauth", :wizard => true,
+ :desc => "Your password for maxing your auth with the bot (used to associate new hostmasks with your owner-status etc)")
# create a new IrcAuth instance.
# bot:: associated bot class
diff --git a/lib/rbot/config.rb b/lib/rbot/config.rb
index a4522926..834b5a98 100644
--- a/lib/rbot/config.rb
+++ b/lib/rbot/config.rb
@@ -229,6 +229,7 @@ module Irc
value = params[:value].to_s
unless @@items.has_key?(key)
m.reply "no such config key #{key}"
+ return
end
begin
@@items[key].set_string(value)
@@ -263,7 +264,7 @@ module Irc
end
end
def usage(m,params)
- m.reply "incorrect usage, try '#{@bot.nick}: help config'"
+ m.reply "incorrect usage, try '#{@@bot.nick}: help config'"
end
# bot:: parent bot class
diff --git a/lib/rbot/httputil.rb b/lib/rbot/httputil.rb
index c6f51d8e..e234dc10 100644
--- a/lib/rbot/httputil.rb
+++ b/lib/rbot/httputil.rb
@@ -44,7 +44,7 @@ class HttpUtil
list = [uri.host]
begin
- list.push Resolv.getaddresses(uri.host)
+ list.concat Resolv.getaddresses(uri.host)
rescue StandardError => err
puts "warning: couldn't resolve host uri.host"
end
@@ -90,10 +90,10 @@ class HttpUtil
if @bot.config["http.use_proxy"]
if (ENV['http_proxy'])
- proxy = URI.parse ENV['http_proxy']
+ proxy = URI.parse ENV['http_proxy'] rescue nil
end
if (@bot.config["http.proxy_uri"])
- proxy = URI.parse ENV['http_proxy_uri']
+ proxy = URI.parse @bot.config["http.proxy_uri"] rescue nil
end
if proxy
debug "proxy is set to #{proxy.uri}"
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb
index 6bdf7bdf..2dcede3e 100644
--- a/lib/rbot/ircbot.rb
+++ b/lib/rbot/ircbot.rb
@@ -71,6 +71,9 @@ class IrcBot
# channel info for channels the bot is in
attr_reader :channels
+ # bot's irc socket
+ attr_reader :socket
+
# bot's object registry, plugins get an interface to this for persistant
# storage (hash interface tied to a bdb file, plugins use Accessors to store
# and restore objects in their own namespaces.)
diff --git a/lib/rbot/messagemapper.rb b/lib/rbot/messagemapper.rb
index 445b80f5..c8e2b6ba 100644
--- a/lib/rbot/messagemapper.rb
+++ b/lib/rbot/messagemapper.rb
@@ -29,15 +29,17 @@ module Irc
else
action = route.options[:action] ? route.options[:action] : route.items[0]
next unless @parent.respond_to?(action)
- auth = route.options[:auth] ? route.options[:auth] : action
+ auth = route.options[:auth] ? route.options[:auth] : route.items[0]
+ debug "checking auth for #{auth}"
if m.bot.auth.allow?(auth, m.source, m.replyto)
debug "route found and auth'd: #{action.inspect} #{options.inspect}"
@parent.send(action, m, options)
return true
end
+ debug "auth failed for #{auth}"
# if it's just an auth failure but otherwise the match is good,
# don't try any more handlers
- break
+ return false
end
end
debug failures.inspect