Uses POSIX shell parameter expansion syntax.
<pragma-> !factadd cookie /me gives a cookie to ${args:-nobody. What a shame}!
<PBot> cookie added to the global channel.
<pragma-> !cookie Bob
* PBot gives a cookie to Bob!
<pragma-> !cookie
* PBot gives a cookie to nobody. What a shame!
<pragma-> !factadd sum /call calc $arg[0]:-1 + $arg[1]:-2
<PBot> sum added to the global channel.
<pragma-> !sum
<PBot> 1 + 2 = 3
<pragma-> !sum 3
<PBot> 3 + 2 = 5
<pragma-> !sum 4 6
<PBot> 4 + 6 = 10
This fixes e.g.:
<pragma-> ,{echo foo ;;; echo bar} ,{echo baz}
<PBot> foo bar
<PBot> foo baz
To instead produce the expected:
<PBot> foo bar
<PBot> baz
This allows us to set `locked` to a value greater than `1` to lock a factoid WITHOUT
allowing invocation of `required_caps` commands. This lets us safely lock a factoid
that has unrestrained `$args` or variables.
This preserves the pipe/cmd-substitution/etc to allow post-processing
of the `date` output.
Interpreter: Reset `interpreted` contextual metadata when handling
result to allow recursion for continued command processing.
As a security measure to prevent users from creating or modifying factoids to
sneak in commands to trick chanops/admins/botowners/etc into executing those
commands, the command interpreter will now check if the command has been
invoked in the context of a factoid. If so, the factoid must be locked.
PBot now preserves whitespace by default. The `preserve_whitespace`
metadata field is now redundant. It has now been replaced with
`condense-whitespace`, which when set to a true value will collapse
adjacent whitespace to a single space.
Due to recent changes to support continued processing of empty string command
results, ProcessManager::execute_process() now returns undefined value, which
causes Interpreter::interpret() to continue looping through registered command
interpreters after successfully handling a command.
This causes some plugins, i.e. Plugin/Date.pm, to continue the interpret() loop
after successfully handling a command, which causes additional interpreters to
handle the command, leading to both a built-in command an a factoid command
being invoked if they share the same name.
Applets::execute_applet() now returns the defined empty string to let the
interpreter loop know that the command has been handled.
`factmove` arguments now behave more sensibly in that:
* `factmove #channel keyword global keyword` now properly moves/renames
factoids to global channel
* `factmove #channel keyword #channel global` renames the factoid to `global`
* `factmove #channel keyword newname` renames the factoid to `newname`
* func sed no longer trims leading whitespace
* quoted text no longer trims leading whitespace
* no longer convert tabs to spaces in output
* no longer condense adjacent whitespace together in output
E.g.:
<pragma-> show testcargs
<PBot> [global] testcargs: /code c11 printf("/say args: " ); while (*++argv) printf("[%s] " , *argv);
<pragma-> testcargs 'hello''world' 'how are 'you today
<PBot> args: [helloworld] [how are you] [today]
Previously, adjacent 'foo''bar' would end up as 2 args like [foo] [bar]. Now
they are properly concatenated into one [foobar] argument.
This also fixes the cases of whitespace being inserted after quoted arguments.
general.debugcontext: filter out cmdlist and arglist
Core/Applets: log applet start/stop and duration
Core/ProcessManager: fix potential race-condition with $context object
Core/Interpreter:
* expand pronouns before command-substitution
* attempt to find current channel's factoid instance for metadata
* remove duplication of command history in command-substition
* terminate pipe/substitution processing when protecting self
Core/Factoids: limit -url contents to 250kb
This was way overdue. User passwords are no longer stored as cleartext.
When PBot is restarted after applying this commit, all stored passwords will
be converted to salted hash digests.
The `useradd`, `userset` and `my` commands will now hash passwords.
Why did it take me so long to finally get around to hashing passwords
properly, you might ask. The reason why this wasn't done sooner is because
all of my users used hostmask-based `autologin`. The passwords that PBot
randomly generated were ignored and never used.
I do regret that it took me so long to get around to this, for those of you
who might be using custom passwords instead of hostmask-based `autologin`.
* obtain bot nick from connection details instead of registry where appropriate
* irc.random_nick works again
* record own hostmask when connecting
* fix web-paste truncation by subtracting length of own hostmask from message length
* set irc.max_msg_len back to 510
* updated IRC numeric 378 to whoishost
* add sprunge.us to WebPaste