diff --git a/Changes b/Changes index 4ce4784fc..aa5c34677 100644 --- a/Changes +++ b/Changes @@ -39,3 +39,4 @@ /topic #channel same for +b if not +o or on the channel. Suggested by Sysop_Mars - Fixed a bug where you would receive a double notice when someone does a /who 0 o - Added first part of the new config parser, s_conf2.c +- Added the next part of the new config parser \ No newline at end of file diff --git a/include/struct.h b/include/struct.h index ad7d00032..eb1a2d03b 100644 --- a/include/struct.h +++ b/include/struct.h @@ -64,8 +64,15 @@ typedef struct t_vhost aVhost; typedef struct SqlineItem aSqlineItem; typedef struct aloopStruct LoopStruct; typedef struct ConfItem aConfItem; +/* New Config Stuff */ typedef struct _configentry ConfigEntry; typedef struct _configfile ConfigFile; +typedef struct _configitem ConfigItem; +typedef struct _configitem_me ConfigItem_me; +typedef struct _configitem_admin ConfigItem_admin; +typedef struct _configitem_class ConfigItem_class; +typedef struct _configitem_oper ConfigItem_oper; + typedef struct Notify aNotify; typedef struct Client aClient; typedef struct Channel aChannel; @@ -900,6 +907,58 @@ struct _configentry }; +struct _configitem { + long flags; + ConfigItem *prev; + ConfigItem *next; +}; + +struct _confitem_me { + long flags; + ConfigItem *prev; + ConfigItem *next; + + char *name; + char *info; + short numeric; +}; + +struct _confitem_admin { + long flags; + ConfigItem *prev; + ConfigItem *next; + char *line; +}; + +struct _confitem_class { + long flags; + ConfigItem *prev; + ConfigItem *next; + char *name; + int pingfreq; + int maxclients; + int sendq; +}; + +struct _confitem_allow { + long flags; + ConfigItem *prev; + ConfigItem *next; + char *ip; + char *hostname; + ConfigItem_class *class; +}; + +struct _confitem_oper { + long flags; + ConfigItem *prev; + ConfigItem *next; + ConfigItem *from; + long oflags; + char *password; +}; + + /* * statistics structures */ @@ -1190,8 +1249,8 @@ extern char *gnulicense[]; #define FLUSH_BUFFER -2 #define COMMA "," + #ifdef USE_SSL #include "ssl.h" #endif - #endif /* __struct_include__ */ diff --git a/src/s_conf2.c b/src/s_conf2.c index 3bb8a0331..8a395d9f0 100644 --- a/src/s_conf2.c +++ b/src/s_conf2.c @@ -67,6 +67,40 @@ static ConfigFile *config_parse(char *filename, char *confdata); static void config_entry_free(ConfigEntry *ceptr); int ConfigParse(ConfigFile *cfptr); + +ConfigItem_me *conf_me = NULL; + +void add_ConfigItem(ConfigItem *item, ConfigItem **list) +{ + item->next = *list; + item->prev = NULL; + if (*list) + (*list)->prev = item; + *list = item; +} + +ConfigItem *del_ConfigItem(ConfigItem *item, ConfigItem **list) +{ + ConfigItem *p, *q; + + for (p = *list; p; p = p->next) + { + if (p == item) + { + q = p->next; + if (p->prev) + p->prev->next = p->next; + else + *list = p->next; + + if (p->next) + p->next->prev = p->prev; + return q; + } + } + return NULL; +} + static void config_error(char *format, ...) { va_list ap;