Commit Graph

1615 Commits

Author SHA1 Message Date
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
Valentin Lorentz
0d627c05b7 Do not break UTF-8 characters in long words. Closes GH-1333. 2018-04-14 22:31:30 +02:00
Valentin Lorentz
f26f098d82 supybot-wizard: Warn if run with ~/.local/bin as CWD. 2018-04-11 11:57:12 +02:00
Valentin Lorentz
2472e857c7 Fix test on Python 3. 2018-02-02 00:19:37 +01:00
Valentin Lorentz
39dacf6e5b Fix Python 2 support. 2018-02-01 23:21:18 +01:00
Valentin Lorentz
030ce5e6d4 Fix previous commit. 2018-02-01 22:37:24 +01:00
Valentin Lorentz
63a17f7491 Rewrite text wrapping to count line size in bytes instead of characters.
Also, fix shitty comparisons that were done in reverse.
2018-02-01 21:32:14 +01:00
Valentin Lorentz
7e98802809 Drop STARTTLS support, it complicates the connection initialization too much. 2018-01-24 09:27:39 +01:00
James Lu
37a42b0e3b ircutils: split ! and @ in hostmasks from the right
This fixes /names parsing when ! is a prefix character and userhost-in-names is enabled: previously, strings such as "!@user!ident@some.host" were incorrectly split into "" for nick and "@user!ident@some.host" for ident@host.
2017-12-17 04:21:35 -05:00
Valentin Lorentz
11bbc89c9d Properly handle multiple hosts in supybot.servers.http.hosts4.
See ebb48a4808 (which I reverted).
2017-10-28 09:50:12 +02:00
James Lu
22408ce413 Fix tests from last commit 2016-03-15 08:35:46 -07:00
James Lu
1b0c2ab95a ircutils: add $network to standard substitutions 2016-03-14 20:30:11 -07:00
Valentin Lorentz
a8be36051f Add tests for ircdb serialization. 2016-02-07 10:49:44 +01:00
Valentin Lorentz
30cb10e422 Add support for CAP NEW, including reauthentication. 2015-12-12 00:52:44 +01:00
Valentin Lorentz
8aff8170e4 Filter list of SASL mechanisms when provided (908 or IRCv3.2-style CAP LS). 2015-12-11 23:30:57 +01:00
Valentin Lorentz
932345fa48 Fix test cases if ecdsa is not available. 2015-12-11 11:10:48 +01:00
Valentin Lorentz
45c23a8f54 Try all possible SASL mechanisms instead of just one. 2015-12-11 10:56:05 +01:00
Valentin Lorentz
15d59d1153 Handle AUTHENTICATE line splitting. 2015-12-10 20:08:53 +01:00
Valentin Lorentz
3b78fd2424 Tag NICK messages with the channel as for QUIT messages. 2015-12-04 13:27:11 +01:00
Valentin Lorentz
d2749ea4d6 Add support for BATCH. 2015-12-04 01:37:23 +01:00
Valentin Lorentz
f880229d78 Tag QUIT messages with the list of channels the user was on. 2015-12-04 01:14:42 +01:00
Valentin Lorentz
c587900c6f Make normalizeWhitespace remove \r as well. 2015-08-30 15:44:07 +02:00
Valentin Lorentz
09cb8e977f supybot-test: Add a new level of verbosity, for showing only unexpected exceptions. 2015-08-29 23:02:20 +02:00
Valentin Lorentz
39df987274 Fix timezone handling of b338a2370. 2015-08-22 20:38:16 +02:00
Valentin Lorentz
b338a23708 core: Use IRCv3.2 extension server-time to fill IrcMsg.time, if available. 2015-08-22 20:11:46 +02:00
Valentin Lorentz
11c10bb3f1 Add attribute IrcMsg.time. 2015-08-22 18:36:47 +02:00
jacksonmj
8eb5d4f240 Add support for italics
New functions:
ircutils.italic to add
ircutils.stripItalic to remove

