diff options
author | ubq323 <ubq323@ubq323.website> | 2023-01-24 17:35:12 +0000 |
---|---|---|
committer | ubq323 <ubq323@ubq323.website> | 2023-01-24 17:35:12 +0000 |
commit | c3d79d07b96c3e2bee7bbdfbc7ec3f6e7af59e17 (patch) | |
tree | aa358412be78c9aa6967623b34b0b0d905abedb7 /irc.c | |
parent | 60a4a26ce76850f3d374d7206e702fbc6548f58b (diff) |
support passwords for joining channels, and refactor channel list into a separate module
Diffstat (limited to 'irc.c')
-rw-r--r-- | irc.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -1,20 +1,12 @@ #include "irc.h" #include "debug.h" +#include "chanlist.h" #include "conf.h" #include "util.h" int g_ircsock = -1; -char *g_chanlist[] = { - "a", - "b", - "g", - "cg", - "secret-channel", -}; -const int g_nchannels = sizeof(g_chanlist)/sizeof(g_chanlist[0]); - int irc_connect() @@ -70,6 +62,14 @@ irc_handshake() } E(irc_sendall("JOIN #",6)); E(irc_sendall(g_chanlist[i],strlen(g_chanlist[i]))); + if (g_chanpwlist[i] != NULL) { + if (strlen(g_chanpwlist[i]) > 32) { + fprintf(stderr,"channel password too long for #(%s)\n",g_chanlist[i]); + return -1; + } + E(irc_sendall(" ",1)); + E(irc_sendall(g_chanpwlist[i],strlen(g_chanpwlist[i]))); + } E(irc_sendall("\r\n",2)); } #undef E |