Commit Graph

3988 Commits

Author SHA1 Message Date
Valentin Lorentz
a5cd870bd2 irclib: Refactor hostmaskPatternEqual to expose compileHostmaskPattern.
This clarifies the code a bit.

And I want to store compiled patterns in ircdb.User in a future
commit, so they can outlive the LRU cache.
2021-05-27 21:36:43 +02:00
Valentin Lorentz
711db72ad0 Socket: Fix crash non-TLS connections when using a SOCKS proxy 2021-05-27 01:08:33 +02:00
Valentin Lorentz
3bedc86479 Socket: Disable resolution when using a SOCKS proxy
1. Avoids leaking DNS queries
2. necessary for onion services
2021-05-27 00:08:02 +02:00
Valentin Lorentz
cca1156b90 drivers: Log SOCKS proxy on connecting 2021-05-26 23:43:23 +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
fa3707ed66 src/conf.py: add :port to explanation of networks.X.socksproxy 2021-05-25 18:58:35 +02:00
Valentin Lorentz
1455a83391 Merge branch 'nopassword' into testing 2021-05-25 00:12:36 +02:00
Valentin Lorentz
d91303271d ircdb: Fix 'IrcUser.nicks' on non-lowercase network names
This dict was filled with IrcString keys, which is hashed
as lowercase, so when queried with a non-lowercase string,
the key would not be found, and lead to very confusing errors.
2021-05-24 17:21:57 +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
8559ea9848 httpserver: Fix pointless tracebacks
because doGet does not accept the 'form' argument
2021-05-17 18:24:21 +02:00
Valentin Lorentz
db99332079 callback: Fix AssertionError when action is given with implicit noLengthCheck 2021-05-07 20:10:57 +02:00
Valentin Lorentz
177c20267c irclib: Fix crash caused by 4d2efc65ef.
dynamicScope inspects the stack looking for this variable, so we need to keep it.
2021-04-24 21:21:57 +02:00
David Macek
151fcf8caf Don't throttle when delay is exactly equal
If throttle time is set to 0.0 (e.g. in tests) and the reported time
since last dequeue is also 0.0 (maybe because the timer resolution is
too low), takeMsg would throttle.  This would make tests fail because
they expect messages immediately.

This issue was observed on Windows 10 20H2 with both a mingw-w64 Python
v3.8.9 from MSYS2 and several version of official Python v3.x.
Confirmed at least as far back as
aa98d987a7.

Since it's a non-integer comparison, the change shouldn't have any
observable effect in normal operation.
2021-04-24 21:04:42 +02:00
David Macek
dce969e4b9 tests: Pass setUp arguments
ChannelPluginTestCase#setUp accepts the same parameters as its
super-method PluginTestCase#setUp, but it didn't pass the arguments down
the line.  Now it does.
2021-04-24 21:03:48 +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
c7d85e73d7 httpserver, Fediverse: show an error message on 404 2021-04-18 16:25:37 +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
24ca278b93 Reorganize the kwargs of _sendReply
I think it's more readable and modular this way
2021-04-16 23:11:02 +02:00
Valentin Lorentz
ab3dbcfecd Fix computation of message overhead in multiline batches. 2021-04-16 23:09:01 +02:00
Valentin Lorentz
6b1460e160 Log loading times for each plugin
It makes it easier to debug long startup times.
2021-04-11 16:35:42 +02:00
Valentin Lorentz
fd873fa0a5 httpserver: Don't serve_forever when documenting
1. it binds the port, which is useless while documenting
2. in some circumstances, it prevents supybot-plugin-doc from exiting
   (because the server threads are still running)
2021-04-11 13:24:10 +02:00
Valentin Lorentz
9869136289 src/setup: Add support for ReST readmes by default 2021-04-11 10:38:05 +02:00
Valentin Lorentz
4fc6580a09 callbacks: Document replySuccess() and error() 2021-04-05 22:47:44 +02:00
Valentin Lorentz
f11684a1cf callbacks: Add/improve method docstrings 2021-04-05 20:34:49 +02:00
Valentin Lorentz
9323302704 Socket: Recover from socks.GeneralProxyError exceptions. 2021-04-05 13:41:29 +02:00
Valentin Lorentz
c28d517d6f irclib: Copy messages before altering them at all
Fixes a bug triggered by Relay when it relays to a network that supports
labeled-response and an other that doesn't
2021-04-02 20:54:21 +02:00
Valentin Lorentz
b030a7bb76 callbacks: Fix py 3.4 support 2021-04-01 20:10:17 +02:00
Valentin Lorentz
d452a7051c callbacks: Don't write nick prefixes in the middle of multiline messages. 2021-04-01 20:10:17 +02:00
Valentin Lorentz
41c5589bea utils.str: Rely only on the documented methods of textwrap.TextWrapper.
'_split_chunks()' should be fine, but '_wrap_chunks()' is the only one explicitly
documented as overridable, so it's probably safer to use.
2021-04-01 20:10:17 +02:00
Valentin Lorentz
bbc2e9de0d irclib: 'lift' message tags to the batch when sending a multiline batch 2021-04-01 20:10:17 +02:00
Valentin Lorentz
92399bb6a7 drivers: Don't strip all whitespaces before parsing messages.
They matter in multiline messages, and there isn't much point to
stripping them anyway.
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
bf90a7c94d callbacks: Make reply() send multiline batches when supybot.reply.mores.instant > 1 2021-04-01 20:10:17 +02:00
Valentin Lorentz
d5d22985f5 irclib: Remove special-casing of the last instant message in _sendReply
There is no reason for it to be special; and this special-casing would be
annoying when we add support for outgoing multiline batches.
2021-04-01 20:10:17 +02:00
Valentin Lorentz
de29218bdb irclib: Make NestedCommandsIrcProxy._replyOverhead count in bytes instead of chars
It was, once again, a bug to count characters, because they
might contain multi-byte characters, and truncation happens
after the 512th byte.
2021-04-01 20:10:17 +02:00
Valentin Lorentz
8a3efe4379 irclib: Split _sendReply from NestedCommandsIrcProxy.reply
This function was getting uncomfortably big.
2021-04-01 20:10:17 +02:00
Valentin Lorentz
567618392f Add tests + fix bugs 2021-04-01 20:10:17 +02:00
Valentin Lorentz
99a6a7cde9 raise exceptions instead of logging, so we get a helpful traceback 2021-04-01 20:10:16 +02:00
Valentin Lorentz
c7939d3eb5 [wip] typo 2021-04-01 20:10:16 +02:00
Valentin Lorentz
26f2d9a292 [wip] idea for ordering batches in Irc.queue 2021-04-01 20:10:16 +02:00
Valentin Lorentz
e19436a4ba [wip] support outgoing batches 2021-04-01 20:10:16 +02:00
Valentin Lorentz
8b90884fa0 irclib: Copy messages before echoing them
Fixes a bug triggered by Relay when it relays between three or more networks.
2021-04-01 20:09:28 +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
0919b9f58a ircmsgs: Fix function docstrings. 2021-03-11 19:46:05 +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
9bfa1458ef httpserver: improve error handling when binding ports
1. better error messages
2. try binding other ports even if one fails
2021-03-09 23:14:23 +01:00
Valentin Lorentz
11e79e44c5 Remove the '(XX more messages)' when the next message is sent immediately after
It's pointless and looks stupid.

It will look even more stupid when we enable multiline, because the
suffixes will be in the middle of the concatenated message.
2021-03-05 21:19:02 +01:00