And remove italics in ircutils.stripFormatting.
2015-08-21 21:44:11 +00:00
Valentin Lorentz
0254d7b84d Add a decorator to retry tests that fail often. 2015-08-11 17:13:27 +02:00
Valentin Lorentz
c3a2c800f1 Remove need for 2to3. 2015-08-11 16:50:23 +02:00
Valentin Lorentz
17bf893437 Fix imports. 2015-08-09 09:21:12 +02:00
Valentin Lorentz
216c5d213f Replace sys.version_info[0] usages with minisix.PY{2,3}. 2015-08-09 00:23:03 +02:00
Valentin Lorentz
078eb9bad8 Fix Python 2 compatiblity. 2015-08-08 23:21:12 +02:00
Valentin Lorentz
be118c3338 Remove use of fix_dict fixer. 2015-08-08 23:08:49 +02:00
nyuszika7h
869c6ce30d Fix capability negotiation 2015-06-12 15:08:45 +02:00
Valentin Lorentz
9e645ed645 Fix non-determinism in tests (again). 2015-05-25 03:12:01 +02:00
Valentin Lorentz
154d8c60ac Fix syntax error. 2015-05-24 12:44:16 +02:00
Valentin Lorentz
05ad96d8ae Fix non-determinism. 2015-05-24 12:40:28 +02:00
Valentin Lorentz
e2b3b917e5 Use CAP LS. 2015-05-24 12:25:42 +02:00
Valentin Lorentz
a2004b7150 Improve order of connect messages. 2015-05-17 12:31:14 +02:00
Valentin Lorentz
b405f998a5 NickAuth: Add support for account-tag (not tested). 2015-05-15 20:46:18 +02:00
Valentin Lorentz
ba495f5719 Add support for message tags. 2015-05-15 18:08:50 +02:00
Valentin Lorentz
7031e47ebd Fix merge. 2015-05-15 14:43:57 +02:00
Valentin Lorentz
487f8c8af5 Merge remote-tracking branch 'supybot/master' into testing
Conflicts:
	.mailmap
	README
	docs/FAQ.rst
	plugins/Ctcp/plugin.py
	plugins/Misc/plugin.py
	plugins/Network/plugin.py
	plugins/QuoteGrabs/plugin.py
	plugins/RSS/README.txt
	plugins/Relay/plugin.py
	plugins/ShrinkUrl/config.py
	plugins/ShrinkUrl/plugin.py
	plugins/ShrinkUrl/test.py
	setup.py
	src/callbacks.py
	src/commands.py
	src/conf.py
	test/test_commands.py
2015-05-15 14:41:08 +02:00
Valentin Lorentz
a39a6d247d Fix previous commit 2015-05-14 07:46:18 +00:00
Valentin Lorentz
ded7dc8e6f Fix Python 2.6 compatibility of previous commit. 2015-05-14 07:33:26 +00:00
Valentin Lorentz
3f9118a1a6 utils.str.format: Add support for sets for %L + add test case. Closes GH-1104 2015-05-14 07:14:29 +00:00
James Lu
6d20183abf tests: Use internal mock from Python 3.3+ if available
Closes ProgVal/Limnoria#1088.
2015-04-26 22:49:02 -07:00
Valentin Lorentz
b0846f914e
Fix crash for commands with ambiguous getopts shortcuts and no docstring.
Signed-off-by: James McCoy <vega.james@gmail.com>
2015-03-26 02:00:43 -04:00
Valentin Lorentz
6f9960d7a4 Fix crash for commands with ambiguous getopts shortcuts and no docstring. 2015-03-03 08:55:29 +01:00
James McCoy
a8cd99f121 commands._getRe: Restore original args for any failure
String.re uses first('regexpMatcher', 'regexpReplacer').  If the args
provided to String.re are not a matcher and are longer than a single IRC
message (e.g., from a nested command), then regexpReplacer would never
be tried.  A too long error should be handled the same as running out of
args while trying to find a valid regexp.

Signed-off-by: James McCoy <vega.james@gmail.com>
2015-02-18 22:09:38 -05:00
Valentin Lorentz
cb6669015e Make ircutils.standardSubstitute accept None as irc and msg. (Preliminary for GH-1041.) 2015-02-07 08:15:42 +01:00
nyuszika7h
c565af7765 Update tests again 2015-01-19 18:14:51 +01:00
Valentin Lorentz
ccea98b428 Update tests. 2015-01-19 17:38:51 +01:00
nyuszika7h
037cc98cac Fix capability negotiation 2014-08-05 11:22:56 +02:00
Valentin Lorentz
3d4f6502d8 Fix previous commit. 2014-08-05 00:29:43 +02:00
Valentin Lorentz
0ec8c13911 Fix test. 2014-08-04 21:52:31 +02:00