Commit Graph

11451 Commits

Author SHA1 Message Date
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
aa2f9202ec Google: Fix false positives on embedded thumbnails (eg. Youtube results). 2020-05-28 19:07:08 +02:00
Valentin Lorentz
847e51a7ec plugins: Fix name mismatch of typeSubstitution in getCommandHelp.
Bug introduced in 4046a1b201.
2020-05-27 21:19:09 +02:00
Valentin Lorentz
8b9ac3540d plugins: Fix AttributeError in getCommandHelp.
Introduced in commit 4046a1b201.
2020-05-27 20:30:39 +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
2924845de4 Google: Update, with a proper HTML parser.
Hopefully it will be more robust than the regexp.
2020-05-24 18:57:27 +02:00
Valentin Lorentz
ed87de1527 Filter: add support for upper-case letters. 2020-05-23 13:32:26 +02:00
Valentin Lorentz
b4d21127b1 Filter: Add uwu. 2020-05-23 12:10:40 +02:00
Valentin Lorentz
a7a03513bf ircutils: Set __slots__. 2020-05-22 08:38:42 +02:00
Valentin Lorentz
dde35a844d Seen: Don't internalize IrcString.
It's a bug, and it would mess case-insensitive comparison anyway.
2020-05-22 08:38:42 +02:00
James Lu
ac4ca4950d DDG: update plugin metadata 2020-05-21 23:11:38 -07:00
James Lu
2b567c5ef9 Owner: remove obsolete note about stock plugins on ImportError
Limnoria has not run 2to3 as part of the build process for many years now.

This reverts part of 1b2617bf8e.
2020-05-21 23:06:20 -07:00
Valentin Lorentz
71cf7338c3 supybot-wizard: Fix crash when adding or removing owner capability.
Closes GH-1410.
2020-05-21 00:17:50 +02:00
Valentin Lorentz
fa76fb9cd4 conf: Fix/update doc of supybot.plugins. 2020-05-20 20:35:05 +02:00
Valentin Lorentz
dc33ee3464 README: mention py3.8 support. 2020-05-18 23:52:40 +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
2682e4cb48 Seen, ChannelUserDictionary: Internalize channel names.
They are not many of them, but they are used a lot so they take
up a surprising amount of memory.
2020-05-17 21:09:00 +02:00
Valentin Lorentz
08f4c781cb ChannelLogger: Make relayed message rewriting optional. 2020-05-17 21:05:59 +02:00
Valentin Lorentz
75f7479bf4 Config: Fix name clash with the expected 'reset' method. 2020-05-17 12:46:46 +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
2fe9bedb86 Fediverse: Remove nick prefix from snarfer output. 2020-05-16 23:15:11 +02:00
Valentin Lorentz
83c49ec43a Fediverse: black 2020-05-16 23:14:46 +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
6cc3d3080c Config: mention 'reset channel' and 'reset network' in setdefault's help.
Closes GH-680.
2020-05-16 10:20:43 +02:00
Valentin Lorentz
27f4386279 Config: Add commands 'reset channel' and 'reset network'.
They allow reseting a channel-specific or network-specific value
back to their parent value, and will follow it when it changes.
2020-05-16 10:15:31 +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
0bfd82f650 DDG: Add missing copyright notice. 2020-05-15 21:36:31 +02:00
Valentin Lorentz
d05b6e120b DDG: Remove note about dependency on BeautifulSoup. 2020-05-15 21:35:16 +02:00
Valentin Lorentz
10df0a0dd0 DDG: Rewrite using html.parser.HTMLParser instead of BeautifulSoup.
So we don't depend on an external library.
2020-05-15 21:26:44 +02:00
Valentin Lorentz
37c1fa2153 DDG: add test 2020-05-15 21:24:43 +02:00
Valentin Lorentz
5e90044fab DDG: Make tests honor --no-network. 2020-05-15 21:24:01 +02:00
James Lu
db184f962b Merge DDG plugin from my repository
Add 'plugins/DDG/' from commit '410b51657aeb93b4836d62168a90b319677a45f1'

git-subtree-dir: plugins/DDG
git-subtree-mainline: 91381aec0f
git-subtree-split: 410b51657a
2020-05-15 11:32:43 -07:00
James Lu
91381aec0f .mailmap: update my email
[skip ci]
2020-05-15 11:28:09 -07:00
James Lu
410b51657a Update plugin author/maintainer data
From: cbd953b32c
2020-05-15 11:19:32 -07:00
James Lu
e44083f9a5 Update my email & repo link references
From: 2ae51939b3
2020-05-15 11:19:32 -07:00
James Lu
c99353106e Annotate READMEs with BeautifulSoup dependencies
From: a80a19564c
2020-05-15 11:19:32 -07:00
James Lu
8689345f74 DDG: remove zeroclick from plugin readme
[skip ci]

From: 3ab4ba16dc
2020-05-15 11:19:32 -07:00
James Lu
c73542fb3f DDG: remove the 'zeroclick' command
The IRC output is poorly formatted, and doesn't yield useful results most of the time anyways.

From: cdf6c7eb3e
2020-05-15 11:19:32 -07:00
James Lu
e4d16257b6 DDG: support !bang links (redirects)
From: 1e7bfed72e
2020-05-15 11:19:32 -07:00