Giuseppe Bilotta [Tue, 16 Dec 2008 00:55:44 +0000 (01:55 +0100)]
utils.rb: Utils.age_string to replace distance_of_time_in_words
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.
Giuseppe Bilotta [Thu, 20 Nov 2008 14:17:27 +0000 (15:17 +0100)]
rss plugin: prevent double UTF-8 deconding
The rss parser looks at the encoding specified into the XML file and
converts everything to UTF-8. Since we do the UTF-8 conversion
ourselves, monkey-patch the XML 'encoding' declaration to claim it's
UTF-8 already (as it actually is).
Giuseppe Bilotta [Mon, 17 Nov 2008 15:37:57 +0000 (16:37 +0100)]
azgame plugin: support autoadding words to wordlist
When the game is started with a wordlist it's possible to specify a
language to use for existence of words. When a word is not found in the
wordlist, it's checked against the given language check function, and if
present it's added to a specific file (autoadd-#{language}), which is
also used on load to choose the word to pick.
Giuseppe Bilotta [Mon, 27 Oct 2008 21:59:07 +0000 (22:59 +0100)]
UNO plugin: give cards to correct player at endgame
If the winner played a Reverse in response to a picker, the previous
player should pick the cards, and not the next one. This is not really
important at the moment because we score by giving points to the winner
instead of taking them from losers, but we fix it for correctness. It'll
be especially useful when we'll implement the other scoring too.
Casey Link [Mon, 27 Oct 2008 19:54:16 +0000 (15:54 -0400)]
* (lastfm) fix a bug resulting in the change of the lastfm api output. now_playing works again
Lastfm removed the <date> element from track's which are currently being played, which caused the plugin to die. Now we detect if the <date> element exists.
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.
message.rb: fix the fix to message addressing logic
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.
Giuseppe Bilotta [Tue, 19 Aug 2008 18:19:45 +0000 (20:19 +0200)]
IRC socket: get rid of delay/burst
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.)
Giuseppe Bilotta [Wed, 13 Aug 2008 04:06:33 +0000 (06:06 +0200)]
message.rb: fix message addressing logic
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.
Giuseppe Bilotta [Mon, 11 Aug 2008 06:49:35 +0000 (08:49 +0200)]
rfc2812: create channels and users for al commands when needed
Always create a user or channel when we receive information about it.
This makes server message parsing much more robust (no more crashes
about NilClass not having user/channel methods) but has a few subtle
implications about the server state: for example, channels may exist in
the Server object even when the bot is not in the channel itself.
Giuseppe Bilotta [Sun, 10 Aug 2008 12:42:11 +0000 (14:42 +0200)]
irclog core module: rename old logs when switching from dir to file
It may happen that a user changes from an irclog.filename_format where
some components are files to a format where they are directories (e.g.
from '%%{where}' to '%%{where}/%Y') or conversely. In this case, we
rename the existing file/dir by appending '.old.atime' to it (atime is
the actual file/dir access time).
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.
message.rb: correct @plainmessage and @message for CTCP messages
After CTCP parsing, @plainmessage was not defined correctly (as it still
contained the CTCP command), and @plainmessage and @message were not
being cleaned up correctly.
This manifested itself e.g. with spurious \001ACTION and other strange
unusual byte sequence popping up in markov-generated text.
Fix by redefining @plainmessage and @message appropriately in CTCP
handling.
basics: option to join channel after identification is confirmed
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.
This is achieved by moving the check for IP vs hostname in the
iplookup() method itself, and using the existing regexps to check if a
string is an IP or not.