Add /join command

master
C. McEnroe 2020-02-06 01:05:09 -05:00
parent db499dc5f5
commit 9a585188c5
2 changed files with 9 additions and 1 deletions

View File

@ -1,4 +1,4 @@
.Dd February 5, 2020 .Dd February 6, 2020
.Dt CATGIRL 1 .Dt CATGIRL 1
.Os .Os
. .
@ -120,6 +120,8 @@ Log in with the server password
.Sh COMMANDS .Sh COMMANDS
.Ss Chat Commands .Ss Chat Commands
.Bl -tag -width Ds .Bl -tag -width Ds
.It Ic /join Ar channel
Join a channel.
.It Ic /me Op Ar action .It Ic /me Op Ar action
Send an action message. Send an action message.
.It Ic /notice Ar message .It Ic /notice Ar message

View File

@ -17,6 +17,7 @@
#include <ctype.h> #include <ctype.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include "chat.h" #include "chat.h"
@ -59,6 +60,10 @@ static void commandMe(size_t id, char *params) {
commandPrivmsg(id, buf); commandPrivmsg(id, buf);
} }
static void commandJoin(size_t id, char *params) {
ircFormat("JOIN %s\r\n", (params ? params : idNames[id]));
}
static void commandQuit(size_t id, char *params) { static void commandQuit(size_t id, char *params) {
(void)id; (void)id;
set(&self.quit, (params ? params : "Goodbye")); set(&self.quit, (params ? params : "Goodbye"));
@ -78,6 +83,7 @@ static const struct Handler {
const char *cmd; const char *cmd;
Command *fn; Command *fn;
} Commands[] = { } Commands[] = {
{ "/join", commandJoin },
{ "/me", commandMe }, { "/me", commandMe },
{ "/notice", commandNotice }, { "/notice", commandNotice },
{ "/quit", commandQuit }, { "/quit", commandQuit },