From 382e95752145e6c8408ec8ff69176575c9258cd4 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 25 Nov 2005 13:03:03 +0000 Subject: [PATCH] Fixes for removal of serverrec git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1946 e03df62e-2008-0410-955e-edbf42e46eb7 --- configure | 11 ++++++++-- include/xline.h | 2 -- src/channels.cpp | 6 +----- src/commands.cpp | 6 ++---- src/helperfuncs.cpp | 52 +++------------------------------------------ src/inspircd.cpp | 5 ++--- src/mode.cpp | 1 - src/modules.cpp | 8 +++---- src/xline.cpp | 36 +------------------------------ 9 files changed, 22 insertions(+), 105 deletions(-) diff --git a/configure b/configure index 477300a5b..956cefc49 100755 --- a/configure +++ b/configure @@ -951,7 +951,7 @@ CC = im a cheezeball CXXFLAGS = -I../include \${FLAGS} -all: socket.o hashcomp.o channels.o mode.o xline.o inspstring.o dns.o base.o inspircd_util.o inspircd_io.o message.o commands.o dnsqueue.o dynamic.o users.o modules.o wildcard.o helperfuncs.o \$(MODULES) inspircd.exe +all: socket.o hashcomp.o channels.o mode.o xline.o inspstring.o dns.o base.o inspircd_util.o inspircd_io.o message.o commands.o dnsqueue.o dynamic.o users.o modules.o wildcard.o helperfuncs.o connection.o \$(MODULES) inspircd.exe inspircd.exe: inspircd.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/channels.h ../include/globals.h ../include/inspircd_config.h ../include/base.h \$(CC) -I../include \$(FLAGS) inspircd.cpp -o inspircd.exe \$(LDLIBS) channels.o mode.o xline.o inspstring.o dns.o base.o inspircd_util.o inspircd_io.o connection.o message.o commands.o dnsqueue.o dynamic.o users.o modules.o wildcard.o servers.o helperfuncs.o hashcomp.o socket.o \$(MODULES) @@ -959,6 +959,9 @@ inspircd.exe: inspircd.cpp ../include/base.h ../include/channels.h ../include/in hashcomp.o: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp +connection.o: connection.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h + \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c connection.cpp + helperfuncs.o: helperfuncs.cpp ../include/base.h ../include/helperfuncs.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp @@ -1032,12 +1035,16 @@ CXXFLAGS = -I../include \${FLAGS} all: libIRCDsocket.so libIRCDhash.so libIRCDchannels.so libIRCDmode.so libIRCDxline.so libIRCDstring.so libIRCDasyncdns.so libIRCDbase.so libIRCDutil.so libIRCDio.so libIRCDmessage.so libIRCDcommands.so libIRCDdnsqueue.so libIRCDdynamic.so libIRCDusers.so libIRCDmodules.so libIRCDwildcard.so libIRCDhelper.so inspircd inspircd: inspircd.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/channels.h ../include/globals.h ../include/inspircd_config.h ../include/socket.h - \$(CC) -I../include \$(FLAGS) -rdynamic -L. inspircd.cpp -o inspircd \$(LDLIBS) libIRCDchannels.so libIRCDmode.so libIRCDxline.so libIRCDstring.so libIRCDasyncdns.so libIRCDbase.so libIRCDutil.so libIRCDio.so libIRCDconnection.so libIRCDmessage.so libIRCDcommands.so libIRCDdnsqueue.so libIRCDdynamic.so libIRCDusers.so libIRCDmodules.so libIRCDwildcard.so libIRCDservers.so libIRCDhelper.so libIRCDhash.so libIRCDsocket.so + \$(CC) -I../include \$(FLAGS) -rdynamic -L. inspircd.cpp -o inspircd \$(LDLIBS) libIRCDchannels.so libIRCDmode.so libIRCDxline.so libIRCDstring.so libIRCDasyncdns.so libIRCDbase.so libIRCDutil.so libIRCDio.so libIRCDconnection.so libIRCDmessage.so libIRCDcommands.so libIRCDdnsqueue.so libIRCDdynamic.so libIRCDusers.so libIRCDmodules.so libIRCDwildcard.so libIRCDhelper.so libIRCDhash.so libIRCDsocket.so libIRCDhash.so: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp \$(CC) -shared -o libIRCDhash.so hashcomp.o +libIRCDconnection.so: connection.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h + \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c connection.cpp + \$(CC) -shared -o libIRCDconnection.so connection.o + libIRCDhelper.so: helperfuncs.cpp ../include/base.h ../include/helperfuncs.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp \$(CC) -shared -o libIRCDhelper.so helperfuncs.o diff --git a/include/xline.h b/include/xline.h index d6b4e5cb4..fed1415d4 100644 --- a/include/xline.h +++ b/include/xline.h @@ -154,6 +154,4 @@ void zline_set_creation_time(char* ip, time_t create_time); bool zline_make_global(const char* ipaddr); bool qline_make_global(const char* nickname); -void sync_xlines(serverrec* serv, char* tcp_host); - #endif diff --git a/src/channels.cpp b/src/channels.cpp index d448f77e2..6af23d3b0 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -85,15 +85,11 @@ extern std::vector module_names; extern int boundPortCount; extern int portCount; -extern int SERVERportCount; + extern int ports[MAXSOCKS]; -extern int defaultRoute; -extern std::vector auth_cookies; extern std::stringstream config_f; -extern serverrec* me[32]; - extern FILE *log_file; extern time_t TIME; diff --git a/src/commands.cpp b/src/commands.cpp index 17401e0e9..a67829ffe 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -113,14 +113,12 @@ extern std::vector module_names; extern char MyExecutable[1024]; extern int boundPortCount; extern int portCount; -extern int SERVERportCount; + extern int ports[MAXSOCKS]; -extern int defaultRoute; -extern std::vector auth_cookies; extern std::stringstream config_f; -extern serverrec* me[32]; + extern FILE *log_file; diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index d6df39dbb..9f457868c 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -36,7 +36,6 @@ using namespace std; #include #include "connection.h" #include "users.h" -#include "servers.h" #include "ctables.h" #include "globals.h" #include "modules.h" @@ -66,7 +65,7 @@ extern int LogLevel; extern std::stringstream config_f; -extern serverrec* me[32]; + extern FILE *log_file; extern userrec* fd_ref_table[65536]; @@ -378,19 +377,6 @@ void ChanExceptSender(chanrec* Ptr, userrec* user, char* text, ...) std::string GetServerDescription(char* servername) { - for (int j = 0; j < 32; j++) - { - if (me[j] != NULL) - { - for (unsigned int k = 0; k < me[j]->connectors.size(); k++) - { - if (!strcasecmp(me[j]->connectors[k].GetServerName().c_str(),servername)) - { - return me[j]->connectors[k].GetDescription(); - } - } - } - } return ServerDesc; // not a remote server that can be found, it must be me. } @@ -1097,21 +1083,7 @@ long chancount(void) long count_servs(void) { - int c = 0; - for (int i = 0; i < 32; i++) - { - if (me[i] != NULL) - { - for (vector::iterator j = me[i]->connectors.begin(); j != me[i]->connectors.end(); j++) - { - if (strcasecmp(j->GetServerName().c_str(),ServerName)) - { - c++; - } - } - } - } - return c; + return 0; } long servercount(void) @@ -1183,25 +1155,7 @@ bool AllModulesReportReady(userrec* user) char islast(const char* s) { - char c = '`'; - for (int j = 0; j < 32; j++) - { - if (me[j] != NULL) - { - for (unsigned int k = 0; k < me[j]->connectors.size(); k++) - { - if (strcasecmp(me[j]->connectors[k].GetServerName().c_str(),s)) - { - c = '|'; - } - if (!strcasecmp(me[j]->connectors[k].GetServerName().c_str(),s)) - { - c = '`'; - } - } - } - } - return c; + return '+'; } long map_count(const char* s) diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 88b9e2042..17ad9d59d 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -140,7 +140,7 @@ userrec* fd_ref_table[65536]; int statsAccept = 0, statsRefused = 0, statsUnknown = 0, statsCollisions = 0, statsDns = 0, statsDnsGood = 0, statsDnsBad = 0, statsConnects = 0, statsSent= 0, statsRecv = 0; -serverrec* me[32]; + FILE *log_file; @@ -160,7 +160,7 @@ struct linger linger = { 0 }; char MyExecutable[1024]; int boundPortCount = 0; int portCount = 0, SERVERportCount = 0, ports[MAXSOCKS]; -int defaultRoute = 0; + char ModPath[MAXBUF]; /* prototypes */ @@ -172,7 +172,6 @@ char* Passwd(userrec *user); bool IsDenied(userrec *user); void AddWhoWas(userrec* u); -std::vector auth_cookies; std::stringstream config_f(stringstream::in | stringstream::out); std::vector all_opers; diff --git a/src/mode.cpp b/src/mode.cpp index 5d6d65094..32033e7f4 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -35,7 +35,6 @@ using namespace std; #include #include "connection.h" #include "users.h" -#include "servers.h" #include "ctables.h" #include "globals.h" #include "modules.h" diff --git a/src/modules.cpp b/src/modules.cpp index 3436ebd4d..0c2f36f0d 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -105,14 +105,14 @@ extern std::vector module_names; extern int boundPortCount; extern int portCount; -extern int SERVERportCount; + extern int ports[MAXSOCKS]; -extern int defaultRoute; -extern std::vector auth_cookies; + + extern std::stringstream config_f; -extern serverrec* me[32]; + extern FILE *log_file; diff --git a/src/xline.cpp b/src/xline.cpp index 24c37324a..0f329602c 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -78,15 +78,11 @@ extern std::vector module_names; extern int boundPortCount; extern int portCount; -extern int SERVERportCount; + extern int ports[MAXSOCKS]; -extern int defaultRoute; -extern std::vector auth_cookies; extern std::stringstream config_f; -extern serverrec* me[32]; - extern FILE *log_file; typedef nspace::hash_map, irc::StrHashComp> user_hash; @@ -310,36 +306,6 @@ bool zline_make_global(const char* ipaddr) return false; } -void sync_xlines(serverrec* serv, char* tcp_host) -{ - char data[MAXBUF]; - - // for zlines and qlines, we should first check if theyre global... - for (std::vector::iterator i = zlines.begin(); i != zlines.end(); i++) - { - if (i->is_global) - { - snprintf(data,MAXBUF,"%s } %s %s %lu %lu :%s",CreateSum().c_str(),i->ipaddr,i->source,(unsigned long)i->set_time,(unsigned long)i->duration,i->reason); - serv->SendPacket(data,tcp_host); - } - } - for (std::vector::iterator i = qlines.begin(); i != qlines.end(); i++) - { - if (i->is_global) - { - snprintf(data,MAXBUF,"%s { %s %s %lu %lu :%s",CreateSum().c_str(),i->nick,i->source,(unsigned long)i->set_time,(unsigned long)i->duration,i->reason); - serv->SendPacket(data,tcp_host); - } - } - // glines are always global, so no need to check - for (std::vector::iterator i = glines.begin(); i != glines.end(); i++) - { - snprintf(data,MAXBUF,"%s # %s %s %lu %lu :%s",CreateSum().c_str(),i->hostmask,i->source,(unsigned long)i->set_time,(unsigned long)i->duration,i->reason); - serv->SendPacket(data,tcp_host); - } -} - - // deletes a z:line, returns true if the line existed and was removed bool del_zline(const char* ipaddr) -- 2.39.5