talons

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

commit 88e34405f8cc4ef3eb653eff5e3cd78e3898d881
parent f9285c5a86c512788f5ee2a5f916013d313ca303
Author: Oliver Lowe <o@olowe.co>
Date:   Sun, 31 Aug 2025 16:04:52 +1000

Remove more newsgroup special cases

Diffstat:
Msrc/account.c | 13++++++-------
Msrc/account.h | 8++++----
Msrc/advsearch.c | 1-
Msrc/compose.c | 38+++++++++++---------------------------
Msrc/compose.h | 3---
Msrc/matcher.c | 14--------------
Msrc/msgcache.c | 3---
Msrc/prefs_template.c | 1-
Msrc/procheader.c | 9---------
Msrc/procmsg.c | 4----
Msrc/procmsg.h | 1-
Msrc/quote_fmt.c | 1-
Msrc/quote_fmt_lex.l | 3---
Msrc/quote_fmt_parse.y | 23+----------------------
Msrc/summaryview.c | 7++-----
Msrc/toolbar.c | 1-
16 files changed, 24 insertions(+), 106 deletions(-)

diff --git a/src/account.c b/src/account.c @@ -292,11 +292,11 @@ PrefsAccount *account_find_from_smtp_server(const gchar *address, * account_find_from_address: * @address: Email address string. * - * Find a mail (not news if newsgroups_ok is FALSE) account with the specified email address. + * Find a mail account with the specified email address. * * Return value: The found account, or NULL if not found. */ -PrefsAccount *account_find_from_address(const gchar *address, gboolean newsgroups_ok) +PrefsAccount *account_find_from_address(const gchar *address) { GList *cur; PrefsAccount *ac; @@ -305,8 +305,7 @@ PrefsAccount *account_find_from_address(const gchar *address, gboolean newsgroup for (cur = account_list; cur != NULL; cur = cur->next) { ac = (PrefsAccount *)cur->data; - if ((newsgroups_ok) && ac->address && - g_ascii_strcasecmp(address, ac->address) == 0) + if (ac->address && g_ascii_strcasecmp(address, ac->address) == 0) return ac; } @@ -1327,7 +1326,7 @@ PrefsAccount *account_get_reply_account(MsgInfo *msginfo, gboolean reply_autosel (msginfo, &from, "From:")) { gchar *buf = from + strlen("From:"); extract_address(buf); - account = account_find_from_address(buf, FALSE); + account = account_find_from_address(buf); g_free(from); } } @@ -1348,7 +1347,7 @@ PrefsAccount *account_get_reply_account(MsgInfo *msginfo, gboolean reply_autosel (*next) = 0; Xstrdup_a(to, cur, return NULL); extract_address(to); - account = account_find_from_address(to, FALSE); + account = account_find_from_address(to); if (next) cur = next + 1; else @@ -1364,7 +1363,7 @@ PrefsAccount *account_get_reply_account(MsgInfo *msginfo, gboolean reply_autosel (msginfo, &deliveredto, "Delivered-To:")) { gchar *buf = deliveredto + strlen("Delivered-To:"); extract_address(buf); - account = account_find_from_address(buf, FALSE); + account = account_find_from_address(buf); g_free(deliveredto); } } diff --git a/src/account.h b/src/account.h @@ -14,7 +14,7 @@ * * 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 __ACCOUNT_H__ @@ -51,7 +51,7 @@ GList *account_find_all_from_address (GList *ac_list, GList *account_find_all (void); PrefsAccount *account_find_from_smtp_server (const gchar *address, const gchar *smtp_server); -PrefsAccount *account_find_from_address (const gchar *address, gboolean newsgroups_ok); +PrefsAccount *account_find_from_address (const gchar *address); PrefsAccount *account_find_from_id (gint id); PrefsAccount *account_find_from_item (FolderItem *item); @@ -69,9 +69,9 @@ void account_set_missing_folder(void); FolderItem *account_get_special_folder(PrefsAccount *ac_prefs, SpecialFolderItemType type); -PrefsAccount *account_get_reply_account (MsgInfo *msginfo, +PrefsAccount *account_get_reply_account (MsgInfo *msginfo, gboolean reply_autosel); -void account_rename_path (const gchar *old_id, +void account_rename_path (const gchar *old_id, const gchar *new_id); gchar *account_get_signature_str(PrefsAccount *account); diff --git a/src/advsearch.c b/src/advsearch.c @@ -225,7 +225,6 @@ gchar *advsearch_expand_search_string(const gchar *search_string) { "i", "messageid", 1, TRUE, TRUE }, { "I", "inreplyto", 1, TRUE, TRUE }, { "L", "locked", 0, FALSE, FALSE }, - { "n", "newsgroups", 1, TRUE, TRUE }, { "N", "new", 0, FALSE, FALSE }, { "O", "~new", 0, FALSE, FALSE }, { "r", "replied", 0, FALSE, FALSE }, diff --git a/src/compose.c b/src/compose.c @@ -832,12 +832,12 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI if not, the account prefs will be guessed using other ways, but we'll keep the from anyway */ if (mailto_from) { - mailto_account = account_find_from_address(mailto_from, TRUE); + mailto_account = account_find_from_address(mailto_from); if (mailto_account == NULL) { gchar *tmp_from; Xstrdup_a(tmp_from, mailto_from, return NULL); extract_address(tmp_from); - mailto_account = account_find_from_address(tmp_from, TRUE); + mailto_account = account_find_from_address(tmp_from); } } if (mailto_account) @@ -1880,7 +1880,7 @@ Compose *compose_reedit(MsgInfo *msginfo, gboolean batch) } if (!account && !procheader_get_header_from_msginfo(msginfo, &queueheader_buf, "S:")) { - account = account_find_from_address(queueheader_buf, FALSE); + account = account_find_from_address(queueheader_buf); g_free(queueheader_buf); } if (!procheader_get_header_from_msginfo(msginfo, &queueheader_buf, @@ -1975,7 +1975,7 @@ Compose *compose_reedit(MsgInfo *msginfo, gboolean batch) gchar *from = NULL; if (!procheader_get_header_from_msginfo(msginfo, &from, "FROM:")) { extract_address(from); - account = account_find_from_address(from, FALSE); + account = account_find_from_address(from); } if (from) g_free(from); @@ -2548,10 +2548,6 @@ static gint compose_parse_header(Compose *compose, MsgInfo *msginfo) g_free(hentry[H_BCC].body); hentry[H_BCC].body = NULL; } - if (hentry[H_NEWSGROUPS].body != NULL) { - compose->newsgroups = hentry[H_NEWSGROUPS].body; - hentry[H_NEWSGROUPS].body = NULL; - } if (hentry[H_FOLLOWUP_TO].body != NULL) { if (hentry[H_FOLLOWUP_TO].body[0] != '\0') { compose->followup_to = @@ -2960,7 +2956,7 @@ static void compose_reply_set_entry(Compose *compose, MsgInfo *msginfo, Xstrdup_a(tmp1, msginfo->from, return); extract_address(tmp1); compose_entry_append(compose, - (!account_find_from_address(tmp1, FALSE)) + (!account_find_from_address(tmp1)) ? msginfo->from : msginfo->to, COMPOSE_TO, PREF_NONE); @@ -3060,7 +3056,6 @@ static void compose_reedit_set_entry(Compose *compose, MsgInfo *msginfo) SET_ADDRESS(COMPOSE_CC, compose->cc); SET_ADDRESS(COMPOSE_BCC, compose->bcc); SET_ADDRESS(COMPOSE_REPLYTO, compose->replyto); - SET_ADDRESS(COMPOSE_NEWSGROUPS, compose->newsgroups); SET_ADDRESS(COMPOSE_FOLLOWUPTO, compose->followup_to); compose_update_privacy_system_menu_item(compose, FALSE); @@ -4574,7 +4569,7 @@ static gboolean compose_check_for_set_recipients(Compose *compose) if (compose->account->set_autocc && compose->account->auto_cc) { gboolean found_other = FALSE; GSList *list; - /* search header entries for to and newsgroup entries */ + /* search header entries for to */ for (list = compose->header_list; list; list = list->next) { gchar *entry; gchar *header; @@ -4610,7 +4605,7 @@ static gboolean compose_check_for_set_recipients(Compose *compose) if (compose->account->set_autobcc && compose->account->auto_bcc) { gboolean found_other = FALSE; GSList *list; - /* search header entries for to and newsgroup entries */ + /* search header entries for to */ for (list = compose->header_list; list; list = list->next) { gchar *entry; gchar *header; @@ -7765,7 +7760,6 @@ static void compose_destroy(Compose *compose) g_free(compose->replyto); g_free(compose->cc); g_free(compose->bcc); - g_free(compose->newsgroups); g_free(compose->followup_to); g_free(compose->ml_post); @@ -10480,7 +10474,7 @@ static PrefsAccount *compose_find_account(MsgInfo *msginfo) gchar *to; Xstrdup_a(to, msginfo->to, return NULL); extract_address(to); - account = account_find_from_address(to, FALSE); + account = account_find_from_address(to); } if (!account && prefs_common.forward_account_autosel) { @@ -10489,7 +10483,7 @@ static PrefsAccount *compose_find_account(MsgInfo *msginfo) (msginfo, &cc, "Cc:")) { gchar *buf = cc + strlen("Cc:"); extract_address(buf); - account = account_find_from_address(buf, FALSE); + account = account_find_from_address(buf); g_free(cc); } } @@ -10500,7 +10494,7 @@ static PrefsAccount *compose_find_account(MsgInfo *msginfo) (msginfo, &deliveredto, "Delivered-To:")) { gchar *buf = deliveredto + strlen("Delivered-To:"); extract_address(buf); - account = account_find_from_address(buf, FALSE); + account = account_find_from_address(buf); g_free(deliveredto); } } @@ -10733,7 +10727,7 @@ static MsgInfo *compose_msginfo_new_from_compose(Compose *compose) if (compose->subject_entry) newmsginfo->subject = gtk_editable_get_chars(GTK_EDITABLE(compose->subject_entry), 0, -1); - /* to, cc, reply-to, newsgroups */ + /* to, cc, reply-to */ for (list = compose->header_list; list; list = list->next) { gchar *header = gtk_editable_get_chars( GTK_EDITABLE( @@ -10758,16 +10752,6 @@ static MsgInfo *compose_msginfo_new_from_compose(Compose *compose) g_free(newmsginfo->cc); newmsginfo->cc = tmp; } - } else - if ( strcasecmp(header, - prefs_common_translated_header_name("Newsgroups:")) == 0 ) { - if ( newmsginfo->newsgroups == NULL ) { - newmsginfo->newsgroups = g_strdup(entry); - } else if (entry && *entry) { - gchar *tmp = g_strconcat(newmsginfo->newsgroups, ", ", entry, NULL); - g_free(newmsginfo->newsgroups); - newmsginfo->newsgroups = tmp; - } } g_free(header); diff --git a/src/compose.h b/src/compose.h @@ -45,7 +45,6 @@ typedef enum COMPOSE_CC, COMPOSE_BCC, COMPOSE_REPLYTO, - COMPOSE_NEWSGROUPS, COMPOSE_FOLLOWUPTO, COMPOSE_INREPLYTO } ComposeEntryType; @@ -166,7 +165,6 @@ struct _Compose gchar *replyto; gchar *cc; gchar *bcc; - gchar *newsgroups; gchar *followup_to; gchar *ml_post; @@ -183,7 +181,6 @@ struct _Compose gboolean use_cc; gboolean use_bcc; gboolean use_replyto; - gboolean use_newsgroups; gboolean use_followupto; gboolean use_attach; diff --git a/src/matcher.c b/src/matcher.c @@ -108,8 +108,6 @@ static const MatchParser matchparser_tab[] = { {MATCHCRITERIA_AGE_LOWER_HOURS, "age_lower_hours"}, {MATCHCRITERIA_DATE_AFTER, "date_after"}, {MATCHCRITERIA_DATE_BEFORE, "date_before"}, - {MATCHCRITERIA_NEWSGROUPS, "newsgroups"}, - {MATCHCRITERIA_NOT_NEWSGROUPS, "~newsgroups"}, {MATCHCRITERIA_MESSAGEID, "messageid"}, {MATCHCRITERIA_NOT_MESSAGEID, "~messageid"}, {MATCHCRITERIA_INREPLYTO, "inreplyto"}, @@ -751,10 +749,6 @@ static gboolean matcherprop_match(MatcherProp *prop, case MATCHCRITERIA_NOT_PARTIAL: /* FIXME: info->size is a goffset */ return (info->total_size == 0 || info->size == (goffset)info->total_size); - case MATCHCRITERIA_NEWSGROUPS: - return matcherprop_string_match(prop, info->newsgroups, context_str[CONTEXT_NEWSGROUPS]); - case MATCHCRITERIA_NOT_NEWSGROUPS: - return !matcherprop_string_match(prop, info->newsgroups, context_str[CONTEXT_NEWSGROUPS]); case MATCHCRITERIA_MESSAGEID: return matcherprop_string_match(prop, info->msgid, context_str[CONTEXT_MESSAGEID]); case MATCHCRITERIA_NOT_MESSAGEID: @@ -1839,7 +1833,6 @@ gchar *matching_build_command(const gchar *cmd, MsgInfo *info) const gchar *const no_cc = _("(none)") ; const gchar *const no_date = _("(none)") ; const gchar *const no_msgid = _("(none)") ; - const gchar *const no_newsgroups = _("(none)") ; const gchar *const no_references = _("(none)") ; size = STRLEN_ZERO(cmd) + 1; @@ -1868,9 +1861,6 @@ gchar *matching_build_command(const gchar *cmd, MsgInfo *info) case 'i': /* message-id */ size += STRLEN_DEFAULT(info->msgid, no_msgid) - 2; break; - case 'n': /* newsgroups */ - size += STRLEN_DEFAULT(info->newsgroups, no_newsgroups) - 2; - break; case 'r': /* references */ /* FIXME: using the inreplyto header for reference */ size += STRLEN_DEFAULT(info->inreplyto, no_references) - 2; @@ -1932,10 +1922,6 @@ gchar *matching_build_command(const gchar *cmd, MsgInfo *info) add_str_default(&p, info->msgid, no_msgid); break; - case 'n': /* newsgroups */ - add_str_default(&p, info->newsgroups, - no_newsgroups); - break; case 'r': /* references */ /* FIXME: using the inreplyto header for references */ add_str_default(&p, info->inreplyto, no_references); diff --git a/src/msgcache.c b/src/msgcache.c @@ -659,7 +659,6 @@ MsgCache *msgcache_read_cache(FolderItem *item, const gchar *cache_file) GET_CACHE_DATA(msginfo->from, memusage); GET_CACHE_DATA(msginfo->to, memusage); GET_CACHE_DATA(msginfo->cc, memusage); - GET_CACHE_DATA(msginfo->newsgroups, memusage); GET_CACHE_DATA(msginfo->subject, memusage); GET_CACHE_DATA(msginfo->msgid, memusage); GET_CACHE_DATA(msginfo->inreplyto, memusage); @@ -715,7 +714,6 @@ MsgCache *msgcache_read_cache(FolderItem *item, const gchar *cache_file) READ_CACHE_DATA(msginfo->from, fp, memusage); READ_CACHE_DATA(msginfo->to, fp, memusage); READ_CACHE_DATA(msginfo->cc, fp, memusage); - READ_CACHE_DATA(msginfo->newsgroups, fp, memusage); READ_CACHE_DATA(msginfo->subject, fp, memusage); READ_CACHE_DATA(msginfo->msgid, fp, memusage); READ_CACHE_DATA(msginfo->inreplyto, fp, memusage); @@ -871,7 +869,6 @@ static int msgcache_write_cache(MsgInfo *msginfo, FILE *fp) WRITE_CACHE_DATA(msginfo->from, fp); WRITE_CACHE_DATA(msginfo->to, fp); WRITE_CACHE_DATA(msginfo->cc, fp); - WRITE_CACHE_DATA(msginfo->newsgroups, fp); WRITE_CACHE_DATA(msginfo->subject, fp); WRITE_CACHE_DATA(msginfo->msgid, fp); WRITE_CACHE_DATA(msginfo->inreplyto, fp); diff --git a/src/prefs_template.c b/src/prefs_template.c @@ -56,7 +56,6 @@ gboolean prefs_template_string_is_valid(gchar *string, gint *line, gboolean esca dummyinfo.cc="John Doe <john@example.com>"; dummyinfo.msgid="<1234john@example.com>"; dummyinfo.inreplyto="<1234john@example.com>"; - dummyinfo.newsgroups="alt.test"; dummyinfo.subject="subject"; quote_fmt_init(&dummyinfo, NULL, NULL, TRUE, account, FALSE); diff --git a/src/procheader.c b/src/procheader.c @@ -681,15 +681,6 @@ static MsgInfo *parse_stream(void *data, gboolean isstring, MsgFlags flags, msginfo->cc = g_strdup(tmp); g_free(tmp); break; - case H_NEWSGROUPS: - if (msginfo->newsgroups) { - p = msginfo->newsgroups; - msginfo->newsgroups = - g_strconcat(p, ",", hp, NULL); - g_free(p); - } else - msginfo->newsgroups = g_strdup(hp); - break; case H_SUBJECT: if (msginfo->subject) break; msginfo->subject = conv_unmime_header(hp, NULL, FALSE); diff --git a/src/procmsg.c b/src/procmsg.c @@ -1123,7 +1123,6 @@ MsgInfo *procmsg_msginfo_copy(MsgInfo *msginfo) MEMBDUP(from); MEMBDUP(to); MEMBDUP(cc); - MEMBDUP(newsgroups); MEMBDUP(subject); MEMBDUP(msgid); MEMBDUP(inreplyto); @@ -1269,7 +1268,6 @@ void procmsg_msginfo_free(MsgInfo **msginfo_ptr) FREENULL(msginfo->from); FREENULL(msginfo->to); FREENULL(msginfo->cc); - FREENULL(msginfo->newsgroups); FREENULL(msginfo->subject); FREENULL(msginfo->msgid); FREENULL(msginfo->inreplyto); @@ -1325,8 +1323,6 @@ guint procmsg_msginfo_memusage(MsgInfo *msginfo) memusage += strlen(msginfo->to); if (msginfo->cc) memusage += strlen(msginfo->cc); - if (msginfo->newsgroups) - memusage += strlen(msginfo->newsgroups); if (msginfo->subject) memusage += strlen(msginfo->subject); if (msginfo->msgid) diff --git a/src/procmsg.h b/src/procmsg.h @@ -201,7 +201,6 @@ struct _MsgInfo gchar *from; gchar *to; gchar *cc; - gchar *newsgroups; gchar *subject; gchar *msgid; gchar *inreplyto; diff --git a/src/quote_fmt.c b/src/quote_fmt.c @@ -55,7 +55,6 @@ static gchar *quote_desc_strings[] = { "%subject (%s)", N_("Subject"), /* subject */ "%to (%t)", N_("To"), /* to */ "%cc (%c)", N_("Cc"), /* cc */ - "%newsgroups (%n)", N_("Newsgroups"), /* newsgroups */ "%references (%r)", N_("References"), /* references */ "%messageid (%i)", N_("Message-ID"), /* message-id */ "%msg (%M)", N_("message body"), /* message */ diff --git a/src/quote_fmt_lex.l b/src/quote_fmt_lex.l @@ -82,7 +82,6 @@ int escaped_string = 0; <S_NORMAL>("%I"|"%initials") /* initial of sender */ return SHOW_SENDER_INITIAL; <S_NORMAL>("%m"|"%msg_no_sig") /* message with no signature */ return SHOW_MESSAGE_NO_SIGNATURE; <S_NORMAL>("%M"|"%msg") /* message */ return SHOW_MESSAGE; -<S_NORMAL>("%n"|"%newsgroups") /* newsgroups */ return SHOW_NEWSGROUPS; <S_NORMAL>("%N"|"%fullname") /* full name */ return SHOW_FULLNAME; <S_NORMAL>("%L"|"%lastname") /* last name */ return SHOW_LAST_NAME; <S_NORMAL>("%r"|"%references") /* references */ return SHOW_REFERENCES; @@ -116,7 +115,6 @@ int escaped_string = 0; ("?s"|"?subject") /* query subject */ return QUERY_SUBJECT; ("?t"|"?to") /* query to */ return QUERY_TO; ("?c"|"?cc") /* query cc */ return QUERY_CC; -("?n"|"?newsgroups") /* query newsgroups */ return QUERY_NEWSGROUPS; ("?i"|"?messageid") /* query message-id */ return QUERY_MESSAGEID; ("?r"|"?references") /* query references */ return QUERY_REFERENCES; ("?af"|"?account_fullname") /* query full name in compose account */ return QUERY_ACCOUNT_FULL_NAME; @@ -132,7 +130,6 @@ int escaped_string = 0; ("!s"|"!subject") /* query not(subject) */ return QUERY_NOT_SUBJECT; ("!t"|"!to") /* query not(to) */ return QUERY_NOT_TO; ("!c"|"!cc") /* query not(cc) */ return QUERY_NOT_CC; -("!n"|"!newsgroups") /* query not(newsgroups) */ return QUERY_NOT_NEWSGROUPS; ("!i"|"!messageid") /* query not(message-id) */ return QUERY_NOT_MESSAGEID; ("!r"|"!references") /* query not(references) */ return QUERY_NOT_REFERENCES; ("!af"|"!account_fullname") /* query not(full name in compose account) */ return QUERY_NOT_ACCOUNT_FULL_NAME; diff --git a/src/quote_fmt_parse.y b/src/quote_fmt_parse.y @@ -711,12 +711,7 @@ string: }; special: - SHOW_NEWSGROUPS - { - if (msginfo->newsgroups) - INSERT(msginfo->newsgroups); - } - | SHOW_DATE_EXPR OPARENT string CPARENT + SHOW_DATE_EXPR OPARENT string CPARENT { quote_fmt_show_date(msginfo, $3); } @@ -941,14 +936,6 @@ query: { remove_visibility(); } - | QUERY_NEWSGROUPS - { - add_visibility(msginfo->newsgroups != NULL); - } - OPARENT quote_fmt CPARENT - { - remove_visibility(); - } | QUERY_MESSAGEID { add_visibility(msginfo->msgid != NULL); @@ -1087,14 +1074,6 @@ query_not: { remove_visibility(); } - | QUERY_NOT_NEWSGROUPS - { - add_visibility(msginfo->newsgroups == NULL); - } - OPARENT quote_fmt CPARENT - { - remove_visibility(); - } | QUERY_NOT_MESSAGEID { add_visibility(msginfo->msgid == NULL); diff --git a/src/summaryview.c b/src/summaryview.c @@ -3034,7 +3034,7 @@ static inline void summary_set_header(SummaryView *summaryview, gchar *text[], if (addr) { extract_address(addr); - if (account_find_from_address(addr, FALSE)) { + if (account_find_from_address(addr)) { should_swap = TRUE; } g_free(addr); @@ -3074,10 +3074,7 @@ static inline void summary_set_header(SummaryView *summaryview, gchar *text[], } to_text = msginfo->to ? msginfo->to : - (msginfo->cc ? msginfo->cc : - (msginfo->newsgroups ? msginfo->newsgroups : NULL - ) - ); + (msginfo->cc ? msginfo->cc : NULL); if (!to_text) to_text = _("(No Recipient)"); diff --git a/src/toolbar.c b/src/toolbar.c @@ -2019,7 +2019,6 @@ Toolbar *toolbar_create(ToolbarType type, GtkWidget *toolbar; GtkWidget *icon_wid = NULL; - GtkWidget *icon_news; GtkWidget *item; ToolbarClawsActions *action_item; GSList *cur;