diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-03-10 17:39:19 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-03-10 17:39:19 +0000 |
commit | 024048d646e5b98846e9967984ad452d2d6bf210 (patch) | |
tree | 2fbe3f4b4b8b0b6f7be827d4fa716320fa4bf754 | |
parent | 4c5acb6a26da3aa16123e848d22e96799e545d2c (diff) |
Moved more stuff into right places
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3637 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | include/users.h | 11 | ||||
-rw-r--r-- | src/inspircd_io.cpp | 12 | ||||
-rw-r--r-- | src/users.cpp | 52 |
3 files changed, 52 insertions, 23 deletions
diff --git a/include/users.h b/include/users.h index 7d0864ffa..b6ad57c64 100644 --- a/include/users.h +++ b/include/users.h @@ -364,9 +364,6 @@ class WhoWasGroup typedef std::deque<WhoWasGroup*> whowas_set; typedef std::map<irc::string,whowas_set*> whowas_users; -/** A lightweight userrec used by WHOWAS - */ - void AddOper(userrec* user); void DeleteOper(userrec* user); void kill_link(userrec *user,const char* r); @@ -377,6 +374,12 @@ void AddClient(int socket, int port, bool iscached, in_addr ip4); void FullConnectUser(userrec* user, CullList* Goners); userrec* ReHashNick(char* Old, char* New); void force_nickchange(userrec* user,const char* newnick); -void ReadClassesAndTypes(); + +/* Configuration callbacks */ +bool InitTypes(const char* tag); +bool InitClasses(const char* tag); +bool DoType(const char* tag, char** entries, void** values, int* types); +bool DoClass(const char* tag, char** entries, void** values, int* types); +bool DoneClassesAndTypes(const char* tag); #endif diff --git a/src/inspircd_io.cpp b/src/inspircd_io.cpp index d167c5034..825b4eb31 100644 --- a/src/inspircd_io.cpp +++ b/src/inspircd_io.cpp @@ -567,6 +567,16 @@ void ServerConfig::Read(bool bail, userrec* user) {DT_CHARPTR, DT_CHARPTR}, InitXLine, DoELine, DoneXLine}, + {"type", + {"name", "classes", NULL}, + {DT_CHARPTR, DT_CHARPTR}, + InitTypes, DoType, DoneClassesAndTypes}, + + {"class", + {"name", "commands", NULL}, + {DT_CHARPTR, DT_CHARPTR}, + InitClasss, DoClass, DoneClassesAndTypes}, + {NULL} }; @@ -693,8 +703,6 @@ void ServerConfig::Read(bool bail, userrec* user) for (int n = 0; n < 12; n++) delete[] data[n]; - ReadClassesAndTypes(); - // write once here, to try it out and make sure its ok WritePID(Config->PID); diff --git a/src/users.cpp b/src/users.cpp index 13146a086..beccb7e66 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -62,35 +62,53 @@ typedef opertype_t operclass_t; opertype_t opertypes; operclass_t operclass; -void ReadClassesAndTypes() +bool InitTypes(const char* tag) { - char TypeName[MAXBUF],Classes[MAXBUF],ClassName[MAXBUF],CommandList[MAXBUF]; for (opertype_t::iterator n = opertypes.begin(); n != opertypes.end(); n++) { if (n->second) delete[] n->second; } + opertypes.clear(); + return true; +} + +bool InitClasses(const char* tag) +{ for (operclass_t::iterator n = operclass.begin(); n != operclass.end(); n++) { if (n->second) delete[] n->second; } - opertypes.clear(); operclass.clear(); - for (int j =0; j < Config->ConfValueEnum("type",&Config->config_f); j++) - { - Config->ConfValue("type","name",j,TypeName,&Config->config_f); - Config->ConfValue("type","classes",j,Classes,&Config->config_f); - opertypes[TypeName] = strdup(Classes); - log(DEBUG,"Read oper TYPE '%s' with classes '%s'",TypeName,Classes); - } - for (int k =0; k < Config->ConfValueEnum("class",&Config->config_f); k++) - { - Config->ConfValue("class","name",k,ClassName,&Config->config_f); - Config->ConfValue("class","commands",k,CommandList,&Config->config_f); - operclass[ClassName] = strdup(CommandList); - log(DEBUG,"Read oper CLASS '%s' with commands '%s'",ClassName,CommandList); - } + return true; +} + +bool DoType(const char* tag, char** entries, void** values, int* types) +{ + char* TypeName = (char*)values[0]; + char* Classes = (char*)values[1]; + /*Config->ConfValue("type","name",j,TypeName,&Config->config_f); + Config->ConfValue("type","classes",j,Classes,&Config->config_f);*/ + opertypes[TypeName] = strdup(Classes); + log(DEBUG,"Read oper TYPE '%s' with classes '%s'",TypeName,Classes); + return true; +} + +bool DoClass(const char* tag, char** entries, void** values, int* types) +{ + char* ClassName = (char*)values[0]; + char* CommandList = (char*)values[1]; + /*Config->ConfValue("class","name",k,ClassName,&Config->config_f); + Config->ConfValue("class","commands",k,CommandList,&Config->config_f);*/ + operclass[ClassName] = strdup(CommandList); + log(DEBUG,"Read oper CLASS '%s' with commands '%s'",ClassName,CommandList); + return true; +} + +bool DoneClassesAndTypes() +{ + return true; } template<typename T> inline string ConvToStr(const T &in) |