Servers bind a nick to a connection for a short window after it
disappears to try and avoid contention over nicks. This may cause a 437
during connection to a server (c.f. ProgVal/Limnoria#1033) or even
during normal nick changes, if the timing is lucky.
Add handling for this error to the startup code and the Admin plugin.
Signed-off-by: James McCoy <vega.james@gmail.com>
Parsing through the various WHOIS replies to build a formatted string
isn't a trivial task, especially since there is some privacy related
information. Consolidate this handling into a single function so
there's one place to fix bugs.
Also fix an issue with people putting (unterminated) formatted text into
the "realname" field of their IRC client (c.f., ProgVal/Limnoria#1083).
Signed-off-by: James McCoy <vega.james@gmail.com>
Allowing Anonymous.say to send a message to either a nick or an
(implicit) channel through the use of first('nick', 'inChannel') changed
the behavior of the command by making it impossible for 'inChannel' to
take effect.
This meant that any previous users of the command that expected "say
some text" to send "some text" to the current channel would instead try
to send "text" to the user "some". Depending on the value of
conf.plugins.Anonymous.allowPrivateTarget, this would result in either
an error or a strange message to a random user.
Creating a new tell command solves this issue as Anonymous.channel now
goes back to its simple 'inChannel' wrapper.
Signed-off-by: James McCoy <vega.james@gmail.com>
The (faulty) detection of recursive Aliases was removed in
a656fd0693, claiming that "our nesting
limit will catch issues now." However, nested Aliases weren't actually
increasing the nesting level.
Actually increasing the nesting level when an alias is executed restores
the intended behavior. Additionally, limiting the size of the
expanded arguments to an alias prevents exponential growth of memory
usage for certain malicious inputs/aliases.
Signed-off-by: James McCoy <vega.james@gmail.com>
Some feeds, such as those from sourceforge.net, will sometimes show an error
page rather than a feed. In this case the feed cache used to be cleared for
that feed, causing all 'old' headlines to be flooded to the channel as soon
as the feed came back online.
This patch hopefully fixes that by only resetting the cache when the returned
page actually contains headlines.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
Otherwise, when a site would take a long time to respond, the thread would hang for quite a while.
also needed to mod src/utils/web.py to take the timeout arg.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
Make a note that the plugin requires restart or the words set updating,
for changes to this setting to take effect.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
This is the only way to limit the execution time of a possibly long-running python statement.
Use this on String.re, due to the possibility of pathologically long re matching in python.
This allows us to remove the 'trusted-only' restriction on string.re.
In the future, this should probably be used in other places that take user-supplied regexps,
such as 'misc last --regexp', for example, as well as other potentially long-running tasks
that can block the bot.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
Previously, when giving an invalid positive number, error would reference number-1 as being invalid.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
The tests were running into the ambiguity between nested commands and commands
with the same name as their plugin, so "plugin plugin" is treated as
specifying the plugin command from the plugin plugin. This leads to it
displaying the help, since an argument is expected.
Since the Utilities plugin is already loaded by the test suite, use a command
from it as the argument to the plugin command.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>