Commit Graph

11725 Commits

Author SHA1 Message Date
James Lu
ff899f5158 Aka, Debug: cleanup imports 2020-01-26 10:42:43 -08:00
Valentin Lorentz
9ab908759a Use importlib instead of imp.
importlib is deprecated.
2020-01-26 12:00:08 +01:00
Valentin Lorentz
9891b0fca4 Replace failUnless/failIf with assertTrue/assertFalse.
The old names are deprecated.
2020-01-26 11:14:18 +01:00
Valentin Lorentz
5efd2afa27 Socket: Don't add instances twice in cls._instances.
The connect() method already adds it, so it was in the list twice
(added both by __init__() and connect()).

This caused _select() to call _read() twice on the same instance,
except there is usually nothing to read on the second call,
so it blocks for up to conf.supybot.drivers.poll().
2020-01-25 21:00:42 +01:00
Valentin Lorentz
b5beb5f981 .travis.yml: fix indent 2020-01-25 00:12:31 +01:00
Valentin Lorentz
777d8e4920 Socket: use a proper lock instead of a boolean. 2020-01-23 16:47:49 +01:00
Valentin Lorentz
f862da3c0e .travis.yml: Allow failures on nightly.
Feedparser doesn't support this version of Python.
https://github.com/kurtmckee/feedparser/issues/201
2020-01-23 14:41:02 +01:00
Valentin Lorentz
e7553dcca4 Add subcommand dispatching for CAP/FAIL/WARN/NOTE. 2020-01-23 14:25:10 +01:00
Valentin Lorentz
c4d073a9be Rename doAuthenticate* functions to not conflict with callback names. 2020-01-23 14:24:41 +01:00
Valentin Lorentz
32d8d141ad Make irc.error do nothing is no string is given as argument.
Fixes c1d3bad64f, which crashed with:

