Skip to content

Commit 665900d

Browse files
authored
Merge pull request #34 from mcpcpc/add_privmsg_alias
remove leader command character for PRIVMSGs
2 parents ffc0220 + 3da949a commit 665900d

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
* Simple shortcut commands and full support for all IRC commands in the [RFC 2812](https://tools.ietf.org/html/rfc2812) standard:
1919

2020
```shell
21-
<message> Send a PRIVMSG to the current channel.
22-
/<command> Send command to IRC server (see RFC 2812 for full list).
23-
/#<channel> Assign new default message channel.
24-
/? Print current message channel.
25-
/@<channel|nick> <message> Send a message to a specified channel or nick
21+
<message> Send a PRIVMSG to the current channel.
22+
@<channel|nick> <message> Send a message to a specified channel or nick
23+
/<command> Send command to IRC server (see RFC 2812 for full list).
24+
/#<channel> Assign new default message channel.
25+
/? Print current message channel.
2626
```
2727

2828
* 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.

kirc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,13 @@ handle_user_input(void) {
241241
if (usrin[0] == '/' && usrin[1] == '#') {
242242
strcpy(chan_default, usrin + 2);
243243
printf("new channel: #%s\n", chan_default);
244-
} else if (usrin[0] == '/' && usrin[1] == '@') {
245-
strtok_r(usrin, " ", &tok);
246-
raw("privmsg %s :%s\r\n", usrin + 2, tok);
247244
} else if (usrin[0] == '/' && usrin[1] == '?' && msg_len == 3) {
248245
printf("current channel: #%s\n", chan_default);
249246
} else if (usrin[0] == '/') {
250247
raw("%s\r\n", usrin + 1);
248+
} else if (usrin[0] == '@') {
249+
strtok_r(usrin, " ", &tok);
250+
raw("privmsg %s :%s\r\n", usrin + 1, tok);
251251
} else {
252252
raw("privmsg #%s :%s\r\n", chan_default, usrin);
253253
}

0 commit comments

Comments
 (0)