Commit Graph

79 Commits

Author SHA1 Message Date
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
74f86654b1 Remove fallbacks for old Python versions. 2022-01-01 18:11:36 +01: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
e19282a2d3 Actually parse weird hostmasks like RFC1459 recommends
Thanks to @Noisytoot for pointing out the RFC actually specific them
with this:

<user>       ::= <nonwhite> { <nonwhite> }
2021-07-14 23:43:11 +02:00
Valentin Lorentz
5baf87ddba ircutils: Improve robustness when faced with invalid hostmasks
eg. @ in nicks, which happened on pissnet earlier today.
2021-07-14 23:25:11 +02:00
Valentin Lorentz
43aada5b33 Store ignored hostmasks in Expiring HostmaskSet to prevent their pattern cache from expiring too soon
See e0fdcb67c0 for the rationale
(tl;dr: prevents triggering a degenerate case of the LRU cache when
there are over 1000 ignore masks)
2021-05-30 19:35:05 +02:00
Valentin Lorentz
86b1741fdd Fix nondeterministic test on Python < 3.7. 2021-05-27 22:36:27 +02:00
Valentin Lorentz
e0fdcb67c0 Store IrcUser hostmasks in HostmaskSet to prevent their pattern cache from expiring
When the number of hostmasks exceeds 1000 (the hardcoded size of
_patternCache and _hostmaskPatternEqualCache), this triggers
a pathological case in the LRU caches, that causes all calls to be
a cache miss.
This means that on every IRC message received, ircdb.checkIgnored triggers
a recompilation of *all* user hostmasks, which is very expensive
computationally.

This commit stores them in their own cache to prevent them from
expiring.
2021-05-27 22:15:52 +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
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
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
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
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
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
James Lu
1b0c2ab95a ircutils: add $network to standard substitutions 2016-03-14 20:30:11 -07:00
Valentin Lorentz
15d59d1153 Handle AUTHENTICATE line splitting. 2015-12-10 20:08:53 +01: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
cb6669015e Make ircutils.standardSubstitute accept None as irc and msg. (Preliminary for GH-1041.) 2015-02-07 08:15:42 +01:00
Valentin Lorentz
720b6d23eb Fix to global hostmask. Fix bug #SF3088559 and submitted as patch #SF3163843 2011-01-22 10:17:32 +01:00
James Vega
f7cedae9ad Update ircutils.standardSubstitute to use string.Template
In the process, deprecate utils.str.perlVariableSubstitute.

Since string.Template doesn't support callable values though, we also
sub-class IrcDict and override __getitem__ to call the value if it is
callable.

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-10-15 22:16:29 -04:00
James Vega
5c197471c6 Fix the tests for mircColor and sorted (Thanks dcraven) 2007-05-08 18:40:48 +00:00
James Vega
a3e4fc5b1d Change the modeline to use softtabstop instead of tabstop. 2006-02-11 15:52:51 +00:00
Jeremy Fincher
cede4a4a97 Fixed bug in ircutils.isNick, which allowed nicks to start with dashes. 2005-08-02 02:47:42 +00:00
James Vega
9971e991fe Fix the modelines. 2005-03-23 20:07:45 +00:00
Jeremy Fincher
895cd3e48e Resurrected the test suite with the new supybot-test program and RCS. 2005-01-23 19:42:25 +00:00
Jeremy Fincher
3d3b1498fe Changed copyright years on test files 2005-01-24 21:27:34 +00:00
Jeremy Fincher
8ca625d339 Initial import. 2005-01-19 13:14:38 +00:00
James Vega
dbfec8afb9 Add supybot module 2007-04-22 20:10:26 +00:00
Jeremy Fincher
3736f6d582 I wrote this to show someone an example of a test, but figured I'd commit it since it's written. 2005-01-04 03:46:55 +00:00
James Vega
23397b44b4 Remove #! lines. 2004-09-20 15:25:47 +00:00
Jeremy Fincher
59d084abef Added a test for isnick always rejecting spaces in nick. 2004-09-13 00:42:10 +00:00
Jeremy Fincher
fbb348b6e7 Copyright updates. Again, more is left to be done, but this is my part. 2004-08-23 13:14:06 +00:00
Jeremy Fincher
127e9f3ccf Fixed a bug in stripFormatting. 2004-08-08 02:07:11 +00:00
James Vega
115a3a88ec move isCtcp to ircmsgs and fix up a couple things with Infobot 2004-07-31 03:45:25 +00:00
Jeremy Fincher
f9c61271ea w00, less path mungingEXCLAIMEXCLAIM 2004-07-24 05:18:26 +00:00
Jeremy Fincher
a4386a6798 Updated to make mircColors an IrcDict, and clean up the limplementation of mircColor function. 2004-07-22 22:30:24 +00:00
Jeremy Fincher
c064aa1155 Let's make sure to zfill those digits before we mircColor. 2004-07-22 20:57:46 +00:00
James Vega
315810d08e yay! no more stray whitespace 2004-07-21 19:36:35 +00:00
Jeremy Fincher
2377a4a83c Automatically convert non-strings to strings with safeArgument. 2004-07-19 22:33:58 +00:00
Jeremy Fincher
8274d5dfb9 Fixed strictRfc appropriately. 2004-04-29 11:41:05 +00:00
James Vega
e87c31aea4 ircutils.strip{Bold,Reverse,Underline,Formatting} 2004-04-15 21:15:57 +00:00
James Vega
0027117e8c Fix some coloring/formatting bugs we had 2004-04-13 01:01:17 +00:00
James Vega
b2153c83fb unColor is now working. Added a colorstrip outfilter to Filter to close RFE
#863599
2004-04-09 03:59:12 +00:00