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>
String.re uses first('regexpMatcher', 'regexpReplacer'). If the args
provided to String.re are not a matcher and are longer than a single IRC
message (e.g., from a nested command), then regexpReplacer would never
be tried. A too long error should be handled the same as running out of
args while trying to find a valid regexp.
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>
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>
freecode.com, nee freshmeat.net, is now a completely static site. Since
it is no longer allowing updates, no need to worry about pushing
information about Supybot releases to it.
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>
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>
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>
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>