From 79a504e10b85c41f0432649d59f8d1e7d916ddb8 Mon Sep 17 00:00:00 2001 From: 8nlight <8nlight@disroot.org> Date: Mon, 9 Oct 2023 17:16:02 +0300 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=B2=20=C2=AB?= =?UTF-8?q?/=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 3 ++- cfg.h | 6 +++++- main.c | 7 +++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ead83ee..b545937 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ CFLAGS?= -s -Os -flto -pedantic +CC?=cc all: - cc *.c $(CFLAGS) -obot + $(CC) *.c $(CFLAGS) -obot clean: rm irc.* bot diff --git a/cfg.h b/cfg.h index 59c408e..7721da8 100644 --- a/cfg.h +++ b/cfg.h @@ -4,7 +4,11 @@ #define PORT 6667 #define DIR "./" -char *channels[] = {"#channel"}; +char *channels[] = {"#channel", NULL}; + +//Put \r\n after string end +//Exp: {..., "PRIVMSG NickServ IDENTIFY mypassword\r\n", ..., NULL}; +char *send_after_join[] = {NULL}; //Output #define FORMAT_TXT "<%s> %s\n" diff --git a/main.c b/main.c index b4451a9..23a6679 100644 --- a/main.c +++ b/main.c @@ -88,6 +88,13 @@ int main(void) { free(tmp); } + for (size_t i = 0; i < sizeof(send_after_join) / sizeof(char *); i++) { + if (send_after_join[i] == NULL) + break; + + send(client.socket, send_after_join[i], strlen(send_after_join[i]), 0); + } + recvinfo(); }