diff --git src/file.c src/file.c index cdfa67f..7e376f1 100644 --- src/file.c +++ src/file.c @@ -655,7 +655,7 @@ char *message_name (struct emailinfo *email) else { #endif /* HAVE_LIBFNV */ - sprintf (buffer, "%.4d", email->msgnum); + sprintf (buffer, set_message_pattern, email->msgnum); return buffer; #ifdef HAVE_LIBFNV } diff --git src/finelink.c src/finelink.c index e320f8c..ec3ee89 100644 --- src/finelink.c +++ src/finelink.c @@ -181,7 +181,9 @@ static int add_anchor(int msgnum, int quoting_msgnum, int quote_num, const char struct emailinfo *ep2; if (hashnumlookup(quoting_msgnum, &ep2)) { char *path = get_path(ep, ep2); - fprintf(fp2, "%s", path, quoting_msgnum, set_htmlsuffix, quote_num, set_link_to_replies); + fprintf(fp2, "%s", set_htmlsuffix, quote_num, set_link_to_replies); if (*path) free(path); } @@ -283,19 +285,23 @@ static char *url_replying_to(struct emailinfo *email, char *line1, /* first line String_Match match_info; char *p; int subjmatch = 0; - char *anchor; + char *anchor, *pattern; struct emailinfo *ep; int statusnum = hashreplynumlookup(*quoting_msgnum, email->inreplyto, email->subject, &subjmatch); hashnumlookup(*quoting_msgnum, &ep); - trio_asprintf(&anchor, "%.4dqlink%d", *quoting_msgnum, quote_num); + trio_asprintf(&pattern, "%sqlink%%d", set_message_pattern); + trio_asprintf(&anchor, pattern, *quoting_msgnum, quote_num); + free(pattern); if (statusnum != -1) { struct emailinfo *ep2; hashnumlookup(statusnum, &ep2); if (add_anchor(statusnum, *quoting_msgnum, quote_num, anchor, line1, 0, count_quoted_lines, NULL)) { char *path = get_path(ep, ep2); char *buf; - trio_asprintf(&buf, "%s%.4d.%s#%s", path, statusnum, set_htmlsuffix, anchor); + trio_asprintf(&pattern, "%%s%s%%s#%%s", set_message_pattern); + trio_asprintf(&buf, pattern, path, statusnum, set_htmlsuffix, anchor); + free(pattern); if (maybe_reply) set_new_reply_to(statusnum, strlen(line2)); if (*path) @@ -316,7 +322,9 @@ static char *url_replying_to(struct emailinfo *email, char *line1, /* first line if (add_anchor(statusnum, *quoting_msgnum, quote_num, anchor, tptr, 1, count_quoted_lines, NULL)) { char *path = get_path(ep, ep2); char *buf; - trio_asprintf(&buf, "%s%.4d.%s#%s", path, statusnum, set_htmlsuffix, anchor); + trio_asprintf(&pattern, "%%s%s%%s#%%s", set_message_pattern); + trio_asprintf(&buf, pattern, path, statusnum, set_htmlsuffix, anchor); + free(pattern); free(tptr); if (maybe_reply) set_new_reply_to(statusnum, strlen(buf)); @@ -362,7 +370,9 @@ static char *url_replying_to(struct emailinfo *email, char *line1, /* first line hashnumlookup(match_info.msgnum, &ep2); path = get_path(ep, ep2); - trio_asprintf(&buf, "%s%.4d.%s#%s", path, match_info.msgnum, set_htmlsuffix, anchor); + trio_asprintf(&pattern, "%%s%s%%s#%%s", set_message_pattern); + trio_asprintf(&buf, pattern, path, match_info.msgnum, set_htmlsuffix, anchor); + free(pattern); set_new_reply_to(match_info.msgnum, match_info.match_len_bytes); free(parsed2); if (*path) @@ -541,8 +551,10 @@ void replace_maybe_replies(const char *filename, struct emailinfo *ep, int new_r char *tmpptr = convchars(ep2->subject, ep2->charset); if (tmpptr) { char *path = get_path(ep, ep2); - fprintf(fp2,"[ %s ]\n", - path, new_reply_to, set_htmlsuffix, lang[MSG_LTITLE_IN_REPLY_TO], + fprintf(fp2,"[ %s ]\n", + set_htmlsuffix, lang[MSG_LTITLE_IN_REPLY_TO], ep2->name, tmpptr ? tmpptr : ""); free(tmpptr); } @@ -552,10 +564,12 @@ void replace_maybe_replies(const char *filename, struct emailinfo *ep, int new_r char *tmpptr = convchars(ep2->subject, ep2->charset); if (tmpptr) { char *path = get_path(ep, ep2); - fprintf(fp2, "
%s", email->msgnum, set_txtsuffix, lang[MSG_TXT_VERSION]); + fprintf(fp, "
msgnum); + fprintf(fp, ".%s\">%s", set_txtsuffix, lang[MSG_TXT_VERSION]); } printfooter(fp, mhtmlfooterfile, set_label, set_dir, email->subject, filename, FALSE); diff --git src/setup.c src/setup.c index 3735391..ce30fc4 100644 --- src/setup.c +++ src/setup.c @@ -146,6 +146,7 @@ char *set_mhtmlfooter; char *set_attachmentlink; char *set_unsafe_chars; char *set_filename_base; +char *set_message_pattern; char *set_folder_by_date; char *set_latest_folder; @@ -910,6 +911,9 @@ struct Config cfg[] = { "# option is set to plus a file name extension if one can be found\n" "# in the name supplied by the message. This option is mainly for\n" "# languages that use different character sets from English.\n", FALSE}, + {"message_pattern", &set_message_pattern, "%.4d", CFG_STRING, + "# This option overrides the default pattern \"%.4d\" for creating\n" + "# html files.\n", FALSE}, }; /* ---------------------------------------------------------------- */ diff --git src/setup.h src/setup.h index 3a57a26..7f944c0 100644 --- src/setup.h +++ src/setup.h @@ -162,6 +162,7 @@ extern char *set_mhtmlfooter; extern char *set_attachmentlink; extern char *set_unsafe_chars; extern char *set_filename_base; +extern char *set_message_pattern; extern bool set_linkquotes; extern char *set_antispamdomain; diff --git src/threadprint.c src/threadprint.c index 5b74a0f..c1b228f 100644 --- src/threadprint.c +++ src/threadprint.c @@ -258,7 +258,11 @@ static void format_thread_info(FILE *fp, struct emailinfo *email, if (set_files_by_thread) { int maybe_reply = 0; int is_reply = 1; - fprintf(fp_body, "", email->msgnum, email->msgnum); + fprintf(fp_body, "msgnum); + fprintf(fp_body, "\" id=\""); + fprintf(fp_body, set_message_pattern, email->msgnum); + fprintf(fp_body, "\">"); print_headers(fp_body, email, TRUE); if ((set_show_msg_links && set_show_msg_links != 4) || !set_usetable) { fprintf(fp_body, "\n");