Add /kick

This commit is contained in:
C. McEnroe 2020-02-14 21:43:27 -05:00
父節點 39a343980b
當前提交 ed52ade739
共有 2 個文件被更改,包括 13 次插入0 次删除

查看文件

@ -246,6 +246,8 @@ Set or clear your away status.
Invite a user to the channel.
.It Ic /join Ar channel
Join a channel.
.It Ic /kick Ar nick Op Ar message
Kick a user from the channel.
.It Ic /list Op Ar channel
List channels.
.It Ic /me Op Ar action

查看文件

@ -141,6 +141,16 @@ static void commandInvite(size_t id, char *params) {
ircFormat("INVITE %s %s\r\n", nick, idNames[id]);
}
static void commandKick(size_t id, char *params) {
if (!params) return;
char *nick = strsep(&params, " ");
if (params) {
ircFormat("KICK %s %s :%s\r\n", idNames[id], nick, params);
} else {
ircFormat("KICK %s %s\r\n", idNames[id], nick);
}
}
static void commandList(size_t id, char *params) {
(void)id;
if (params) {
@ -259,6 +269,7 @@ static const struct Handler {
{ "/help", .fn = commandHelp },
{ "/invite", .fn = commandInvite },
{ "/join", .fn = commandJoin, .restricted = true },
{ "/kick", .fn = commandKick },
{ "/list", .fn = commandList },
{ "/me", .fn = commandMe },
{ "/move", .fn = commandMove },