Commit Graph

122 Commits

Author SHA1 Message Date
Valentin Lorentz
985ca23f71 Add tests for nicksToHostmasks 2022-11-23 19:25:12 +01:00
Valentin Lorentz
314fad36eb Modernize tests
Thanks to https://pypi.org/project/teyit/
2022-11-20 19:33:23 +01:00
Valentin Lorentz
2c5dc405fc test: Revert generic 'The Limnoria Contributors' in copyright notices
I forgot to include these in 63eb6672ea

(This is fine because noone but me touched these files since the initial
change in db7ef3f025).
2022-10-24 23:41:26 +02:00
Valentin Lorentz
088d0f54dd irclib: Catch exception from outFilter, as with inFilter 2022-03-17 22:29:10 +01:00
Valentin Lorentz
ce7e4b754c Replace deprecated unittest function calls. 2021-11-08 21:29:59 +01:00
Valentin Lorentz
ee9f0dc1bf STS: When persisting STS keys, use the actual port instead of the one from the policy
'Servers MAY send this key to securely connected clients, but it will be ignored.'
-- https://ircv3.net/specs/extensions/sts\#the-port-key
2021-09-03 20:15:18 +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
747ef77106 Fix tests when pyxmpp2_scram is not installed. 2021-07-31 14:40:44 +02:00
Valentin Lorentz
ade5a02457 Fix/update SASL tests, broken by the previous commit. 2021-07-31 13:05:39 +02:00
Valentin Lorentz
8fe517f48a irclib: Fix previous commits so RPL_NAMREPLY actually works
Turns out irclib parses ISUPPORT PREFIX properly, so it's not just
a raw string; but I didn't test the change live...
2021-07-16 22:53:38 +02:00
Valentin Lorentz
45c7615f4a irclib: Properly populate nickToHostmasks on RPL_NAMREPLY
It used to set the nick instead of the hostmask as values...
2021-07-16 19:53:25 +02:00
Valentin Lorentz
d308329461 irclib: Fix support of power prefix chars in RPL_NAMREPLY
nickFromHostmask now (legitimately) complains when it's getting @ or !
at the beginning of a hostmask; so we need to strip them before passing
it to nickFromHostmask.

Then re-add them before calling c.addUser, because it uses them to
sort users in the right sets (ops/halfops/voices).

Additionally, this commit replaces the hardcoded set of prefix chars
(`@%+&~!`) with the one advertised in ISUPPORT when possible.
2021-07-16 19:50:13 +02:00
Valentin Lorentz
65ab65cbb1 irclib: Fix crashes when ERROR is part of a batch. 2021-06-20 23:59:51 +02:00
Valentin Lorentz
567618392f Add tests + fix bugs 2021-04-01 20:10:17 +02:00
Valentin Lorentz
d60cc5c92a irclib: add method getClientTagDenied
To allow plugins to check if they should send a tag or not.
2021-03-18 19:56:30 +01:00
Valentin Lorentz
cb7a395444 irclib: truncate outgoing messages to 512 bytes, not 512 chars 2021-03-11 19:02:55 +01:00
Valentin Lorentz
6f6dad8f7b Add proper support for nested batches. 2021-03-03 23:32:00 +01:00
Valentin Lorentz
9719bb799e irclib: Send the bot user mode when advertized by the server
It is enabld by default in order to be a good netizen,
but can be overridden by admins if needed.

References:
*
* https://github.com/ircv3/ircv3-specifications/pull/439
2021-02-28 11:11:29 +01:00
Valentin Lorentz
772ec8d6a9 When getting STS policy over insecure connection, reuse the exact same IP address
Otherwise, if some IP addresses don't work (eg. all odd ones), the bot will
consecutively fail because it can't connect, then connect + get STS + reconnect,
then fail again, then connect + get STS, etc.
2021-01-11 23:22:21 +01:00
Valentin Lorentz
5d80b2eec9 irclib: Fix crash when MOTD is sent again later in the connection.
This can happen with this ZNC module: https://wiki.znc.in/Missingmotd
or if a plugin sends a 'MOTD' command.
2020-09-19 17:08:52 +02:00
Valentin Lorentz
0a6bb49fe6 irclib: Fix crash on CAP NEW.
Turns out, it wasn't tested so it never worked...
2020-09-19 16:55:51 +02:00
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
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
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
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
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
9268356e97 Split 'CAP REQ' commands to not exceed 512 bytes. 2019-10-25 23:07:31 +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
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
7e98802809 Drop STARTTLS support, it complicates the connection initialization too much. 2018-01-24 09:27:39 +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
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
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