Commit Graph

5634 Commits

Author SHA1 Message Date
James Lu
fa13c68ebc SedRegex: work around "nothing to repeat" errors on Python < 2.7.6
Source: https://stackoverflow.com/questions/3675144/regex-error-nothing-to-repeat and https://bugs.python.org/issue18647

From: 335fc6e3da
2020-01-01 21:55:58 -08:00
James Lu
1499141f09 Import SedRegex plugin as of 2a556a1b84
Co-authored-by: Michael Daniel Telatynski <postmaster@webdevguru.co.uk>
Co-authored-by: nyuszika7h <nyuszika7h@openmailbox.org>
2020-01-01 21:55:57 -08:00
Valentin Lorentz
12b6c9d60e Config: Sort output of @list. 2019-12-24 02:43:31 +01:00
Valentin Lorentz
8491d0b944 Web: Lower log level when title could not be found. 2019-12-15 18:43:51 +01:00
Valentin Lorentz
dc2068deca Web: Remove leading space if the prefix is empty. 2019-12-15 17:27:47 +01:00
Richard
143cd9d506 Services: Fix typo in doInvite() (#1394) 2019-12-13 11:01:48 -08:00
Valentin Lorentz
83114e5fbd src/callbacks.py: use network-specific values.
Closes GH-1393
2019-12-05 21:51:25 +01:00
Mattia Rizzolo
981a3b245a QuoteGrabs: fix SyntaxWarning (#1391)
SyntaxWarning: "is" with a literal. Did you mean "=="?

Signed-off-by: Mattia Rizzolo <mattia@mapreri.org>
2019-11-27 07:59:11 -08:00
Valentin Lorentz
1a1707420b Web: Add early returns on exception when snarfing titles.
Closes GH-1390.
2019-11-22 18:17:53 +01:00
James Lu
9291fbd4a0 All plugins: set Limnoria contributors as maintainer 2019-11-16 11:41:13 -08:00
James Lu
1858eaf59e Plugin: support showing __maintainer__ field in the 'author' command 2019-11-16 11:41:13 -08:00
James Lu
a4701b258c Plugin: accept author name in 'contributors' command 2019-11-16 11:41:13 -08:00
Valentin Lorentz
bace9cb6c0 MoobotFactoids: Fix support of commands sent in private.
Regression from c1ae3f5c81.
2019-11-15 21:24:31 +01:00
Valentin Lorentz
bc663b164c Nicer error message in getChannel/makeChannelFilename when channel is None. 2019-11-15 21:14:46 +01:00
Valentin Lorentz
f85287771d RSS: Register feed config in config.py instead of plugin.py.
So they are not dropped if plugin.py fails to load before
feedparser is not installed.

Closes GH-1387.
2019-11-11 19:42:34 +01:00
Valentin Lorentz
8001de6960 Scheduler: Use assertRegexp instead of assertNotRegexp in tests.
It avoids self negatives.
2019-11-11 18:06:59 +01:00
Valentin Lorentz
5718eafc07 Scheduler: Use default timeout for assertResponse.
Needed for slow/busy computers like Travis, apparently.
2019-11-11 15:29:20 +01:00
Valentin Lorentz
ad6671966c Scheduler: Use mocking to make tests faster.
40s -> less than 10s.
Also some timeout tweaks that might fix GH-1385.
2019-11-11 15:06:06 +01:00
Valentin Lorentz
1a69a7b892 Math: Fix test on Pypy. 2019-11-11 12:38:27 +01:00
Valentin Lorentz
78a50c81bd Math: Display a nicer error in case of MemoryError. 2019-11-11 12:12:10 +01:00
Valentin Lorentz
3848ae78de Math: Rewrite calc functions with a proper evaluator.
Instead of hacking around eval(), which everyone knows is a bad idea
even with prior expression sanitizing.
2019-11-09 15:49:31 +01:00
Valentin Lorentz
813f688858 Config: Add : prefix to network-specific values listed by 'config list'. 2019-11-02 18:50:20 +01:00
Valentin Lorentz
322923c957 Config: make 'config list' exclude pseudo-children of network-specific variables. 2019-11-02 18:49:10 +01:00
Valentin Lorentz
9e58b2c936 Owner: Fix @upkeep reply on recent Pypy versions.
Because their gc.collect() function returns None.
2019-11-01 22:21:51 +01:00
Rodrigo Nascimento Hernandez
7466058c8f Web: Catch more errors in getTitle. 2019-11-01 09:06:45 +01:00
Valentin Lorentz
3648751911 MoobotFactoids: Don't rely on unspecified order of sqlite3 results. Closes GH-1383. 2019-10-28 18:17:13 +01:00
Valentin Lorentz
cf954cf500 MoobotFactoids: Fix test to actually detect that sqlite3 is installed.
It works in the test suite because other plugins do the right import,
but we need to do it here as well if we want supybot-test to run on
this plugin alone.
2019-10-28 18:17:13 +01:00
James Lu
9eecedee93 Fill in author info for plugins missing it 2019-10-27 12:59:37 -07:00
James Lu
d3a2964705 Plugin: add missing substitution, check for supybot.authors.unknown explicitly 2019-10-19 12:02:14 -07:00
James Lu
35a64eca38 Plugin: update tests
I'm taking the liberty of adding myself to supybot.authors here.
2019-10-19 11:34:24 -07:00
James Lu
e3d89875ae Plugin: update plugin description in __init__.py
Also remove some outdated comments.
2019-10-19 11:27:39 -07:00
James Lu
75a96ffa17 Plugin: show individual contributions in 'contributors [nick]' as a list
Remove special handling of one word contributions as commands, which was never clearly documented and is prone to false positives.
2019-10-19 11:17:35 -07:00
James Lu
672652d780 Plugin: refactor the first half of 'contributors [nick]' 2019-10-19 11:10:42 -07:00
James Lu
65e3e18fe2 Plugin: simplify the 'contributors' command
- Remove author sorting; it's not obvious that this is being done anyways.
- Format author and contributors as separate sentences; conjunctions are messy for code and very language-specific.
2019-10-19 10:47:33 -07:00
James Lu
18f9a342b3 Throw out mungeEmail for supybot.Author
This has limited value these days, because 1) the email info for authors is most often in a public VCS already 2) it makes using the actual contact info harder.
2019-10-19 10:20:35 -07:00
Johannes Löthberg
27e7d6a9ac Aka: Add web UI (#1373)
* utils.web: Import html escaping functions

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>

* Aka: Add web interface for browsing Akas

Fixes #1226.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>

* httpserver: Actually handle KeyError in unhook

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>

* test: FakeHTTPConnection: Don't decode data in send

BaseHTTPRequestHandler expects to get bytes, so we can't decode the sent
data.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>

* test: HTTPPluginTestCase: Use BytesIO instead of StringIO

BaseHTTPRequestHandler expects bytes, not strings.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>

* test: HTTPPluginTestCase: Rewind wfile to 0 before reading the response

Otherwise the read pointer is at the end of the file.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>

* Aka: Add basic web UI tests

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
2019-10-10 17:27:34 +02:00
jesopo
68539da7ab Format: use string.capwords() - not .title() (#1378)
* use string.capwords() - not .title(). closes #1366

* add test case for "@format title" that checks handling apostrophes

* `assertResponse` evidently needs the relevant subcommand
2019-10-10 07:46:36 -07:00
James Lu
3c23faf1bd RSS: add 'announce channels' command to list channels a feed is announced to
Closes #1322.
2019-10-06 20:46:21 +02:00
Johannes Löthberg
ba6878375b plugins/Config: Reply with success on setdefault
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
2019-10-06 17:43:58 +02:00
James Lu
beb1000c7e Network: send whois requests using the original nick case
Fixes #1350. This works around an edge case in charybdis / ircd-seven where remote
whois requests to a UID are not accepted if it is given in a different case.
2019-10-05 16:40:37 -07:00
Valentin Lorentz
702cfaaf97 RSS: Fix __repr__ formatter. 2019-10-05 15:57:28 +02:00
Valentin Lorentz
dcf55cf6de RSS: Use an explicit timeout for assertNoResponse, because it defaults to 0.
Which means there may be a command/update thread running and returning after assertNoResponse returns.
In particular, that's an issue when assertNoResponse is called right before
setting feedparser._open_resource, because the running thread might still
be holding the lock but have fetched the new version already, so the
thread announces the new feed elements earlier than expected.
2019-10-05 15:57:01 +02:00
Valentin Lorentz
a4665803fa News + RSS: Mock time.time() instead of using time.sleep() in tests.
Saves 40s over the ~5min test suite.
2019-10-05 12:22:30 +02:00
Valentin Lorentz
656222e341 ChannelLogger: Fix filename escaping. 2019-09-14 14:35:43 +02:00
Valentin Lorentz
af6052997c ChannelLogger: Fix test broken by previous merge. 2019-09-14 12:15:57 +02:00
Valentin Lorentz
573921c00f Merge branch 'netconf-and-ircmsgs-channel' into testing 2019-09-14 12:10:47 +02:00
Valentin Lorentz
de9cea89cf ChannelLogger: Fix NameError on 'irc'. 2019-09-08 19:22:30 +02:00
Valentin Lorentz
88524beada ChannelLogger + Karka + all DB plugins: Sanitize channel names when used in filenames. 2019-09-06 20:42:13 +02:00
Valentin Lorentz
b166f4ad5c Network: Make the 'network' argument of @disconnect mandatory. Closes GH-161.
Otherwise, if it's provided and the network doesn't exist (or the bot isn't
currently connected to it), it's interpreted as being a quit message and
disconnects from the current network.
2019-08-31 17:43:16 +02:00
Valentin Lorentz
0413304d53 Nickometer: Use non-euclidian division as was originally intended.
I accidentally broke it in 88c2c130ca,
thinking the operands were both integers.
2019-08-26 22:24:14 +02:00
Valentin Lorentz
b65d78518c Services: Add support for network-specific password. 2019-08-25 14:08:11 +02:00
Valentin Lorentz
68de4f8ffd Config: Prevent accidental leak of private values on public channels. 2019-08-25 10:26:47 +02:00
Valentin Lorentz
c07086d7dc Config: Add command '@config network'. 2019-08-25 10:25:14 +02:00
Valentin Lorentz
2f4644f7b3 Config: Prevent accidental leak of private values on public channels. 2019-08-25 10:24:57 +02:00
Valentin Lorentz
633eea0730 Config: Fix test failure when another test set this value before. 2019-08-24 23:35:46 +02:00
Valentin Lorentz
c1ae3f5c81 all plugins: Use msg.channel instead of msg.args[0] + give network name to self.registryValue. 2019-08-24 23:35:01 +02:00
Valentin Lorentz
9326331c60 Merge branch 'ircmsg-channel' into netconf-and-ircmsgs-channel 2019-08-24 15:39:17 +02: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
4f024cb0b2 Add network-specific config values. 2019-08-15 12:22:43 +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
dba0ae3771 Google: update scraping regexp 2019-07-22 21:39:41 +02:00
Valentin Lorentz
540b827213 Google: Update for Google's new HTML layout.
Closes GH-1365
2019-05-28 19:37:52 +02:00
James Lu
f0e75679fe PluginDownloader: update my repo name 2019-03-19 21:35:03 -07:00
Valentin Lorentz
6b213f0686 Later: Add option senderHostname. 2019-03-06 15:29:09 +01:00
Gordon Shumway
61f03ff0ed Add oddluck's repo 2019-02-14 20:55:10 +01:00
Valentin Lorentz
0f82f89eec Web: Fix encoding issue on Python 2. Closes GH-1359. 2019-02-01 21:02:57 +01:00
Valentin Lorentz
fcf30a5601 Fix FutureWarning related to nested sets.
See https://bugs.python.org/issue30349
2018-12-29 23:36:57 +01:00
Valentin Lorentz
2c7c83b07d Success: Declare __slots__
Required since 1ac7812d7a.
2018-12-19 09:38:07 +01:00
James Lu
c7716de887 RSS: add a quick test for a malformed feed that has no entries
(Only both of these combined gives new output so far.)
2018-10-14 12:42:15 -07:00
James Lu
2fdc433cb3 RSS: show soft errors set by feedparser when no entries are found
Hopefully this will ease debugging - e.g. a bad TLS certificate will now show
"Error: Couldn't get RSS feed. Parser error: <urlopen error
 [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:720)>"
instead of only a generic message.
2018-10-14 12:41:22 -07:00
James Lu
9ba21a1cad Unix: fix a typo in sysuname & sysuptime's command descriptions
runnning -> running
2018-09-30 18:03:29 -07:00
Valentin Lorentz
be36591760 Fix test. 2018-09-11 07:33:16 +02:00
Valentin Lorentz
1f400e4020 Fix Python 3.7 support, and run Travis tests on 3.7.
Travis' "nightly" python is actually older than 3.7.0 (3.7.0a4+)
2018-09-10 00:57:04 +02:00
Laurent Kislaire
fb3c8978b5 Small fix on french translation (#1344) 2018-08-31 17:50:14 -07:00
James Lu
2242aadde9 Web: add trailing space for snarferPrefix at runtime
Before, the trailing space in the default snarferPrefix value disappears after a reload because spaces at the end of config lines are ignored.
2018-07-22 04:01:21 +00:00
Valentin Lorentz
00b8b6b51e Later: Add support for hostmasks. 2018-07-05 19:48:43 +02:00
Valentin Lorentz
50c41f5862 Fix previous commit on python 2. 2018-06-27 11:10:14 +02:00
Valentin Lorentz
1840b94453 Later: load the db with utf8 encoding (the default for AtomicFile). 2018-06-27 00:54:58 +02:00
Valentin Lorentz
01e4427057 Config: Fix previous commit. 2018-05-29 22:46:56 +02:00
Valentin Lorentz
c2b6305c46 Config: Support arbitrarily many channels for '@config channel'. 2018-05-29 22:17:28 +02:00
Valentin Lorentz
2d084f4deb Math: Convert the output of factorial() to a float. 2018-05-10 06:20:55 +02:00
Valentin Lorentz
cd479717b8 Web: Add supybot.plugins.snarfMultipleUrls. Also, fix Web's test cases. 2018-04-14 21:50:32 +02:00
Tasos Sahanidis
b900a369a4 RSS: Fix feeds with missing description or title
An AttributeError would be raised when a blacklist or a whitelist
would be set on feeds that miss either a title or a description.
2018-03-13 23:50:47 +01:00
Valentin Lorentz
e2180a1e08 Add variable supybot.plugins.Web.snarferPrefix. 2018-03-02 01:26:00 +01:00
Valentin Lorentz
9c1d46d151 Add channel-specific config variables that are only settable by the owner. 2018-02-06 14:20:37 +01:00
Valentin Lorentz
030ce5e6d4 Fix previous commit. 2018-02-01 22:37:24 +01:00
James Lu
55723c2161 Services: fix rejoin-on-kickban with atheme 7.x
- Adjust _chanRe to only match channels, as atheme also puts the target nick in bold
- Look for "unbanned <botnick>" messages in ChanServ notices (after stripping formatting)

This likely fixes GH-166. atheme has been using this format since at least 2005[1],
so it's possible that Supybot's rejoin-on-ban had never worked with it.

[1]: 4017c0da85 (diff-ba2bdc02ba7b29fd7e4931cafe63baa0R218)
2018-01-27 13:22:21 -08:00
James Lu
add3ceb4e7 Services: do not send the bot's nick in ChanServ commands
On Atheme, Anope, and oftc-ircservices, /cs unban, invite, op, and voice
implicitly assume the caller if no nick is given. However, certain combinations
such as /cs invite *with* a nick are not supported on atheme per
https://github.com/atheme/atheme/issues/568, and cause rejoin-on-kick to +i
channels to fail.

This fixes one part of GH-1118.
2018-01-27 13:22:15 -08:00
James Lu
eb1cb9bd76 Services: don't mangle the case of NickServ notices in logging
This might be confusing if you're dealing with password changes, etc.
2018-01-27 12:33:36 -08:00
Valentin Lorentz
5daaa14825 NickAuth: Fix NameError caused by e732931688. 2018-01-25 14:09:19 +01:00
Nicolas Coevoet
e732931688 Modified NickAuth to match the new WHOX 2018-01-23 19:37:19 +01:00
Valentin Lorentz
d656db454d User: if '@hostmask add' detects a conflict and the caller is the owner, tell them who the conflicting user is. 2017-12-30 18:47:09 +01:00
Valentin Lorentz
bd39debb48 User: Simplify owner-checking logic, and fix crash when @hostmask remove is called by an unregistered user. 2017-12-30 17:12:35 +01:00
Valentin Lorentz
8cfb841f3b BadWords: better tests. 2017-12-26 05:46:46 +01:00
James Lu
289c894dc5 Services: log all messages from NickServ to info
Closes GH-1016.
2017-12-10 11:03:30 -08:00
Valentin Lorentz
3ab226c129 RSS: Only defer feed loading at plugin load while the bot is starting.
Defering it if the plugin is (re)loaded while already running is useless.
Closes GH-922.
2017-12-10 09:39:20 +01:00
James Lu
bdd0adfef5 RSS: add missing configuration help for feed URL options
This fixes confusing "That configuration group exists, but seems to have no help." errors on the URL
options for feeds, when these options are actually relevant and settable.
2017-12-09 23:03:42 -08:00
James Lu
c78aff24e8 Hashes: fix copyright year format
[skip ci]
2017-11-09 09:08:41 -08:00
James Lu
fffe1efa9b Hashes: remove duplicate check for hashlib.algorithms_available
This code is never wrap()'ed if the attribute is unavailable, so it isn't necessary to check for it in runtime twice.
2017-11-09 09:05:58 -08:00
James Lu
287610b776 Hashes: simplify test suites
- Use hasattr instead of assigning the import availability to a variable
- Use a simple if statement instead of redefining skipIf
2017-11-09 09:04:21 -08:00