Commit Graph

5920 Commits

Author SHA1 Message Date
Valentin Lorentz
8b26b675ba Use stdlib instead of pytz on Python >= 3.9
Python 3.9 introduced the zoneinfo module, which provides the only
feature we used pytz for (getting a datetime.tzinfo object from
an IANA timezone id); so let's use it instead of a third-party
dependency.
2021-11-08 21:46:48 +01:00
Valentin Lorentz
ce7e4b754c Replace deprecated unittest function calls. 2021-11-08 21:29:59 +01:00
James Lu
417cd7d66f LogToIrc: add missing import 2021-10-20 17:39:50 -07:00
Valentin Lorentz
63eb6672ea Revert generic 'The Limnoria Contributors' in copyright notices
This commit reverts db7ef3f025
(though it keeps the year updates)

After discussion with several people, it seems better to mention
copyright owners explicitly. eg. https://reuse.software/faq/#vcs-copyright
explains the issue of using VCSs to track copyright.

As db7ef3f025 only replaced mentions
of my name with 'The Limnoria Contributors', this commit only needs
to undo that + add one person who contributed to setup.py.
2021-10-17 09:57:55 +02:00
PeGaSuS
f31e5c4b9a LogToIrc: Synchronize README with config.py
Better document the format of the 'target' config var
2021-10-09 22:53:13 +02:00
Valentin Lorentz
3f27c03f77 LogToIrc: better document the format of the 'target' config var 2021-10-09 21:08:48 +02:00
Valentin Lorentz
163e717bf0 Fediverse: increase again to fix failures on the CI... 2021-10-08 01:03:31 +02:00
Valentin Lorentz
d844243ce1 Fediverse: increase max heap size to mitigate crashes on pypy 2021-10-08 00:15:45 +02:00
Valentin Lorentz
bc0c5bdeed ChannelLogger: Log away messages 2021-10-07 21:34:04 +02:00
Valentin Lorentz
4d974869f9 String: Fix TypeError. 2021-09-21 21:41:25 +02:00
Valentin Lorentz
f468557899 Channel: Fix capability check in alertOps, to check the target instead of sender. 2021-09-21 21:21:21 +02:00
Valentin Lorentz
c93493901e Fediverse & String: Increase test timeouts, they can be flaky on CIs 2021-09-21 21:19:03 +02:00
Valentin Lorentz
dc79ab193a Update capitalization of my Github username 2021-09-14 20:30:47 +02:00
Valentin Lorentz
5b9ec4f716 LogToIrc: Prevent loop when sending to non-existing channels
When the target is a channel it is not in, it would treat it as a user;
which, if userCapabilityRequired is empty, would unconditionally send it
to a channel.
This would usually result in an error, that would be logged,
hence the loop.
2021-09-13 19:07:34 +02:00
Valentin Lorentz
070090ffc5 LogToIrc: Honor the configured log level 2021-09-13 19:05:42 +02:00
Valentin Lorentz
e63858659a Fediverse: Better assertionerror messages 2021-08-28 23:48:19 +02:00
Valentin Lorentz
52a5cefd50 Move stripformatting from Format to Filter, for consistency 2021-08-28 23:37:21 +02:00
Valentin Lorentz
db05081ff6 commands: fix _checkUrl 2021-08-25 23:28:25 +02:00
Valentin Lorentz
be88530fa4 commands: Disallow IRIs from 'url' and 'httpUrl' converters.
urllib doesn't support IRIs, and gives out a cryptic
'UnicodeEncodeError: 'ascii' codec can't encode character ...'
if we don't validate it.
2021-08-25 21:54:55 +02:00
Valentin Lorentz
ca624d7ae6 RSS: Fix nondeterministic test failures
Caused by 'rss announce add' triggering headline announces, that would
delay the execution of the 'remove' commands.

