Commit Graph

4078 Commits

Author SHA1 Message Date
James Lu 3be1804553 botchk: fix syntax error 2023-04-27 18:36:50 -07:00
Valentin Lorentz 6f663e4140 Merge branch 'testing' into entrypoints 2023-04-26 18:04:21 +02:00
Valentin Lorentz add9306d30 Socket: Clear buffers on reconnect 2023-03-24 20:23:32 +01:00
Valentin Lorentz f518579c77 Request standard-replies capability
Arbitrary standard-replies are already supported, this signals to servers
that we do.
2023-02-21 19:10:11 +01:00
Valentin Lorentz efed7d8081 Move the 'ignore=False' trick from callbacks to Scheduler
I fear putting it in callbacks would be overzealous and reset it
within the processing of the same message, eg. when using conditional
to set the 'ignore' tag before other nested commands run.
2023-01-19 10:31:13 +01:00
Valentin Lorentz f409111872 callbacks: Fix interference between Scheduler.repeat, Anonymous, and nested commands
Specifically, the issue is with Anonymous using irc.noReply() in
the first call, preventing nested commands' result from being used.

Before this commit, the second and third responses in the test would be
only "1" and "2" instead of "1 ['foo']" and "2 ['foo']".
2023-01-19 10:19:01 +01:00
Valentin Lorentz 985ca23f71 Add tests for nicksToHostmasks 2022-11-23 19:25:12 +01:00
James Lu 73a23e220f IrcState: fix typo in attribute docs
capabilities_acq -> capabilities_ack
2022-11-06 18:38:24 -08:00
Valentin Lorentz 4da1291876 URL: Lazily deserialize records from the end in @last
Before this commit, the plugin first fetched a list of all
(deserialized) records in a list, then reversed the list, and iterated
on the reverse list.
This proved to be slow, with most of the time being spent in
`dbi.DB._newRecord` (which essentially deserializes one list of CSV).

After this commit, the list is reversed first, then the plugin iterates
on its generator, which calls `_newRecord` on records as they are
requested.

This means that when there are many URLs in the database, `@last` does
not need to waste time deserializing most records, when the result is
near the end (and if the result is the first record, then it does
exactly as much work as before).
2022-10-30 20:46:35 +01:00
Valentin Lorentz 77805ff36e irclib: Abort authentication when server fails SCRAM challenge
Will be tested by irctest:
https://github.com/progval/irctest/pull/179
2022-10-28 15:00:58 +02:00
Valentin Lorentz e9a29e9159 irclib: Fix crashes on ecdsa/scram signature failures 2022-10-28 14:57:57 +02:00
Valentin Lorentz b0525bcf42 Double default peekSize
We bumped it to 8kB in 2015, but it is starting to be an issue again.
2022-10-28 14:22:44 +02:00
Valentin Lorentz 009b900100 Make TimeoutQueue.iter() actually expire items
It is functionally fine not to, but causes objects to never be freed
if iter() is the only method called on the queue (ie. no
enqueue/dequeue, len(), ...)
2022-10-24 23:43:52 +02:00
Valentin Lorentz d0a484c11c Sort remaining nondeterministc sets of values
Closes GH-1516
2022-10-20 18:35:58 +02:00
Valentin Lorentz dc94f8dc68 registry: Default to sorting sets of values
Not sorting them causes the config file to change when the bot writes
it, because order is nondeterministic.

This is usually fine, but can be annoying when configs are deployed
with Ansible.

Closes GH-1516
2022-10-14 23:15:11 +02:00
Valentin Lorentz a6aa5530dd Ensure files written with AtomicFile are read in UTF8
With some locale configurations (not that uncommon on CentOS), open() may
default to non-UTF8 encodings (eg. ANSI_X3.4-1968).

This is usually not an issue, because we use open() both for writing and
reading. However, AtomicFile implicitly enforces UTF8; which needs to be
mirrored when reading.
2022-10-06 09:49:42 +02:00
Valentin Lorentz 35bf599856 utils/web: Add <br/> to the list of block elements
It should always be replaced with a space.
2022-09-20 07:51:46 +02:00
Valentin Lorentz 200acdfa93 registry: Normalize values before checking they are valid
Otherwise, normalization is useless, and gives a surprising error message,
such as:

```
<user> config plugins.rss.sortfeeditems oldestfirst
<bot> Error: Valid values include 'asInFeed', 'oldestFirst', 'newestFirst', 'outdatedFirst', and 'updatedFirst', not 'oldestFirst'.
```
2022-09-07 12:31:22 +02:00
Valentin Lorentz ef081746b1 commands: Silence noisy logging of command evaluation 2022-07-29 10:29:48 +02:00
Valentin Lorentz ee60431396 Add debug logging when skipping SASL mechanisms
It is useful to figure out what you forgot to configure
2022-07-29 10:03:39 +02:00
Valentin Lorentz f549ec12c6 Add debug logging of SASL mechanisms 2022-07-29 09:45:09 +02:00
Valentin Lorentz 96b7f51e71 callbacks: Ignore chathistory batches in PluginRegexp
This is consistent with what we already do with commands; and generally
makes sense, as we don't want to re-send titles and others when cycling
on UnrealIRCd (which includes a chathistory batch when joining when
chmode +H is set, despite umode +B)
2022-07-06 22:07:37 +02:00
Valentin Lorentz b3443a5a4c setup: Fix install of subpackages when pip-installed from git repositories
It seems setuptools needs to be explicitly told to include subpackages
in this case.
2022-06-22 20:31:59 +02:00
Valentin Lorentz 0572d49988 Use setuptools 'entry_points' instead of distutils-style 'scripts'
A future commit will add aliases for these scripts, and using entry_points
will make them easier to set up.
2022-06-17 11:45:31 +02:00
Valentin Lorentz fd04fccaec i18n: Validate value of supybot.language 2022-06-17 00:29:38 +02:00
Valentin Lorentz 93370b6f0e utils: Rewrite i18n initialization
The previous implementation was messy and needlessly complicated

