mirror of
https://github.com/anope/anope.git
synced 2026-07-10 09:25:43 +02:00
Remove moduleAddData|GetData|DelData and all associated mess. Extensible base replaces all this in a much cleaner and more transparent fashion.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1706 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 :)
|
||||
**/
|
||||
|
||||
-230
File diff suppressed because it is too large
Load Diff
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user