Age | Commit message (Collapse) | Author |
|
We were making use of an undefined variable e when catching ServerError
in the main loop.
|
|
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.
|
|
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.
|
|
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
|
|
Fix a typo in a comment and specify 'htmlinfo' in the debug message.
|
|
parenthesize argument(s) for future version
|
|
A stupid missing hash sign prevented the full registry accessor doc from
being parsed by rdoc.
|
|
The RFC1459 casemaps had the non-letter casemapping the wrong way
around. Fix by swapping them.
|
|
Break early from ignore checks, and skip them altogether when the
message is ignored already.
|
|
In some circumstances the user might want to turn the bot into a pure
logbot for some channels. This can now be achieved by adding that
channel to the irc.ignore_channels config key, that makes the bot ignore
all PRIVMSG to that channel (note that notices and service messages such
as joins and parts are still acted on, just like for irc.ignore_users).
|
|
The reconnect() call in the main loop must be protected in the
begin/rescue blocks. Most of the rescue blocks can be fall-through,
because the begin/end is wrapped in a loop. The only exception is the
ServerError block that issues a retry lest too_fast is reset to false
even when it should be true.
|
|
false
|
|
Some editors put a BOM at the beginning of UTF-8 files, and it's not
stripped by Ruby's String#strip, so we have to get rid of it ourselves.
|
|
The new Wordlist.exist? method can be used to check if a wordlist file exists.
It will refuse to check upstream of the wordlist base directory
|
|
Introduce an elementary Wordlist.list() command that accepts an optional
:pattern option to restrict the list to wordlists matching the given
pattern.
Also introduce a wordlist UI to list wordlists from IRC.
|
|
|
|
|
|
+ (reply) symbol to bypass the config option
* (plugins) fixed url according to the patch
The symbols are:
:to => :public force the message to be replied in channel (if any)
:to => :private force the message to be replied in private
:to => :auto takes core.private_replies (default)
|
|
Message#reply() now accepts a :reply option
:nick => false don't prefix nick
:nick => true prefix nick
:nick => :auto take core.reply_with_nick (default)
|
|
The refactored reconnect() method would only wait when the socket was
connected at the time it got called. In case where the socket would have
closed earlier (e.g. because of a network I/O error) it would reconnect
directly, which would for example fail to prevent fast reconnections.
Fix by fencing the wait code with a check for @last_rec (checked before the
optional disconnect) rather than keeping it with the socket connect check,
and always initializing @last_rec on socket connect.
A side effect of this strategy is that reconnect() will only wait if the bot
was previously connect, or if it got disconnected by anything but the
disconnect() method. Callers of disconnect() should take care of waiting
themselves if they plan to reconnect.
|
|
|
|
|
|
|
|
|
|
Sometimes the bot may receive incomplete or malformed mode lines. This
can be seen for example by kicking repeatedly and at very short
intervals the bot from a channel with +l set to some numbers (at least
on freenode).
We (don't) handle these malformed modelines by skipping them rather than
crashing.
|
|
|
|
|
|
|
|
|
|
We define a new age_string function which is a cleaner version of
distance_of_time_in_words. The latter gets removed as its only
in-tree usage was from timeago (which is the UI version that should
be used by plugins anyway).
Utils.timeago gets a revamp too, exploiting the new age_string function.
|
|
|
|
|
|
|
|
Irc::Socket initialization now always has opt as last parameter, so
don't bother checking if it's a Hash.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Keep a track of exceptions to a global 'quiet' command so that user can
use !quiet and !talk in here to make the bot only talk in one channel
without quiet-ing it by hand in each one of the other channels.
|
|
This reverts commit b6bd9a24014ac9fbc822e9051f216f0506f24cd5
"message.rb: fix message addressing logic" since it actually breaks the
validity for address? in a number of cases.
Instead, add proper @address setting to NickMessage which is the only
one getting it wrong presently.
|
|
|
|
|
|
The penalty system should be enough to prevent the bot from being
disconnected because of excess flood, making the old sendq delay/burst
code unnecessary. So get rid of the latter altogether.
(If the penalty system as implemented ever happens to be insufficient as
implemented, it should just get fixed rather than rely on the sendq
delay/burst assistance.)
|
|
IRC messages which are not PRIVMSG or NOTICE (i.e. not UserMessage) are
'addressed' to the bot when they originate from it.
Rather than putting this logic in each one of them (and forgetting about
it for some, e.g. NICK messages), put it in BasicUserMessage. Compensate
by always setting @address in UserMessage to test against target
instead.
|
|
For consistency, all delegations now return the actual Channel object in
data[:channel] and the actual User object in data[:nick].
|