This simplifies the logic and removes hackiness by making utils/str.py
handle internationalization logic itself, instead of bending over
backwards to load logic from the parent package at import time.
2022-06-17 00:05:51 +02:00
Valentin Lorentz 4a620bf7f0 Socket: Use the right variable to initialize the reconnect delay 2022-06-16 22:35:08 +02:00
Valentin Lorentz 94d669ebec Make the minimum reconnect delay configurable 2022-05-28 13:53:05 +02:00
Valentin Lorentz 32198d42c2 i18n: Skip fuzzy strings
The German translation currently has at least one fuzzy string
with a missing %s; and several translations are completely wrong.
2022-04-27 22:15:43 +02:00
Valentin Lorentz 109f938b0c Implement +draft/channel-context 2022-04-22 18:30:31 +02:00
Valentin Lorentz 9ec4eb9563 irclib: Fix assertion failure on InspIRCd when Sigyn plugin is loaded 2022-04-08 12:44:42 +02:00
Valentin Lorentz 088d0f54dd irclib: Catch exception from outFilter, as with inFilter 2022-03-17 22:29:10 +01:00
Valentin Lorentz 862fca1602 conf: Use imports instead of sys.modules to detect module availability
`conf.supybot.databases()` may be called without any plugin supporting
sqlite3 being loaded yet, which causes `sqlite3` to be missing from
`sys.modules`; so it wouldn't be used by plugins loaded afterward.
2022-03-06 13:39:47 +01:00
Valentin Lorentz d58d8d4a71 conf: Prioritize sqlite3 over sqlalchemy in supybot.databases
It's usually a better choice for plugins that implement both
2022-03-06 13:39:41 +01:00
Valentin Lorentz 9e995d8ac2 conf: Remove 'sqlite' module from supybot.databases
It is wholy replaced by 'sqlite3', now
2022-03-06 13:39:19 +01:00
PeGaSuS 80b26c013d
Fix typo in conf.py (#1501)
Fixed typo that lead to a wrong variable name being pointed out
2022-03-06 12:30:02 +01:00
Valentin Lorentz 66d986e820 Web: Add overrides to support Youtube and Reddit; remove Twitter from tests. 2022-03-03 22:16:53 +01:00
Valentin Lorentz 78bdc469e4 htmlToText: Don't replace inline element tags with spaces
They are not meant to be displayed like this, so they look weird sometimes.
For example, Mastodon splits long links between spans, so the Fediverse plugin
always displayed them broken.
2022-02-19 21:00:51 +01:00
Valentin Lorentz bc76f7ead4 Fix utils.time.iana_timezone on python < 3.9 2022-02-17 12:18:13 +01:00
Valentin Lorentz 1643cb1b09 registry.Regexp: Better safeguard against misuses of _setValue() 2022-01-11 20:38:44 +01:00
Valentin Lorentz dcca9f9637 RSS: Make feed announces actually network-specific
.getSpecific() always returned the  channel-specific but non-network-specific var,
unless the channel-specific and network-specific one was manually set.
2022-01-11 20:13:39 +01:00
Valentin Lorentz 40155ede22 Fix syntax DeprecationWarning. 2022-01-09 14:10:15 +01:00
Valentin Lorentz 74f86654b1 Remove fallbacks for old Python versions. 2022-01-01 18:11:36 +01:00
Valentin Lorentz 3f77c53ed5 utils/structures: Fix typos, remove unused code 2021-12-19 20:53:11 +01:00
Valentin Lorentz e223b507dd utils.time: Add support for timezones without a slash.
eg. UTC, CET, ...
2021-12-07 23:30:16 +01:00
Valentin Lorentz ef0cd48bd1 registry: Better explain String.__str__ 2021-12-03 18:03:27 +01:00
Valentin Lorentz fba5ed5fa4 Fix crash caused by registry.Json.__str__ returning non-str objects 2021-12-03 18:02:14 +01:00
Valentin Lorentz baa8cda814 Fix bypassed cache invalidation checks, causing '@config reload' to be partially ignored
`registry.Value.__call__()` is a wrapper around access to
`registry.Value.value`, that checks if the value was set before the latest
call to `registry.open_registry`; and updates the `value` if needed.

When accessing `registry.Value.value` directly, this cache can't be
invalidated, causing the old value to still be used, until the next call
to `registry.Value.__call__()`.
2021-12-03 16:56:06 +01:00
Valentin Lorentz 2236c7552a irclib: Request draft/account-registration
Servers might reject the REGISTER command if it's not ACKed.
2021-11-17 23:26:06 +01:00
Valentin Lorentz feaa02ab6d Add docstring to supybot.utils.time.iana_timezone 2021-11-08 23:20:28 +01:00