summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/extern.h1
-rw-r--r--include/modules.h5
-rw-r--r--include/services.h16
-rw-r--r--include/users.h2
-rw-r--r--src/chanserv.c2
-rw-r--r--src/core/ms_del.c1
-rw-r--r--src/memoserv.c2
-rw-r--r--src/module.cpp3
-rw-r--r--src/modules.c230
-rw-r--r--src/nickserv.c3
-rw-r--r--src/users.c3
11 files changed, 0 insertions, 268 deletions
diff --git a/include/extern.h b/include/extern.h
index 407e9454f..6e3495ece 100644
--- a/include/extern.h
+++ b/include/extern.h
@@ -715,7 +715,6 @@ E int str_is_cidr(char *str, uint32 * ip, uint32 * mask, char **host);
/**** modules.c ****/
E void modules_unload_all(bool fini, bool unload_proto); /* Read warnings near function source */
-E void moduleCleanStruct(ModuleData **moduleData);
E void ModuleDatabaseBackup(const char *dbname);
E void ModuleRemoveBackups(const char *dbname);
diff --git a/include/modules.h b/include/modules.h
index 6953ec476..c09b234c2 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -458,11 +458,6 @@ MDE void moduleDeleteLanguage(int langNumber);
/*************************************************************************/
-MDE char *moduleGetData(ModuleData **md, const char *key); /* Get the value for this key from this struct */
-MDE int moduleAddData(ModuleData **md, const char *key, char *value); /* Set the value for this key for this struct */
-MDE void moduleDelData(ModuleData **md, const char *key); /* Delete this key/value pair */
-MDE void moduleDelAllData(ModuleData **md); /* Delete all key/value pairs for this module for this struct */
-void moduleDelAllDataMod(Module *m); /* remove all module data from all structs for this module */
MDE bool moduleMinVersion(int major,int minor,int patch,int build); /* Checks if the current version of anope is before or after a given verison */
/*************************************************************************/
diff --git a/include/services.h b/include/services.h
index d6cdc015b..70aaf0066 100644
--- a/include/services.h
+++ b/include/services.h
@@ -391,7 +391,6 @@ typedef struct server_ Server;
typedef struct channel_ Channel;
typedef struct c_elist EList;
typedef struct c_elist_entry Entry;
-typedef struct ModuleData_ ModuleData; /* ModuleData struct */
typedef struct memo_ Memo;
typedef struct badword_ BadWord;
typedef struct bandata_ BanData;
@@ -581,20 +580,6 @@ typedef struct {
/*************************************************************************/
-
-/**
- * ModuleData strucs used to allow modules to add / delete module Data from existing structs
- */
-
-struct ModuleData_ {
- char *moduleName; /* Which module we belong to */
- char *key; /* The key */
- char *value; /* The Value */
- ModuleData *next; /* The next ModuleData record */
-};
-
- /*************************************************************************/
-
/* Memo info structures. Since both nicknames and channels can have memos,
* we encapsulate memo data in a MemoList to make it easier to handle. */
@@ -604,7 +589,6 @@ struct memo_ {
time_t time; /* When it was sent */
char sender[NICKMAX];
char *text;
- ModuleData *moduleData; /* Module saved data attached to the Memo */
#ifdef USE_MYSQL
uint32 id; /* Database ID; see mysql.c */
#endif
diff --git a/include/users.h b/include/users.h
index db0d42818..c8fc7e343 100644
--- a/include/users.h
+++ b/include/users.h
@@ -44,8 +44,6 @@ class User : public Extensible
NickAlias *na;
- ModuleData *moduleData; /* defined for it, it should allow the module Add/Get */
-
int isSuperAdmin; /* is SuperAdmin on or off? */
struct u_chanlist *chans; /* Channels user has joined */
diff --git a/src/chanserv.c b/src/chanserv.c
index 44b2a690a..3327f5b06 100644
--- a/src/chanserv.c
+++ b/src/chanserv.c
@@ -482,7 +482,6 @@ void load_cs_dbase(void)
memos->time = tmp32;
SAFE(read = read_buffer(memos->sender, f));
SAFE(read_string(&memos->text, f));
- memos->moduleData = NULL;
}
}
@@ -1779,7 +1778,6 @@ int delchan(ChannelInfo * ci)
for (i = 0; i < ci->memos.memocount; i++) {
if (ci->memos.memos[i].text)
free(ci->memos.memos[i].text);
- moduleCleanStruct(&ci->memos.memos[i].moduleData);
}
free(ci->memos.memos);
}
diff --git a/src/core/ms_del.c b/src/core/ms_del.c
index 1f30eb25e..0924dd7d8 100644
--- a/src/core/ms_del.c
+++ b/src/core/ms_del.c
@@ -136,7 +136,6 @@ int do_del(User * u)
/* Delete all memos. */
for (i = 0; i < mi->memocount; i++) {
free(mi->memos[i].text);
- moduleCleanStruct(&mi->memos[i].moduleData);
}
free(mi->memos);
mi->memos = NULL;
diff --git a/src/memoserv.c b/src/memoserv.c
index 0054f3f9c..d9bd61b93 100644
--- a/src/memoserv.c
+++ b/src/memoserv.c
@@ -256,7 +256,6 @@ void memo_send(User * u, char *name, char *text, int z)
mi->memos = (Memo *)srealloc(mi->memos, sizeof(Memo) * mi->memocount);
m = &mi->memos[mi->memocount - 1];
strscpy(m->sender, source, NICKMAX);
- m->moduleData = NULL;
if (mi->memocount > 1) {
m->number = m[-1].number + 1;
if (m->number < 1) {
@@ -346,7 +345,6 @@ int delmemo(MemoInfo * mi, int num)
break;
}
if (i < mi->memocount) {
- moduleCleanStruct(&mi->memos[i].moduleData);
free(mi->memos[i].text); /* Deallocate memo text memory */
mi->memocount--; /* One less memo now */
if (i < mi->memocount) /* Move remaining memos down a slot */
diff --git a/src/module.cpp b/src/module.cpp
index 5676b16fb..d0929bfdd 100644
--- a/src/module.cpp
+++ b/src/module.cpp
@@ -86,9 +86,6 @@ Module::~Module()
/* Kill any active callbacks this module has */
moduleCallBackPrepForUnload(this->name.c_str());
- /* Remove any stored data this module has */
- moduleDelAllDataMod(this);
-
/**
* ok, im going to walk every hash looking for commands we own, now, not exactly elegant or efficiant :)
**/
diff --git a/src/modules.c b/src/modules.c
index 3d9355944..7120d5c4e 100644
--- a/src/modules.c
+++ b/src/modules.c
@@ -1128,236 +1128,6 @@ void moduleDisplayHelp(int service, User * u)
}
/**
- * 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, const char *key, char *value)
-{
- ModuleData *newData = NULL;
-
- if (mod_current_module_name == NULL) {
- alog("moduleAddData() called with mod_current_module_name being NULL");
- if (debug)
- do_backtrace(0);
- }
-
- if (!key || !value) {
- alog("A module (%s) tried to use ModuleAddData() with one or more NULL arguments... returning", mod_current_module_name);
- return MOD_ERR_PARAMS;
- }
-
- moduleDelData(md, key); /* Remove any existing module data for this module with the same key */
-
- newData = (ModuleData *)malloc(sizeof(ModuleData));
- if (!newData) {
- return MOD_ERR_MEMORY;
- }
-
- newData->moduleName = sstrdup(mod_current_module_name);
- newData->key = sstrdup(key);
- newData->value = sstrdup(value);
- newData->next = *md;
- *md = newData;
-
- return MOD_ERR_OK;
-}
-
-/**
- * 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
- * @param key The key to find the data for
- * @return the value paired to the given key will be returned, or NULL
- **/
-char *moduleGetData(ModuleData ** md, const char *key)
-{
- /* See comment in moduleAddData... -GD */
- char *mod_name = sstrdup(mod_current_module_name);
- ModuleData *current = *md;
-
- if (mod_current_module_name == NULL) {
- alog("moduleGetData() called with mod_current_module_name being NULL");
- if (debug)
- do_backtrace(0);
- }
-
- if (debug) {
- alog("debug: moduleGetData %p : key %s", (void *) md, key);
- alog("debug: Current Module %s", mod_name);
- }
-
- while (current) {
- if ((stricmp(current->moduleName, mod_name) == 0)
- && (stricmp(current->key, key) == 0)) {
- free(mod_name);
- return sstrdup(current->value);
- }
- current = current->next;
- }
- free(mod_name);
- return NULL;
-}
-
-/**
- * Delete the key/value pair indicated by "key" for the current module.
- * This allows module coders to remove a previously stored key/value pair.
- * @param md The module data for the struct to be used
- * @param key The key to delete the key/value pair for
- **/
-void moduleDelData(ModuleData ** md, const char *key)
-{
- /* See comment in moduleAddData... -GD */
- char *mod_name = sstrdup(mod_current_module_name);
- ModuleData *current = *md;
- ModuleData *prev = NULL;
- ModuleData *next = NULL;
-
- if (mod_current_module_name == NULL) {
- alog("moduleDelData() called with mod_current_module_name being NULL");
- if (debug)
- do_backtrace(0);
- }
-
- if (key) {
- while (current) {
- next = current->next;
- if ((stricmp(current->moduleName, mod_name) == 0)
- && (stricmp(current->key, key) == 0)) {
- if (prev) {
- prev->next = current->next;
- } else {
- *md = current->next;
- }
- free(current->moduleName);
- free(current->key);
- free(current->value);
- current->next = NULL;
- free(current);
- } else {
- prev = current;
- }
- current = next;
- }
- }
- free(mod_name);
-}
-
-/**
- * This will remove all data for a particular module from existing structs.
- * Its primary use is modulePrepForUnload() however, based on past expericance with module coders wanting to
- * do just about anything and everything, its safe to use from inside the module.
- * @param md The module data for the struct to be used
- **/
-void moduleDelAllData(ModuleData ** md)
-{
- /* See comment in moduleAddData... -GD */
- char *mod_name = sstrdup(mod_current_module_name);
- ModuleData *current = *md;
- ModuleData *prev = NULL;
- ModuleData *next = NULL;
-
- if (mod_current_module_name == NULL) {
- alog("moduleDelAllData() called with mod_current_module_name being NULL");
- if (debug)
- do_backtrace(0);
- }
-
- while (current) {
- next = current->next;
- if ((stricmp(current->moduleName, mod_name) == 0)) {
- if (prev) {
- prev->next = current->next;
- } else {
- *md = current->next;
- }
- free(current->moduleName);
- free(current->key);
- free(current->value);
- current->next = NULL;
- free(current);
- } else {
- prev = current;
- }
- current = next;
- }
- free(mod_name);
-}
-
-/**
- * This will delete all module data used in any struct by module m.
- * @param m The module to clear all data for
- **/
-void moduleDelAllDataMod(Module * m)
-{
- bool freeme = false;
- int i, j;
- User *user;
- NickAlias *na;
- NickCore *nc;
- ChannelInfo *ci;
-
- if (!mod_current_module_name) {
- mod_current_module_name = sstrdup(m->name.c_str());
- freeme = true;
- }
-
- for (i = 0; i < 1024; i++) {
- /* Remove the users */
- for (user = userlist[i]; user; user = user->next) {
- moduleDelAllData(&user->moduleData);
- }
- /* Remove the nick Cores */
- for (nc = nclists[i]; nc; nc = nc->next) {
- /* Remove any memo data for this nick core */
- for (j = 0; j < nc->memos.memocount; j++) {
- moduleCleanStruct(&nc->memos.memos[j].moduleData);
- }
- }
- }
-
- for (i = 0; i < 256; i++) {
- /* Remove any chan info data */
- for (ci = chanlists[i]; ci; ci = ci->next) {
- /* Remove any memo data for this nick core */
- for (j = 0; j < ci->memos.memocount; j++) {
- moduleCleanStruct(&ci->memos.memos[j].moduleData);
- }
- }
- }
-
- if (freeme) {
- free((void *)mod_current_module_name);
- mod_current_module_name = NULL;
- }
-}
-
-/**
- * Remove any data from any module used in the given struct.
- * Useful for cleaning up when a User leave's the net, a NickCore is deleted, etc...
- * @param moduleData the moduleData struct to "clean"
- **/
-void moduleCleanStruct(ModuleData ** moduleData)
-{
- ModuleData *current = *moduleData;
- ModuleData *next = NULL;
-
- while (current) {
- next = current->next;
- free(current->moduleName);
- free(current->key);
- free(current->value);
- current->next = NULL;
- free(current);
- current = next;
- }
- *moduleData = NULL;
-}
-
-/**
* Check the current version of anope against a given version number
* Specifiying -1 for minor,patch or build
* @param major The major version of anope, the first part of the verison number
diff --git a/src/nickserv.c b/src/nickserv.c
index 2e1a68934..4bfbe9527 100644
--- a/src/nickserv.c
+++ b/src/nickserv.c
@@ -343,7 +343,6 @@ void load_old_ns_dbase(void)
memos->time = tmp32;
SAFE(read_buffer(memos->sender, f));
SAFE(read_string(&memos->text, f));
- memos->moduleData = NULL;
}
}
@@ -539,7 +538,6 @@ void load_ns_dbase(void)
memos->time = tmp32;
SAFE(read_buffer(memos->sender, f));
SAFE(read_string(&memos->text, f));
- memos->moduleData = NULL;
}
}
@@ -1257,7 +1255,6 @@ static int delcore(NickCore * nc)
for (i = 0; i < nc->memos.memocount; i++) {
if (nc->memos.memos[i].text)
free(nc->memos.memos[i].text);
- moduleCleanStruct(&nc->memos.memos[i].moduleData);
}
free(nc->memos.memos);
}
diff --git a/src/users.c b/src/users.c
index fba9a6611..40750d221 100644
--- a/src/users.c
+++ b/src/users.c
@@ -43,7 +43,6 @@ User::User(const std::string &snick)
na = NULL;
chans = NULL;
founder_chans = NULL;
- moduleData = NULL;
timestamp = my_signon = svid = mode = invalid_pw_time = lastmemosend = lastnickreg = lastmail = 0;
strscpy(this->nick, snick.c_str(), NICKMAX);
@@ -253,8 +252,6 @@ User::~User()
if (this->nickTrack)
free(this->nickTrack);
- moduleCleanStruct(&this->moduleData);
-
if (debug >= 2)
alog("debug: User::~User(): delete from list");