Commit Graph

109 Commits

Author SHA1 Message Date
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
Valentin Lorentz
b405f998a5 NickAuth: Add support for account-tag (not tested). 2015-05-15 20:46:18 +02: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
nyuszika7h
8729fee015 Fix typo 2014-08-02 13:47:19 +02:00
nyuszika7h
e185416987 Fix tests 2014-08-02 13:45:41 +02:00
Valentin Lorentz
c23f25545f Fix core tests for Python 3 (actually imported + fixes). 2013-08-10 15:18:04 +02:00
Valentin Lorentz
3dba9088b0 Merge remote-tracking branch 'supybot/master' into testing
Conflicts:
	INSTALL
	plugins/ChannelLogger/README.txt
	plugins/ChannelStats/README.txt
	plugins/Google/plugin.py
	plugins/Google/test.py
	plugins/Plugin/test.py
	plugins/Web/test.py
	setup.py
	src/callbacks.py
	src/ircdb.py
	src/irclib.py
	src/utils/str.py
	test/test_irclib.py
2013-01-01 21:11:24 +01:00
Valentin Lorentz
79eeb8eb95 Revert "irclib: Apply changes to supybot.protocols.irc.maxHistoryLength immediately."
This reverts commit 1d2eefe880.

IrcState instances are created more than five times a second! Imagine how much
memory is used (hint: 300MB five minutes after startup).
We should first try to reduce this amount.
2012-12-27 16:06:01 +00:00
Valentin Lorentz
1d2eefe880 irclib: Apply changes to supybot.protocols.irc.maxHistoryLength immediately. 2012-12-27 12:24:24 +00:00
Valentin Lorentz
6b7db2e9f1 test_irclib: Make use of context for maxHistoryLength. 2012-12-27 11:05:04 +00:00