Commit Graph

7154 Commits

Author SHA1 Message Date
James McCoy
e7d0bfd2d0 commands: Handle OverflowError in _int
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2013-08-23 23:36:44 -04:00
Arnout Engelen
58e7e61d69 Only reset the cached feed when the response actually contains headlines
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>
2013-08-23 23:13:28 -04:00
James McCoy
333067c151 Provide a default help message for commands without help.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2013-08-23 22:57:13 -04:00
James McCoy
e421722960 Fix crash if a custom error message is provided to somethingWithoutSpaces
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2013-08-23 22:06:07 -04:00
James McCoy
c73ead8aef supybot-botchk: Directly execute supybot instead of running it in sh
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2013-08-23 21:42:01 -04:00
Valentin Lorentz
960e1da61c commands.py: Fix error message of getSomethingWithoutSpaces.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2013-08-23 00:29:11 -04:00
James McCoy
5b329df6f0 Socket: Try all resolved addresses before scheduling a reconnect
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>
2013-08-22 23:43:09 -04:00
James McCoy
88e4f73777 getSocket: Use returned family to create the socket
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>
2013-08-22 23:40:28 -04:00
Valentin Lorentz
caa36121a7 ShrinkUrl: Add ur1.ca support.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2013-01-08 22:54:02 -05:00
Joe Julian
a8e3081b18 ShrinkUrl: Support for goo.gl url shortener.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2013-01-08 22:44:35 -05:00
Terje Hoås
2327317b33 Web: Fix fetch. Use getUrl instead of getUrlFd.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2013-01-08 20:32:43 -05:00
James McCoy
295f9b1f0d Make utils.str.soundex perform better when length is large
Closes: Sf patch#148
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-12-31 17:29:02 -05:00
Valentin Lorentz
8d8e574d12 Owner: fix error message when the ImportError comes from the plugin 2012-12-02 20:35:52 -05:00
Daniel Folkinshteyn
3c30463e11 Math: default %f formatting rounds to 6 decimal places. increase that to 16.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-11-04 19:48:53 -05:00
Daniel Folkinshteyn
910ad6dd62 core: make network.channels and channel keys private by default. Otherwise these can reveal secret information.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-11-04 19:43:36 -05:00
Valentin Lorentz
ac13d09511 conf.py: Prevent traceback if server address is an IPv6 address.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-11-03 14:48:16 -04:00
Daniel Folkinshteyn
c68afacc0f Math: calc: coerce argument to ascii string. working with unicode errors on the translate() step.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-30 19:09:45 -04:00
Valentin Lorentz
484d7e6fac Misc: Notify the caller when @tell succeeded. Closes GH-97.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-24 17:36:21 -04:00
Valentin Lorentz
9b8397193b Admin: Add clearq command.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-24 01:45:38 -04:00
Valentin Lorentz
8062d9592c Change the minimal number of non-wildcard characters in hostmask from 8 to 3. Closes GH-276.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-24 01:36:19 -04:00
James McCoy
b5eac0994a Call unqualified process/regexp_wrapper, since commands exports them now.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-24 00:26:51 -04:00
James McCoy
57e429011d Misc: Use regexp_wrapper for Misc.last
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-24 00:24:16 -04:00
James McCoy
c774be3ea6 commands: Add process and regexp_wrapper to __all__
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-24 00:23:25 -04:00
James McCoy
90b7f3cd4e utils.web: Simplify getUrlFd by using standard parse methods
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-23 17:06:30 -04:00
James McCoy
180508496f docs/USING_WRAP.rst: Add docs for missing converters
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-20 19:43:55 -04:00
James McCoy
6ab807be43 utils.net: Use _ipAddr and _domain from utils.web to define emailRe
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-20 19:43:11 -04:00
Valentin Lorentz
db3746d122 Add support for authentication scheme.
This commit closes http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=690879

Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-20 19:42:15 -04:00
Valentin Lorentz
7d87d422e1 Fix detection of .42 domains
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-20 19:15:05 -04:00
Daniel Folkinshteyn
dfdfd00b04 core: make sure owner is never ignored. also simplify the logic flow in ignore checking.
Thanks m4v for the patch!

Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-20 15:11:23 -04:00
Daniel Folkinshteyn
18ec61842c Secure some more commands which take a regexp from untrusted user input.
Namely todo.search, note.search, dunno.search.

Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-20 15:06:43 -04:00
Daniel Folkinshteyn
ac500b059a String: set default re subprocess timeout to 0.1, since that should be quite enough.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-20 14:56:30 -04:00
Daniel Folkinshteyn
9356d0734f Misc: fix potential ddos when misc.last command is fed a specially-crafted regexp.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-20 14:56:11 -04:00
Daniel Folkinshteyn
72c5c8ec09 String: fix it up to work with the previously committed enhancement for subprocess timeout.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-20 14:47:16 -04:00
Daniel Folkinshteyn
6a9af819a3 src/commands.py: make subprocesses raise an error on timeout, rather than return a string
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-15 22:14:15 -04:00
Daniel Folkinshteyn
f310350335 Web: add 'timeout' config for web fetch, default 5 sec.
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>
2012-10-15 22:10:56 -04:00
Daniel Folkinshteyn
ce9891368b Seen: fix tests so they pass. fix seen command so it properly accepts nick wildcards.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-15 22:09:34 -04:00
Valentin Lorentz
8ded033410 Seen: Fix save Seen.any.db. (thanks to beo_ for the repport and the test)
Signed-off-by: Daniel Folkinshteyn <nanotube@users.sourceforge.net>
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-15 22:06:49 -04:00
Daniel Folkinshteyn
854e086fa7 Topic: get shouldn't require capabilities, since it's a read-only operation.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-15 22:04:35 -04:00
Daniel Folkinshteyn
02b9431536 BadWords: improve help for requireWordBoundaries config.
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>
2012-10-15 22:01:39 -04:00
Daniel Folkinshteyn
011d4dd676 Badwords: add plugin docstring, and fix/standardize some method docstrings.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-15 22:00:08 -04:00
Daniel Folkinshteyn
a5ec33adeb Make plugin loading/reloading case-insensitive.
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>
2012-10-15 21:51:00 -04:00
Daniel Folkinshteyn
92be7c255f String: make levenshtein command threaded, since it can take a nontrivial amount of time with longer inputs.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-15 21:49:15 -04:00
Daniel Folkinshteyn
34e5aedc45 String: make re timeout configurable.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-15 21:47:32 -04:00
Daniel Folkinshteyn
9fc7ec28b4 Fix error handling for subprocesses.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-15 21:44:04 -04:00
Daniel Folkinshteyn
7504c646b7 Status.processes: add output of currently active processes.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-15 21:35:26 -04:00
Daniel Folkinshteyn
141b120a9c commands.process: return immediately when terminating process, without having to deal with the queue.
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>
2012-10-15 21:32:54 -04:00
Daniel Folkinshteyn
7f4a1be9f9 Status: add 'processes' command, the multiprocessing equivalent of the threads command.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-15 21:32:17 -04:00
Daniel Folkinshteyn
7f98aa7105 Some improvements to the commands.process function - better process naming and informational output.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-15 21:28:41 -04:00
Daniel Folkinshteyn
a2985c37d6 Create a commands.process function which runs a function inside a separate process.
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>
2012-10-15 21:19:34 -04:00
Daniel Folkinshteyn
d691a91636 Topic: fix bug in invalid number error output.
Previously, when giving an invalid positive number, error would reference number-1 as being invalid.

Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-15 20:52:27 -04:00