Commit Graph

1570 Commits

Author SHA1 Message Date
Valentin Lorentz
0284ed9ebd irclib: Don't error when 004 is missing umodes and chanmodes. 2020-07-05 19:45:08 +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
759fca5eba Switch names of TimeoutDict and ExpiringDict.
For consistency, as TimeoutQueue has guaranteed deletion after the timeout,
like the new TimeoutDict (ex-ExpiringDict).
2020-05-10 08:42:25 +02:00
Valentin Lorentz
d205a9b5f8 Fediverse: Use ExpiringDict instead of TimeoutDict for the cache, it guarantees expiry after the timeout. 2020-05-10 08:34:36 +02:00
Valentin Lorentz
43a8724d3a Don't strip spaces when parsing registry values.
It breaks plugins.Messageparser.listSeparator, and probably others.
2020-05-08 22:18:27 +02:00
Valentin Lorentz
0d89b2352b Add plugin load case-insensitivity test. 2020-05-08 11:58:12 +02:00
Valentin Lorentz
83a8afde16 Add experimental support for +draft/reply client capability on outgoing messages. 2020-05-07 21:17:55 +02:00
Valentin Lorentz
eb1e27e20b Add echo messages, either with the echo-message capability or simulated.
Plugin can opt in to getting echo messages by setting the class attribute
'echo_message = True' if they want to get echos.
This defaults to False in order not to break existing plugins, and because
they usually don't need it (there's outFilter for most cases).
2020-05-07 21:08:07 +02:00
Valentin Lorentz
2008f7b815 Exclude server_tags from truncation.
They have their own 8191 bytes.
2020-05-07 18:38:17 +02:00
Valentin Lorentz
da328b4985 Expire batches that never ended to avoid leaking memory. 2020-05-06 20:39:21 +02:00
Valentin Lorentz
cc0af4e790 Include start and end messages in a batch.
They may have useful server tags (especially when we start
supporting labeled-response).
2020-05-06 18:29:17 +02:00
Valentin Lorentz
fc4cc956ba Merge branch 'sts' into testing 2020-05-02 17:10:13 +02:00
Valentin Lorentz
8d377e4416 Fix non-deterministic test on python <= 3.6 2020-05-02 00:06:55 +02:00
Valentin Lorentz
01dcbf412b Fix edge case of server tags unescaping, when the backslash is followed by an 'invalid' char. 2020-05-01 23:46:34 +02:00
Valentin Lorentz
e92156711b Only spaces are token separators, not all whitespaces. 2020-05-01 23:44:38 +02:00
Valentin Lorentz
f4d5b866d9 tests: raw strings for better readability. 2020-05-01 23:37:59 +02:00
Valentin Lorentz
1854d86476 Add support for outputting server tags.
Will be useful when we start sending client tags.
2020-05-01 23:35:52 +02:00
Valentin Lorentz
22120ee862 Fix various issues with STS handling. 2020-05-01 19:46:19 +02:00
Valentin Lorentz
51ff013fcc Apply STS policies when connecting to a server. 2020-05-01 19:46:19 +02:00
Valentin Lorentz
ecc2c32950 Add support for storing STS policies.
If on an insecure connection: reconnect.
If on a secure connect: store it and do nothing else.

For now, stored STS policies are not read when connecting to an
insecure server.
2020-05-01 19:46:19 +02:00
Valentin Lorentz
45ff70907f [WIP] Start reworking Irc around a FSM.
To keep track of connection state instead of a complex implicit flow
between handling functions.
2020-05-01 19:43:27 +02:00
Valentin Lorentz
0b0da9716d callbacks: honor network-specificity of supybot.reply.whenAddressedBy.
A side-effect is that plugins should now pass 'irc' instead of 'irc.nick'
when they call 'callbacks.addressed()'.
2020-04-11 15:00:46 +02:00
Valentin Lorentz
9891b0fca4 Replace failUnless/failIf with assertTrue/assertFalse.
The old names are deprecated.
2020-01-26 11:14:18 +01:00
Valentin Lorentz
e7553dcca4 Add subcommand dispatching for CAP/FAIL/WARN/NOTE. 2020-01-23 14:25:10 +01:00
Valentin Lorentz
32d8d141ad Make irc.error do nothing is no string is given as argument.
Fixes c1d3bad64f, which crashed with:

