Tom Gilbert [Tue, 26 Jul 2005 21:50:00 +0000 (21:50 +0000)]
* Prevent multiple plugin registrations of the same name
* reworking the config system to use yaml for persistence
* reworking the config system key names
* on first startup, the bot will prompt for the essential startup config
* new config module for configuring the bot at runtime
* new config module includes new configurables, for example changing the
bot's language at runtime.
* various other fixes
* New way of mapping plugins to strings, using maps. These may be
familiar to rails users. This is to reduce the amount of regexps plugins
currently need to do to parse arguments. The old method (privmsg) is still
supported, of course. Example plugin now:
def MyPlugin < Plugin
def foo(m, params)
m.reply "bar"
end
def complexfoo(m, params)
m.reply "qux! (#{params[:bar]} #{params[:baz]})"
end
end
plugin = MyPlugin.new
# simple map
plugin.map 'foo'
# this will match "rbot: foo somestring otherstring" and pass the
# parameters as a hash using the names in the map.
plugin.map 'foo :bar :baz', :action => 'complexfoo'
# this means :foo is an optional parameter
plugin.map 'foo :foo', :defaults => {:foo => 'bar'}
# you can also gobble up into an array
plugin.map 'foo *bar' # params[:bar] will be an array of string elements
# and you can validate, here the first param must be a number
plugin.map 'foo :bar', :requirements => {:foo => /^\d+$/}
Tom Gilbert [Thu, 21 Jul 2005 11:03:46 +0000 (11:03 +0000)]
Wed Jul 20 23:30:01 BST 2005 Tom Gilbert <tom@linuxbrit.co.uk>
* Move some core plugins to use the new httputil
* fix wserver's redirection handling for relative (i.e. broken) redirects
* fix tube plugin's html parsing
Tom Gilbert [Wed, 20 Jul 2005 00:17:51 +0000 (00:17 +0000)]
Add new httputil object to the bot object, to be used by plugins etc that
wish to make http requests. It sets up all the proxies etc for them
according to bot config.
Tom Gilbert [Tue, 19 Jul 2005 16:13:21 +0000 (16:13 +0000)]
at some point over the last couple of years, the ruby http library started
throwing timeout exceptions from .new, wheras they used to come from .get.
This means timeouts kill the bot so I've moved all the http code into the
begin block.
Tom Gilbert [Thu, 14 Jul 2005 22:51:05 +0000 (22:51 +0000)]
Rudolf Polzer pointed out (a while ago, I forgot to apply this fix) an issue
with rbot's string handling. Most ircds are pretty liberal about lines
ending in various combinations of \r, \n, etc.
We need to be careful about strings we pass to the ircd that may have come
from users/untrusted sources (such as the output of the wserver plugin), and
sanitize their line endings so that raw commands can't be sneaked through to
the ircd.