Thanks to @mapreri and @Unit193 for help in reproducing the issue
and confirming the patch.
2021-08-22 19:23:05 +02:00
Valentin Lorentz
0c8e455b4e RSS: When deleting a named feed, preserve anonymous feed of the same URL. 2021-08-22 19:21:28 +02:00
Valentin Lorentz
db7ef3f025 all: Add generic 'The Limnoria Contributors' to copyright notices.
No need to bother with details (that are all outdated / out of sync
anyway), just look up the git history.
2021-08-01 21:54:49 +02:00
Valentin Lorentz
c008d1191c RSS: Fix crashes when the set of channels changed while iterating. 2021-07-31 14:33:34 +02:00
Valentin Lorentz
0af4af16d3 RSS: Fix random test failure
Closes GH-1479
2021-07-04 10:46:51 +02:00
James Lu
64ae28c0b8 Remove references to my old nick 2021-07-03 16:42:13 -07:00
Valentin Lorentz
b8aa5aa33e User: Make @register automatically add the account tag
No need for '@nickauth nick add' right after registering anymore.
2021-06-30 21:28:17 +02:00
Valentin Lorentz
c23227cdc7 MessageParser: Show error when the action has a syntax error
Instead of being silent
2021-06-28 23:10:36 +02:00
Valentin Lorentz
6b72672a1e Poll: Fix typo in documentation 2021-06-28 23:10:36 +02:00
James Lu
a7216d290f Remove Spanish translations as requested by the author 2021-06-24 22:36:04 -07:00
Valentin Lorentz
a7c4c9bd78 Poll: Document usage. 2021-06-19 16:56:17 +02:00
Valentin Lorentz
936d7ebfea Poll Disallow 0 as poll id. 2021-06-19 16:48:40 +02:00
Valentin Lorentz
d919e2133d Poll: Initial commit with basic features. 2021-06-19 16:44:21 +02:00
Valentin Lorentz
3b25a94b46 Regenerate READMEs. 2021-06-19 16:44:21 +02:00
Valentin Lorentz
2293d1c129 Services: Update to the latest version of the draft/account-registration spec. 2021-06-15 20:35:55 +02:00
Valentin Lorentz
4b82934131 Services: Add @nickserv and @chanserv command, to message services directly
This is because the recommended method ('owner ircquote nickserv register mypassword bot@example.com')
does not work on charybdis, as Limnoria inserts a colon
before the trailing argument and Charybdis' m_alias module
does not parse commands using the IRC syntax, so it
considers the leading colon to be part of the email address.

The alternative would be to change the recommended command to:
'owner ircquote PRIVMSG nickserv :register mypassword bot@example.com'
but it is prone to typos, so I think we should avoid it.
2021-06-14 21:47:36 +02:00
Valentin Lorentz
a4758146d8 Factoids: Fix NameErrors in HTTP callback. 2021-06-01 12:16:34 +02:00
Valentin Lorentz
4caf35f94b Dunno: Document command substitution 2021-06-01 10:43:05 +02:00
Mattia Rizzolo
a0b1334034 increase the timeout for Fediverse's tests
At least in Debian CI they routinely timeout when they run in the
busiest server.

Signed-off-by: Mattia Rizzolo <mattia@mapreri.org>
2021-06-01 08:58:56 +02:00
Valentin Lorentz
2e2c243b8b RSS: Remove flaky test 2021-05-28 19:37:37 +02:00
Valentin Lorentz
b8852eb9f3 RSS: Fix nondeterministic test failure 2021-05-28 19:15:56 +02:00
Valentin Lorentz
758f9bee34 RSS: Catch errors from update_feed(), just in case
feedparser should always catch the error, but someone reported it doesn't
catch this error on TLS cert issues:

```
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/falso/virtualenv/limnoria/lib/python3.8/site-packages/supybot/plugins/RSS/plugin.py", line 86, in newf
    f(*args, **kwargs)
  File "/home/falso/virtualenv/limnoria/lib/python3.8/site-packages/supybot/plugins/RSS/plugin.py", line 351, in update_feeds
    self.update_feed_if_needed(feed)
  File "/home/falso/virtualenv/limnoria/lib/python3.8/site-packages/supybot/plugins/RSS/plugin.py", line 337, in update_feed_if_needed
    self.update_feed(feed)
  File "/home/falso/virtualenv/limnoria/lib/python3.8/site-packages/supybot/plugins/RSS/plugin.py", line 311, in update_feed
    d = feedparser.parse(feed.url, etag=feed.etag,
  File "/home/falso/virtualenv/limnoria/lib/python3.8/site-packages/feedparser/api.py", line 214, in parse
    data = _open_resource(url_file_stream_or_string, etag, modified, agent, referrer, handlers, request_headers, result)
  File "/home/falso/virtualenv/limnoria/lib/python3.8/site-packages/feedparser/api.py", line 114, in _open_resource
    return http.get(url_file_stream_or_string, etag, modified, agent, referrer, handlers, request_headers, result)
  File "/home/falso/virtualenv/limnoria/lib/python3.8/site-packages/feedparser/http.py", line 158, in get
    f = opener.open(request)
  File "/usr/lib/python3.8/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/usr/lib/python3.8/urllib/request.py", line 542, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 1393, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "/usr/lib/python3.8/urllib/request.py", line 1354, in do_open
    r = h.getresponse()
  File "/usr/lib/python3.8/http/client.py", line 1347, in getresponse
    response.begin()
  File "/usr/lib/python3.8/http/client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.8/http/client.py", line 268, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib/python3.8/socket.py", line 669, in readinto
    return self._sock.recv_into(b)
  File "/usr/lib/python3.8/ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/lib/python3.8/ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
```

