diff options
author | Michael Czigler <37268479+mcpcpc@users.noreply.github.com> | 2020-09-25 06:57:30 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-25 06:57:30 -0400 |
commit | 53450398d1e4eb96a31f9f0a073087101e187e70 (patch) | |
tree | 54dc32d77f158a101e500faadbe9b84b097a10e9 /kirc.c | |
parent | squash commits to address README and defaults (diff) | |
download | kirc-53450398d1e4eb96a31f9f0a073087101e187e70.tar.gz kirc-53450398d1e4eb96a31f9f0a073087101e187e70.tar.bz2 kirc-53450398d1e4eb96a31f9f0a073087101e187e70.tar.xz kirc-53450398d1e4eb96a31f9f0a073087101e187e70.tar.zst kirc-53450398d1e4eb96a31f9f0a073087101e187e70.zip |
Add alias PRIVMSG aliased command
Diffstat (limited to '')
-rw-r--r-- | kirc.c | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -229,7 +229,7 @@ handle_server_message(void) { static void handle_user_input(void) { - char usrin[MSG_MAX]; + char usrin[MSG_MAX], *tok; fgets(usrin, MSG_MAX, stdin); @@ -238,15 +238,16 @@ handle_user_input(void) { usrin[msg_len - 1] = '\0'; } - if (usrin[0] == '/') { - if (usrin[1] == '#') { - strcpy(chan_default, usrin + 2); - printf("new channel: #%s\n", chan_default); - } else if (usrin[1] == '?' && msg_len == 3) { - printf("current channel: #%s\n", chan_default); - } else { - raw("%s\r\n", usrin + 1); - } + 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 { raw("privmsg #%s :%s\r\n", chan_default, usrin); } |