diff options
-rw-r--r-- | Changes | 2 | ||||
-rwxr-xr-x | configure | 6 | ||||
-rw-r--r-- | modules.c | 128 | ||||
-rw-r--r-- | modules.h | 7 | ||||
-rw-r--r-- | services.h | 1 | ||||
-rw-r--r-- | version.log | 7 |
6 files changed, 7 insertions, 144 deletions
@@ -1,7 +1,7 @@ Anope Version S V N ------------------- Provided by Anope Dev. <dev@anope.org> - 2004 -06/22 F Changed strcasecmp to stricmp as it should be [ #00] +06/22 F Changed all strcasecmp's to stricmp's [ #00] 06/20 F PTLink server support [ #00] 06/18 A Added proper Bahamut1.8 support. [ #55] @@ -710,12 +710,6 @@ if [ "$USE_MODULES" = "USE_MODULES" ] ; then ok=1 fi fi - if [ ! -d "$INPUT/data/" ] ; then - if mkdir -p $INPUT/data/ ; then - ok=1 - fi - fi - done MODULE_PATH=$INPUT echo "" @@ -1755,17 +1755,13 @@ void moduleDisplayHelp(int service, User * u) /** * Add module data to a struct. - * This actaully adds the request data to the moduleData structs, this should not be called directly from modules. + * This allows module coders to add data to an existing struct * @param md The module data for the struct to be used * @param key The Key for the key/value pair * @param value The value for the key/value pair, this is what will be stored for you - * @param persistant Should the key/value pair be persistant? * @return MOD_ERR_OK will be returned on success - * @see moduleAddData - * @see moduleAddPersistantData **/ -int moduleAddDataValue(ModuleData * md[], char *key, char *value, - int persistant) +int moduleAddData(ModuleData * md[], char *key, char *value) { char *mod_name = sstrdup(mod_current_module_name); @@ -1817,7 +1813,6 @@ int moduleAddDataValue(ModuleData * md[], char *key, char *value, } item->next = NULL; item->key = strdup(key); - item->persistant = persistant; item->value = strdup(value); if (lastItem) lastItem->next = item; @@ -1835,32 +1830,6 @@ int moduleAddDataValue(ModuleData * md[], char *key, char *value, } /** - * Add persistant module data to a struct. - * This allows module coders to add data to an existing struct, and have anope take care of loading/saving it! - * @param md The module data for the struct to be used - * @param key The Key for the key/value pair - * @param value The value for the key/value pair, this is what will be stored for you - * @return MOD_ERR_OK will be returned on success - **/ -int moduleAddPersistantData(ModuleData * md[], char *key, char *value) -{ - return moduleAddDataValue(md, key, value, 1); -} - -/** - * Add module data to a struct. - * This allows module coders to add data to an existing struct - * @param md The module data for the struct to be used - * @param key The Key for the key/value pair - * @param value The value for the key/value pair, this is what will be stored for you - * @return MOD_ERR_OK will be returned on success - **/ -int moduleAddData(ModuleData * md[], char *key, char *value) -{ - return moduleAddDataValue(md, key, value, 0); -} - -/** * Returns the value from a key/value pair set. * This allows module coders to retrive any data they have previuosly stored in any given struct * @param md The module data for the struct to be used @@ -2057,97 +2026,4 @@ void moduleCleanStruct(ModuleData * moduleData[]) } } -/** - * Load any data relevant for this module - * @param m The module to Load the data for - **/ -void moduleLoadAllData(Module * m) -{ - FILE *in; - char buffer[2000]; /* will _never_ be this big thanks to the 512 limit of a message */ - char filename[4096]; - char *key = NULL; - char *value = NULL; - char *service = NULL; - char *str_key = NULL; - int len; - enum MODULE_DATA_TYPE struc; - NickCore *nc; - NickAlias *na; - Channel *c; - - strncpy(filename, MODULE_PATH, 4095); - len = strlen(filename); - strncat(filename, "data/", 4095 - len); - len = strlen(filename); - strncat(filename, m->name, 4095 - len); - len = strlen(filename); - strncat(filename, ".db", 4095 - len); - - if ((in = fopen(filename, "r")) == NULL) { - alog("unable to open module data file [%s] for reading, module data will not be loaded", filename); - } else { - while (!feof(in)) { - fgets(buffer, 1500, in); - service = myStrGetToken(buffer, ' ', 0); - str_key = myStrGetToken(buffer, ' ', 1); - key = myStrGetToken(buffer, ' ', 2); - value = myStrGetTokenRemainder(buffer, ' ', 3); - if (service) { - struc = atoi(service); - if (str_key) { - if (key) { - if (value) { - switch (struc) { - case MD_NICK_CORE: - nc = findcore(str_key); - if (nc) { - moduleAddPersistantData(nc->moduleData, - key, value); - } - break; - case MD_NICK_ALIAS: - na = findnick(str_key); - if (na) { - moduleAddPersistantData(na->moduleData, - key, value); - } - break; - case MD_NICK_MEMO: - - break; - case MD_CHAN_MEMO: - - break; - case MD_CHAN_INFO: - c = findchan(name); - if (c && c->ci) { - moduleAddPersistantData(c->ci-> - moduleData, - key, value); - } - break; - } - free(value); - } - free(key); - } - free(str_key); - } - free(service); - } - } - } -} - -/** - * Save any data relevant for this module - * @param m The module to Save the data for - **/ -void moduleSaveAllData(Module * m) -{ - -} - - /* EOF */ @@ -74,8 +74,6 @@ extern CommandHash *HELPSERV[MAX_CMD_HASH]; extern CommandHash *OPERSERV[MAX_CMD_HASH]; extern MessageHash *IRCD[MAX_CMD_HASH]; -enum MODULE_DATA_TYPE { MD_NICK_CORE = 1, MD_NICK_ALIAS = 2, MD_NICK_MEMO = 3, MD_CHAN_MEMO =4, MD_CHAN_INFO = 5}; - struct Module_ { char *name; char *filename; @@ -223,15 +221,12 @@ void moduleDelCallback(char *name); void moduleCallBackRun(void); char *moduleGetData(ModuleData *md[], char *key); /* Get the value for this key from this struct */ -int moduleAddDataValue(ModuleData * md[], char *key, char *value,int persistant); /* Store the value in the struct */ -int moduleAddPersistantData(ModuleData * md[], char *key, char *value); /* Set the value for this key for this struct to be saved*/ int moduleAddData(ModuleData *md[], char *key, char *value); /* Set the value for this key for this struct */ void moduleDelData(ModuleData *md[], char *key); /* Delete this key/value pair */ void moduleDelAllData(ModuleData *md[]); /* Delete all key/value pairs for this module for this struct */ void moduleCleanStruct(ModuleData * moduleData[]); /* Clean a moduleData hash */ void moduleDelAllDataMod(Module *m); /* remove all module data from all structs for this module */ -void moduleLoadAllData(Module *m); /* Load any persistant module data settings */ -void moduleSaveAllData(Module *m); /* Save any persistant module data settings */ + /*************************************************************************/ #endif diff --git a/services.h b/services.h index 62e7d2aa9..6033673a0 100644 --- a/services.h +++ b/services.h @@ -424,7 +424,6 @@ struct ModuleDataItem_ { char *key; /* The key */ char *value; /* The Value */ ModuleDataItem *next; /* The next ModuleDataItem in this list */ - int persistant; /* Is this value persistant? */ }; struct ModuleData_ { diff --git a/version.log b/version.log index 7bb7d93eb..8ae6ecbf4 100644 --- a/version.log +++ b/version.log @@ -8,14 +8,13 @@ VERSION_MAJOR="1" VERSION_MINOR="7" VERSION_PATCH="4" -VERSION_BUILD="210" +VERSION_BUILD="211" # $Log$ # -# BUILD : 1.7.4 (210) +# BUILD : 1.7.4 (211) # BUGS : N/A -# NOTES : Changed strcasecmp to stricmp -# +# NOTES : Fixed a booboo with my last commit :) # # BUILD : 1.7.4 (209) # BUGS : none |