So let's catch the error just in case, so it doesn't block all other
feeds.
2021-05-28 18:48:35 +02:00
Valentin Lorentz
3415cd08a1 RSS: Add test checking exception from a feed doesn't affect other feeds. 2021-05-28 18:38:06 +02:00
Valentin Lorentz
7c68b2cb53 RSS: Fix crash in @rss list 2021-05-28 17:56:59 +02:00
Valentin Lorentz
c3f39fc93b callbacks, Misc, Relay: Fix when the message prefix is just a nick
<user> and <host> are optional in https://datatracker.ietf.org/doc/html/rfc1459#section-2.3.1

Closes GH-1451.
2021-05-26 17:50:29 +02:00
Valentin Lorentz
e59e0f6908 irclib: Fix target computation
It mistakenly used the bot's nick as target when the message is in private,
so 'more' after a private message always answered the user did not send
a command before (because said command was attributed to the bot)
2021-05-26 00:30:27 +02:00
Valentin Lorentz
710d16f301 Admin: Fix python 3.4 support. 2021-05-25 19:24:21 +02:00
Valentin Lorentz
fd97f78f93 Admin: Fix @acmd 2021-05-25 09:22:24 +02:00
Valentin Lorentz
742f4f825d Add the option to disable password login.
Actually resolves GH-1140, finally.
2021-05-23 15:33:38 +02:00
Valentin Lorentz
14e637f4af SedRegex: Fix NameError in config setup 2021-05-22 18:51:35 +02:00
Valentin Lorentz
fb16e8b6c2 Network: Fix IPv6 parsing 2021-05-22 18:51:22 +02:00
Valentin Lorentz
7af8918f41 Channel: Fix Nameerror in @alert.
Closes GH-1452
2021-05-17 18:24:37 +02:00
Valentin Lorentz
e3fce56800 Relay: Don't relay QUIT/NICK if the sender isn't in the relayed channel. 2021-05-03 20:02:33 +02:00
Valentin Lorentz
ca369afe59 Relay: Send the right network in the display name (was dest instead of source) 2021-05-02 18:34:49 +02:00
Valentin Lorentz
fc2e34956e Relay: Implement +draft/display-name specification.
https://github.com/ircv3/ircv3-specifications/pull/452
2021-05-02 17:14:20 +02:00
Valentin Lorentz
97a7aa304e RSS: Make @remove completely clean up feeds 2021-05-01 14:29:09 +02:00
Valentin Lorentz
556bd788b5 RSS: Default to setting announces per channel+network, instead of just per channel
The default behavior was to announce feeds on all channels with the same name,
which is rarely what was expected.
Instead, this limits it to the current network.
2021-05-01 13:31:34 +02:00
Valentin Lorentz
435f8de73a RSS: Fix bug in @remove that prevented it from fully deleting aliased feeds. 2021-05-01 13:27:56 +02:00
Valentin Lorentz
e96633c1e3 RSS: Forbid dots in feed names.
They confuse the registry
2021-04-28 20:04:58 +02:00
David Macek
3d21c7cbcb Services: Keep per-network state separate
Until now, only `waitingJoins` was stored separately per network, while
`channels`, `sentGhost` and `identified` had one common value per plugin
instance.  Instead of making everything a dictionary indexed by network
name like `waitingJoins`, let's bundle all the state together in a class
and store *its* instances in such a dictionary.

