Using Raise=True was only papering over the real problem in the nested
command error handling. The actual issue is that we were trying to
return an IrcMsg from NestedCommandsIrcProxy.__init__. Dropping
Raise=True and moving return to its own line is the correct fix and
resolves the test failure in testMaximumNestingDepth.
This commit reverts 7838cae3bc
Signed-off-by: James McCoy <vega.james@gmail.com>
The `is` operator performs object identity comparison. Changing to `==`
implements the expected behavior.
Use the mock library to add tests verifying the API of questions.yn.
If addAuth is called with a hostmask that already exists (exactly, not
just equivalent patterns) in self.auth, remove the entry for the old
authentication. This essentially updates the timeout for the hostmask.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
driver.reconnect(wait=True) should flag a driver to reconnect, but not
immediately. The Socket driver lost its handling of this flag in
8730832e.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
Instead of assuming the first address returned from getaddrinfo can be
reached, try each one in turn until a connection is established.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
The existing code was parsing the passed in host to determine what type
of socket family to create. getaddrinfo already provides this for us,
so there's no need to perform our own, potentially buggy, parsing.
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>
Since load/reload was the only place where case mattered for plugins, and it tripped up
a lot of new users, this should be a nice bit of usability improvement.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
otherwise, we have to block for $smalldelay between putting and getting the item, since queue putting is not instantaneous
and sometimes we would get 'nothing returned' instead of the timeout message.
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>
it /should/ always be a string anyway, but sometimes things break with
a TypeError that it is an int instead of the expected string and hangs
up the bot.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
If a colored message were wrapped just right (e.g., a colored number ending
the chunk), FormatParser would gobble up the color format code and the number
in the message, causing a KeyError when trying to look up the color in
mircColors.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>