Commit Graph

11528 Commits

Author SHA1 Message Date
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
f390ade16d Anonymous: Add CLIENTTAGDENY test 2021-03-18 20:28:15 +01:00
Valentin Lorentz
ac0d7952a7 Anonymous: Add @react command
Gated behind supybot.protocols.irc.experimentalExtensions, as usual.

Spec: https://ircv3.net/specs/client-tags/react
2021-03-18 20:20:09 +01: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
544f137c64 Anonymous: Simplify/modernize @internationalizeDocstring and var setting in test. 2021-03-18 19:56:30 +01:00
Valentin Lorentz
7861040c37 Merge branch 'logtoirc' into testing 2021-03-17 21:22:29 +01:00
Valentin Lorentz
2990fcd302 README+setup: Update supported Python versions 2021-03-13 13:15:41 +01:00
Valentin Lorentz
f1a5ab4866 String: Add unicodename and unicodesearch commands. 2021-03-11 22:49:13 +01:00
Valentin Lorentz
54342765cd LogToIrc: Make variables channel- and network-specific when relevant 2021-03-11 20:20:53 +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
7359ddce90 LogToIrc: better error handling 2021-03-11 00:40:43 +01:00
Valentin Lorentz
f0b4332908 LogToIrc: Update __init__/die signatures. 2021-03-11 00:40:43 +01:00
Valentin Lorentz
6d880c9a6f LogToIrc: Move IrcHandler to its own module, it shouldn't be reloaded. 2021-03-11 00:40:43 +01:00
Valentin Lorentz
436277a9ed LogToIrc: Run 2to3 2021-03-11 00:40:43 +01:00
Valentin Lorentz
e9ef8b22c0 LogToIrc: Split into modules, like modern plugins 2021-03-11 00:40:43 +01:00
Valentin Lorentz
d08dd24e43 LogToIrc: Resurect from from before the Darcs migration.
Last commit: da614f5561
2021-03-10 22:24:12 +01:00
Valentin Lorentz
c0527b6859 String: update docstrings of ord/chr, we're using unicode now 2021-03-10 22:19:35 +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
ce03729f20 ShrinkUrl: Improve error messages when opening the database. 2021-03-09 23:13:16 +01:00
Valentin Lorentz
36800ed4bc ShrinkUrl: Fix tinyurl.com test 2021-03-09 23:12:54 +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
Valentin Lorentz
f98542e884 Add testReplyInstant
I'm going to mess with instant replies to add support for multiline,
so it's good to have a safety net.
2021-03-05 21:11:43 +01:00
Valentin Lorentz
4aca6e3d5a Add support for receiving commands from draft/multiline batches. 2021-03-04 21:34:25 +01:00
Valentin Lorentz
975a9101f4 Services: Fix conditional on supybot.protocols.irc.experimentalExtensions
It was always true-ish because we tested the variable itself instead
of its value.
2021-03-04 21:30:07 +01:00
Valentin Lorentz
f8c5221efd do43x: add the current nick to the list of tried nicks.
The original nick was never added to the list...
2021-03-04 21:29:23 +01:00
Valentin Lorentz
af5364b0dc .travis.yml: Disable optional dependencies on py3.6, python-cryptography no longer supports it. 2021-03-04 20:33:35 +01:00
Valentin Lorentz
de9b518e5c .travis.yml: try to fix irctest run 2021-03-04 20:09:37 +01:00
Valentin Lorentz
8b497af30b Services: Add support for REGISTER responses in nested batches. 2021-03-04 18:48:15 +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
78dc45e99e Aka: eliminate race condition in tests?
Sometimes (very rarely), the test errors with:

```
======================================================================
FAIL: testHistsearch (Aka.test.AkaChannelTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/supybot/test.py", line 214, in runTest
    originalRunTest()
  File "/usr/lib/python3/dist-packages/supybot/plugins/Aka/test.py", line 67, in testHistsearch
    self.assertResponse('histsearch .*', '@echo foo')
  File "/usr/lib/python3/dist-packages/supybot/test.py", line 402, in assertResponse
    self.assertEqual(m.args[1], expectedResponse,
AssertionError: '@aka add histsearch "last --from [cif true[80 chars]"]]"' != '@echo foo'
- @aka add histsearch "last --from [cif true \"echo test\" \"echo test\"] --regexp [concat \"m/$1/\" [re s/g// \"@2\"]]"
+ @echo foo
 : '@echo foo' != '@aka add histsearch "last --from [cif true \\"echo test\\" \\"echo test\\"] --regexp [concat \\"m/$1/\\" [re s/g// \\"@2\\"]]"'
```

ie. histsearch returns the 'aka add' message instead of the 'echo foo'
one.