```
ERROR 2020-01-18T01:34:07 Uncaught exception in NickAuth._callCommand:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/supybot/callbacks.py", line 1337, in _callCommand
    irc.errorNoCapability(cap)
  File "/usr/local/lib/python3.7/dist-packages/supybot/callbacks.py", line 544, in errorNoCapability
    raise Error()
supybot.callbacks.Error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/supybot/log.py", line 368, in m
    return f(self, *args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/supybot/callbacks.py", line 1359, in _callCommand
    irc.error(str(e))
  File "/usr/local/lib/python3.7/dist-packages/supybot/callbacks.py", line 1065, in error
    raise ArgumentError
supybot.callbacks.ArgumentError
```
2020-01-18 11:04:54 +01:00
Valentin Lorentz
fcb342cb2c test: Mock calls to time.sleep()
The tests now take 7 seconds instead of 30.
2019-12-15 20:20:42 +01:00
Valentin Lorentz
a8b6698849 Add config supybot.reply.format.list.maximumItems to limit the size of format('%L', ...). 2019-11-23 18:48:58 +01:00
James Lu
a4701b258c Plugin: accept author name in 'contributors' command 2019-11-16 11:41:13 -08:00
James Lu
7854db7135 Better formatting in supybot.Author if some fields are missing 2019-11-16 11:41:13 -08:00
Valentin Lorentz
b2f6c3c83f test: Don't overwrite the main Schedule in the driver list.
Closes GH-1385.
2019-11-11 18:06:07 +01:00
Valentin Lorentz
9268356e97 Split 'CAP REQ' commands to not exceed 512 bytes. 2019-10-25 23:07:31 +02:00
Valentin Lorentz
573921c00f Merge branch 'netconf-and-ircmsgs-channel' into testing 2019-09-14 12:10:47 +02:00
Valentin Lorentz
f143e977d6 Interpret empty server tag values as missing tag values.
As required by https://ircv3.net/specs/extensions/message-tags
2019-09-08 14:47:05 +02:00
Valentin Lorentz
88524beada ChannelLogger + Karka + all DB plugins: Sanitize channel names when used in filenames. 2019-09-06 20:42:13 +02:00
Valentin Lorentz
0b5bd625eb Add test for simple registry value inheritance. 2019-08-25 00:07:29 +02:00
Valentin Lorentz
e878279e6a py2.6 compat for cac3de71b1. 2019-08-25 00:07:11 +02:00
Valentin Lorentz
cac3de71b1 Add test for escaping registry key names. 2019-08-24 23:37:47 +02:00
Valentin Lorentz
8bb31a54e7 Strip statusmsg chars in core to determine the actual channel.
Use msg.channel if relevant, otherwise strip them locally.
2019-08-24 14:52:59 +02:00
Valentin Lorentz
5b40b5136d Limit statusmsg prefix stripping to PRIVMSG and NOTICE. 2019-08-18 10:09:11 +02:00
Valentin Lorentz
7a7cdb9f05 Add a 'channel' attribute to IrcMsg objects.
It's nicer to use 'irc.channel' instead of 'irc.args[0]', and .channel
provides the actual channel name (stripped of the statusmsg prefix),
so it can be used by plugins when they want to use the actual channel
name.
2019-08-17 22:23:51 +02:00
Valentin Lorentz
d4cac026d4 Remove '+' from the default chantypes.
It's more likely to be a statusmsg than chantype.
2019-08-04 21:52:40 +02:00
Valentin Lorentz
696254ff1b Use irc.isChannel instead of ircutils.isChannel when possible.
It's aware of the network's 'chantypes'.
2019-08-04 21:52:40 +02:00
Valentin Lorentz
6d938e0999 Fix test for pypy 3. 2019-02-07 22:10:24 +01:00
Valentin Lorentz
233deee0d3 Fix previous commit for py2 and pypy. 2019-02-07 21:35:39 +01:00
Valentin Lorentz
969b9ed341 Make utils.python.collect_extra_debug_data support objects with __slots__. 2019-02-07 21:00:56 +01:00
Valentin Lorentz
7adc958dd6 Fix SyntaxWarnings on Python 3.8 2019-01-06 18:06:44 +01:00
Valentin Lorentz
a03a89730a Fix bugs in wrapping IRC messages. 2019-01-06 16:48:11 +01:00
Valentin Lorentz
93b0476751 Fix text wrapping when colors cross message boundaries. 2019-01-05 23:47:56 +01:00
James Lu
6f9deecbcf test_plugin_create: skip if supybot-plugin-create is not installed
This is often the case when tests are run automatically as part of a package build process (e.g. in Debian).

Reported by @unit193.
2018-06-25 14:04:45 -07:00
James Lu
11d4015f71 Fixes and tests to supybot-plugin-create; modernize the plugin template (#1340)
* supybot-plugin-create: compactify import statements in the template

* supybot-plugin-create: prefer importlib over imp on Python >= 3.4

The imp module is deprecated as of Python 3.4[1], with importlib being the successor. However, importlib is only available in Python 2.7+ and 3.1+, so we should still use a fallback.

[1]: https://docs.python.org/3.6/library/imp.html

* test: add test cases for supybot-plugin-create

* -plugin-create: fix errors when only a subset of args are given

* -plugin-create: rename --real-name to --author/-a

These days, working under a pseudonym or alias is not unheard of, so putting emphasis on real names feels somewhat out of place.

* -plugin-create: add -d as an alias to --desc for consistency
2018-06-20 17:18:46 +02:00