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
The number of rounds, questions and bonus rounds are now all configurable via
`spinach set settings`.
Refactored states to not transition of a false value is returned, to eliminate
all explicit "wait" states.
Refactored ridiculous large per-round/per-question state transitions and
subroutines into a much more manageable and simpler state machine.
Now can easily and trivially adjust maximum rounds and maximum questions
by editing $self->{game} hashtable entries. TODO: make this configurable
via `spinach set`.
Replaced "/msg me" with "/msg $botnick" throughout.
Adjusted lie validation:
* If all words of lie are found within solution and word-count of lie is
less than word-count of solution, then game will say "So-and-so has found
part of the truth!"
* If lie is 20%-or-less different to the solution, then game will say
"So-and-so has misspelled the truth!"
Also remove the explicit check for `ArrayRef`, which is obsolete since the 2014 addition of the `_is_simple_node` override in commit ba59edb04. (Upstream `_is_simple_node` returns `True` for an `ArrayRef`.)
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
* set `preserve_escapes` to 0 in guest/_c_base.pm so escapes are stripped in:
<pragma-> ,show testcargs
<candide> [global] testcargs: /code c11 printf("/say args: " ); while
(*++argv) printf("[%s] " , *argv);
<pragma-> ,testcargs foo\'bar baz\'qux
<candide> args: [foo\'bar] [baz\'qux]
to produce the desired output of:
<candide> args: [foo'bar] [baz'qux]
* set `keep_spaces` to 1 in host/_default.pm since it turns out that in some
languages unquoted spaces are significant, e.g. in `sh ${1% *}` to strip
text following two spaces. Without `keep_spaces` enabled, `sh ${1% *}`
becomes `sh ${1% *}` and strips all text following one space instead of two.
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