Commit Graph

564 Commits

Author SHA1 Message Date
Valentin Lorentz
f18eafc8d8 Fix crash on simulated echos (they don't have a prefix set). 2020-05-08 11:57:02 +02:00
Valentin Lorentz
83a8afde16 Add experimental support for +draft/reply client capability on outgoing messages. 2020-05-07 21:17:55 +02:00
Valentin Lorentz
3eb20adaf2 Fix extra arguments to irc.reply() being ignored by messages returned by '@more'.
This change builds all the ircmsg objects directly in irc.reply, with
the original arguments.

A side effect is that if a config var is changed between the initial command
call and the call to '@more', this commit makes it use the old values,
but that shouldn't be too much of an issue.

Closes GH-1405.
2020-04-11 16:40:07 +02:00
Valentin Lorentz
61b47bb65b Deduplicate list of arguments of _makeReply. 2020-04-11 16:36:14 +02:00
Valentin Lorentz
0b0da9716d callbacks: honor network-specificity of supybot.reply.whenAddressedBy.
A side-effect is that plugins should now pass 'irc' instead of 'irc.nick'
when they call 'callbacks.addressed()'.
2020-04-11 15:00:46 +02:00
Valentin Lorentz
32d8d141ad Make irc.error do nothing is no string is given as argument.
Fixes c1d3bad64f, which crashed with:

```
ERROR 2020-01-18T01:34:07 Uncaught exception in NickAuth._callCommand:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/supybot/callbacks.py", line 1337, in _callCommand
    irc.errorNoCapability(cap)
  File "/usr/local/lib/python3.7/dist-packages/supybot/callbacks.py", line 544, in errorNoCapability
    raise Error()
supybot.callbacks.Error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/supybot/log.py", line 368, in m
    return f(self, *args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/supybot/callbacks.py", line 1359, in _callCommand
    irc.error(str(e))
  File "/usr/local/lib/python3.7/dist-packages/supybot/callbacks.py", line 1065, in error
    raise ArgumentError
supybot.callbacks.ArgumentError
```
2020-01-18 11:04:54 +01:00
Valentin Lorentz
83114e5fbd src/callbacks.py: use network-specific values.
Closes GH-1393
2019-12-05 21:51:25 +01:00
Valentin Lorentz
67c2bacd69 Set msg.channel in ReplyIrcProxy and NestedCommandsIrcProxy.
Needed when plugins use a self.Proxy with a crafted message;
else the called commands will assume the message was sent in
private.
2019-09-08 21:35:35 +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
a03a89730a Fix bugs in wrapping IRC messages. 2019-01-06 16:48:11 +01:00
Valentin Lorentz
c1d3bad64f Raise error even if supybot.replies.(generic)noCapability is empty. 2018-10-06 08:13:11 +02:00
Valentin Lorentz
7cc7b4fac9 Redesign the message truncation algorithm. 2018-09-10 22:39:45 +02: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
636712be51 Limit the number of combinations of capabilities required for command names with spaces.
To call a command named 'X Y Z' in plugin 'P', we used to require lots of capabilities,
like 'P.X', 'P.Y', 'P.Z', 'P.X.Y', 'X.Y', 'P.Y', ...
Now, we only require 'P', 'P.X', 'P.X.Y', 'P.X.Y.Z', and 'Z'.

It makes it a lot easier to work with command names with a space when
supybot.capabilities.default is False.
2018-02-02 18:20:05 +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
Valentin Lorentz
965dcc293d Do not call noReply() on raw IRC objects. 2017-10-26 09:21:31 +02:00
Valentin Lorentz
73ddedd73c Fix previous commit to work with Karma. 2017-10-21 15:53:38 +02:00
Valentin Lorentz
543edccd41 Properly handle noReplies() in nested commands.
This fix prevents the bot from replying 'Error: I tried to send you an empty message'
when 'utilities ignore' is called from an Aka.
2017-10-21 15:37:43 +02:00
Valentin Lorentz
c6e29031d1 Make replies() behave consistently with reply() regarding the 'to' parameter.
Side-effect: Fixes channel-specificity of supybot.reply.onetoone for the Reply.replies command.
Closes GH-1266.
2016-10-01 13:37:03 +02:00
Valentin Lorentz
6ec0af2da3 Strip CTCP characters from irc.reply by default. 2016-04-24 21:11:34 +02:00
Valentin Lorentz
15e387ea46 Make irc.replies return all results in a single line by default (instead of following the conf), if used in a nested command. Closes GH-219. 2016-02-20 12:57:04 +01:00
Valentin Lorentz
7ce385b6f8 Don't substitude in errorInvalid. Closes GH-49.
Why was it doing substitutions in the first place?
2015-12-28 20:01:40 +01:00
Valentin Lorentz
d9a01629cd Fix bytes count in message splitting. 2015-12-27 19:58:14 +00:00
Valentin Lorentz
5f361ef180 Conditional: Add command @iferror. Closes GH-1114. 2015-11-14 19:20:25 +01:00
Valentin Lorentz
a99e674b88 Add support for (anti)capabilities for multi-words commands. Closes GH-1140. 2015-09-23 12:00:18 +02:00
Valentin Lorentz
912d2e1538 core: Apply some suggestions of pyflakes. 2015-08-31 18:19:22 +02:00
Valentin Lorentz
c3a2c800f1 Remove need for 2to3. 2015-08-11 16:50:23 +02:00
Valentin Lorentz
f305ff3c02 Remove fix_basestring. 2015-08-10 20:24:11 +02:00
Valentin Lorentz
34d384bd67 Remove need for fix_methodattrs. 2015-08-10 18:09:52 +02:00
Valentin Lorentz
c0ac84bb53 Remove need for fix_import, fix_types, and fix_urllib. 2015-08-10 17:55:25 +02:00
Valentin Lorentz
216c5d213f Replace sys.version_info[0] usages with minisix.PY{2,3}. 2015-08-09 00:23:03 +02:00
Valentin Lorentz
487f8c8af5 Merge remote-tracking branch 'supybot/master' into testing
Conflicts:
	.mailmap
	README
	docs/FAQ.rst
	plugins/Ctcp/plugin.py
	plugins/Misc/plugin.py
	plugins/Network/plugin.py
	plugins/QuoteGrabs/plugin.py
	plugins/RSS/README.txt
	plugins/Relay/plugin.py
	plugins/ShrinkUrl/config.py
	plugins/ShrinkUrl/plugin.py
	plugins/ShrinkUrl/test.py
	setup.py
	src/callbacks.py
	src/commands.py
	src/conf.py
	test/test_commands.py
2015-05-15 14:41:08 +02:00
Valentin Lorentz
86d9f49aa5 callbacks: Allow Plugin.noIgnore to be a function instead of a boolean. 2015-05-15 12:39:30 +02:00
James Lu
6add519765 callbacks.py: log plugin name in registryValue='text' errors
This can help with debugging to find what plugins are passing invalid things to registryValue().
2015-04-05 13:44:30 -07:00
Valentin Lorentz
6a134eb302
Update string comparison to a newer string.
Signed-off-by: James McCoy <vega.james@gmail.com>
2015-03-26 02:04:06 -04:00
Valentin Lorentz
b0846f914e
Fix crash for commands with ambiguous getopts shortcuts and no docstring.
Signed-off-by: James McCoy <vega.james@gmail.com>
2015-03-26 02:00:43 -04:00
Valentin Lorentz
4470805b5f core: Remove useless imports. 2015-03-03 09:02:29 +01:00
Valentin Lorentz
72e71edb89 Update string comparison to a newer string. 2015-03-03 08:55:29 +01:00
Valentin Lorentz
6f9960d7a4 Fix crash for commands with ambiguous getopts shortcuts and no docstring. 2015-03-03 08:55:29 +01:00
Valentin Lorentz
681bd5d85d Count number of bytes instead of number of characters for truncating messages. Closes GH-1038. 2015-02-04 17:31:42 +01:00
Dan
bd2d17a1c2 update irc.reply() change new arg name 2015-01-17 03:49:32 -05:00
ddan39
2fe84a3474 add usesendMsg=False to irc.reply() to use sendMsg() instead of queueMsg() 2015-01-17 07:13:30 +01:00
Valentin Lorentz
6f19088724 Merge remote-tracking branch 'supybot/master' into testing
Conflicts:
	.gitignore
	plugins/Alias/plugin.py
	plugins/Anonymous/plugin.py
	plugins/Anonymous/test.py
	setup.py
	src/callbacks.py
2014-07-12 09:48:27 +02:00
James McCoy
3d993a0cab callbacks: Properly handle nested command errors
Using Raise=True was only papering over the real problem in the nested
command error handling.  The actual issue is that we were trying to
return an IrcMsg from NestedCommandsIrcProxy.__init__.  Dropping
Raise=True and moving return to its own line is the correct fix and
resolves the test failure in testMaximumNestingDepth.

This commit reverts 7838cae3bc

Signed-off-by: James McCoy <vega.james@gmail.com>
2014-06-29 19:12:22 -04:00
Valentin Lorentz
ddc37a7f4a Revert "Make supybot.reply.oneToOne not always true on channels."
This reverts commit 5881c97120.
2014-06-11 11:13:01 +00:00