Commit Graph

3919 Commits

Author SHA1 Message Date
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