```
ERROR 2020-01-18T01:34:07 Uncaught exception in NickAuth._callCommand:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/supybot/callbacks.py", line 1337, in _callCommand
    irc.errorNoCapability(cap)
  File "/usr/local/lib/python3.7/dist-packages/supybot/callbacks.py", line 544, in errorNoCapability
    raise Error()
supybot.callbacks.Error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/supybot/log.py", line 368, in m
    return f(self, *args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/supybot/callbacks.py", line 1359, in _callCommand
    irc.error(str(e))
  File "/usr/local/lib/python3.7/dist-packages/supybot/callbacks.py", line 1065, in error
    raise ArgumentError
supybot.callbacks.ArgumentError
```
2020-01-18 11:04:54 +01:00
Valentin Lorentz
895881e66e Call super().setValue() before defaultHttpHeaders.
To prevent infinite recursion on startup, because defaultHttpHeaders
gets the value; which is unset, so 'registry._lastModified > self._lastModified'
is True, so .set() is called, so .setValue() is called again.
2020-01-17 19:49:16 +01:00
Valentin Lorentz
c457b52067 Deduplicate setting Accept-Language HTTP header.
This adds a new function conf.defaultHttpHeaders that can be used by plugins
to get all the default HTTP headers for a given network/channel.
2020-01-14 19:03:12 +01:00
Tasos Sahanidis
ae5ad2ceab Web: Implement protocols.http.requestLanguage 2020-01-14 18:48:11 +01:00
Tasos Sahanidis
62f8b47e61 Add supybot.protocols.http.requestLanguage 2020-01-14 18:48:11 +01:00
Tasos Sahanidis
7bd68df8aa Fix getSpecific usage
The channel and network arguments were incorrectly swapped
2020-01-12 10:35:35 +01:00
Valentin Lorentz
0fccea30ce Import MutableMapping and MutableSet from collections.abc.
Aliases in collections itself are removed in 3.8.
2020-01-09 01:11:12 +01:00
James Lu
94ca4cc810 setup.py: migrate shebang to Python 3 2020-01-05 11:35:00 -08:00
James Lu
1ab9f4642e setup.py: remove obsolete version_info conditionals
None of these will run since the base version is now Python 3.4.
2020-01-05 11:32:42 -08:00
James Lu
5c2e16f391 scripts: remove obsolete conditionals for Python 2 2020-01-05 11:31:45 -08:00
James Lu
7e70ce43f2 scripts: migrate shebangs and version checks to Python 3 2020-01-05 11:29:41 -08:00
James Lu
9e03e0e6e2 Be less hostile to users in --allow-root help 2020-01-05 11:25:47 -08:00
James Lu
d080edce00 Readd Limnoria name to default part & quit messages
This was removed in c930edd943
2020-01-04 11:17:57 -08:00
James Lu
9570ea9fb4 Merge branch 'sedregex-merge' into testing
Import SedRegex plugin: History replacer using sed-style expressions.
2020-01-03 21:24:21 -08:00
James Lu
758a3efa44 .travis.yml: remove --disable-multiprocessing (fix SedRegex tests) 2020-01-01 22:13:10 -08:00
James Lu
51f10dbb60 SedRegex: update plugin metadata 2020-01-01 21:56:40 -08:00
James Lu
35dd3c3d9c Update plugin author/maintainer data
From: cbd953b32c
2020-01-01 21:55:58 -08:00
Valentin Lorentz
08764b85ef SedRegex: spawn a single process to handle the whole history.
This is more efficient than spawning up to 1000 processes (assuming
Limnoria's default config).

From: ede85ca8b0
2020-01-01 21:55:58 -08:00
James Lu
9e0db63b5b SedRegex: add test for ReDoS timeout
From: 81debc45ec
2020-01-01 21:55:58 -08:00
James Lu
1267d6452e SedRegex: abort when a search times out
This requires commit b54d8f8073, which separates the timeout and no match cases.

Also, raise the default processTimeout as the plugin now aborts on the first message that times out.

From: e5af479939
2020-01-01 21:55:58 -08:00
James Lu
43d4861577 Update my email & repo link references
From: 2ae51939b3
2020-01-01 21:55:58 -08:00
James Lu
6c54352713 SedRegex: test case normalization of channel names
From: 5672008a31
2020-01-01 21:55:58 -08:00
James Lu
937930ab6a SedRegex: match channel names case insensitively
Some IRCds (Unreal 3.2) don't mangle target names for case correctness, leading to a bug where users end up ignored by the plugin.

Reported by DOMF via IRC.

From: e19abe0498
2020-01-01 21:55:58 -08:00
James Lu
67a3928e4d SedRegex: log all errors, always display the not found mesage
From: fdab0edbc8
2020-01-01 21:55:58 -08:00
James Lu
06f70e59da SedRegex: reuse processTimeout in the sub() process too
From: 4e08442cde
2020-01-01 21:55:58 -08:00
James Lu
363285cfbf README: specifically mention that /s is specific to this plugin
[skip ci]

From: 5e6c9349fa
2020-01-01 21:55:58 -08:00
James Lu
e831d0e8ec SedRegex: make the regexp process timeout configurable
Although the default has been adequate on my systems, busy or low-powered machines may fail to process regexps quickly enough and cause SedRegex to sporadically error.

Reported by @cottongin via IRC.

From: 51ff41251b
2020-01-01 21:55:58 -08:00
James Lu
fd7aa571e9 SedRegex: remove compatibility workaround for Python 2.7.6 and lower
From: c9bcbbb934
2020-01-01 21:55:58 -08:00
James Lu
1646ca25c2 SedRegex: skip testBoldReplacement on Python 2
I don't know why it breaks here and I don't really care.

From: b9481184cb
2020-01-01 21:55:58 -08:00
James Lu
dcadb7e73b SedRegex: remove a duplicate test
From: 5e77c65a5f
2020-01-01 21:55:58 -08:00
James Lu
01e0c12641 SedRegex: use self.__class__ instead of __class__ in tests (Python 2 compat)
From: b53e6e40a0
2020-01-01 21:55:58 -08:00
James Lu
b01c50cd4d SedRegex: add a bunch of test cases
Closes #53.

From: a58785fa4a
2020-01-01 21:55:58 -08:00
James Lu
f40d8c530f SedRegex: bump copyright year to 2017
From: 0ef8138ab3
2020-01-01 21:55:58 -08:00
James Lu
90ec8a6976 SedRegex: fix some replacement queries not working
From: 926454b01d
2020-01-01 21:55:58 -08:00
James Lu
6445e90ec7 SedRegex: also catch errors in the regexp_wrapper() step
E.g. sre_constants.error: invalid group reference

From: e137d29eb9
2020-01-01 21:55:58 -08:00
James Lu
5370296bbf SedRegex: log the exact error name instead of "SedRegex error"
From: 406d7b1790
2020-01-01 21:55:58 -08:00
James Lu
dee2b6bdb3 SedRegex: require ending delimiter to prevent overzealous matching of replacement text
Closes #59.

From: 414a4a4a16
2020-01-01 21:55:58 -08:00
James Lu
656d2172db SedRegex: work around "nothing to replace" errors on < Python 2.7.6 again
From: 244a8c6bee
2020-01-01 21:55:58 -08:00
James Lu
889c6a1615 SedRegex: fix flag matching
From: db125ee5d1
2020-01-01 21:55:58 -08:00
James Lu
c1c423cc0d SedRegex: add configuration / usage instructions
From: 9d0dce6ef5
2020-01-01 21:55:58 -08:00
James Lu
24ae250ac4 SedRegex: implement 's' regex flag to only match the caller's message
From: 87c79db3d0
2020-01-01 21:55:58 -08:00