Commit Graph

4090 Commits

Author SHA1 Message Date
Eric Mertens
9e82e3f16c Add command to manually initiate SASL 2023-09-05 20:13:21 +02:00
Valentin Lorentz
f8dd8d7642 supybot-test: Add --clean-after option 2023-09-04 20:07:42 +02:00
Valentin Lorentz
6b778598bb --clean removes files before running tests, not after 2023-09-04 18:24:16 +02:00
Valentin Lorentz
8029e2b390 supybot-test: Ensure --clean doesn't leave 'backup' and 'test-logs' directories 2023-09-04 17:36:22 +02:00
Valentin Lorentz
2b4c5eb78f Fix crash when calling .reply(..., action=True) on ReplyIrcProxy
instead of on NestedCommandIrcProxy.

ReplyIrcProxy._sendReply expects action=True to imply noLengthCheck=True, but only
NestedCommandIrcProxy.reply() enforces the latter, not ReplyIrcProxy.reply().

This crash was introduced in 3c1c4a69e9 by
moving NestedCommandIrcProxy's .reply() to ReplyIrcProxy.
2023-07-18 07:46:51 +02:00
Valentin Lorentz
054ee6e410 Disable generic error reply when supybot.replies.error is empty 2023-07-11 21:34:49 +02:00
Valentin Lorentz
eb002a31e9 wizard: Check language is supported
Otherwise it may raise InvalidRegistryValue on first start
2023-07-08 16:46:13 +02:00
Valentin Lorentz
8d1d4b84eb Fix error message on invalid 'supybot.language' value 2023-07-08 16:42:26 +02:00
James Lu
b374418c81 irclib: fix mismatched arguments when logging IRCv3 cap responses 2023-06-30 20:07:45 -07:00
Val Lorentz
2902a85dbd
Fix STS parsing and handling of unchecked-TLS connections (#1524)
* ircutils: Fix incorrect log message on invalid STS policy

* STS: fix confusion over what a secure connection is

irclib computed 'secure_connection' when TLS is enabled and TLS certs
are checked; but ircutils used the value to parse STS policies, which
should only care about being TLS or not.

This commit fixes the incorrect parsing on unchecked-TLS, and triggers
a reconnect when a STS policy is encountered in this case, to force
TLS certs to be checked before storing the policy.

* Accept STS policies when reconnecting after getting it over cleartext

ircutils.parseStsPolicy() was passed self.driver.ssl which is the configured
value, even though the connection was forced to be TLS temporarily

* ci: Lower timeout

* Fix typo in test name

Co-authored-by: James Lu <james@overdrivenetworks.com>

---------

Co-authored-by: James Lu <james@overdrivenetworks.com>
2023-06-10 08:28:08 +02:00
James Lu
416a05e326
Route commands from Network.command back to the original network (#1540)
Add a replyIrc parameter to ReplyIrcProxy to run a command on one network, but route the replies to another.
This fixes a long standing issue where replies for remote commands are often lost to the void, as the nick of the caller may not exist on the target network (or worse, it could belong to a completely unrelated person).

Closes GH-556.

Co-authored-by: Val Lorentz <progval+git@progval.net>
2023-06-04 12:39:56 -07:00
James Lu
654937ecfc botchk: move imports to top-level 2023-05-26 20:27:39 -07:00
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