=================================================================== RCS file: /cvs/hypermail/hypermail/src/hypermail.c,v retrieving revision 1.15 diff -u -r1.15 hypermail.c --- hypermail/src/hypermail.c 1999/11/29 02:33:38 1.15 +++ hypermail/src/hypermail.c 1999/11/30 07:44:41 @@ -390,6 +390,11 @@ authname = setindex(set_defaultindex, "author", set_htmlsuffix); /* + * Set name of the overviewfile. FIXME, this is hardcoded + */ + overviewname = "archive_overview.hoaf" ; + + /* * General settings for mail command and rewriting. */ @@ -496,6 +501,7 @@ writethreads(amount_new); writesubjects(amount_new); writeauthors(amount_new); + writeoverview(amount_new); } else { printf("No mails to output!\n"); Index: hypermail/src/hypermail.h =================================================================== RCS file: /cvs/hypermail/hypermail/src/hypermail.h,v retrieving revision 1.14 diff -u -r1.14 hypermail.h --- hypermail/src/hypermail.h 1999/11/17 22:44:29 1.14 +++ hypermail/src/hypermail.h 1999/11/30 07:44:41 @@ -252,6 +252,7 @@ VAR char *datename; /* By date index file */ VAR char *subjname; /* By subject index file */ VAR char *thrdname; /* By thread index file */ +VAR char *overviewname; /* Easily parsable overview file */ VAR int use_mailcommand; VAR int use_mailto; Index: hypermail/src/print.c =================================================================== RCS file: /cvs/hypermail/hypermail/src/print.c,v retrieving revision 1.32 diff -u -r1.32 print.c --- hypermail/src/print.c 1999/11/29 02:33:38 1.32 +++ hypermail/src/print.c 1999/11/30 07:44:41 @@ -366,6 +366,34 @@ } } +/* +** Pretty-prints the items for the overviewfile. +*/ + +void printoverviewitems(FILE *fp, struct header *hp) +{ + char *subj; + if (hp != NULL) { + struct emailinfo *em = hp->data; + printoverviewitems(fp, hp->left); + subj = convchars(em->subject); + fprintf(fp, + " \n" + " %s\n" + " %s\n" + " %s\n" + " %s\n" + " %s\n" + " \"%.4d.%s\"\n" + " \n\n" + ,subj, getdatestr(em->date), em->name, em->emailaddr, em->msgid, + em->msgnum, set_htmlsuffix); + + free(subj); + printoverviewitems(fp, hp->right); + } +} + int showheader(char *header) { return (inlist(set_show_headers, header) || inlist(set_show_headers, "*")); @@ -1482,6 +1510,67 @@ printfooter(fp, ihtmlfooterfile, set_label, set_dir, lang[MSG_BY_AUTHOR], authname); + + fclose(fp); + + if (newfile && chmod(filename, set_filemode) == -1) { + sprintf(errmsg, "%s \"%s\": %o.", + lang[MSG_CANNOT_CHMOD], filename, set_filemode); + progerr(errmsg); + } + + if (set_showprogress) + putchar('\n'); +} + +/* +** Write the overviewfile. Might be XML based. Should be easily parseble. +*/ + +void writeoverview(int amountmsgs) +{ + int newfile; + char filename[MAXFILELEN]; + FILE *fp; + + sprintf(filename, "%s%s%s", set_dir, + (set_dir[strlen(set_dir) - 1] == '/') ? "" : "/", overviewname); + + if (isfile(filename)) + newfile = 0; + else + newfile = 1; + + if ((fp = fopen(filename, "w")) == NULL) { + sprintf(errmsg, "%s \"%s\".", lang[MSG_COULD_NOT_WRITE], filename); + progerr(errmsg); + } + + if (set_showprogress) + printf("%s \"%s\"...", lang[MSG_WRITING_DATE_INDEX], filename); + + + fprintf(fp,"\n\n"); + fprintf(fp," \n\n" + ); + fprintf(fp," \n\n"); + + fprintf(fp," \n"); + fprintf(fp," %s\n",datename); + fprintf(fp," %s\n",thrdname); + fprintf(fp," %s\n",subjname); + fprintf(fp," %s\n",authname); + fprintf(fp," \n\n"); + + fprintf(fp," \n\n"); + printoverviewitems(fp,datelist); + fprintf(fp," \n"); + + + fprintf(fp," "); + fclose(fp);