diff --git a/ChangeLog b/ChangeLog index 6874d5eb..217c31fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -35,6 +35,8 @@ v0.61.1 20-Jun-2004. name creation in default compiled mode. When editing files, after leaving a file record the file range displayed stays around the last area. + If a message area is deleted and a rulefile is present, this + rulefile is deleted too. v0.61.0 06-Jun-2004 - 20-Jun-2004 diff --git a/TODO b/TODO index 33824eb1..ea484ce7 100644 --- a/TODO +++ b/TODO @@ -66,10 +66,6 @@ newuser: L: Allow handles to be the same as the unixname. mbfido: - N: The elist rules files are named (8.3) areaname.rul where areaname - is the first 8 characters of the area name and we use the full name - only. Make sure both namings are accepted? - N: Count posted messages during mailscan. N: Code cleanup and make a structure in this program. Remove duplicate @@ -160,5 +156,3 @@ mbsetup: N: Add global setup in menus 9.1 and 10.1 at least to change uplink data. - N: When a message area is deleted, delete the rulesfile too. - diff --git a/mbsetup/m_marea.c b/mbsetup/m_marea.c index 6cf53ae1..f8901723 100644 --- a/mbsetup/m_marea.c +++ b/mbsetup/m_marea.c @@ -638,6 +638,48 @@ int SaveMsgRec(int Area, int work) +void DeleteRules(char *); +void DeleteRules(char *filename) +{ + DIR *dp; + struct dirent *de; + char temp[128]; + + if (strlen(filename) == 0) + return; + + if ((dp = opendir(CFG.rulesdir)) == NULL) + return; + + while ((de = readdir(dp))) { + if (de->d_name[0] != '.') { + strcpy(temp, msgs.Tag); + if (strcasecmp(de->d_name, temp) == 0) { + sprintf(temp, "%s/%s", CFG.rulesdir, de->d_name); + Syslog('+', "unlink(%s) rc=%d", temp, unlink(temp)); + break; + } + sprintf(temp, "%s.rul", msgs.Tag); + if (strcasecmp(de->d_name, temp) == 0) { + sprintf(temp, "%s/%s", CFG.rulesdir, de->d_name); + Syslog('+', "unlink(%s) rc=%d", temp, unlink(temp)); + break; + } + memset(&temp, 0, sizeof(temp)); + strncpy(temp, msgs.Tag, 8); + sprintf(temp, "%s.rul", temp); + if (strcasecmp(de->d_name, temp) == 0) { + sprintf(temp, "%s/%s", CFG.rulesdir, de->d_name); + Syslog('+', "unlink(%s) rc=%d", temp, unlink(temp)); + break; + } + } + } + closedir(dp); +} + + + void ShowStatus(sysconnect); void ShowStatus(sysconnect S) { @@ -662,7 +704,7 @@ void MsgGlobal(void); void MsgGlobal(void) { gr_list *mgr = NULL, *tmp; - char *p, mfile[PATH_MAX]; + char *p, mfile[PATH_MAX], *temp; FILE *fil; fidoaddr a1, a2; int menu = 0, marea, Areas, akan = 0, Found, charset = FTNC_CP437; @@ -1008,6 +1050,7 @@ void MsgGlobal(void) case 14:if (msgs.Active) { msgs.Active = FALSE; Msg_DeleteMsgBase(msgs.Base); + DeleteRules(msgs.Tag); memset(&msgs, 0, sizeof(msgs)); if (SaveMsgRec(marea, FALSE) == 0) { Done++; @@ -1311,6 +1354,7 @@ int EditMsgRec(int Area) * Make it so */ Msg_DeleteMsgBase(msgs.Base); + DeleteRules(msgs.Tag); memset(&System, 0, sizeof(System)); fseek(tfil, 0, SEEK_SET); for (i = 0; i < (msgshdr.syssize / sizeof(sysconnect)); i++)