From c5cb6ef9fe5faffab9630a2d2684e7373f32403f Mon Sep 17 00:00:00 2001 From: "rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b" Date: Sun, 2 May 2004 10:34:58 +0000 Subject: [PATCH] BUILD : 1.7.2 (80) BUGS : N/A NOTES : Added Memos/ChannelInfo to the moduleAddData() system git-svn-id: svn://svn.anope.org/anope/trunk@80 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@56 5417fbe8-f217-4b02-8779-1006273d7864 --- Changes | 2 +- chanserv.c | 4 ++++ memoserv.c | 5 ++++- modules.c | 20 +++++++++++++++++++- nickserv.c | 4 ++-- services.h | 3 +++ version.log | 6 +++++- 7 files changed, 38 insertions(+), 6 deletions(-) diff --git a/Changes b/Changes index d5ac67f3c..6a45cc85d 100644 --- a/Changes +++ b/Changes @@ -1,7 +1,7 @@ Anope Version 1.7.x (will be renamed when next release is produced) ------------------- Provided by Anope Dev. -2004/05/02 Added NickCore and NickAlias to the moduleAddData stuff, its going well! +2004/05/02 Added NickCore,NickAlias,Memos,ChannelInfo to the moduleAddData stuff, its going well! 2004/04/29 Added new MemoServ command CHECK to check whether a memo has been read or not. 2004/04/26 Added module data ability, currently only added to User struct 2004/04/23 Added new MemoServ command RSEND to send a memo requesting a receipt memo once the recipient reads it. diff --git a/chanserv.c b/chanserv.c index 4e0a0cae7..304a72cfe 100644 --- a/chanserv.c +++ b/chanserv.c @@ -2182,6 +2182,7 @@ 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); } @@ -2193,6 +2194,9 @@ int delchan(ChannelInfo * ci) } if (ci->badwords) free(ci->badwords); + + moduleCleanStruct(ci->moduleData); + free(ci); if (nc) nc->channelcount--; diff --git a/memoserv.c b/memoserv.c index 5508347b4..b02573740 100644 --- a/memoserv.c +++ b/memoserv.c @@ -192,6 +192,7 @@ static 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 */ @@ -778,8 +779,10 @@ static int do_del(User * u) notice_lang(s_MemoServ, u, MEMO_DELETED_ONE, last); } else { /* Delete all memos. */ - for (i = 0; i < mi->memocount; i++) + for (i = 0; i < mi->memocount; i++) { free(mi->memos[i].text); + moduleCleanStruct(mi->memos[i].moduleData); + } free(mi->memos); mi->memos = NULL; mi->memocount = 0; diff --git a/modules.c b/modules.c index 04451d5bc..6e7564ddc 100644 --- a/modules.c +++ b/modules.c @@ -1939,10 +1939,12 @@ void moduleDelAllData(ModuleData * md[]) void moduleDelAllDataMod(Module * m) { boolean freeme = false; - int i; + int i, j; User *user; NickAlias *na; NickCore *nc; + ChannelInfo *ci; + if (!mod_current_module_name) { mod_current_module_name = sstrdup(m->name); freeme = true; @@ -1956,12 +1958,28 @@ void moduleDelAllDataMod(Module * m) /* Remove the nick Cores */ for (nc = nclists[i]; nc; nc = nc->next) { moduleDelAllData(nc->moduleData); + /* Remove any memo data for this nick core */ + for (j = 0; j < nc->memos.memocount; j++) { + moduleCleanStruct(nc->memos.memos[j].moduleData); + } } /* Remove the nick Aliases */ for (na = nalists[i]; na; na = na->next) { moduleDelAllData(na->moduleData); } } + + for (i = 0; i < 256; i++) { + /* Remove any chan info data */ + for (ci = chanlists[i]; ci; ci = ci->next) { + moduleDelAllData(ci->moduleData); + /* 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(mod_current_module_name); mod_current_module_name = NULL; diff --git a/nickserv.c b/nickserv.c index 451f961e5..a68a0ba5e 100644 --- a/nickserv.c +++ b/nickserv.c @@ -1514,14 +1514,14 @@ static int delcore(NickCore * nc) if (nc->memos.memos) { 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[i].text); } free(nc->memos.memos); } moduleCleanStruct(nc->moduleData); - free(nc); return 1; diff --git a/services.h b/services.h index 9e2e13c60..88b4a7051 100644 --- a/services.h +++ b/services.h @@ -219,6 +219,7 @@ struct memo_ { time_t time; /* When it was sent */ char sender[NICKMAX]; char *text; + ModuleData *moduleData[1024]; /* Module saved data attached to the Memo */ }; #define MF_UNREAD 0x0001 /* Memo has not yet been read */ @@ -502,6 +503,8 @@ struct chaninfo_ { struct channel_ *c; /* Pointer to channel record (if * * channel is currently in use) */ + + ModuleData *moduleData[1024]; /* Module saved data attached to the ChannelInfo */ /* For BotServ */ diff --git a/version.log b/version.log index 4132fc48e..b30a81176 100644 --- a/version.log +++ b/version.log @@ -8,11 +8,15 @@ VERSION_MAJOR="1" VERSION_MINOR="7" VERSION_PATCH="2" -VERSION_BUILD="79" +VERSION_BUILD="80" VERSION_EXTRA="" # $Log$ # +# BUILD : 1.7.2 (80) +# BUGS : N/A +# NOTES : Added Memos/ChannelInfo to the moduleAddData() system +# # BUILD : 1.7.2 (79) # BUGS : # NOTES : Added check to anoperc to see if paths work, and fixed one grammar error