11389 Commits

Author SHA1 Message Date
Valentin Lorentz
1c4a3c25f5 callbacks: Split long errors. 2020-05-22 11:37:56 +02:00
Valentin Lorentz
e531bc027e callbacks: Make _prepareReply return a namedtuple instead of a huge tuple.
Otherwise it may cause complex bugs in the future if we
mess up the order.
2020-05-22 08:24:05 +02:00
Valentin Lorentz
67612b5338 callbacks: Move reply chunking from NestedCommandsIrcProxy to ReplyIrcProxy.
So non-commands also benefit from the chunking/mores.

Closes GH-183.
2020-05-22 08:17:27 +02:00
Valentin Lorentz
b07619e26f callbacks: deduplicate computation of 'to'. 2020-05-22 07:57:50 +02:00
Valentin Lorentz
daa6e39bca callbacks: Move reply splitting to its own function. 2020-05-21 18:49:38 +02:00
Valentin Lorentz
92f9a0350d callbacks: Deduplicate computation of message overhead.
NestedCommandsIrcProxy.reply tried to compute the length of
a message's overhead (':<prefix> <command> <target> :' and '\r\n'),
but because it doesn't exactly duplicate the code of _makeReply --
especially when computing the actual target -- it ends up slightly
off.

This commit moves the overhead length computation next to the
computation of the overhead itself, so it's always exact.

This will also allow message splitting in other methods without
duplicating the code too much.
2020-05-21 18:23:13 +02: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: 91381aec0f9fe95357f259b4527d0ce42c7c1452
git-subtree-split: 410b51657aeb93b4836d62168a90b319677a45f1
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
James Lu
ba04480405 DDG: rewrite _ddgurl() to return new and original request URLs
This uses utils.web.getUrlTargetAndContent(), which is specific to Limnoria and requires commit ProgVal/Limnoria@57b77a6725 or later

From: 2db371a9fa
2020-05-15 11:19:32 -07:00
James Lu
53318d142c DDG: show all lines of multiline zeroclick replies
Thanks to @nathan0 for pointing this out.

From: 0b0c1b59ab
2020-05-15 11:19:32 -07:00
James Lu
f5a53a1965 DDG: actually, return a list of tuples in search_core()
This abstraction makes it easier for depending plugins to filter out the data they actually need.

From: 4915b7713b
2020-05-15 11:19:32 -07:00
James Lu
828112eaa1 DDG: fix a typo in comments
From: 3729068633
2020-05-15 11:19:32 -07:00
James Lu
48b5016f41 DDG: rewrite to fix "max results" not working
From: 7a6e2f9f97
2020-05-15 11:19:32 -07:00
James Lu
30615a7284 DDG: abstract out a search_core(), as the LastFM plugin will use this later
From: 47bb74d7d9
2020-05-15 11:19:32 -07:00
James Lu
44b626df64 DDG: make _ddgurl() a static method
From: d332e73e48
2020-05-15 11:19:32 -07:00
James Lu
c92bc0ca0c DDG: expand redirect links in search results
Some links on DuckDuckGo's site are now shown going through a redirect service.
These links are in the format "/l/?kh=-1&uddg=https%3A%2F%2Fduckduckgo.com%2F" instead of simply being "https://duckduckgo.com", and we should decode these here.

From: 8187d51cef
2020-05-15 11:19:32 -07:00
James Lu
98600b26e8 DDG: fix wrong command name in README
[skip ci]
From: 22a4fb457d
2020-05-15 11:19:32 -07:00
James Lu
1806646be2 plugins: update my email
From: 177eefa0a3
2020-05-15 11:19:32 -07:00
James Lu
f9b83ac2de DDG: log search URL to DEBUG
From: 5431f25e0a
2020-05-15 11:19:32 -07:00
James Lu
950aec696e DDG: remove broken error catching (irc isn't in the _ddgurl namespace)
From: 52ec05a041
2020-05-15 11:19:32 -07:00