From 0a4de3b7f0159fc44f87996e1d25678e3b456878 Mon Sep 17 00:00:00 2001 From: Test_User Date: Wed, 9 Aug 2023 23:15:35 -0400 Subject: de-hardcode hax.irc.andrewyu.org, place example in config.h --- client_network.c | 57 ++++++++++++++++++++++++++++++++++++------------------- config.h | 26 +++++++++++++------------ general_network.c | 8 ++++++-- server_network.c | 4 +++- 4 files changed, 60 insertions(+), 35 deletions(-) diff --git a/client_network.c b/client_network.c index 08b9aea..3ddad6e 100644 --- a/client_network.c +++ b/client_network.c @@ -228,28 +228,41 @@ int client_user_handler(uint64_t argc, struct string *argv) { if (add_local_client(STRING("1HC000001"), client_nick, client_hostmask, argv[0], argv[3], time(NULL)) != 0) return 1; - SENDCLIENT(STRING(":hax.irc.andrewyu.org 001 ")); + SENDCLIENT(STRING(":")); + SENDCLIENT(server_name); + SENDCLIENT(STRING(" 001 ")); SENDCLIENT(client_nick); - SENDCLIENT(STRING(" :Welcome to the Rexnet IRC Network\r\n")); - SENDCLIENT(STRING(":hax.irc.andrewyu.org 002 ")); + SENDCLIENT(STRING(" :Welcome to the Rexnet IRC Network\r\n:")); + SENDCLIENT(server_name); + SENDCLIENT(STRING(" 002 ")); SENDCLIENT(client_nick); - SENDCLIENT(STRING(" :Your host is hax.irc.andrewyu.org, running a totally not sus IRCd\r\n")); - SENDCLIENT(STRING(":hax.irc.andrewyu.org 003 ")); + SENDCLIENT(STRING(" :Your host is ")); + SENDCLIENT(server_name); + SENDCLIENT(STRING(", running a totally not sus IRCd\r\n:")); + SENDCLIENT(server_name); + SENDCLIENT(STRING(" 003 ")); SENDCLIENT(client_nick); - SENDCLIENT(STRING(" :This server was created 02:51:36 Apr 03 2023\r\n")); - SENDCLIENT(STRING(":hax.irc.andrewyu.org 004 ")); + SENDCLIENT(STRING(" :This server was created 02:51:36 Apr 03 2023\r\n:")); + SENDCLIENT(server_name); + SENDCLIENT(STRING(" 004 ")); SENDCLIENT(client_nick); - SENDCLIENT(STRING(" irc.andrewyu.org InspIRCd-3 BDGHILNORSTWcdghikorswxz ABCDEFGHIJKLMNOPQRSTXYZabcdefghijklmnopqrstuvwz :BEFHIJLXYZabdefghjkloqvw\r\n")); - SENDCLIENT(STRING(":hax.irc.andrewyu.org 005 ")); + SENDCLIENT(STRING(" ")); + SENDCLIENT(server_name); + SENDCLIENT(STRING(" InspIRCd-3 BDGHILNORSTWcdghikorswxz ABCDEFGHIJKLMNOPQRSTXYZabcdefghijklmnopqrstuvwz :BEFHIJLXYZabdefghjkloqvw\r\n:")); + SENDCLIENT(server_name); + SENDCLIENT(STRING(" 005 ")); SENDCLIENT(client_nick); - SENDCLIENT(STRING(" ACCEPT=100 AWAYLEN=200 BOT=B CALLERID=g CASEMAPPING=ascii CHANLIMIT=#:20 CHANMODES=IXZbegw,k,BEFHJLdfjl,ACDGKMNOPQRSTcimnprstuz CHANNELLEN=60 CHANTYPES=# ELIST=CMNTU ESILENCE=CcdiNnPpTtx EXCEPTS=e :are supported by this server\r\n")); - SENDCLIENT(STRING(":hax.irc.andrewyu.org 005 ")); + SENDCLIENT(STRING(" ACCEPT=100 AWAYLEN=200 BOT=B CALLERID=g CASEMAPPING=ascii CHANLIMIT=#:20 CHANMODES=IXZbegw,k,BEFHJLdfjl,ACDGKMNOPQRSTcimnprstuz CHANNELLEN=60 CHANTYPES=# ELIST=CMNTU ESILENCE=CcdiNnPpTtx EXCEPTS=e :are supported by this server\r\n:")); + SENDCLIENT(server_name); + SENDCLIENT(STRING(" 005 ")); SENDCLIENT(client_nick); - SENDCLIENT(STRING(" EXTBAN=,ACNOQRSTUacjmnprswz HOSTLEN=64 INVEX=I KEYLEN=32 KICKLEN=300 LINELEN=512 MAXLIST=I:1000,X:1000,b:1000,e:1000,g:1000,w:1000 MAXTARGETS=20 MODES=20 MONITOR=30 NAMELEN=130 NAMESX NETWORK=LibreIRC :are supported by this server\r\n")); - SENDCLIENT(STRING(":hax.irc.andrewyu.org 005 ")); + SENDCLIENT(STRING(" EXTBAN=,ACNOQRSTUacjmnprswz HOSTLEN=64 INVEX=I KEYLEN=32 KICKLEN=300 LINELEN=512 MAXLIST=I:1000,X:1000,b:1000,e:1000,g:1000,w:1000 MAXTARGETS=20 MODES=20 MONITOR=30 NAMELEN=130 NAMESX NETWORK=LibreIRC :are supported by this server\r\n:")); + SENDCLIENT(server_name); + SENDCLIENT(STRING(" 005 ")); SENDCLIENT(client_nick); - SENDCLIENT(STRING(" NICKLEN=30 OVERRIDE=O PREFIX=(Yqaohv)!~&@%+ REMOVE SAFELIST SECURELIST=60 SILENCE=100 STATUSMSG=!~&@%+ TOPICLEN=330 UHNAMES USERIP USERLEN=10 USERMODES=,,s,BDGHILNORSTWcdghikorwxz :are supported by this server\r\n")); - SENDCLIENT(STRING(":hax.irc.andrewyu.org 005 ")); + SENDCLIENT(STRING(" NICKLEN=30 OVERRIDE=O PREFIX=(Yqaohv)!~&@%+ REMOVE SAFELIST SECURELIST=60 SILENCE=100 STATUSMSG=!~&@%+ TOPICLEN=330 UHNAMES USERIP USERLEN=10 USERMODES=,,s,BDGHILNORSTWcdghikorwxz :are supported by this server\r\n:")); + SENDCLIENT(server_name); + SENDCLIENT(STRING(" 005 ")); SENDCLIENT(client_nick); SENDCLIENT(STRING(" WATCH=32 WHOX :are supported by this server\r\n")); @@ -322,8 +335,9 @@ int client_join_handler(uint64_t argc, struct string *argv) { SENDCLIENT(STRING(" ")); SENDCLIENT(user); } else { - SENDCLIENT(STRING("\r\n")); - SENDCLIENT(STRING(":hax.irc.andrewyu.org 353 ")); + SENDCLIENT(STRING("\r\n:")); + SENDCLIENT(server_name); + SENDCLIENT(STRING(" 353 ")); SENDCLIENT(client_nick); SENDCLIENT(STRING(" = ")); SENDCLIENT(channels); @@ -331,8 +345,9 @@ int client_join_handler(uint64_t argc, struct string *argv) { SENDCLIENT(user); } } - SENDCLIENT(STRING("\r\n")); - SENDCLIENT(STRING(":hax.irc.andrewyu.org 366 ")); + SENDCLIENT(STRING("\r\n:")); + SENDCLIENT(server_name); + SENDCLIENT(STRING(" 366 ")); SENDCLIENT(client_nick); SENDCLIENT(STRING(" ")); SENDCLIENT(channels); @@ -459,7 +474,9 @@ int client_ping_handler(uint64_t argc, struct string *argv) { if (argc < 1) return 1; - SENDCLIENT(STRING(":hax.irc.andrewyu.org PONG :")); + SENDCLIENT(STRING(":")); + SENDCLIENT(server_name); + SENDCLIENT(STRING(" PONG :")); SENDCLIENT(argv[0]); SENDCLIENT(STRING("\r\n")); diff --git a/config.h b/config.h index 9011e6e..3a783e5 100644 --- a/config.h +++ b/config.h @@ -32,18 +32,20 @@ #include "types.h" -extern struct string address; -extern struct string port; -extern struct string nick; -extern struct string log_channel; -extern struct string recv_password; -extern struct string send_password; -extern struct string hostmask; -extern struct string prejoin_channels[]; -extern uint64_t num_prejoin_channels; +extern struct string address; // = STRING("irc.nowhere.net"); +extern struct string port; // = STRING("1234"); +extern struct string nick; // = STRING("HaxServ"); +extern struct string server_name; // = STRING("hax.irc.nowhere.net"); -extern struct string command_prefix; +extern struct string log_channel; // = STRING("#logs"); +extern struct string recv_password; // = STRING("password we should get back from the other server"); +extern struct string send_password; // = STRING("password to send for auth"); +extern struct string hostmask; // = STRING("NetworkHaxxors/HaxServ"); +extern struct string prejoin_channels[]; // = {STRING("#logs"), STRING("#services"), STRING("#blahblahblah")} +extern uint64_t num_prejoin_channels; // = sizeof(prejoin_channels) / sizeof(*prejoin_channels); -extern struct string client_hostmask; +extern struct string command_prefix; // = STRING("."); -extern struct string opertype; +extern struct string client_hostmask; // = STRING("127.0.0.1"); + +extern struct string opertype; // = STRING("Admin"); diff --git a/general_network.c b/general_network.c index 86b60ca..475591a 100644 --- a/general_network.c +++ b/general_network.c @@ -120,11 +120,15 @@ int PRIVMSG(struct string source, struct string target, struct string message) { SENDCLIENT(STRING("@")); SENDCLIENT(hostmask); } else if (source.len == 3 && memcmp(source.data, "1HC", 3) == 0) { - SENDCLIENT(STRING(":hax.irc.andrewyu.org ")); + SENDCLIENT(STRING(":")); + SENDCLIENT(server_name); + SENDCLIENT(STRING(" ")); } SENDCLIENT(STRING(" PRIVMSG ")); } else { - SENDCLIENT(STRING(":hax.irc.andrewyu.org PRIVMSG ")); + SENDCLIENT(STRING(":")); + SENDCLIENT(server_name); + SENDCLIENT(STRING(" PRIVMSG ")); } if (target.len == 9 && memcmp(target.data, "1HC000001", 9) == 0) diff --git a/server_network.c b/server_network.c index 055e86d..6f32425 100644 --- a/server_network.c +++ b/server_network.c @@ -847,7 +847,9 @@ int initservernetwork(void) { } // probably inefficient to be calling SSL_write this frequently, but also less effort - SEND(STRING("SERVER hax.irc.andrewyu.org ")); + SEND(STRING("SERVER ")); + SEND(server_name); + SEND(STRING(" ")); SEND(send_password); SEND(STRING(" 0 1HC :HaxServ\n")); SEND(STRING("BURST ")); -- cgit v1.2.3