Try loading rubygems as soon as we're set up, since it can be needed for
gettext and a number of other things. This also allows us to get rid of
some stupid convoluted tricks in utils.
irc: monkeypatch Singleton to make _load and _dump public.
This is to fix a possible bug in newer versions of ruby where _load was
declared private in singletons. This would lead to errors where Marshal
could not restore the Singleton. This "bug" was introduced to ruby
in revisions 16659 and 17396.
markov: ensure messages are cleaned before learning and replying.
Lines that began with or ended with spaces were breaking the learning
thread. The call to clean_str was moved down into learn_line (and
random_markov) so that all messages, including those being learned from
files, get cleaned.
Giuseppe Bilotta [Fri, 27 Feb 2009 20:40:16 +0000 (21:40 +0100)]
rss plugin: upper limit for watched feeds
Config option to set the maximum number of items that will be announced
when a feed updates. 0 means all of them, anything else clips the list
to the latest ones, and also announces that some of the updates will not
be listed.
Giuseppe Bilotta [Tue, 24 Feb 2009 20:48:34 +0000 (21:48 +0100)]
lastfm: catch all errors when connecting
Since httputil.get_response() can raise exceptions, catch them into an
appropriate block. Turn a missing response body into a runtime error to
handle this error conditions consistently with other exceptions.
Giuseppe Bilotta [Sat, 21 Feb 2009 19:03:53 +0000 (20:03 +0100)]
markov: try harder when generating strings
generate_strings() is now able to work with a single word. Additionally,
when the given lookup is not found in the database, it will try
lookups that start, and failing that include, the given one.
Giuseppe Bilotta [Sat, 21 Feb 2009 23:25:35 +0000 (00:25 +0100)]
registry: spare useless I/O
The each_key()/each_value() methods of the accessor relied on the each()
method of the database, wasting I/O bandwidth and time by loading
unnecessary data (particularly when running each_key() on databases with
ridiculously enormous values such as in the markov plugin case).
Giuseppe Bilotta [Mon, 16 Feb 2009 22:57:10 +0000 (23:57 +0100)]
factoids: pass proper parameter from unreplied()
When passing on the Array of split words from unreplied() to facts()
make sure that the passed argument behaves like an Array/String from
the MessageMapper.
Giuseppe Bilotta [Mon, 16 Feb 2009 20:14:32 +0000 (21:14 +0100)]
lastfm: limits to user data output
Define configuration keys for maximum and default number of user data
items output, with a separate value for shouts (which are usually much
more verbose and therefore would have a much lower maximum and default).
Each command also allow the specification of the number of entries
actually output (different than the default, clipped at the configured
maximum.
This way user data has the same rate limiting as events.
Internally, the switches for the user data are also made more uniform to
select, where it makes sense, different sentences depending on how many
entries are being displayed (none, all, some).
Giuseppe Bilotta [Sun, 15 Feb 2009 00:30:51 +0000 (01:30 +0100)]
+ @bot.path and datafile methods
We provide two methods that make it more simple and elegant for
botmodules to define paths relative to the bot's own directory
(botclass) and to the BotModule's (assumed) non-registry directory.
The first method is Irc::Bot#path(), which joins its arguments with the
botclass. This method can be used to access datafiles in the bot
directory with a much cleaner syntax; and since it uses File.join, the
resulting paths are also properly formatted on each platform, which
doesn't hurt.
Each BotModule now also carries a dirname() method that should return the
directory under botclass that holds the BotModule's datafiles. dirname()
defaults to the BotModule's name(), but it can be overridden, e.g. for
backwards compatibility (see the patch for the quotes plugin), or
for BotModules that share their datafiles.
Datafiles can be accessed using the BotModule#datafile() method that
joins the botclass, the dirname() and whatever other argument is passed.
Giuseppe Bilotta [Sat, 14 Feb 2009 22:56:49 +0000 (23:56 +0100)]
ircbot: refactor and clean up botclass dir handling
Use File.join across the board, and refactor some botclass directory
handling. Most important changes:
* failure to create the registry and safe_save directory is now fatal;
* failure to create the local plugin directory prevents it from being
added to the plugin path (with a warning);
* botclass directory update from templates is now a standalone routine
called during init, making it possible to use it in other cases too.
Giuseppe Bilotta [Wed, 11 Feb 2009 22:34:16 +0000 (23:34 +0100)]
ircbot: sendmsg filtering
We allow a filter to manipulate the arguments of sendmsg() by running
them through the filters of the :sendmsg group. The DataStream passed to
the filters has four keys:
:text => the message text
:type => the message type (typically, PRIVSMG or NOTICE)
:dest => the destination (typically, a Channel or User)
:options => options passed to sendmsg, merged with the default ones
Giuseppe Bilotta [Tue, 10 Feb 2009 00:19:03 +0000 (01:19 +0100)]
geoip: make the GeoIP module a standalone
The geoip plugin defines and makes use of a GeoIP module to handle the
actual geoip data retrieval. The module used to be defined in the same
namespace as the plugin, and therefore in a barely accessible anonymous
module.
Move the GeoIP module to the outermost namespace to allow it to be
accessible from scripts and plugins too.
Move the whitelist and badwords check in the message() method instead of
triggering on listen(). This is more correct and more efficient, and it
ensures that the whitelist protects mass-highlighters too.
Simon Hafner [Sun, 1 Feb 2009 19:08:25 +0000 (20:08 +0100)]
+ (bans) added masshl ban option
When a masshl ban is added, the bot will ban (or kick or whatever)
anybody that calls more than a given fixed number of users or a
percentage of in-channel users.