My guess is that if they happen too closely to each other, they get
added to the history in the wrong order (how? it's not threaded)

So this commit works around the issue by making the regexp unambiguous.
2021-02-21 00:18:03 +01:00
Valentin Lorentz
85549bf0c3 Services: Fix typo in docstring 2021-01-30 19:41:26 +01:00
Valentin Lorentz
18baff976a .travis.yml: Add use releases for python 3.8 and 3.9 2021-01-27 18:19:23 +01:00
Valentin Lorentz
c016ed5bfd Services: Add support for batches as reply to REGISTER/VERIFY.
Oragono uses them.
2021-01-25 22:03:08 +01:00
Valentin Lorentz
1c6c1cb16a Services: Add initial implementation of the @register and @verify commands.
Using this early draft specification:
https://gist.github.com/edk0/bf3b50fc219fd1bed1aa15d98bfb6495
2021-01-25 21:57:12 +01:00
Valentin Lorentz
e54751f9c9 Make the email regexp less strict.
The former one disallowed too many valid address, eg. those containing
quotes or square brackets.
2021-01-25 19:49:08 +01:00
Valentin Lorentz
7110b8f74e Relay: Set msg.channel before passing it to _sendToOthers.
_sendToOthers expects msg.channel to be 'in otherIrc.state.channels',
but IrcMsg objects don't have their 'channel' attribute set until they
are passed through irclib, so it was left unset, which means messages
were never sent at all.

Regression introduced in c1ae3f5c81.
2021-01-15 21:25:02 +01:00
Valentin Lorentz
aceb7baeb2 .travis.yml: Allow failures for pypy3 + opt deps.
'cryptography' can't be installed because of errors thrown by gcc.
2021-01-12 00:55:48 +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
ba77de0946 Try all IP addresses of a hostname.
Fixes a regression in ecc2c32950 that caused
Socket.py to ignore the IP address entirely after computing it, and
to call getSocket() and connect() with the hostname instead.
2020-12-05 14:26:52 +01:00
Valentin Lorentz
771c05c666 irclib: Fix test failure
FAIL: testMoreIsCaseInsensitive (Misc.test.MiscTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File /home/travis/virtualenv/python3.8-dev/lib/python3.8/site-packages/supybot/test.py, line 214, in runTest
    originalRunTest()
  File ./plugins/Misc/test.py, line 260, in testMoreIsCaseInsensitive
    self.assertNotError('more %s' % nick.upper())
  File /home/travis/virtualenv/python3.8-dev/lib/python3.8/site-packages/supybot/test.py, line 355, in assertNotError
    m = self._feedMsg(query, **kwargs)
  File /home/travis/virtualenv/python3.8-dev/lib/python3.8/site-packages/supybot/test.py, line 526, in _feedMsg
    response = self.irc.takeMsg()
  File /home/travis/virtualenv/python3.8-dev/lib/python3.8/site-packages/supybot/log.py, line 368, in m
    return f(self, *args, **kwargs)
  File /home/travis/virtualenv/python3.8-dev/lib/python3.8/site-packages/supybot/irclib.py, line 1308, in takeMsg
    assert not msg.tagged('emulatedEcho')
AssertionError

I don't understand why it's happening or why it's only that specific test,
but there we go.
2020-11-10 09:47:36 +01:00
Valentin Lorentz
81a7530577 Network: add @capabilities command. 2020-11-09 21:45:01 +01:00
Valentin Lorentz
c062787436 irclib: use a dedicated tag to detect emulated echo-messages, instead of receivedAt.
Plugins implementing inFilter do not set receivedAt, so incoming messages
rewritten by inFilter would be detected as echo messages, and ignored
by most plugins.
2020-11-04 11:32:20 +01:00
Valentin Lorentz
903eceebda Simplify checkIgnored code from previous commit 2020-11-04 11:32:20 +01:00
Lars Kellogg-Stedman
d24130f46d
resolve warnings about 'is not' and integer comparisons (#1435)
running supybot-adduser (or supybot-reset-password) with a recent
python would result in the warning:

> ```
> /usr/local/bin/supybot-adduser:59: SyntaxWarning: "is not" with a literal. Did you mean "!="?
> if len(args) is not 1:
> ```

This commits corrects the syntax.
`
2020-10-29 12:22:34 -07:00
Valentin Lorentz
76b5a42428 supybot.defaultIgnore shouldn't ignore registered users.
Even if they are not trusted. This fixes a regression in
97016b9c55.

This happens because 'user._checkCapability' raises a KeyError
when the user has neither this cap or the anticap; which was mistakenly
caught here by the 'except KeyError' expecting to catch non-existing
users.
(And that why 'try' blocks should be limited to as few lines as possible.)
2020-10-26 00:19:57 +01:00
Valentin Lorentz
160bcc8b6b Revert "irclib: Fill the nick and prefix of simulated echo messages."
This reverts commit 1fe414764c.

I initially wrote that commit so that plugins with echoMessage=True can
get the nick/prefix from the message (eg. the SkypeRelay plugin in my
personal repo).
Unfortunately, this breaks any test that does equality comparison on
between the result of getMsg()/takeMsg() and an IrcMsg object they
crafted themselves.

Additionally, the filled in nick and prefix might be inaccurate if the
bot changes nick/host at the same time. So instead plugins should check
for the None value.

(Also, editing IrcMsgs on the fly like this isn't great, and the commit
forgot to reset the `_str` attribute.)
2020-10-22 20:04:23 +02:00
James Lu
5ee63ebe96 SedRegex: test "nick, " prefix for explicit reference as well as "nick: " 2020-10-18 13:44:05 -07:00
James Lu
6c138d66ba SedRegex: follow config preference for strictRfc checking
Also add some tests to check that nicks containing the sed separator character are handled correctly.
2020-10-18 13:44:05 -07:00