diff --git a/ChangeLog b/ChangeLog index e26b962c..7910c32b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -72,6 +72,8 @@ v0.51.4 11-Apr-2004 used if configured with --enable-experiment. The users tag directory wasn't properly cleaned before a new download session. + The message group stat counters were not updated when a user + posted a message at the bbs. mball: Added new experimental files database code which will only be @@ -88,6 +90,7 @@ v0.51.4 11-Apr-2004 without a file header. Added new experimental files database code which will only be used if configured with --enable-experiment. + Message group setup now sets mode 660 for ~/etc/mgroups.data. mbtask: Removed debug logging for the disk thread. diff --git a/mbnntp/rfc2ftn.c b/mbnntp/rfc2ftn.c index 55a17fd8..cc6be0ce 100644 --- a/mbnntp/rfc2ftn.c +++ b/mbnntp/rfc2ftn.c @@ -64,7 +64,7 @@ static int removereturnto; */ extern char *replyaddr; extern int do_mailout; - +extern int grecno; /* @@ -129,6 +129,7 @@ int rfc2ftn(FILE *fp) int sot_kludge = FALSE, eot_kludge = FALSE, tinyorigin = FALSE; int needsplit, hdrsize, datasize, splitpart, forbidsplit, rfcheaders; time_t Now; + struct tm *l_date; temp = calloc(4097, sizeof(char)); Syslog('m', "Entering rfc2ftn"); @@ -670,16 +671,52 @@ int rfc2ftn(FILE *fp) Syslog('+', "Msg (%ld) to \"%s\", \"%s\"", Msg.Id, Msg.To, Msg.Subject); do_mailout = TRUE; + /* + * Create fast scan index + */ sprintf(temp, "%s/tmp/echomail.jam", getenv("MBSE_ROOT")); if ((qfp = fopen(temp, "a")) != NULL) { fprintf(qfp, "%s %lu\n", msgs.Base, Msg.Id); fclose(qfp); } + + /* + * Link messages + */ rc = Msg_Link(msgs.Base, TRUE, CFG.slow_util); if (rc != -1) Syslog('+', "Linked %d message%s", rc, (rc != 1) ? "s":""); else Syslog('+', "Could not link messages"); + + /* + * Update statistical counters + */ + Now = time(NULL); + l_date = localtime(&Now); + msgs.LastPosted = time(NULL); + msgs.Posted.total++; + msgs.Posted.tweek++; + msgs.Posted.tdow[l_date->tm_wday]++; + msgs.Posted.month[l_date->tm_mon]++; + mgroup.LastDate = time(NULL); + mgroup.MsgsSent.total++; + mgroup.MsgsSent.tweek++; + mgroup.MsgsSent.tdow[l_date->tm_wday]++; + mgroup.MsgsSent.month[l_date->tm_mon]++; + UpdateMsgs(); + + sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT")); + if ((qfp = fopen(temp, "r+"))) { + fread(&usrconfighdr, sizeof(usrconfighdr), 1, qfp); + fseek(qfp, usrconfighdr.hdrsize + (grecno * usrconfighdr.recsize), SEEK_SET); + if (fread(&usrconfig, usrconfighdr.recsize, 1, qfp) == 1) { + usrconfig.iPosted++; + fseek(qfp, usrconfighdr.hdrsize + (grecno * usrconfighdr.recsize), SEEK_SET); + fwrite(&usrconfig, usrconfighdr.recsize, 1, qfp); + } + fclose(qfp); + } } Msg_Close(); } diff --git a/mbsebbs/mail.c b/mbsebbs/mail.c index 65ed2e3f..e602c21f 100644 --- a/mbsebbs/mail.c +++ b/mbsebbs/mail.c @@ -854,6 +854,29 @@ int Save_Msg(int IsReply, faddr *Dest) fclose(fp); } + if (strlen(msgs.Group)) { + sprintf(temp, "%s/etc/mgroups.data", getenv("MBSE_ROOT")); + if ((fp = fopen(temp, "r+")) != NULL) { + fread(&mgrouphdr, sizeof(mgrouphdr), 1, fp); + while ((fread(&mgroup, mgrouphdr.recsize, 1, fp)) == 1) { + if (!strcmp(msgs.Group, mgroup.Name)) { + mgroup.LastDate = time(NULL); + mgroup.MsgsSent.total++; + mgroup.MsgsSent.tweek++; + mgroup.MsgsSent.tdow[l_date->tm_wday]++; + mgroup.MsgsSent.month[l_date->tm_mon]++; + fseek(fp, - mgrouphdr.recsize, SEEK_CUR); + fwrite(&mgroup, mgrouphdr.recsize, 1, fp); + break; + } + } + fclose(fp); + } else { + WriteError("$Save_Msg(): Can't open %s", temp); + } + } + + /* * Add quick mailscan info */ diff --git a/mbsetup/m_mgroup.c b/mbsetup/m_mgroup.c index 5c5fcd40..134d5605 100644 --- a/mbsetup/m_mgroup.c +++ b/mbsetup/m_mgroup.c @@ -72,7 +72,7 @@ int CountMGroup(void) mgroup.Active = TRUE; fwrite(&mgroup, sizeof(mgroup), 1, fil); fclose(fil); - chmod(ffile, 0640); + chmod(ffile, 0660); return 2; } else return -1; @@ -205,7 +205,7 @@ void CloseMGroup(int force) fclose(fi); fclose(fo); unlink(fout); - chmod(fin, 0640); + chmod(fin, 0660); disk_reset(); Syslog('+', "Updated \"mgroups.data\""); if (!force) @@ -213,7 +213,7 @@ void CloseMGroup(int force) return; } } - chmod(fin, 0640); + chmod(fin, 0660); working(1, 0, 0); unlink(fout); }