From 2be353eececbfb9ab811ac74134ed7437b641369 Mon Sep 17 00:00:00 2001 From: brain Date: Tue, 20 May 2008 18:29:15 +0000 Subject: [PATCH] A few minor fixes, some copy constructor stuff, misnamed channelmanager constructor, add files to vc8 project, configreader tidyups git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9780 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/channelmanager.h | 5 ++-- include/configreader.h | 10 +++++-- include/usermanager.h | 5 ++-- include/users.h | 4 +-- src/configreader.cpp | 9 +++--- win/inspircdVC80.vcproj | 60 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 77 insertions(+), 16 deletions(-) diff --git a/include/channelmanager.h b/include/channelmanager.h index a85cdea26..c19876859 100644 --- a/include/channelmanager.h +++ b/include/channelmanager.h @@ -14,14 +14,13 @@ #ifndef __CHANNELMANAGER_H #define __CHANNELMANAGER_H -class CoreExport ChannelManager : public classbase +class CoreExport ChannelManager : public Extensible { private: InspIRCd *ServerInstance; public: - UserManager(InspIRCd *Instance) + ChannelManager(InspIRCd *Instance) : ServerInstance(Instance) { - ServerInstance = Instance; } }; diff --git a/include/configreader.h b/include/configreader.h index 86191fa6d..7fc60203d 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -53,6 +53,10 @@ enum ConfigDataType DT_BOOTONLY = 256 /* Can only be set on startup, not on rehash */ }; +/** The maximum number of values in a core configuration tag. Can be increased if needed. + */ +#define MAX_VALUES_PER_TAG 18 + /** Holds a config value, either string, integer or boolean. * Callback functions receive one or more of these, either on * their own as a reference, or in a reference to a deque of them. @@ -193,11 +197,11 @@ struct MultiConfig /** Tag name */ const char* tag; /** One or more items within tag */ - const char* items[18]; + const char* items[MAX_VALUES_PER_TAG]; /** One or more defaults for items within tags */ - const char* items_default[18]; + const char* items_default[MAX_VALUES_PER_TAG]; /** One or more data types */ - int datatype[18]; + int datatype[MAX_VALUES_PER_TAG]; /** Initialization function */ MultiNotify init_function; /** Validation function */ diff --git a/include/usermanager.h b/include/usermanager.h index 3a9e15150..6ec80c9db 100644 --- a/include/usermanager.h +++ b/include/usermanager.h @@ -19,7 +19,7 @@ /** A list of ip addresses cross referenced against clone counts */ typedef std::map clonemap; -class CoreExport UserManager : public classbase +class CoreExport UserManager : public Extensible { private: InspIRCd *ServerInstance; @@ -28,9 +28,8 @@ class CoreExport UserManager : public classbase */ clonemap local_clones; public: - UserManager(InspIRCd *Instance) + UserManager(InspIRCd *Instance) : ServerInstance(Instance) { - ServerInstance = Instance; } ~UserManager() diff --git a/include/users.h b/include/users.h index 0d2bff012..f098500e3 100644 --- a/include/users.h +++ b/include/users.h @@ -143,7 +143,7 @@ public: registration_timeout(source->registration_timeout), flood(source->flood), host(source->host), pingtime(source->pingtime), pass(source->pass), hash(source->hash), threshold(source->threshold), sendqmax(source->sendqmax), recvqmax(source->recvqmax), maxlocal(source->maxlocal), maxglobal(source->maxglobal), maxchans(source->maxchans), - port(source->port), RefCount(0), disabled(false), limit(0) + port(source->port), RefCount(0), disabled(false), limit(source->limit) { } @@ -191,7 +191,7 @@ public: registration_timeout(source->registration_timeout), flood(source->flood), host(source->host), pingtime(source->pingtime), pass(source->pass), hash(source->hash), threshold(source->threshold), sendqmax(source->sendqmax), recvqmax(source->recvqmax), maxlocal(source->maxlocal), maxglobal(source->maxglobal), maxchans(source->maxchans), - port(source->port), RefCount(0), disabled(false), limit(0) + port(source->port), RefCount(0), disabled(false), limit(source->limit) { } diff --git a/src/configreader.cpp b/src/configreader.cpp index bc26cbd95..e18435316 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -961,7 +961,7 @@ void ServerConfig::Read(bool bail, User* user) /* Read the values of all the tags which occur once or not at all, and call their callbacks. */ - for (int Index = 0; Values[Index].tag; Index++) + for (int Index = 0; Values[Index].tag; ++Index) { char item[MAXBUF]; int dt = Values[Index].datatype; @@ -997,7 +997,6 @@ void ServerConfig::Read(bool bail, User* user) ValueContainerChar* vcc = (ValueContainerChar*)Values[Index].val; this->ValidateHostname(vi.GetString(), Values[Index].tag, Values[Index].value); vcc->Set(vi.GetString(), strlen(vi.GetString()) + 1); - ServerInstance->Logs->Log("CONFIG",DEFAULT,"Got %s", vi.GetString()); } break; case DT_IPADDRESS: @@ -1052,7 +1051,7 @@ void ServerConfig::Read(bool bail, User* user) * and call the callbacks associated with them. We have three * callbacks for these, a 'start', 'item' and 'end' callback. */ - for (int Index = 0; MultiValues[Index].tag; Index++) + for (int Index = 0; MultiValues[Index].tag; ++Index) { ServerInstance->Threads->Mutex(true); MultiValues[Index].init_function(this, MultiValues[Index].tag); @@ -1060,10 +1059,10 @@ void ServerConfig::Read(bool bail, User* user) int number_of_tags = ConfValueEnum(newconfig, MultiValues[Index].tag); - for (int tagnum = 0; tagnum < number_of_tags; tagnum++) + for (int tagnum = 0; tagnum < number_of_tags; ++tagnum) { ValueList vl; - for (int valuenum = 0; MultiValues[Index].items[valuenum]; valuenum++) + for (int valuenum = 0; (MultiValues[Index].items[valuenum]) && (valuenum < MAX_VALUES_PER_TAG); ++valuenum) { int dt = MultiValues[Index].datatype[valuenum]; bool allow_newlines = ((dt & DT_ALLOW_NEWLINE) > 0); diff --git a/win/inspircdVC80.vcproj b/win/inspircdVC80.vcproj index 3e83cbb26..7d10bfac3 100644 --- a/win/inspircdVC80.vcproj +++ b/win/inspircdVC80.vcproj @@ -1073,6 +1073,46 @@ /> + + + + + + + + + + + + + + + + @@ -1813,6 +1853,26 @@ /> + + + + + + + + -- 2.39.5