[tin-dev] [PATCH] rfc2047.c: strings moved to lang.c
Dennis Preiser
dennis at d--p.de
Mon Nov 13 13:47:40 CET 2023
I've moved strings from rfc2047 to lang.c.
Dennis
-------------- next part --------------
--- a/include/extern.h
+++ b/include/extern.h
@@ -497,18 +497,26 @@ extern constext txt_articles_mailed[];
#ifndef DONT_HAVE_PIPING
extern constext txt_articles_piped[];
#endif /* !DONT_HAVE_PIPING */
+extern constext txt_mime_boundary[];
+extern constext txt_mime_boundary_end[];
extern constext txt_mime_charset[];
extern constext txt_mime_content_subtype[];
extern constext txt_mime_content_type[];
extern constext txt_mime_description[];
extern constext txt_mime_encoding[];
+extern constext txt_mime_hdr_c_disposition_inline[];
+extern constext txt_mime_hdr_c_transfer_encoding[];
+extern constext txt_mime_hdr_c_type_msg_rfc822[];
+extern constext txt_mime_hdr_c_type_multipart_mixed[];
+extern constext txt_mime_hdr_c_type_text_plain_charset[];
extern constext txt_mime_lang[];
extern constext txt_mime_lines[];
extern constext txt_mime_name[];
extern constext txt_mime_sep[];
extern constext txt_mime_size[];
-extern constext txt_mime_preamble_multipsrt_mixed[];
+extern constext txt_mime_preamble_multipart_mixed[];
extern constext txt_mime_unsup_charset[];
+extern constext txt_mime_version[];
extern constext txt_attachment_menu[];
extern constext txt_attachment_menu_com[];
extern constext txt_attachment_no_name[];
--- a/src/lang.c
+++ b/src/lang.c
@@ -76,20 +76,28 @@ constext txt_article_singular[] = N_("article");
constext txt_article_upper[] = N_("Article");
constext txt_articles_mailed[] = N_("-- %d %s mailed --");
constext txt_at_s[] = N_(" at %s");
+constext txt_mime_boundary[] = "--%s\n";
+constext txt_mime_boundary_end[] = "--%s--\n";
constext txt_mime_charset[] = N_("charset %s");
constext txt_mime_content_subtype[] = N_("content subtype %s");
constext txt_mime_content_type[] = N_("content type %s");
constext txt_mime_unsup_charset[] = N_("%*s[-- charset %s not supported --]\n");
constext txt_mime_description[] = N_("%*s[-- Description: %s --]\n");
constext txt_mime_encoding[] = N_("encoding %s");
+constext txt_mime_hdr_c_disposition_inline[] = "Content-Disposition: inline\n";
+constext txt_mime_hdr_c_transfer_encoding[] = "Content-Transfer-Encoding: %s\n";
+constext txt_mime_hdr_c_type_msg_rfc822[] = "Content-Type: message/rfc822\n";
+constext txt_mime_hdr_c_type_multipart_mixed[] = "Content-Type: multipart/mixed; boundary=\"%s\"\n";
+constext txt_mime_hdr_c_type_text_plain_charset[] = "Content-Type: text/plain; charset=%s\n";
constext txt_mime_lang[] = N_("lang %s");
constext txt_mime_lines[] = N_("%s lines");
constext txt_mime_name[] = N_("name %s");
constext txt_mime_sep[] = N_(", ");
constext txt_mime_size[] = N_("size %s");
-constext txt_mime_preamble_multipsrt_mixed[] = N_("This message has been composed in the 'multipart/mixed' MIME-format. If you\n\
+constext txt_mime_preamble_multipart_mixed[] = N_("This message has been composed in the 'multipart/mixed' MIME-format. If you\n\
are reading this prefix, your mail reader probably has not yet been modified\n\
to understand the new format, and some of what follows may look strange.\n\n");
+constext txt_mime_version[] = "MIME-Version: %s\n";
constext txt_attachment_menu[] = N_("Attachment Menu");
constext txt_attachment_menu_com[] = N_("Attachment Menu Commands");
constext txt_attachment_no_name[] = N_("<no name>");
--- a/src/rfc2047.c
+++ b/src/rfc2047.c
@@ -1027,13 +1027,13 @@ do_rfc15211522_encode(
*/
if (mime_headers_needed) {
if (contains_headers)
- fprintf(f, "MIME-Version: %s\n", MIME_SUPPORTED_VERSION);
+ fprintf(f, txt_mime_version, MIME_SUPPORTED_VERSION);
#ifdef CHARSET_CONVERSION
- fprintf(f, "Content-Type: text/plain; charset=%s\n", txt_mime_charsets[mmnwcharset]);
+ fprintf(f, txt_mime_hdr_c_type_text_plain_charset, txt_mime_charsets[mmnwcharset]);
#else
- fprintf(f, "Content-Type: text/plain; charset=%s\n", tinrc.mm_charset);
+ fprintf(f, txt_mime_hdr_c_type_text_plain_charset, tinrc.mm_charset);
#endif /* CHARSET_CONVERSION */
- fprintf(f, "Content-Transfer-Encoding: %s\n", mime_encoding);
+ fprintf(f, txt_mime_hdr_c_transfer_encoding, mime_encoding);
}
}
fputc('\n', f);
@@ -1275,7 +1275,7 @@ compose_mail_mime_forwarded(
if (*line != '\0')
fprintf(fp, "%s\n", line);
}
- fprintf(fp, "MIME-Version: %s\n", MIME_SUPPORTED_VERSION);
+ fprintf(fp, txt_mime_version, MIME_SUPPORTED_VERSION);
rewind(entityfp);
copy_fp(entityfp, fp);
@@ -1304,9 +1304,9 @@ compose_message_rfc822(
*is_8bit = contains_8bit_characters(articlefp);
/* Header: CT, CD, CTE */
- fprintf(fp, "Content-Type: message/rfc822\n");
- fprintf(fp, "Content-Disposition: inline\n");
- fprintf(fp, "Content-Transfer-Encoding: %s\n", *is_8bit ? txt_8bit : txt_7bit);
+ fprintf(fp, txt_mime_hdr_c_type_msg_rfc822);
+ fprintf(fp, txt_mime_hdr_c_disposition_inline);
+ fprintf(fp, txt_mime_hdr_c_transfer_encoding, *is_8bit ? txt_8bit : txt_7bit);
fputc('\n', fp);
/* Body: articlefp */
@@ -1345,35 +1345,35 @@ compose_multipart_mixed(
/*
* Header: CT with multipart boundary, CTE
- * TODO: -> lang.c
*/
generate_mime_boundary(boundary, textfp, articlefp);
- fprintf(fp, "Content-Type: multipart/mixed; boundary=\"%s\"\n", boundary);
- fprintf(fp, "Content-Transfer-Encoding: %s\n\n", requires_8bit ? txt_8bit : txt_7bit);
+ fprintf(fp, txt_mime_hdr_c_type_multipart_mixed, boundary);
+ fprintf(fp, txt_mime_hdr_c_transfer_encoding, requires_8bit ? txt_8bit : txt_7bit);
+ fputc('\n', fp);
/*
* preamble
*/
- fprintf(fp, "%s", _(txt_mime_preamble_multipsrt_mixed));
+ fprintf(fp, "%s", _(txt_mime_preamble_multipart_mixed));
/*
* Body: boundary+text, message/rfc822 part, closing boundary
*/
/* text */
- fprintf(fp, "--%s\n", boundary);
+ fprintf(fp, txt_mime_boundary, boundary);
rewind(textfp);
copy_fp(textfp, fp);
fputc('\n', fp);
/* message/rfc822 part */
- fprintf(fp, "--%s\n", boundary);
+ fprintf(fp, txt_mime_boundary, boundary);
rewind(messagefp);
copy_fp(messagefp, fp);
fclose(messagefp);
fputc('\n', fp);
/* closing boundary */
- fprintf(fp, "--%s--\n", boundary);
+ fprintf(fp, txt_mime_boundary_end, boundary);
/* TODO: insert an epilogue here? */
free(boundary);
return fp;
More information about the tin-dev
mailing list