diff options
author | June McEnroe <june@causal.agency> | 2020-02-05 19:00:54 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-02-05 19:00:54 -0500 |
commit | b2d35edcb22a9a41235229b41b180a50b51b5908 (patch) | |
tree | 4cfc6ca3682aff0fa7fd65348c35210df832460f /command.c | |
parent | Scroll the input window (diff) | |
download | catgirl-b2d35edcb22a9a41235229b41b180a50b51b5908.tar.gz catgirl-b2d35edcb22a9a41235229b41b180a50b51b5908.zip |
Change prompt depending on command
Diffstat (limited to '')
-rw-r--r-- | command.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/command.c b/command.c index ef27888..928f470 100644 --- a/command.c +++ b/command.c @@ -19,6 +19,27 @@ #include "chat.h" +const char *commandIsPrivmsg(size_t id, const char *input) { + if (id == Network || id == Debug) return NULL; + if (input[0] != '/') return input; + const char *space = strchr(&input[1], ' '); + const char *slash = strchr(&input[1], '/'); + if (slash && (!space || slash < space)) return input; + return NULL; +} + +const char *commandIsNotice(size_t id, const char *input) { + if (id == Network || id == Debug) return NULL; + if (strncmp(input, "/notice ", 8)) return NULL; + return &input[8]; +} + +const char *commandIsAction(size_t id, const char *input) { + if (id == Network || id == Debug) return NULL; + if (strncmp(input, "/me ", 4)) return NULL; + return &input[4]; +} + void command(size_t id, char *input) { if (id == Debug) { ircFormat("%s\r\n", input); |