summaryrefslogtreecommitdiff
path: root/lib/rbot/ircbot.rb
AgeCommit message (Collapse)Author
2010-03-16Tokyo Cabinet DB backendVoker57
2010-03-16DB backend optionVoker57
2010-03-16Moved DB stuff to registry/bdbVoker57
2009-12-21ircbot/rfc2812/message: Add banlist message handlingAlex Legler
2009-12-21ircbot: Delegate ERR_NOSUCHNICK and ERR_NOSUCHCHANNEL events to pluginsAlex Legler
2009-10-21Loop until connected in reconnect()Giuseppe Bilotta
Untrapped connect() failures would raise up to the mainloop, causing a burst of reconnect attempts without delay. Fix by rescuing in reconnect() and retrying after waiting.
2009-08-26ruby 1.9: fix *methods.include?franz
Since in 1.9 methods arrays have symbols instead of strings, fix it by changing into respond_to? and method_defined?
2009-08-26ruby 1.9: convert Exception to string explicitlyfranz
changed "string + exception" to "string #{e}", the former yields 'can't convert <e> into String' in ruby 1.9
2009-08-26ircbot: fix indentation errorfranz
2009-08-16Suppress warnings about unitialized variablesGiuseppe Bilotta
hangman: an unneeded letters accessor was defined ircbot: restore initializations removed by previous commit
2009-08-14ircbot: clean up ping timings on connectGiuseppe Bilotta
2009-05-21multiple plugins: Changes to remove parenthesize warnings.David Gadling
All of these modules/plugins were generating warnings like this: warning: parenthesize argument(s) for future version This patch should fix all the warnings without affecting functionality.
2009-05-06ircbot: reinstante @bot.channelsGiuseppe Bilotta
When the new IRC framework was introduced, the old @channels Hash and its accessor for @bot were dismissed. Reintroduce it for backwards compatibility.
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-03ircbot: enable gettext on "restarting, back in..."Raine Virta
2009-02-28Separate @dirs containing all botmodules (plugins and core modules)Raine Virta
into @core_module_dirs and @plugin_dirs
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-01ircbot: suppress warningGiuseppe Bilotta
parenthesize argument(s) for future version
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-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-07ircbot: handle 'Trying to reconnect too fast' server ERRORGiuseppe Bilotta
2008-12-12ircsocket: tunable IRC penaltyGiuseppe Bilotta
2008-09-24ircbot.rb: fill was_on info when delegating sent QUITGiuseppe Bilotta
2008-09-05quiet exception listGiuseppe Bilotta
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.
2008-08-19IRC socket: get rid of delay/burstGiuseppe Bilotta
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.)
2008-08-10+ handle WHOIS queriesGiuseppe Bilotta
The bot now exposes a whois(nick) method to make WHOIS queries to the server. The extended syntax whois(nick, server) is also supported, allowing another server to be queried (this is useful to retrieve info which is only available on nick's server, such as idle time and signon date). Most if not all RFC-compliant replies are handled, although some of the data received is currently ignored. Non-RFC extended replies such as nickserv identification status are not hanlded yet, since they are highly server-specific, both in numeric reply choice (e.g. 307 vs 320) and in reply message syntax and meaning. A new WhoisMessage is also introduced, for plugin delegation. The source is the originating server, the target is the user for which information was requested. A #whois() method is provided holding all retrieved information.
2008-08-06basics: option to join channel after identification is confirmedGiuseppe Bilotta
Sometimes it is necessary to wait for identification to be confirmed before certain channels may be joined. In this case the option irc.join_after_identify can be set to true, and the bot will wait for nickserv to confirm the identification before joining any channels. This solution is actually a rather ugly hack, but I can't think of a better way to approach the problem without rewriting the whole framework.
2008-07-30+ @bot.wanted_nick stores the nick wanted by the botGiuseppe Bilotta
2008-07-30ircbot.rb: server no-color modes can be configuredGiuseppe Bilotta
2008-06-29* fix handling of IDENTIFY_MSGGiuseppe Bilotta
When a server has IDENTIFY-MSG, we would expect identification in any PRIVMSG or NOTICE, even on those generated from the bot. This caused lots of spurious warnings, and would lead to mislogging when a bot-generated message started with + or -. Fix this by only handling IDENTIFY-MSG on server-generated messages.
2008-06-28ircbot.rb: @bot.topic() can also be used to retrieve topic information ↵Giuseppe Bilotta
instead of setting it
2008-06-26ircbot.rb: make #mode()'s third argument optionalGiuseppe Bilotta
2008-06-24ircbot.rb: create the appropriate directories when updating botclass dir ↵Giuseppe Bilotta
from template
2008-06-24message handling: improve IRC format handling for received messagesGiuseppe Bilotta
Rather than stripping colors all around and keeping other format codes, we only strip initial and final formatting before parsing the message. We store the original, unstripped message in #logmessage() and a fully stripped copy of the message in #plainmessage() This means that most plugins will now have full formatting of arguments preserved, while stupid IRC usage of formatting whole lines will not interfere with bot usage. Plugins that need a fully stripped version of the message can still access it.
2008-06-24ircbot.rb: copy missing template files on startupGiuseppe Bilotta
2008-06-23+ strip all colours and formatting when sending to a +c or +C channelGiuseppe Bilotta
2008-06-23ircbot.rb: ask about current channel modes on joinGiuseppe Bilotta
2008-06-20ircbot.rb: ensure that the logger is flushedGiuseppe Bilotta
If the bot fails to load (e.g. because of missing dependency) the user might miss the last error messages because the logger thread wouldn't reach completion. Ensure its closure in an END block.
2008-06-18* ircbot: fix quiet/reset_quiet wrt missing argsdmitry kim
2008-06-17+ print the location of the debug log to stdout on startdmitry kim
2008-04-23core: refactor signal trapping, and call it from initialize()Giuseppe Bilotta
2008-04-23core: restart on SIGHUPGiuseppe Bilotta
2008-04-18* make the daemonization thing to suck less (wrt standard io channels)dmitry kim