summaryrefslogtreecommitdiff
path: root/src/config.c
diff options
context:
space:
mode:
authorAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-11-08 20:06:21 +0000
committerAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-11-08 20:06:21 +0000
commit458be36a321615c0f3004a6abde7e14d40f5da32 (patch)
tree711be83fc6f2d49f9d31015db51730cdac57f687 /src/config.c
parent38ad96c57c520dd84c8de21766f5de082a844a99 (diff)
Rewrote all of the old C style flag systems into a new Flag class which everything inherits from. This breaks reading and writing flags to the old databases (and probably many other things aswell) - Don't use it
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2636 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c83
1 files changed, 46 insertions, 37 deletions
diff --git a/src/config.c b/src/config.c
index 070fcfb6d..03f1fde24 100644
--- a/src/config.c
+++ b/src/config.c
@@ -95,7 +95,7 @@ static std::string NSDefaults;
char *NSGuestNickPrefix;
bool NSAllowKillImmed;
bool NSNoGroupChange;
-int NSDefFlags;
+Flags<NickCoreFlag> NSDefFlags;
unsigned NSDefLanguage;
time_t NSRegDelay;
time_t NSResendDelay;
@@ -117,7 +117,7 @@ bool NSModeOnID;
bool NSAddAccessOnReg;
static std::string CSDefaults;
-int CSDefFlags;
+Flags<ChannelInfoFlag> CSDefFlags;
unsigned CSMaxReg;
time_t CSExpire;
int CSDefBantype;
@@ -135,7 +135,7 @@ bool MSNotifyAll;
unsigned MSMemoReceipt;
static std::string BSDefaults;
-int BSDefFlags;
+Flags<BotServFlag> BSDefFlags;
time_t BSKeepData;
unsigned BSMinUsers;
unsigned BSBadWordsMax;
@@ -1785,29 +1785,34 @@ int read_config(int reload)
}
}
- NSDefFlags = 0;
- if (NSDefaults.empty()) NSDefFlags = NI_SECURE | NI_MEMO_SIGNON | NI_MEMO_RECEIVE;
+ if (NSDefaults.empty())
+ {
+ NSDefFlags.SetFlag(NI_SECURE);
+ NSDefFlags.SetFlag(NI_MEMO_SIGNON);
+ NSDefFlags.SetFlag(NI_MEMO_RECEIVE);
+ }
else if (NSDefaults != "none") {
bool hadAutoop = false;
spacesepstream options(NSDefaults);
std::string option;
- while (options.GetToken(option)) {
- if (option == "kill") NSDefFlags |= NI_KILLPROTECT;
- else if (option == "killquick") NSDefFlags |= NI_KILL_QUICK;
- else if (option == "secure") NSDefFlags |= NI_SECURE;
- else if (option == "private") NSDefFlags |= NI_PRIVATE;
+ while (options.GetToken(option))
+ {
+ if (option == "kill") NSDefFlags.SetFlag(NI_KILLPROTECT);
+ else if (option == "killquick") NSDefFlags.SetFlag(NI_KILL_QUICK);
+ else if (option == "secure") NSDefFlags.SetFlag(NI_SECURE);
+ else if (option == "private") NSDefFlags.SetFlag(NI_PRIVATE);
else if (option == "msg") {
if (!UsePrivmsg) alog("msg in <nickserv:defaults> can only be used when UsePrivmsg is set");
- else NSDefFlags |= NI_MSG;
+ else NSDefFlags.SetFlag(NI_MSG);
}
- else if (option == "hideemail") NSDefFlags |= NI_HIDE_EMAIL;
- else if (option == "hideusermask") NSDefFlags |= NI_HIDE_MASK;
- else if (option == "hidequit") NSDefFlags |= NI_HIDE_QUIT;
- else if (option == "memosignon") NSDefFlags |= NI_MEMO_SIGNON;
- else if (option == "memoreceive") NSDefFlags |= NI_MEMO_RECEIVE;
+ else if (option == "hideemail") NSDefFlags.SetFlag(NI_HIDE_EMAIL);
+ else if (option == "hideusermask") NSDefFlags.SetFlag(NI_HIDE_MASK);
+ else if (option == "hidequit") NSDefFlags.SetFlag(NI_HIDE_QUIT);
+ else if (option == "memosignon") NSDefFlags.SetFlag(NI_MEMO_SIGNON);
+ else if (option == "memoreceive") NSDefFlags.SetFlag(NI_MEMO_RECEIVE);
else if (option == "autoop") hadAutoop = true;
}
- if (!hadAutoop) NSDefFlags |= NI_AUTOOP;
+ if (!hadAutoop) NSDefFlags.SetFlag(NI_AUTOOP);
}
if (reload) {
@@ -1820,37 +1825,41 @@ int read_config(int reload)
retval = 0;
}
- CSDefFlags = 0;
- if (CSDefaults.empty()) CSDefFlags = CI_KEEPTOPIC | CI_SECURE | CI_SECUREFOUNDER | CI_SIGNKICK;
+ if (CSDefaults.empty())
+ {
+ CSDefFlags.SetFlag(CI_KEEPTOPIC);
+ CSDefFlags.SetFlag(CI_SECURE);
+ CSDefFlags.SetFlag(CI_SECUREFOUNDER);
+ CSDefFlags.SetFlag(CI_SIGNKICK);
+ }
else if (CSDefaults != "none") {
spacesepstream options(CSDefaults);
std::string option;
while (options.GetToken(option)) {
- if (option == "keeptopic") CSDefFlags |= CI_KEEPTOPIC;
- else if (option == "topiclock") CSDefFlags |= CI_TOPICLOCK;
- else if (option == "private") CSDefFlags |= CI_PRIVATE;
- else if (option == "restricted") CSDefFlags |= CI_RESTRICTED;
- else if (option == "secure") CSDefFlags |= CI_SECURE;
- else if (option == "secureops") CSDefFlags |= CI_SECUREOPS;
- else if (option == "securefounder") CSDefFlags |= CI_SECUREFOUNDER;
- else if (option == "signkick") CSDefFlags |= CI_SIGNKICK;
- else if (option == "signkicklevel") CSDefFlags |= CI_SIGNKICK_LEVEL;
- else if (option == "opnotice") CSDefFlags |= CI_OPNOTICE;
- else if (option == "xop") CSDefFlags |= CI_XOP;
- else if (option == "peace") CSDefFlags |= CI_PEACE;
+ if (option == "keeptopic") CSDefFlags.SetFlag(CI_KEEPTOPIC);
+ else if (option == "topiclock") CSDefFlags.SetFlag(CI_TOPICLOCK);
+ else if (option == "private") CSDefFlags.SetFlag(CI_PRIVATE);
+ else if (option == "restricted") CSDefFlags.SetFlag(CI_RESTRICTED);
+ else if (option == "secure") CSDefFlags.SetFlag(CI_SECURE);
+ else if (option == "secureops") CSDefFlags.SetFlag(CI_SECUREOPS);
+ else if (option == "securefounder") CSDefFlags.SetFlag(CI_SECUREFOUNDER);
+ else if (option == "signkick") CSDefFlags.SetFlag(CI_SIGNKICK);
+ else if (option == "signkicklevel") CSDefFlags.SetFlag(CI_SIGNKICK_LEVEL);
+ else if (option == "opnotice") CSDefFlags.SetFlag(CI_OPNOTICE);
+ else if (option == "xop") CSDefFlags.SetFlag(CI_XOP);
+ else if (option == "peace") CSDefFlags.SetFlag(CI_PEACE);
}
}
- BSDefFlags = 0;
if (!BSDefaults.empty()) {
spacesepstream options(BSDefaults);
std::string option;
while (options.GetToken(option)) {
- if (option == "dontkickops") BSDefFlags |= BS_DONTKICKOPS;
- else if (option == "dontkickvoices") BSDefFlags |= BS_DONTKICKVOICES;
- else if (option == "greet") BSDefFlags |= BS_GREET;
- else if (option == "fantasy") BSDefFlags |= BS_FANTASY;
- else if (option == "symbiosis") BSDefFlags |= BS_SYMBIOSIS;
+ if (option == "dontkickops") BSDefFlags.SetFlag(BS_DONTKICKOPS);
+ else if (option == "dontkickvoices") BSDefFlags.SetFlag(BS_DONTKICKVOICES);
+ else if (option == "greet") BSDefFlags.SetFlag(BS_GREET);
+ else if (option == "fantasy") BSDefFlags.SetFlag(BS_FANTASY);
+ else if (option == "symbiosis") BSDefFlags.SetFlag(BS_SYMBIOSIS);
}
}