3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-28 14:59:56 +01:00
Commit Graph

170 Commits

Author SHA1 Message Date
Pragmatic Software
001f2024c4
Factoids: add default value modifier
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
2024-11-27 12:17:45 -08:00
Pragmatic Software
7a7730d039
Interpreter: improve processing of embedded and split commands 2024-11-21 20:31:28 -08:00
Pragmatic Software
5f4b2989a1
Factoids: fact no longer adds ref channel to output 2024-11-21 20:21:14 -08:00
Pragmatic Software
888da7dda1
Factoids: move enabled check to before /call 2024-11-15 01:15:37 -08:00
Pragmatic Software
c6433a662f
Commands/Factoids: remove "not owner" restriction on factset/factunset 2024-11-14 01:21:48 -08:00
Pragmatic Software
dbff4bc2f7
Interpreter: reset split_result after processing it
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
2024-11-10 17:45:33 -08:00
Pragmatic Software
a11dc12861
Interpreter: remove debug message 2024-11-07 19:47:02 -08:00
Pragmatic Software
a262139fd2
Factoids: require locked to be exactly 1 to invoke commands with required_caps
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.
2024-11-07 01:45:15 -08:00
Pragmatic Software
12ec8bb77c
Factoids: don't add nick if add_nick defined and set to 0 2024-11-06 22:51:29 -08:00
Pragmatic Software
54ef6b14ce
Plugin/Date: use existing context when launching date applet
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.
2024-11-05 23:57:48 -08:00
Pragmatic Software
7f49321e29
Commands/Factoids: fix unsetting locked on factoids with cap-override 2024-11-05 16:55:53 -08:00
Pragmatic Software
650bf40a24
Disallow invoking of commands with requires_cap from unlocked factoids
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.
2024-11-05 16:48:59 -08:00
Pragmatic Software
9ebc77f4da
Replace preserve_whitespace metadata with condense-whitespace
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.
2024-11-04 00:25:36 -08:00
Pragmatic Software
4c866d39b6
Fix white-space handling; add suppress-no-output 2024-11-03 19:26:56 -08:00
Pragmatic Software
1f232a9455
Applets: Add $context->{interpreted} to exit interpreter loop 2024-11-03 19:22:45 -08:00
Pragmatic Software
b58b778648
Applets: execute_applet() returns defined value to end interpreter loop
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.
2024-11-03 12:05:39 -08:00
Pragmatic Software
02a0d8ecfb
Commands/Factoids: Fix 4-arg form of factmove; add factcopy
`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`
2024-11-02 18:27:51 -07:00
Pragmatic Software
73c4ed465d
Factoid/Variables: minor refactor, no semantic changes 2024-11-02 17:58:14 -07:00
Pragmatic Software
c6f6823df9
Fix misc white-spacing issues
* 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
2024-11-02 17:57:19 -07:00
Pragmatic Software
af2d9844b8
Interpreter: allow processing of empty result
This fixes .e.g.:

    <pragma-> !echo foo &{echo bar | { sed s/bar// }} baz

such that it produces the output "foo  baz" instead of no output at all.
2024-11-02 17:53:37 -07:00
Pragmatic Software
d8a284e9c1
Core/Interpreter: preserve newlines in commands 2024-10-30 16:37:20 -07:00
Pragmatic Software
f4caf44eb0
split_line(): Remove no longer used next_ch/last_ch 2024-10-29 12:49:19 -07:00
Pragmatic Software
4287cb9fa2
Fix split_line() quoting to be more sh-like
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.
2024-10-29 10:19:46 -07:00
Pragmatic Software
f542cc0cf2
Core/Factoids: top20: show only defined edited-by for edited sub-command 2024-10-23 22:32:27 -07:00
Pragmatic Software
4345b0a75c
Core/Factoids: update edit-by when factadd -f; add edited to top20 2024-10-23 21:36:21 -07:00
Pragmatic Software
755d7bd6c0
Bug fixes
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
2024-10-22 09:50:10 -07:00
Pragmatic Software
521e8850b0
Core/IgnoreList: allow specifying nickname as channel argument to ignore private messages 2024-10-15 20:05:24 -07:00
Pragmatic Software
597820c053
Core/Factoids: properly restore invalid $variable expansions 2024-10-15 19:56:04 -07:00
Pragmatic Software
646a7f8e7f
Factoids: move /code to after action processing 2024-10-04 22:34:02 -07:00
Pragmatic Software
a453518fab
AntiFlood: add some missing nickserv account case normalization 2024-09-28 12:19:37 -07:00
Pragmatic Software
85c3f1f9f2
AntiFlood: relax default flood values 2024-09-19 13:57:08 -07:00
Pragmatic Software
e39c9ea3ad
WebPaste: sprunge.us dead 2024-09-19 13:56:23 -07:00
Pragmatic Software
6722fd7f8d
Store user passwords as salted hash digests
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`.
2024-06-22 22:38:15 -07:00
Pragmatic Software
04209e4b7e
Interpreter: restore preserve_escapes in make_args() to fix sed
Update factoids
2024-06-03 09:07:53 -07:00
Pragmatic Software
80f9ea1acd
Interpreter: escaped spaces behave better 2024-05-26 17:44:59 -07:00
Pragmatic Software
c62b6b9a75
Functions: fix help function signature 2024-05-09 16:10:06 -07:00
Pragmatic Software
5d3f188a09
Multiple bugfixes
* 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
2024-04-07 20:55:04 -07:00
Pragmatic Software
09aed30893
pbot-vm: add PBOTVM_ADDR env var to set address of vm-server 2024-03-31 17:36:36 -07:00
Pragmatic Software
5d3507421e
Plugin/Wordle: fix not detecting duplicate letters 2024-03-09 20:29:25 -08:00
Pragmatic Software
7347fef521
EventQueue: minor whitespace correction 2023-11-14 10:44:43 -08:00
Pragmatic Software
afa124e0d3
Commands/ChanOp: Group multiple unbans/unmutes together into one command 2023-11-14 10:42:16 -08:00
Pragmatic Software
2096df16d6
Factoids: process regex factoids when implicitly invoked 2023-09-24 11:24:20 -07:00
Pragmatic Software
5ffde32d46
Factoids: disregard error messages when not explicitly invoked 2023-09-23 13:52:10 -07:00
Pragmatic Software
fe3e7c80cb
Interpreter: disallow /msg from vm-client 2023-08-19 16:36:26 -07:00
Pragmatic Software
64b4d8a53c Handlers/Server: fix constant look-up (was previously moved from hash to constant) 2023-07-30 16:46:04 -07:00
Pragmatic Software
d4cc3bf7f2 Plugin/ActionTrigger: handle QUIT triggers per-channel 2023-07-19 00:23:54 -07:00
Pragmatic Software
f3ad345340 Core/Interpreter: require whitespace in front of bot name for suffix-trigger 2023-05-21 16:16:06 -07:00
Pragmatic Software
8934936658 Perform anti-flood checking on NOTICEs to channels 2023-05-14 15:56:17 -07:00
Pragmatic Software
48daaa91ca Core/Handlers: Do not auto-reply to NOTICEs 2023-05-14 15:38:51 -07:00
Pragmatic Software
2b36286c22 Interpreter: extract_bracketed: missed a state change 2023-05-11 11:02:16 -07:00