talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit e6503663b06663e366a045fa45848ed967023e41
parent 2b423d631037f5a575dfd770f5ad1b5fa9c897f8
Author: Oliver Lowe <o@olowe.co>
Date:   Fri, 15 Aug 2025 11:28:11 +1000

Remove text/enriched support

Not used, unfortunately. Or fortunately?

Diffstat:
Msrc/Makefile.am | 3---
Dsrc/enriched.c | 228-------------------------------------------------------------------------------
Dsrc/enriched.h | 67-------------------------------------------------------------------
Msrc/mimeview.c | 2--
Dsrc/pixmaps/mime_text_enriched.xpm | 87-------------------------------------------------------------------------------
Msrc/procmime.c | 13-------------
Msrc/stock_pixmap.c | 2--
Msrc/textview.c | 46----------------------------------------------
8 files changed, 0 insertions(+), 448 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am @@ -67,7 +67,6 @@ claws_mail_SOURCES = \ customheader.c \ displayheader.c \ edittags.c \ - enriched.c \ entity.c \ export.c \ filtering.c \ @@ -176,7 +175,6 @@ claws_mailinclude_HEADERS = \ customheader.h \ displayheader.h \ edittags.h \ - enriched.h \ entity.h \ export.h \ filtering.h \ @@ -389,7 +387,6 @@ EXTRA_DIST = \ pixmaps/mime_ps.xpm \ pixmaps/mime_calendar.xpm \ pixmaps/mime_pgpsig.xpm \ - pixmaps/mime_text_enriched.xpm \ pixmaps/mime_text_html.xpm \ pixmaps/mime_text_patch.xpm \ pixmaps/mime_text_plain.xpm \ diff --git a/src/enriched.c b/src/enriched.c @@ -1,228 +0,0 @@ -/* - * Claws Mail -- a GTK based, lightweight, and fast e-mail client - * Copyright (C) 1999,2000 Hiroyuki Yamamoto - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#include "claws-features.h" -#endif - -#include <glib.h> -#include <stdio.h> -#include <string.h> -#include <ctype.h> - -#include "enriched.h" -#include "utils.h" - -#define ERTFBUFSIZE 8192 - - -static ERTFState ertf_read_line (ERTFParser *parser); -static void ertf_append_char (ERTFParser *parser, - gchar ch); - -static ERTFState ertf_parse_tag (ERTFParser *parser); -static void ertf_get_parenthesis (ERTFParser *parser, - gchar *buf, - gint len); - -ERTFParser *ertf_parser_new(FILE *fp, CodeConverter *conv) -{ - ERTFParser *parser; - - cm_return_val_if_fail(fp != NULL, NULL); - cm_return_val_if_fail(conv != NULL, NULL); - - parser = g_new0(ERTFParser, 1); - parser->fp = fp; - parser->conv = conv; - parser->str = g_string_new(NULL); - parser->buf = g_string_new(NULL); - parser->bufp = parser->buf->str; - parser->newline = TRUE; - parser->empty_line = TRUE; - parser->space = FALSE; - parser->pre = FALSE; - - return parser; -} - -void ertf_parser_destroy(ERTFParser *parser) -{ - g_string_free(parser->str, TRUE); - g_string_free(parser->buf, TRUE); - g_free(parser); -} - -gchar *ertf_parse(ERTFParser *parser) -{ - parser->state = ERTF_NORMAL; - g_string_truncate(parser->str, 0); - - if (*parser->bufp == '\0') { - g_string_truncate(parser->buf, 0); - parser->bufp = parser->buf->str; - if (ertf_read_line(parser) == ERTF_EOF) - return NULL; - } - - while (*parser->bufp != '\0') { - switch (*parser->bufp) { - case '<': - if (parser->bufp[1]=='<') { - ertf_append_char(parser,'<'); - parser->bufp+=2; - } - else if (parser->str->len == 0) - ertf_parse_tag(parser); - else - return parser->str->str; - break; - case '\n': - case '\r': - if (parser->bufp[0] == '\r' && parser->bufp[1] == '\n') - parser->bufp++; - - if (!parser->pre) { - /* When not pre (not <nofill>), 1 CRLF = SPACE, N>1 CRLF = N-1 CRLF*/ - if (!parser->newline) { - parser->newline = TRUE; - parser->space = TRUE; - parser->bufp++; - break; - } - - } - default: - ertf_append_char(parser, *parser->bufp++); - } - } - - return parser->str->str; -} - -static ERTFState ertf_read_line(ERTFParser *parser) -{ - gchar buf[ERTFBUFSIZE]; - gchar buf2[ERTFBUFSIZE]; - gint index; - - if (fgets(buf, sizeof(buf), parser->fp) == NULL) { - parser->state = ERTF_EOF; - return ERTF_EOF; - } - - if (conv_convert(parser->conv, buf2, sizeof(buf2), buf) < 0) { - g_warning("ertf_read_line(): code conversion failed"); - - index = parser->bufp - parser->buf->str; - - g_string_append(parser->buf, buf); - - parser->bufp = parser->buf->str + index; - - return ERTF_ERR; - } - - index = parser->bufp - parser->buf->str; - - g_string_append(parser->buf, buf2); - - parser->bufp = parser->buf->str + index; - - return ERTF_NORMAL; -} - -static void ertf_append_char(ERTFParser *parser, gchar ch) -{ - GString *str = parser->str; - - if (!parser->pre && parser->space) { - if (ch != '\n') - g_string_append_c(str, ' '); - parser->space = FALSE; - } - - g_string_append_c(str, ch); - - parser->empty_line = FALSE; - if (ch == '\n') { - if (parser->newline) - parser->empty_line = TRUE; - else - parser->newline = TRUE; - } else - parser->newline = FALSE; -} - -static ERTFState ertf_parse_tag(ERTFParser *parser) -{ - gchar buf[ERTFBUFSIZE]; - gchar *p; - gchar *down; - - ertf_get_parenthesis (parser, buf, sizeof(buf)); - - for (p = buf; *p != '\0'; p++) { - if (isspace (*(guchar *)p)) { - *p = '\0'; - break; - } - } - - parser->state = ERTF_UNKNOWN; - if (buf[0] == '\0') return parser->state; - - down = g_utf8_strdown (buf, -1); - - if (!strcmp(down, "nofill")) { - parser->pre = TRUE; - parser->state = ERTF_NOFILL; - } - else if (!strcmp(down, "/nofill")) { - parser->pre = FALSE; - parser->state = ERTF_NORMAL; - } - g_free(down); - return parser->state; -} - -static void ertf_get_parenthesis(ERTFParser *parser, gchar *buf, gint len) -{ - gchar *p; - - buf[0] = '\0'; - cm_return_if_fail(*parser->bufp == '<'); - - /* ignore params */ - if (!g_ascii_strncasecmp(parser->bufp, "<param>", 4)) { - parser->bufp += 7; - while ((p = strstr(parser->bufp, "</param>")) == NULL) - if (ertf_read_line(parser) == ERTF_EOF) return; - parser->bufp = p + 8; - return; - } - parser->bufp++; - while ((p = strchr(parser->bufp, '>')) == NULL) - if (ertf_read_line(parser) == ERTF_EOF) return; - - strncpy2(buf, parser->bufp, MIN(p - parser->bufp + 1, len)); - parser->bufp = p + 1; -} - diff --git a/src/enriched.h b/src/enriched.h @@ -1,67 +0,0 @@ -/* - * Claws Mail -- a GTK based, lightweight, and fast e-mail client - * Copyright (C) 1999,2000 Hiroyuki Yamamoto - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -#ifndef __ERTF_H__ -#define __ERTF_H__ - -#include <glib.h> -#include <stdio.h> - -#include "codeconv.h" - -typedef enum -{ - ERTF_NORMAL, - ERTF_NOFILL, - ERTF_UNKNOWN, - ERTF_ERR, - ERTF_EOF -} ERTFState; - -typedef struct _ERTFParser ERTFParser; - -struct _ERTFParser -{ - FILE *fp; - CodeConverter *conv; - - GHashTable *symbol_table; - - GString *str; - GString *buf; - - gchar *bufp; - - ERTFState state; - - gboolean newline; - gboolean empty_line; - gboolean space; - gboolean pre; -}; - -ERTFParser *ertf_parser_new (FILE *fp, - CodeConverter *conv); -void ertf_parser_destroy (ERTFParser *parser); -gchar *ertf_parse (ERTFParser *parser); - -#endif /* __ERTF_H__ */ - - - diff --git a/src/mimeview.c b/src/mimeview.c @@ -2447,8 +2447,6 @@ static void icon_list_append_icon (MimeView *mimeview, MimeInfo *mimeinfo) case MIMETYPE_TEXT: if (mimeinfo->subtype && !g_ascii_strcasecmp(mimeinfo->subtype, "html")) stockp = STOCK_PIXMAP_MIME_TEXT_HTML; - else if (mimeinfo->subtype && !g_ascii_strcasecmp(mimeinfo->subtype, "enriched")) - stockp = STOCK_PIXMAP_MIME_TEXT_ENRICHED; else if (mimeinfo->subtype && !g_ascii_strcasecmp(mimeinfo->subtype, "calendar")) stockp = STOCK_PIXMAP_MIME_TEXT_CALENDAR; else if (mimeinfo->subtype && (!g_ascii_strcasecmp(mimeinfo->subtype, "x-patch") diff --git a/src/pixmaps/mime_text_enriched.xpm b/src/pixmaps/mime_text_enriched.xpm @@ -1,87 +0,0 @@ -/* XPM */ -static char *mime_text_enriched_xpm[] = { -/* columns rows colors chars-per-pixel */ -"16 16 65 1", -" c #A7A2A6", -". c #9795A1", -"X c #878BA5", -"o c #686D83", -"O c #7C84A3", -"+ c #676D82", -"@ c #686E83", -"# c #4B4B49", -"$ c red", -"% c #FEFEFE", -"& c #FDFDFD", -"* c #FBFBFB", -"= c #F1F1F1", -"- c gray94", -"; c #EFEFEF", -": c #EEEEEE", -"> c gray93", -", c #ECECEC", -"< c gray92", -"1 c #EAEAEA", -"2 c #E9E9E9", -"3 c gray91", -"4 c #E7E7E7", -"5 c #E6E6E6", -"6 c gray90", -"7 c #E4E4E4", -"8 c gray89", -"9 c #E2E2E2", -"0 c gray88", -"q c LightGray", -"w c #CACACA", -"e c #C8C8C8", -"r c gray78", -"t c #C5C5C5", -"y c gray77", -"u c #C3C3C3", -"i c gray76", -"p c #C1C1C1", -"a c #C0C0C0", -"s c gray75", -"d c gray", -"f c gray74", -"g c #BCBCBC", -"h c #BBBBBB", -"j c gray71", -"k c gray70", -"l c gray68", -"z c gray66", -"x c #A0A0A0", -"c c gray52", -"v c #767676", -"b c #5D5D5D", -"n c gray25", -"m c #161616", -"M c black", -"N c black", -"B c black", -"V c black", -"C c black", -"Z c black", -"A c black", -"S c black", -"D c black", -"F c black", -"G c None", -/* pixels */ -"GGGMMMMMMMMMGGGG", -"GGM%%%%%%&0pMGGG", -"GGM%======u*zMGG", -"GGM%=djdw=lvbnMG", -"GGM%=====-9c#mMG", -"GGM%=kefk0;::tMG", -"GGM%;0;:::::,yMG", -"GGM&:kqkggrr<uMG", -"GGM&>,,,<<111pMG", -"GGM&<ii3@@@@3aMG", -"GGM&1122@XO@4sMG", -"GGM&3pp5@ .@6dMG", -"GGM&4455@oo+7fMG", -"GGM&566677888hMG", -"GGMifffgghhhhxMG", -"GGGMMMMMMMMMMMGG" -}; diff --git a/src/procmime.c b/src/procmime.c @@ -43,7 +43,6 @@ #include "uuencode.h" #include "unmime.h" #include "html.h" -#include "enriched.h" #include "codeconv.h" #include "utils.h" #include "prefs_common.h" @@ -803,18 +802,6 @@ gboolean procmime_scan_text_content(MimeInfo *mimeinfo, } sc_html_parser_destroy(parser); conv_code_converter_destroy(conv); - } else if (mimeinfo->type == MIMETYPE_TEXT && !g_ascii_strcasecmp(mimeinfo->subtype, "enriched")) { - ERTFParser *parser; - CodeConverter *conv; - - conv = conv_code_converter_new(src_codeset); - parser = ertf_parser_new(tmpfp, conv); - while ((str = ertf_parse(parser)) != NULL) { - if ((scan_ret = scan_callback(str, cb_data)) == TRUE) - break; - } - ertf_parser_destroy(parser); - conv_code_converter_destroy(conv); } else if (mimeinfo->type == MIMETYPE_TEXT && mimeinfo->disposition != DISPOSITIONTYPE_ATTACHMENT) { while (fgets(buf, sizeof(buf), tmpfp) != NULL) { str = conv_codeset_strdup(buf, src_codeset, CS_UTF_8); diff --git a/src/stock_pixmap.c b/src/stock_pixmap.c @@ -114,7 +114,6 @@ #include "pixmaps/mime_application.xpm" #include "pixmaps/mime_image.xpm" #include "pixmaps/mime_audio.xpm" -#include "pixmaps/mime_text_enriched.xpm" #include "pixmaps/mime_unknown.xpm" #include "pixmaps/mime_pdf.xpm" #include "pixmaps/mime_ps.xpm" @@ -397,7 +396,6 @@ static StockPixmapData pixmaps[] = {mime_application_xpm , NULL, NULL, "mime_application", NULL, NULL}, {mime_image_xpm , NULL, NULL, "mime_image", NULL, NULL}, {mime_audio_xpm , NULL, NULL, "mime_audio", NULL, NULL}, - {mime_text_enriched_xpm , NULL, NULL, "mime_text_enriched", NULL, NULL}, {mime_unknown_xpm , NULL, NULL, "mime_unknown", NULL, NULL}, {mime_pdf_xpm , NULL, NULL, "mime_pdf", NULL, NULL}, {mime_ps_xpm , NULL, NULL, "mime_ps", NULL, NULL}, diff --git a/src/textview.c b/src/textview.c @@ -46,7 +46,6 @@ #include "gtkutils.h" #include "procmime.h" #include "html.h" -#include "enriched.h" #include "compose.h" #include "addressbook.h" #include "addrindex.h" @@ -138,9 +137,6 @@ static void textview_set_font_zoom(TextView *textview); textview->messageview->statusbar_cid); \ } -static void textview_show_ertf (TextView *textview, - FILE *fp, - CodeConverter *conv); static void textview_add_part (TextView *textview, MimeInfo *mimeinfo); static void textview_add_parts (TextView *textview, @@ -943,19 +939,6 @@ static void textview_write_body(TextView *textview, MimeInfo *mimeinfo) unlink(filename); } g_free(filename); - } else if (!g_ascii_strcasecmp(mimeinfo->subtype, "enriched")) { - gchar *filename; - - filename = procmime_get_tmp_file_name(mimeinfo); - if (procmime_get_part(filename, mimeinfo) == 0) { - tmpfp = g_fopen(filename, "rb"); - if (tmpfp) { - textview_show_ertf(textview, tmpfp, conv); - fclose(tmpfp); - } - unlink(filename); - } - g_free(filename); } else if ( g_ascii_strcasecmp(mimeinfo->subtype, "plain") && (cmd = prefs_common.mime_textviewer) && *cmd && (p = strchr(cmd, '%')) && *(p + 1) == 's') { @@ -1145,35 +1128,6 @@ static void textview_show_html(TextView *textview, FILE *fp, sc_html_parser_destroy(parser); } -static void textview_show_ertf(TextView *textview, FILE *fp, - CodeConverter *conv) -{ - ERTFParser *parser; - gchar *str; - gint lines = 0; - - parser = ertf_parser_new(fp, conv); - cm_return_if_fail(parser != NULL); - - account_sigsep_matchlist_create(); - - while ((str = ertf_parse(parser)) != NULL) { - textview_write_line(textview, str, NULL, FALSE); - lines++; - if (lines % 500 == 0) - GTK_EVENTS_FLUSH(); - if (textview->stop_loading) { - account_sigsep_matchlist_delete(); - ertf_parser_destroy(parser); - return; - } - } - - account_sigsep_matchlist_delete(); - - ertf_parser_destroy(parser); -} - #define ADD_TXT_POS(bp_, ep_, pti_) \ if ((last->next = alloca(sizeof(struct txtpos))) != NULL) { \ last = last->next; \