This fixes at least one race condition, for which a test case was added.
Even with `noJoinsUntilIdentified` set, the bot would let joins through
as long as *any* one network has already finished identifying.
2021-04-27 19:52:58 +02:00
David Macek
8a4e8c2a37 Services: Reset configured passwords in tests
I didn't observe any error with the current set of tests but adding
another one that used "services password" caused oen of these tests
to fail.  Given that tests shouldn't leave traces in global state,
let's reset the configured passwords in finally blocks.
2021-04-24 21:13:53 +02:00
David Macek
abac8307ac Admin: Merge tests with the same name into one 2021-04-24 21:03:13 +02:00
David Macek
4d2efc65ef Remove some unused names 2021-04-24 21:01:40 +02:00
David Macek
e740953068 Fix some typos 2021-04-24 21:01:07 +02:00
Valentin Lorentz
fec6959acb all plugins: regenerate READMEs 2021-04-22 00:29:15 +02:00
Valentin Lorentz
c7d85e73d7 httpserver, Fediverse: show an error message on 404 2021-04-18 16:25:37 +02:00
Valentin Lorentz
a209b73248 Fediverse: Remove duplicate documentation 2021-04-18 15:36:18 +02:00
Valentin Lorentz
82fbfcffa4 all plugins: regenerate READMEs 2021-04-17 20:09:33 +02:00
Valentin Lorentz
b0cdf474a8 Fediverse: Move Secure Fetch documentation to the 'Usage' section 2021-04-17 20:08:33 +02:00
Valentin Lorentz
3c1c4a69e9 callbacks: Make snarfers' output paginatable with @more
by moving the 'smart' reply() method from NestedCommandsIrcProxy
to ReplyIrcProxy.

There is no reason only commands should have a paginated output
and not snarfers defined in PluginRegexp.
2021-04-16 23:38:44 +02:00
Valentin Lorentz
cd02444f87 supybot-plugin-doc: Add labels for all command and config variables
So they can be referenced from elsewhere in the doc.
2021-04-06 00:33:07 +02:00
Valentin Lorentz
66ba7cb020 Plugin: Only show the first paragraph; as the whole help can be very long. 2021-04-05 17:42:40 +02:00
Valentin Lorentz
833af36b08 all plugins: auto-generate READMEs
Starting with this commit, there should be no "original" text
in READMEs.
Instead, the entire text should be in docstrings, and READMEs
should be automatically generated from these docstrings.

Motivation:

* The same help is available both via IRC and in the README
  (although the README can be more detailed, as only the first
  paragraph will be shown on IRC)
* This will allow auto-generating plugin help on docs.limnoria.net
  using the same content as the README, as it's sourced from the
  docstrings

Additionally, this converts all READMEs from Markdown to ReST,
because the documentation already uses ReST, and other docstrings
in the codebase are in ReST for this reason.
2021-04-05 17:42:31 +02:00
Valentin Lorentz
113fc74ca1 Relay: Mention other plugins in the README. 2021-04-05 15:54:13 +02:00
Valentin Lorentz
21657f31ee Aka, Alias: Remove mentions of Alias in the Aka documentation, and explain Alias is deprecated 2021-04-05 15:00:02 +02:00
Valentin Lorentz
49eef1cd7d Misc: Make @help mention '@plugin help' when relevant. 2021-04-05 14:39:41 +02:00
Valentin Lorentz
24f20dcb86 Factoids, Services: Fix crash when imported by supybot-plugin-doc 2021-04-05 11:30:59 +02:00
Richard
911f875c1f PluginDownloader: Change default branch from master to HEAD
Many people are renaming their default branches from master to main or
something else (I just renamed mine). Using HEAD works no matter what
the default branch is named.
2021-04-01 20:10:17 +02:00
Valentin Lorentz
a003eff7a5 Config: Document network-specific variables in @list output 2021-04-01 20:10:17 +02:00
Valentin Lorentz
91a4083ae1 Misc: Clamp the number of lines returned by @more to the draft/multiline max-lines value, if any. 2021-04-01 20:10:17 +02:00
Valentin Lorentz
7cb3ae12da Misc: Make @more reply in batches when possible. 2021-04-01 20:10:17 +02:00
Valentin Lorentz
f390ade16d Anonymous: Add CLIENTTAGDENY test 2021-03-18 20:28:15 +01:00
Valentin Lorentz
ac0d7952a7 Anonymous: Add @react command
Gated behind supybot.protocols.irc.experimentalExtensions, as usual.

