summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2009-03-06load rubygems if availableGiuseppe Bilotta
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.
2009-03-06irc: monkeypatch Singleton to make _load and _dump public.Spencer Rinehart
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.
2009-03-03utils: add a helper method for creating comma separated listsRaine Virta
2009-03-03ircbot: enable gettext on "restarting, back in..."Raine Virta
2009-03-03config: add alias config removeRaine Virta
2009-03-03config: allow multiple values in config add and rmRaine Virta
2009-02-28plugins: allow plugins whitelistingRaine Virta
If the whitelist is not empty, only load the specified plugins.
2009-02-28plugins: refactor plugin scanningRaine Virta
Refactor plugin scanning for cleaner distinction between core modules and plugins.
2009-02-28Separate @dirs containing all botmodules (plugins and core modules)Raine Virta
into @core_module_dirs and @plugin_dirs
2009-02-26finnish localization for basic expressionsRaine Virta
2009-02-22registry: expose set and bulk parametersGiuseppe Bilotta
expose set and bulk parameters in the each*() iterators. Some plugins might need it for faster lookup.
2009-02-22registry: spare useless I/OGiuseppe Bilotta
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).
2009-02-19remove whitespaceRaine Virta
2009-02-17ircbot: fix nil error variable on ServerErrorGiuseppe Bilotta
We were making use of an undefined variable e when catching ServerError in the main loop.
2009-02-15+ @bot.path and datafile methodsGiuseppe Bilotta
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.
2009-02-15ircbot: refactor and clean up botclass dir handlingGiuseppe Bilotta
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.
2009-02-11ircbot: sendmsg filteringGiuseppe Bilotta
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
2009-02-11utils: htmlinfo filtering doc cleanupsGiuseppe Bilotta
Fix a typo in a comment and specify 'htmlinfo' in the debug message.
2009-02-01ircbot: suppress warningGiuseppe Bilotta
parenthesize argument(s) for future version
2009-01-30* (registry) rdoc fixGiuseppe Bilotta
A stupid missing hash sign prevented the full registry accessor doc from being parsed by rdoc.
2009-01-29IRC Framework: fix wrong rfc casemapsGiuseppe Bilotta
The RFC1459 casemaps had the non-letter casemapping the wrong way around. Fix by swapping them.
2009-01-28ircbot: optimize ignore loopsGiuseppe Bilotta
Break early from ignore checks, and skip them altogether when the message is ignored already.
2009-01-28ircbot: irc.ignore_channels config optionGiuseppe Bilotta
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).
2009-01-28ircbot: the reconnect must be protectedGiuseppe Bilotta
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.
2009-01-28* (httputils) get_response must refresh the cached object even if :cache => ↵dmitry kim
false
2009-01-27wordlist: strip UTF-8 BOM on loadGiuseppe Bilotta
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.
2009-01-27wordlist: exist? methodGiuseppe Bilotta
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
2009-01-27wordlist: Wordlist.list command and UIGiuseppe Bilotta
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.
2009-01-27wordlist providerRaine Virta
2009-01-22+ (userdata) method delete_botdata(key)Simon Hafner
2009-01-22+ (reply) config option to force reply to querySimon Hafner
+ (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)
2009-01-22+ (reply) add new option to control nick prefixingSimon Hafner
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)
2009-01-15ircbot: fix reconnect() waitingGiuseppe Bilotta
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.
2009-01-15ircbot: SIGUSR1 forces a reconnectGiuseppe Bilotta
2009-01-15ircbot: refactor reconnection into its own methodGiuseppe Bilotta
2009-01-15auth: better clarify the allow/deny syntaxGiuseppe Bilotta
2009-01-08auth core botmodule: fix permission view without a specified userGiuseppe Bilotta
2009-01-08rfc2812: better handling of incomplete mode linesGiuseppe Bilotta
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.
2009-01-07ircbot: handle 'Trying to reconnect too fast' server ERRORGiuseppe Bilotta
2009-01-07rfc2812: handle server ERRORGiuseppe Bilotta
2008-12-29* (timer) ignore blocked actions .next() :/dmitry kim
2008-12-29* (timer.rb) race condition on @actions.each() fixed (thanks, Mike`)dmitry kim
2008-12-16utils.rb: Utils.age_string to replace distance_of_time_in_wordsGiuseppe Bilotta
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.
2008-12-16utils.rb: fix Utils.timeago for explicit date outputGiuseppe Bilotta
2008-12-16utils.rb: fix Utils.distance_of_time_in_words for negative offsetsGiuseppe Bilotta
2008-12-12ircsocket: tunable IRC penaltyGiuseppe Bilotta
2008-12-12ircsocket: clean up opt parsingGiuseppe Bilotta
Irc::Socket initialization now always has opt as last parameter, so don't bother checking if it's a Hash.
2008-12-10* (httputil) provide an informative error message for non-http urlsdmitry kim
2008-11-21* (core/unicode) validate encoding.charsets with Iconvdmitry kim
2008-11-21* fix config validation diagnostics for ArrayValuedmitry kim