diff options
author | Michael Czigler <37268479+mcpcpc@users.noreply.github.com> | 2020-09-25 09:05:06 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-25 09:05:06 -0400 |
commit | 665900d4d93d491a1a4739513799742b1573dac5 (patch) | |
tree | b799918799067f4e0b93e8a45a4bbabb73524924 | |
parent | Merge pull request #33 from mcpcpc/add_privmsg_alias (diff) | |
parent | Update README.md (diff) | |
download | kirc-665900d4d93d491a1a4739513799742b1573dac5.tar.gz kirc-665900d4d93d491a1a4739513799742b1573dac5.tar.bz2 kirc-665900d4d93d491a1a4739513799742b1573dac5.tar.xz kirc-665900d4d93d491a1a4739513799742b1573dac5.tar.zst kirc-665900d4d93d491a1a4739513799742b1573dac5.zip |
Merge pull request #34 from mcpcpc/add_privmsg_alias
remove leader command character for PRIVMSGs
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | kirc.c | 6 |
2 files changed, 8 insertions, 8 deletions
@@ -18,11 +18,11 @@ * Simple shortcut commands and full support for all IRC commands in the [RFC 2812](https://tools.ietf.org/html/rfc2812) standard: ```shell -<message> Send a PRIVMSG to the current channel. -/<command> Send command to IRC server (see RFC 2812 for full list). -/#<channel> Assign new default message channel. -/? Print current message channel. -/@<channel|nick> <message> Send a message to a specified channel or nick +<message> Send a PRIVMSG to the current channel. +@<channel|nick> <message> Send a message to a specified channel or nick +/<command> Send command to IRC server (see RFC 2812 for full list). +/#<channel> Assign new default message channel. +/? Print current message channel. ``` * Color scheme definition via [ANSI 8-bit colors](https://en.wikipedia.org/wiki/ANSI_escape_code). Therefore, one could theoretically achieve uniform color definition across all shell applications and tools. @@ -241,13 +241,13 @@ handle_user_input(void) { if (usrin[0] == '/' && usrin[1] == '#') { strcpy(chan_default, usrin + 2); printf("new channel: #%s\n", chan_default); - } else if (usrin[0] == '/' && usrin[1] == '@') { - strtok_r(usrin, " ", &tok); - raw("privmsg %s :%s\r\n", usrin + 2, tok); } else if (usrin[0] == '/' && usrin[1] == '?' && msg_len == 3) { printf("current channel: #%s\n", chan_default); } else if (usrin[0] == '/') { raw("%s\r\n", usrin + 1); + } else if (usrin[0] == '@') { + strtok_r(usrin, " ", &tok); + raw("privmsg %s :%s\r\n", usrin + 1, tok); } else { raw("privmsg #%s :%s\r\n", chan_default, usrin); } |