Valentin Lorentz
76b5a42428
supybot.defaultIgnore shouldn't ignore registered users.
...
Even if they are not trusted. This fixes a regression in
97016b9c55
.
This happens because 'user._checkCapability' raises a KeyError
when the user has neither this cap or the anticap; which was mistakenly
caught here by the 'except KeyError' expecting to catch non-existing
users.
(And that why 'try' blocks should be limited to as few lines as possible.)
2020-10-26 00:19:57 +01:00
Valentin Lorentz
160bcc8b6b
Revert "irclib: Fill the nick and prefix of simulated echo messages."
...
This reverts commit 1fe414764c
.
I initially wrote that commit so that plugins with echoMessage=True can
get the nick/prefix from the message (eg. the SkypeRelay plugin in my
personal repo).
Unfortunately, this breaks any test that does equality comparison on
between the result of getMsg()/takeMsg() and an IrcMsg object they
crafted themselves.
Additionally, the filled in nick and prefix might be inaccurate if the
bot changes nick/host at the same time. So instead plugins should check
for the None value.
(Also, editing IrcMsgs on the fly like this isn't great, and the commit
forgot to reset the `_str` attribute.)
2020-10-22 20:04:23 +02:00
Valentin Lorentz
1fe414764c
irclib: Fill the nick and prefix of simulated echo messages.
2020-10-17 14:22:48 +02:00
Valentin Lorentz
4213d95356
plugin setup: declare the long_description is in markdown
...
Else PyPI rejects it because it can't parse it as ReST.
2020-10-07 19:46:56 +02:00
Valentin Lorentz
48b24769c2
irclib: Document classes better, especially instance attributes.
2020-09-27 15:51:01 +02:00
Valentin Lorentz
5d80b2eec9
irclib: Fix crash when MOTD is sent again later in the connection.
...
This can happen with this ZNC module: https://wiki.znc.in/Missingmotd
or if a plugin sends a 'MOTD' command.
2020-09-19 17:08:52 +02:00
Valentin Lorentz
0a6bb49fe6
irclib: Fix crash on CAP NEW.
...
Turns out, it wasn't tested so it never worked...
2020-09-19 16:55:51 +02:00
Valentin Lorentz
f4d6bd11be
registry: forbid direct access to Regexp.setValue.
...
This is not a regression; this was already forbidden before
23417b0675
, and this commit was not
tagged/released yet at the moment I'm writing this one.
2020-09-15 09:59:08 +02:00
Valentin Lorentz
ac94c5291e
registry: fix Regexp initialization when the default value is not None.
2020-09-15 09:57:15 +02:00
Valentin Lorentz
23417b0675
registry: Fix regression preventing default None value for Regexp.
2020-09-05 22:20:38 +02:00
Valentin Lorentz
6a3be33fcd
registry: Don't use an internal state for Regexp, it breaks net- and chan- specific values.
2020-09-05 21:40:40 +02:00
Valentin Lorentz
97016b9c55
Exempt trusted users from being ignored.
...
Closes GH-66.
2020-09-05 16:42:28 +02:00
Valentin Lorentz
a55fbab591
Autocomplete: Initial implementation.
...
This plugin implements the first version of
https://github.com/ircv3/ircv3-specifications/pull/415
2020-08-29 16:33:29 +02:00
Valentin Lorentz
fe84bfbbb6
callbacks: add comments to findCallbacksForArgs.
2020-08-29 16:29:40 +02:00
Valentin Lorentz
5dc72d2b34
Rename IrcCallback.echo_message to IrcCallback.echoMessage.
...
For consistency with 'alwaysCall' and 'noIgnore'.
2020-08-23 16:27:22 +02:00
Valentin Lorentz
761fc2353e
utils.net: Do not disable TLS certificate check when authorityCertificate is set.
...
It makes sense that manually configuring a CA overrides this
value which defaults to False.
2020-08-01 21:46:26 +02:00
Valentin Lorentz
57da6d04e2
utils.net: always check fingerprints if they are set, even if verifyCertificates is False.
...
It makes sense that manually configuring fingerprints overrides this
value which defaults to False.
2020-08-01 21:45:08 +02:00
Valentin Lorentz
8f72c418e5
callbacks: don't crash when the prefix is from network services.
2020-07-25 15:29:23 +02:00
Gordon Shumway
5315cd3275
userAgents: avoid potential IndexError
...
random.choice() should only be run after verifying the config has been set.
2020-07-12 16:42:42 +02:00
Gordon Shumway
4c4d0024ca
Fix typo. HttpUserAgent -> HttpUserAgents ( #1424 )
...
Fixes typo in https://github.com/ProgVal/Limnoria/pull/1423
2020-07-11 15:13:13 -07:00
Gordon Shumway
73de5616e8
Selectable User-Agent for HTTP requests ( #1423 )
...
https://github.com/ProgVal/Limnoria/issues/1382
2020-07-11 10:25:09 +02:00
Valentin Lorentz
0284ed9ebd
irclib: Don't error when 004 is missing umodes and chanmodes.
2020-07-05 19:45:08 +02:00
Gordon Shumway
a3e6887fc9
Keep closing parenthesis when snarfing URLs
...
Fixes bug when handling URLs with a closing parenthesis ')'. e.g. https://en.wikipedia.org/wiki/Harley_Quinn_(TV_series)
2020-06-27 20:41:56 +02:00
Valentin Lorentz
6c4a8edb9c
irclib: Ignore 'sts' in case of missing keys instead of aborting the connection.
...
In case https://github.com/ircv3/ircv3-specifications/pull/390 gets adopted.
2020-06-20 20:15:28 +02:00
Valentin Lorentz
76ead86e2c
commands: Add a helpful error message instead of OSError when a subprocess can't be started.
2020-06-20 12:57:15 +02:00
Valentin Lorentz
42d1bd3f39
ircmsgs: Document IrcMsg attributes.
2020-06-07 16:43:20 +02:00
Valentin Lorentz
277cbb6589
Socket: Add missing self argument to setTimeout.
2020-05-30 21:54:24 +02:00
Valentin Lorentz
2bcdfd069a
Socket: Detect closed TCP connections.
...
So far Limnoria relied on detecting 'ERROR :closing link' (see doError
in src/irclib.py), but that's not a standard at all, and fails on
Oragono; so we need to do this to check we're disconnected.
Plus, parsing the argument of ERROR is awful in the first place.
2020-05-29 19:50:43 +02:00
Valentin Lorentz
d9b1d1f49d
Socket: make setTimeout catch errors.
...
setTimeout may be called as a supybot.drivers.poll callback,
which may by the access to supybot.drivers.poll() in _select;
so a crash in setTimeout will propage up to _run(), which would
cause a random driver to be killed because another one failed
and that's bad.
For example:
INFO 2020-05-27T18:40:18 supybot Received SIGHUP, reloading configuration.
ERROR 2020-05-27T18:40:19 supybot Uncaught exception in in drivers.run:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/supybot/drivers/__init__.py", line 104, in run
driver.run()
File "/usr/lib/python3/dist-packages/supybot/drivers/Socket.py", line 194, in run
self._select()
File "/usr/lib/python3/dist-packages/supybot/drivers/Socket.py", line 167, in _select
[], [], conf.supybot.drivers.poll())
File "/usr/lib/python3/dist-packages/supybot/registry.py", line 422, in __call__
self.set(_cache[self._name])
File "/usr/lib/python3/dist-packages/supybot/registry.py", line 476, in set
self.setValue(float(s))
File "/usr/lib/python3/dist-packages/supybot/registry.py", line 495, in setValue
super(PositiveFloat, self).setValue(v)
File "/usr/lib/python3/dist-packages/supybot/registry.py", line 482, in setValue
super(Float, self).setValue(float(v))
File "/usr/lib/python3/dist-packages/supybot/registry.py", line 385, in setValue
callback(*args, **kwargs)
File "/usr/lib/python3/dist-packages/supybot/drivers/Socket.py", line 305, in setTimeout
self.conn.settimeout(conf.supybot.drivers.poll())
OSError: [Errno 9] Bad file descriptor
ERROR 2020-05-27T18:40:19 supybot Exception id: 0x86ecf
INFO 2020-05-27T18:40:21 supybot Removing driver SocketDriver(Irc object for irchaven).
2020-05-29 19:50:28 +02:00
Valentin Lorentz
fabe8a284e
Socket: de-register setTimeout from supybot.drivers.poll's callbacks when dying.
2020-05-29 19:42:42 +02:00
Valentin Lorentz
88549f9faa
Socket: Move call to supybot.drivers.poll outside the critical section.
...
It may do some non-trivial stuff (eg. calling registry callbacks);
and the less code in the locked-section the better.
2020-05-29 19:41:25 +02:00
Valentin Lorentz
f9bf75aeee
net: Give more context to TLS errors.
...
They are notoriously hard to read, so let's at least say which
part of ssl_wrap_socket triggered them so the user have some
idea what is going on.
2020-05-26 23:06:39 +02:00
Valentin Lorentz
d56e8ef73d
Socket: Remove misleading error fallback for Python <3.4.
...
We no longer support this Python version.
Fixes GH-1412.
2020-05-26 23:01:10 +02:00
Valentin Lorentz
b4df468b3a
net: remove fallback implementation of ssl_wrap_socket.
...
We no longer support Python < 3.4.
2020-05-26 22:46:28 +02:00
Valentin Lorentz
a7a03513bf
ircutils: Set __slots__.
2020-05-22 08:38:42 +02:00
Valentin Lorentz
fa76fb9cd4
conf: Fix/update doc of supybot.plugins.
2020-05-20 20:35:05 +02:00
Valentin Lorentz
568b84847b
irclib: Fix hang in cap nego when echo-message is available but not labeled-response.
...
echo-message ended up in self.state.capabilities_req even though it wasn't
requested, so the bot was stuck in state:
"Waiting for ACK/NAK of capabilities: {'echo-message'}".
2020-05-18 20:50:14 +02:00
Valentin Lorentz
c9c05cf8e1
ircmsgs: Internalize prefix, server_tags keys, and command.
...
prefixes can be rather long, they have rather small cardinality, and
they are repeated a lot in the history; so they take up a sizeable
portion of memory.
And let's also internalize commands and server_tags keys
while I'm at it.
2020-05-17 21:11:14 +02:00
Valentin Lorentz
e9a8826805
irclib: catch exception when calling callback.reset()
...
We don't want the Irc driver to hang when a plugin crashes
in this function.
2020-05-17 12:46:01 +02:00
Valentin Lorentz
b78973265b
registry: Remove warnings in getSpecific, they are going to show up way too often.
...
Closes GH-1409
2020-05-16 10:43:37 +02:00
Valentin Lorentz
1b4205f1ac
registry: Fix comment about high-cardinality values.
2020-05-16 00:35:16 +02:00
Valentin Lorentz
2eb32de26e
registry: Hide warning when channel is 'global'.
2020-05-16 00:32:28 +02:00
Valentin Lorentz
f408f6cc42
registry: Prevent memory leaks caused by Value.getSpecific getting values with non-channel/non-network values.
2020-05-16 00:04:10 +02:00
Valentin Lorentz
7e7a7bf936
registry: Explain why Value.set sets self._wasSet.
2020-05-15 23:56:39 +02:00
Valentin Lorentz
eead5566e5
utils.gen: set __slots__.
...
We create *a lot* of these structs, so it saves a considerable
amount of space.
2020-05-15 22:57:35 +02:00
Valentin Lorentz
ddce09d257
Rename supybot.reply.format.databaseRecord to supybot.replies.databaseRecord.
2020-05-15 19:08:43 +02:00
Valentin Lorentz
3d1e88cb68
safeEval: Get rid of eval().
...
It should be safe considering the AST sanity checks,
but I don't see any point in keeping it.
2020-05-15 18:31:04 +02:00
Valentin Lorentz
7444e656d8
supybot.reply.format.databaseRecord: Add $nick
2020-05-14 18:56:20 +02:00
Valentin Lorentz
4046a1b201
ChannelIdDatabasePlugin: Make the format of showRecord() configurable.
2020-05-14 18:45:04 +02:00
Valentin Lorentz
dc736799b8
callbacks: Prevent passing 'value' as positional argument to registryValue.
...
In case we need to add other arguments in the future.
2020-05-14 18:43:54 +02:00
Valentin Lorentz
0c6b526fdd
Add -scheduler.repeat to default capabilities.
...
It's too easy to use to flood.
2020-05-13 20:16:35 +02:00
Valentin Lorentz
759fca5eba
Switch names of TimeoutDict and ExpiringDict.
...
For consistency, as TimeoutQueue has guaranteed deletion after the timeout,
like the new TimeoutDict (ex-ExpiringDict).
2020-05-10 08:42:25 +02:00
Valentin Lorentz
d205a9b5f8
Fediverse: Use ExpiringDict instead of TimeoutDict for the cache, it guarantees expiry after the timeout.
2020-05-10 08:34:36 +02:00
Valentin Lorentz
5c5cad5851
httpserver: Fix circular dependency when servers.http.keepAlive is true.
2020-05-09 22:17:28 +02:00
Valentin Lorentz
e87a14826e
Fediverse: First draft.
2020-05-09 19:27:34 +02:00
Valentin Lorentz
43a8724d3a
Don't strip spaces when parsing registry values.
...
It breaks plugins.Messageparser.listSeparator, and probably others.
2020-05-08 22:18:27 +02:00
Valentin Lorentz
e990ffa30c
Add long_description from a plugin's README.md
2020-05-08 22:02:05 +02:00
Valentin Lorentz
f54588f9dd
Add a 'limnoria.plugins entrypoint, to discover plugins installed via pip/setuptools.
2020-05-08 22:02:05 +02:00
Valentin Lorentz
f18eafc8d8
Fix crash on simulated echos (they don't have a prefix set).
2020-05-08 11:57:02 +02:00
Valentin Lorentz
83a8afde16
Add experimental support for +draft/reply client capability on outgoing messages.
2020-05-07 21:17:55 +02:00
Valentin Lorentz
eb1e27e20b
Add echo messages, either with the echo-message capability or simulated.
...
Plugin can opt in to getting echo messages by setting the class attribute
'echo_message = True' if they want to get echos.
This defaults to False in order not to break existing plugins, and because
they usually don't need it (there's outFilter for most cases).
2020-05-07 21:08:07 +02:00
Valentin Lorentz
572c609181
Add labels to outgoing messages when labeled-response is supported.
...
This is going to be useful for implementing echo-message; and to plugins
targetting only networks with labeled-response support.
2020-05-07 20:56:59 +02:00
Valentin Lorentz
bb063b8064
Check server_tags in IrcMsg.__eq__.
2020-05-07 18:38:18 +02:00
Valentin Lorentz
307a2367f4
Don't add line breaks in the middle of capability names.
2020-05-07 18:38:18 +02:00
Valentin Lorentz
fc06aa72a6
Fix parsing ISUPPORT MODES with empty value.
2020-05-07 18:38:18 +02:00
Valentin Lorentz
2008f7b815
Exclude server_tags from truncation.
...
They have their own 8191 bytes.
2020-05-07 18:38:17 +02:00
Valentin Lorentz
da328b4985
Expire batches that never ended to avoid leaking memory.
2020-05-06 20:39:21 +02:00
Valentin Lorentz
cc0af4e790
Include start and end messages in a batch.
...
They may have useful server tags (especially when we start
supporting labeled-response).
2020-05-06 18:29:17 +02:00
Valentin Lorentz
a58c994954
Negotiate the 'setname' capability.
...
We don't store the name anywhere, but it can be useful to plugins.
2020-05-05 19:56:24 +02:00
Valentin Lorentz
ad05468257
Scheduler: Preserve period offset on restarts.
...
Partial fix for GH-397.
2020-05-02 18:28:41 +02:00
Valentin Lorentz
fc4cc956ba
Merge branch 'sts' into testing
2020-05-02 17:10:13 +02:00
Valentin Lorentz
01dcbf412b
Fix edge case of server tags unescaping, when the backslash is followed by an 'invalid' char.
2020-05-01 23:46:34 +02:00
Valentin Lorentz
e92156711b
Only spaces are token separators, not all whitespaces.
2020-05-01 23:44:38 +02:00
Valentin Lorentz
1854d86476
Add support for outputting server tags.
...
Will be useful when we start sending client tags.
2020-05-01 23:35:52 +02:00
Valentin Lorentz
309fc1233b
Add postTransition method to IrcCallback, called when irc.state.fsm changes.
2020-05-01 20:19:53 +02:00
Valentin Lorentz
f7130f2629
Add missing transition trigger on MOTD start.
2020-05-01 20:19:00 +02:00
Valentin Lorentz
22120ee862
Fix various issues with STS handling.
2020-05-01 19:46:19 +02:00
Valentin Lorentz
51ff013fcc
Apply STS policies when connecting to a server.
2020-05-01 19:46:19 +02:00
Valentin Lorentz
ecc2c32950
Add support for storing STS policies.
...
If on an insecure connection: reconnect.
If on a secure connect: store it and do nothing else.
For now, stored STS policies are not read when connecting to an
insecure server.
2020-05-01 19:46:19 +02:00
Valentin Lorentz
ff5edd95a3
Remove Twisted.
...
There's no reason to use it anymore instead of Socket.
It's already missing features compared to Socket, and I don't want to
maintain it anymore so it will keep getting worse.
2020-05-01 19:46:19 +02:00
Valentin Lorentz
45ff70907f
[WIP] Start reworking Irc around a FSM.
...
To keep track of connection state instead of a complex implicit flow
between handling functions.
2020-05-01 19:43:27 +02:00
Valentin Lorentz
3eb20adaf2
Fix extra arguments to irc.reply() being ignored by messages returned by '@more'.
...
This change builds all the ircmsg objects directly in irc.reply, with
the original arguments.
A side effect is that if a config var is changed between the initial command
call and the call to '@more', this commit makes it use the old values,
but that shouldn't be too much of an issue.
Closes GH-1405.
2020-04-11 16:40:07 +02:00
Valentin Lorentz
61b47bb65b
Deduplicate list of arguments of _makeReply.
2020-04-11 16:36:14 +02:00
Valentin Lorentz
0b0da9716d
callbacks: honor network-specificity of supybot.reply.whenAddressedBy.
...
A side-effect is that plugins should now pass 'irc' instead of 'irc.nick'
when they call 'callbacks.addressed()'.
2020-04-11 15:00:46 +02:00
Valentin Lorentz
2953126fca
test: Make assertNoResponse default to a non-zero timeout for threaded plugins.
...
Else it doesn't reliably check there is no response.
2020-04-11 00:17:16 +02:00
Valentin Lorentz
c489d2e9be
Prevent getChannelDb from overriding state.channel set by getChannel.
...
I don't see any use for this; and it means a 'channel' converter
called after 'channeldb' returns '#' instead of the actual channel
if it's after 'channeldb' in the arg list and
databases.plugins.channelspecific is False.
2020-04-07 21:20:01 +02:00
Valentin Lorentz
712d8c2eab
Remove debug print
...
Was added in 8bb31a54e7
.
2020-03-26 10:29:42 +01:00
Valentin Lorentz
de77ce6ddc
Raise exception instead of assert...
2020-03-21 02:21:06 +01:00
Valentin Lorentz
3576503e3f
Update links to the documentation.
2020-03-17 19:22:52 +01:00
Valentin Lorentz
8f001f8045
Check spec.loader is not None when importing a plugin.
2020-02-09 16:02:35 +01:00
nyuszika7h
0f3264cf26
Add modulo operator to new math evaluator
...
Closes #1402 .
2020-02-08 16:08:23 +01:00
opal hart
f24a17e5c4
Config docs: remove reference to grouped nicks
...
Some networks (e.g. freenode) now allow usage of grouped nicks for SASL
username
2020-02-08 11:07:19 +01:00
Valentin Lorentz
a6ae9f51a3
ChannelStats: Use the safe math evaluator.
2020-01-26 20:42:55 +01:00
Valentin Lorentz
99dd6f1506
core/Math: Move the math evaluator to src/utils/.
...
It will be used by ChannelStats.
2020-01-26 20:42:55 +01: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
777d8e4920
Socket: use a proper lock instead of a boolean.
2020-01-23 16:47:49 +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
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
Valentin Lorentz
ac07b440dc
Rewrite ecdsa-nist256p-challenge using python-cryptography instead of python-ecdsa.
...
Which is more secure. Closes GH-1389.
It also fixes the protocol/format to use the same one as Atheme.
See also: 8a81224ba8
2020-01-01 12:07:59 +01:00
James Lu
a6392c8582
test: choose a random free port for tests using the HTTP server
...
Closes #1392 .
2019-12-15 20:20:37 +01:00
Valentin Lorentz
a86df1fc35
Remove dead code from Group that belongs in Value.
2019-12-09 21:27:09 +01:00
Valentin Lorentz
83114e5fbd
src/callbacks.py: use network-specific values.
...
Closes GH-1393
2019-12-05 21:51:25 +01:00
Valentin Lorentz
1ed47f802f
Request msgid capability.
2019-12-05 21:11:35 +01:00
Valentin Lorentz
a1ee580d08
Make getLocaleFromRegistryCache reload existing locales.
...
The core locale is loaded before this function is called, so it needs to
reload it for non-en locales to be loaded.
2019-11-24 12:59:38 +01:00
Valentin Lorentz
63b0d7e653
Update core fr translation.
2019-11-24 12:47:03 +01:00
Valentin Lorentz
0828b207be
Add fallback if getting supybot.language from registry cache failed.
2019-11-24 12:46:10 +01:00
Valentin Lorentz
423a38770b
Get locale name on startup from registry cache instead of parsing config file.
...
Parsing the config file needlessly requires an extra read of it,
and is brittle (extra spaces, etc.)
It was especially broken as there was a newline character
at the end of currentLocale, which made everything fail
shamefully.
2019-11-24 12:04:21 +01:00
Valentin Lorentz
a8b6698849
Add config supybot.reply.format.list.maximumItems to limit the size of format('%L', ...).
2019-11-23 18:48:58 +01:00
James Lu
9291fbd4a0
All plugins: set Limnoria contributors as maintainer
2019-11-16 11:41:13 -08:00
James Lu
a4701b258c
Plugin: accept author name in 'contributors' command
2019-11-16 11:41:13 -08:00
James Lu
7854db7135
Better formatting in supybot.Author if some fields are missing
2019-11-16 11:41:13 -08:00
Valentin Lorentz
2dddfefa98
Fix log on SASL failure.
...
Broken by 04b55805b8
.
2019-11-09 18:38:40 +01:00
Valentin Lorentz
6a9462be00
Fix reset of capabilities_ls.
...
Broken by 0014b206ad
.
2019-11-09 18:27:07 +01:00
Valentin Lorentz
5e2343f717
Update doc of capabilities.default to mention 'channel capability setdefault'.
2019-11-08 20:53:04 +01:00
Valentin Lorentz
04b55805b8
Log SASL mechanism on failure. Closes GH-1014.
2019-11-02 20:52:58 +01:00
Valentin Lorentz
10ccfbbf3c
Remove early return in upkeep() in case sys.stdout is replaced.
...
We don't want flushing to be entirely skipped just because
of that.
2019-11-01 22:18:32 +01:00
Valentin Lorentz
9268356e97
Split 'CAP REQ' commands to not exceed 512 bytes.
2019-10-25 23:07:31 +02:00
Valentin Lorentz
0014b206ad
Reset capability set state on reconnection.
2019-10-25 22:40:51 +02:00
Valentin Lorentz
cfbbed3da9
Truncate incoming lines to 512-2, not 500.
2019-10-25 22:31:09 +02:00
Valentin Lorentz
71cc414ff3
Fix conditional on CTCP in urlSnarfer.
...
Broken in 8bb31a54e7
.
( 8bb31a54e7
\#diff-44309956f4d4fbbe0b8499c3d849080fL209-R212 )
2019-10-22 17:57:46 +02:00
James Lu
35a64eca38
Plugin: update tests
...
I'm taking the liberty of adding myself to supybot.authors here.
2019-10-19 11:34:24 -07:00
James Lu
930da6a6ba
Use a real invalid email in supybot.authors.unknown
2019-10-19 10:20:38 -07:00
James Lu
e7f033539b
Don't repeat nick in supybot.Author if nick and name are the same
...
This is the case e.g. for quantumlemur's plugins.
2019-10-19 10:20:38 -07:00
James Lu
18f9a342b3
Throw out mungeEmail for supybot.Author
...
This has limited value these days, because 1) the email info for authors is most often in a public VCS already 2) it makes using the actual contact info harder.
2019-10-19 10:20:35 -07:00
James Lu
b54d8f8073
regexp_wrapper: return None instead of False when search times out ( #1379 )
...
This allows plugins to detect whether a search timed out or did not match, which are two distinct outcomes.
2019-10-17 12:30:07 -07:00
Johannes Löthberg
27e7d6a9ac
Aka: Add web UI ( #1373 )
...
* utils.web: Import html escaping functions
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
* Aka: Add web interface for browsing Akas
Fixes #1226 .
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
* httpserver: Actually handle KeyError in unhook
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
* test: FakeHTTPConnection: Don't decode data in send
BaseHTTPRequestHandler expects to get bytes, so we can't decode the sent
data.
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
* test: HTTPPluginTestCase: Use BytesIO instead of StringIO
BaseHTTPRequestHandler expects bytes, not strings.
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
* test: HTTPPluginTestCase: Rewind wfile to 0 before reading the response
Otherwise the read pointer is at the end of the file.
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
* Aka: Add basic web UI tests
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
2019-10-10 17:27:34 +02:00
Valentin Lorentz
8b2cbbc583
Use a monotonic time for registry cache.
...
So an old cache does not take precedence over a newly set value.
I noticed this bug because of the time going backward in tests
because of the time.time mock introduced in
dcf55cf6de
, but this may happen
in production systems too.
Also adds another deprecation warning for python < 3.3.
2019-10-05 22:29:11 +02:00
Valentin Lorentz
a4665803fa
News + RSS: Mock time.time() instead of using time.sleep() in tests.
...
Saves 40s over the ~5min test suite.
2019-10-05 12:22:30 +02:00
Valentin Lorentz
3c42ce0861
Only clear users db if the filename is set.
2019-09-28 10:33:54 +02:00
Valentin Lorentz
bcbaa979d5
Revert "Deduplicate (de)serialization code shared by UsersDictionary and ChannelsDictionary."
...
This reverts commit a4f8e3f647
.
2019-09-28 10:33:10 +02:00
Valentin Lorentz
5bfee2e72b
Fix typo in doc.
2019-09-26 23:00:01 +02:00
Valentin Lorentz
a4f8e3f647
Deduplicate (de)serialization code shared by UsersDictionary and ChannelsDictionary.
2019-09-26 22:48:05 +02:00
Valentin Lorentz
7d218ec8ce
Document unpreserve.Reader (expected format + method hooks).
2019-09-26 22:47:04 +02:00
Valentin Lorentz
84c1f1572d
Don't temporarily set msg.channel to invalid values.
...
This causes issue when multiple command threads deal with the same message.
2019-09-20 21:25:32 +02:00
jesopo
6c5072cfe0
only raise in commands.process() when a raise was wrapped ( #1370 )
2019-09-18 20:27:02 +02:00
Valentin Lorentz
40837dbda0
Don't mutate server list while iterating on it.
...
It causes hanging at bot/test stops.
2019-09-15 08:02:10 +02:00
Valentin Lorentz
573921c00f
Merge branch 'netconf-and-ircmsgs-channel' into testing
2019-09-14 12:10:47 +02:00
Valentin Lorentz
67c2bacd69
Set msg.channel in ReplyIrcProxy and NestedCommandsIrcProxy.
...
Needed when plugins use a self.Proxy with a crafted message;
else the called commands will assume the message was sent in
private.
2019-09-08 21:35:35 +02:00
Valentin Lorentz
f143e977d6
Interpret empty server tag values as missing tag values.
...
As required by https://ircv3.net/specs/extensions/message-tags
2019-09-08 14:47:05 +02:00
Valentin Lorentz
88524beada
ChannelLogger + Karka + all DB plugins: Sanitize channel names when used in filenames.
2019-09-06 20:42:13 +02:00
Valentin Lorentz
b65d78518c
Services: Add support for network-specific password.
2019-08-25 14:08:11 +02:00
Valentin Lorentz
0b5bd625eb
Add test for simple registry value inheritance.
2019-08-25 00:07:29 +02:00
Valentin Lorentz
7e1a1a23a9
Fix fallback of Group.__getattr__ on protected attributes.
2019-08-25 00:06:35 +02:00
Valentin Lorentz
e9bf05bbab
Don't unregister subtree if only the child is unset.
...
Because now, grandchildren may have set values.
2019-08-24 23:37:23 +02:00
Valentin Lorentz
c1ae3f5c81
all plugins: Use msg.channel instead of msg.args[0] + give network name to self.registryValue.
2019-08-24 23:35:01 +02:00
Valentin Lorentz
9326331c60
Merge branch 'ircmsg-channel' into netconf-and-ircmsgs-channel
2019-08-24 15:39:17 +02:00
Valentin Lorentz
8bb31a54e7
Strip statusmsg chars in core to determine the actual channel.
...
Use msg.channel if relevant, otherwise strip them locally.
2019-08-24 14:52:59 +02:00
Valentin Lorentz
5b40b5136d
Limit statusmsg prefix stripping to PRIVMSG and NOTICE.
2019-08-18 10:09:11 +02:00
Valentin Lorentz
7a7cdb9f05
Add a 'channel' attribute to IrcMsg objects.
...
It's nicer to use 'irc.channel' instead of 'irc.args[0]', and .channel
provides the actual channel name (stripped of the statusmsg prefix),
so it can be used by plugins when they want to use the actual channel
name.
2019-08-17 22:23:51 +02:00
Valentin Lorentz
4f024cb0b2
Add network-specific config values.
2019-08-15 12:22:43 +02:00
Valentin Lorentz
d4cac026d4
Remove '+' from the default chantypes.
...
It's more likely to be a statusmsg than chantype.
2019-08-04 21:52:40 +02:00
Valentin Lorentz
696254ff1b
Use irc.isChannel instead of ircutils.isChannel when possible.
...
It's aware of the network's 'chantypes'.
2019-08-04 21:52:40 +02:00
Valentin Lorentz
bf7db13f01
Disallow mutating commands in Aka/Alias/Scheduler by default.
...
It's too easy to abuse these commands when owners don't know they have to set
the appropriate anticapabilities; so let's set the anticapabilities by default.
2019-07-31 23:00:55 +02:00
Valentin Lorentz
76699ec063
Add support for 'message-tags' capability, to receive TAGMSGs.
2019-05-08 21:19:53 +02:00
Valentin Lorentz
71dbd39dd7
Revert changes to the structure of sdist packages.
...
c87aacb690
b882d1cc00
b1db15c056
2019-02-23 00:12:06 +01:00
jesopo
e7b076aa44
startwith
-> startswith
2019-02-22 20:31:07 +01:00
jesopo
61d9596d35
Support [ipv6]:port
format
2019-02-22 20:31:07 +01:00
Valentin Lorentz
233deee0d3
Fix previous commit for py2 and pypy.
2019-02-07 21:35:39 +01:00
Valentin Lorentz
969b9ed341
Make utils.python.collect_extra_debug_data support objects with __slots__.
2019-02-07 21:00:56 +01:00
Valentin Lorentz
624553c069
irclib: Don't return the same nick twice when duplicates in supybot.nick.alternates + supybot.nick.
...
It migt crash on: 'assert newNick != self.nick'
2019-01-27 09:10:06 +01:00
Valentin Lorentz
b051537f7f
Add support for Python 3.8/nightly.
2019-01-06 18:08:15 +01:00
Valentin Lorentz
7adc958dd6
Fix SyntaxWarnings on Python 3.8
2019-01-06 18:06:44 +01:00
Valentin Lorentz
a03a89730a
Fix bugs in wrapping IRC messages.
2019-01-06 16:48:11 +01:00
Valentin Lorentz
93b0476751
Fix text wrapping when colors cross message boundaries.
2019-01-05 23:47:56 +01:00
Valentin Lorentz
b1db15c056
Add a symlink supybot pointing to src/ + move locales/ to src/
...
This looks like a more standard source tree, and allows for running tests without installing.
2019-01-02 14:29:32 +01:00
Valentin Lorentz
fcf30a5601
Fix FutureWarning related to nested sets.
...
See https://bugs.python.org/issue30349
2018-12-29 23:36:57 +01:00
Valentin Lorentz
06400596e9
Prevent commands.process from trying to increase heap size. Closes GH-1353.
2018-12-15 22:15:12 +01:00
Valentin Lorentz
c1d3bad64f
Raise error even if supybot.replies.(generic)noCapability is empty.
2018-10-06 08:13:11 +02:00
Valentin Lorentz
11dd5049fe
Fix MITM warning.
2018-10-06 08:13:10 +02:00
Valentin Lorentz
88894d69bc
Fix fa2c11eec1
.
2018-09-25 20:04:07 +02:00
Valentin Lorentz
1ac7812d7a
Use __slots__ for core config values.
2018-09-25 18:59:46 +02:00
Valentin Lorentz
fa2c11eec1
registry: Get rid of the 'class X'-based hack.
2018-09-25 18:55:42 +02:00
296d44354f
src/conf.py: clarify supybot.protocols.http.proxy
2018-09-16 14:19:30 +02:00
Valentin Lorentz
c433f05190
Add a config var to require SASL auth when connecting.
2018-09-10 22:48:49 +02:00
Valentin Lorentz
7cc7b4fac9
Redesign the message truncation algorithm.
2018-09-10 22:39:45 +02:00
James Lu
c5175110e0
Socket: fix 91a38887a
with backported ipaddress on Python 2
...
Closes GH-1342.
2018-07-09 03:37:10 +00:00
James Lu
72c4801bb9
Socket: fix previous commit
2018-06-19 12:13:45 -07:00
James Lu
91a38887a2
Socket: suppress "not using TLS" errors on loopback addresses
...
This is a refined version of #1317 .
2018-06-19 11:59:42 -07:00
Valentin Lorentz
c2b6305c46
Config: Support arbitrarily many channels for '@config channel'.
2018-05-29 22:17:28 +02:00
James Lu
43ee68ee3d
conf: maxHistoryLength no longer requires a restart to apply
...
03c4529d9e
made irc.state.history network specific, so reconnecting each network separately will update its history buffer's max length.
2018-05-19 12:50:56 -07:00
Valentin Lorentz
0d627c05b7
Do not break UTF-8 characters in long words. Closes GH-1333.
2018-04-14 22:31:30 +02:00
James Lu
75e6816e91
Merge pull request #1332 from farooqkz/master
...
Added docstring for getIrc()
2018-03-26 08:10:12 -07:00
Farooq Karimi Zadeh
3a4b77cefd
Added docstring for getIrc()
2018-03-26 13:40:15 +04:30
Valentin Lorentz
c930edd943
Report 'Limnoria <foo>' instead of 'Limnoria Limnoria <foo>' as a version.
2018-03-02 01:20:52 +01:00
Valentin Lorentz
af98c0c12e
Allow MODE arguments that do not start with a + or a -.
2018-02-06 15:35:49 +01:00
Valentin Lorentz
9c1d46d151
Add channel-specific config variables that are only settable by the owner.
2018-02-06 14:20:37 +01:00
Valentin Lorentz
636712be51
Limit the number of combinations of capabilities required for command names with spaces.
...
To call a command named 'X Y Z' in plugin 'P', we used to require lots of capabilities,
like 'P.X', 'P.Y', 'P.Z', 'P.X.Y', 'X.Y', 'P.Y', ...
Now, we only require 'P', 'P.X', 'P.X.Y', 'P.X.Y.Z', and 'Z'.
It makes it a lot easier to work with command names with a space when
supybot.capabilities.default is False.
2018-02-02 18:20:05 +01:00
Valentin Lorentz
39dacf6e5b
Fix Python 2 support.
2018-02-01 23:21:18 +01:00
Valentin Lorentz
030ce5e6d4
Fix previous commit.
2018-02-01 22:37:24 +01:00
Valentin Lorentz
63a17f7491
Rewrite text wrapping to count line size in bytes instead of characters.
...
Also, fix shitty comparisons that were done in reverse.
2018-02-01 21:32:14 +01:00
Valentin Lorentz
7e98802809
Drop STARTTLS support, it complicates the connection initialization too much.
2018-01-24 09:27:39 +01:00
Nicolas Coevoet
2b030ac178
more arguments added for WHOX, to avoid external plugins recall same requests
2018-01-23 19:37:19 +01:00