Spec: https://ircv3.net/specs/client-tags/react
2021-03-18 20:20:09 +01:00
Valentin Lorentz
544f137c64 Anonymous: Simplify/modernize @internationalizeDocstring and var setting in test. 2021-03-18 19:56:30 +01:00
Valentin Lorentz
7861040c37 Merge branch 'logtoirc' into testing 2021-03-17 21:22:29 +01:00
Valentin Lorentz
f1a5ab4866 String: Add unicodename and unicodesearch commands. 2021-03-11 22:49:13 +01:00
Valentin Lorentz
54342765cd LogToIrc: Make variables channel- and network-specific when relevant 2021-03-11 20:20:53 +01:00
Valentin Lorentz
7359ddce90 LogToIrc: better error handling 2021-03-11 00:40:43 +01:00
Valentin Lorentz
f0b4332908 LogToIrc: Update __init__/die signatures. 2021-03-11 00:40:43 +01:00
Valentin Lorentz
6d880c9a6f LogToIrc: Move IrcHandler to its own module, it shouldn't be reloaded. 2021-03-11 00:40:43 +01:00
Valentin Lorentz
436277a9ed LogToIrc: Run 2to3 2021-03-11 00:40:43 +01:00
Valentin Lorentz
e9ef8b22c0 LogToIrc: Split into modules, like modern plugins 2021-03-11 00:40:43 +01:00
Valentin Lorentz
d08dd24e43 LogToIrc: Resurect from from before the Darcs migration.
Last commit: da614f5561
2021-03-10 22:24:12 +01:00
Valentin Lorentz
c0527b6859 String: update docstrings of ord/chr, we're using unicode now 2021-03-10 22:19:35 +01:00
Valentin Lorentz
ce03729f20 ShrinkUrl: Improve error messages when opening the database. 2021-03-09 23:13:16 +01:00
Valentin Lorentz
36800ed4bc ShrinkUrl: Fix tinyurl.com test 2021-03-09 23:12:54 +01:00
Valentin Lorentz
4aca6e3d5a Add support for receiving commands from draft/multiline batches. 2021-03-04 21:34:25 +01:00
Valentin Lorentz
975a9101f4 Services: Fix conditional on supybot.protocols.irc.experimentalExtensions
It was always true-ish because we tested the variable itself instead
of its value.
2021-03-04 21:30:07 +01:00
Valentin Lorentz
8b497af30b Services: Add support for REGISTER responses in nested batches. 2021-03-04 18:48:15 +01:00
Valentin Lorentz
78dc45e99e Aka: eliminate race condition in tests?
Sometimes (very rarely), the test errors with:

```
======================================================================
FAIL: testHistsearch (Aka.test.AkaChannelTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/supybot/test.py", line 214, in runTest
    originalRunTest()
  File "/usr/lib/python3/dist-packages/supybot/plugins/Aka/test.py", line 67, in testHistsearch
    self.assertResponse('histsearch .*', '@echo foo')
  File "/usr/lib/python3/dist-packages/supybot/test.py", line 402, in assertResponse
    self.assertEqual(m.args[1], expectedResponse,
AssertionError: '@aka add histsearch "last --from [cif true[80 chars]"]]"' != '@echo foo'
- @aka add histsearch "last --from [cif true \"echo test\" \"echo test\"] --regexp [concat \"m/$1/\" [re s/g// \"@2\"]]"
+ @echo foo
 : '@echo foo' != '@aka add histsearch "last --from [cif true \\"echo test\\" \\"echo test\\"] --regexp [concat \\"m/$1/\\" [re s/g// \\"@2\\"]]"'
```

ie. histsearch returns the 'aka add' message instead of the 'echo foo'
one.

My guess is that if they happen too closely to each other, they get
added to the history in the wrong order (how? it's not threaded)

So this commit works around the issue by making the regexp unambiguous.
2021-02-21 00:18:03 +01:00
Valentin Lorentz
85549bf0c3 Services: Fix typo in docstring 2021-01-30 19:41:26 +01:00