summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-14 21:43:27 -0500
committerJune McEnroe <june@causal.agency>2020-02-14 21:43:27 -0500
commited52ade7393fafe8e76dad7772c2ebfaf3647119 (patch)
tree3df85b4caa56a8821a9814535145e0b6d58b6a6d
parentAdd /invite (diff)
downloadcatgirl-ed52ade7393fafe8e76dad7772c2ebfaf3647119.tar.gz
catgirl-ed52ade7393fafe8e76dad7772c2ebfaf3647119.zip
Add /kick
-rw-r--r--catgirl.12
-rw-r--r--command.c11
2 files changed, 13 insertions, 0 deletions
diff --git a/catgirl.1 b/catgirl.1
index 437b0d1..86bf53d 100644
--- a/catgirl.1
+++ b/catgirl.1
@@ -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
diff --git a/command.c b/command.c
index f59176f..3b94270 100644
--- a/command.c
+++ b/command.c
@@ -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 },
/span>Add wakeJune McEnroe That payload can appear anywhere within an ethernet frame. Wake-on-LAN is funny. 2017-08-04Use $() in install.shJune McEnroe Something gave me the impression that sh did not like this, but it's specified by POSIX. 2017-08-02Create Code Tarmak 3 layoutJune McEnroe 2017-07-31Add tupJune McEnroe 2017-07-31Use designated initializer for hnel tableJune McEnroe I did not know this syntax worked! 2017-07-30Add juneJune McEnroe 2017-07-30Play nethack as ValkyrieJune McEnroe 2017-07-28Add toggle to hnelJune McEnroe 2017-07-28Install slJune McEnroe 2017-07-25Add up, supJune McEnroe 2017-07-24Autopickup ringsJune McEnroe 2017-07-24Name dogJune McEnroe 2017-07-23Add nethackrcJune McEnroe 2017-07-23Remove useless setuid in briJune McEnroe Don't you think it would be better if the setuid bit only gave you permission to do it and didn't do it for you? 2017-07-23Clean up hnel a tiny bitJune McEnroe 2017-07-21Set window size in hnelJune McEnroe 2017-07-21Add hnelJune McEnroe 2017-07-19chmod 600 in dtchJune McEnroe