Rename badly named signatures separators matching API members
authorwwp <subscript@free.fr>
Fri, 27 Sep 2019 09:49:32 +0000 (11:49 +0200)
committerwwp <subscript@free.fr>
Fri, 27 Sep 2019 09:49:32 +0000 (11:49 +0200)
(account_signatures_* -> account_sigsep_*).

src/account.c
src/account.h
src/procmime.c
src/quote_fmt_parse.y
src/textview.c

index 1ffe464..d3d7d82 100644 (file)
@@ -1931,50 +1931,50 @@ gboolean password_get(const gchar *user,
        return FALSE;
 }
 
-static GSList *account_signatures_list = NULL;
+static GSList *account_sigsep_list = NULL;
 
 /* create a list of unique signatures from accounts list */
-void account_signatures_matchlist_create(void)
+void account_sigsep_matchlist_create(void)
 {
        GList *cur_ac = NULL;
        PrefsAccount *ac_prefs = NULL;
 
-       if (account_signatures_list)
+       if (account_sigsep_list)
                return;
 
-       account_signatures_list = g_slist_prepend(account_signatures_list, g_strdup("-- "));
+       account_sigsep_list = g_slist_prepend(account_sigsep_list, g_strdup("-- "));
        for (cur_ac = account_get_list();
                 cur_ac != NULL;
                 cur_ac = g_list_next(cur_ac)) {
                ac_prefs = (PrefsAccount *)cur_ac->data;
 
                if (ac_prefs->sig_sep && *ac_prefs->sig_sep != '\0') {
-                       if (!g_slist_find_custom(account_signatures_list, ac_prefs->sig_sep,
+                       if (!g_slist_find_custom(account_sigsep_list, ac_prefs->sig_sep,
                                        (GCompareFunc)g_strcmp0)) {
-                               account_signatures_list = g_slist_prepend(account_signatures_list,
+                               account_sigsep_list = g_slist_prepend(account_sigsep_list,
                                                g_strdup(ac_prefs->sig_sep));
                        }
                }
        }
 }
 
-/* delete the list of signatures created by account_signatures_matchlist_create() */
-void account_signatures_matchlist_delete(void)
+/* delete the list of signatures created by account_sigsep_matchlist_create() */
+void account_sigsep_matchlist_delete(void)
 {
-       if (account_signatures_list) {
-               slist_free_strings_full(account_signatures_list);
-               account_signatures_list = NULL;
+       if (account_sigsep_list) {
+               slist_free_strings_full(account_sigsep_list);
+               account_sigsep_list = NULL;
        }
 }
 
 /* match a string against all signatures in list, using the specified format */
-gboolean account_signatures_matchlist_str_found(const gchar *str, const gchar *format)
+gboolean account_sigsep_matchlist_str_found(const gchar *str, const gchar *format)
 {
        gchar *tmp = NULL;
        gboolean found = FALSE;
        GSList *item;
 
-       for (item = account_signatures_list;
+       for (item = account_sigsep_list;
                 item != NULL && !found;
                 item = g_slist_next(item)) {
                tmp = g_strdup_printf(format, (gchar *)item->data);
@@ -1982,7 +1982,7 @@ gboolean account_signatures_matchlist_str_found(const gchar *str, const gchar *f
                        found = (strcmp(tmp, str) == 0);
                        g_free(tmp);
                } else {
-                       g_warning("account_signatures_matchlist_str_found: g_strdup_printf failed, check format '%s'",
+                       g_warning("account_sigsep_matchlist_str_found: g_strdup_printf failed, check format '%s'",
                                format);
                        return FALSE;
                }
@@ -1991,14 +1991,14 @@ gboolean account_signatures_matchlist_str_found(const gchar *str, const gchar *f
 }
 
 /* match M first char of a string against all signatures in list, using the specified format */
-gboolean account_signatures_matchlist_nchar_found(const gchar *str, const gchar *format)
+gboolean account_sigsep_matchlist_nchar_found(const gchar *str, const gchar *format)
 {
        gchar *tmp = NULL;
        gboolean found = FALSE;
        GSList *item;
        gint len;
 
-       for (item = account_signatures_list;
+       for (item = account_sigsep_list;
                 item != NULL && !found;
                 item = g_slist_next(item)) {
                tmp = g_strdup_printf(format, (gchar *)item->data);
@@ -2007,7 +2007,7 @@ gboolean account_signatures_matchlist_nchar_found(const gchar *str, const gchar
                        found = (strncmp(tmp, str, len) == 0);
                        g_free(tmp);
                } else {
-                       g_warning("account_signatures_matchlist_nchar_found: g_strdup_printf failed, check format '%s'",
+                       g_warning("account_sigsep_matchlist_nchar_found: g_strdup_printf failed, check format '%s'",
                                format);
                        return FALSE;
                }
index 6d9319a..3c25dd0 100644 (file)
@@ -81,9 +81,9 @@ gboolean      password_get(const gchar *user,
                           guint16 port,
                           gchar **password);
 
-void             account_signatures_matchlist_create           (void);
-void             account_signatures_matchlist_delete           (void);
-gboolean         account_signatures_matchlist_str_found        (const gchar *str, const gchar *format);
-gboolean         account_signatures_matchlist_nchar_found      (const gchar *str, const gchar *format);
+void             account_sigsep_matchlist_create         (void);
+void             account_sigsep_matchlist_delete         (void);
+gboolean         account_sigsep_matchlist_str_found  (const gchar *str, const gchar *format);
+gboolean         account_sigsep_matchlist_nchar_found    (const gchar *str, const gchar *format);
 
 #endif /* __ACCOUNT_H__ */
index fe35130..da5f13f 100644 (file)
@@ -262,7 +262,7 @@ const gchar *procmime_mimeinfo_get_parameter(MimeInfo *mimeinfo, const gchar *na
                gint llen = 0;                                                  \
                strretchomp(lastline);                                          \
                llen = strlen(lastline);                                        \
-               if (lastline[llen-1] == ' ' && !account_signatures_matchlist_str_found(lastline, "%s") &&       \
+               if (lastline[llen-1] == ' ' && !account_sigsep_matchlist_str_found(lastline, "%s") &&   \
                    !(llen == 2 && lastline[1] == ' ' && strchr(prefs_common.quote_chars, lastline[0]))) {                                      \
                        /* this is flowed */                                    \
                        if (delsp)                                              \
@@ -348,7 +348,7 @@ gboolean procmime_decode_content(MimeInfo *mimeinfo)
        tmp_file = TRUE;
        readend = mimeinfo->offset + mimeinfo->length;
 
-       account_signatures_matchlist_create(); /* FLUSH_LASTLINE will use it */
+       account_sigsep_matchlist_create(); /* FLUSH_LASTLINE will use it */
 
        *buf = '\0';
        if (encoding == ENC_QUOTED_PRINTABLE) {
@@ -470,7 +470,7 @@ gboolean procmime_decode_content(MimeInfo *mimeinfo)
        claws_fclose(outfp);
        claws_fclose(infp);
 
-       account_signatures_matchlist_delete();
+       account_sigsep_matchlist_delete();
 
        if (err == TRUE) {
                return FALSE;
index 7e29f34..663a9ed 100644 (file)
@@ -488,11 +488,11 @@ static void quote_fmt_show_msg(MsgInfo *msginfo, const gchar *body,
        if (fp == NULL)
                g_warning("Can't get text part");
        else {
-               account_signatures_matchlist_create();
+               account_sigsep_matchlist_create();
                while (fgets(buf, sizeof(buf), fp) != NULL) {
                        strcrchomp(buf);
 
-                       if (!signature && account_signatures_matchlist_nchar_found(buf, "%s\n"))
+                       if (!signature && account_sigsep_matchlist_nchar_found(buf, "%s\n"))
                                break;
                
                        if (quoted && quote_str)
@@ -500,7 +500,7 @@ static void quote_fmt_show_msg(MsgInfo *msginfo, const gchar *body,
                        
                        INSERT(buf);
                }
-               account_signatures_matchlist_delete();
+               account_sigsep_matchlist_delete();
                fclose(fp);
        }
 }
index 0e2ab76..d707a87 100644 (file)
@@ -1039,7 +1039,7 @@ static void textview_write_body(TextView *textview, MimeInfo *mimeinfo)
 
        procmime_decode_content(mimeinfo);
 
-       account_signatures_matchlist_create();
+       account_sigsep_matchlist_create();
 
        if (!g_ascii_strcasecmp(mimeinfo->subtype, "html") &&
            prefs_common.render_html) {
@@ -1122,7 +1122,7 @@ static void textview_write_body(TextView *textview, MimeInfo *mimeinfo)
                                claws_fclose(tmpfp);
                                waitpid(pid, pfd, 0);
                                g_unlink(fname);
-                               account_signatures_matchlist_delete();
+                               account_sigsep_matchlist_delete();
                                return;
                        }
                }
@@ -1152,13 +1152,13 @@ textview_default:
                        tmpfp = claws_fopen(mimeinfo->data.filename, "rb");
                if (!tmpfp) {
                        FILE_OP_ERROR(mimeinfo->data.filename, "claws_fopen");
-                       account_signatures_matchlist_delete();
+                       account_sigsep_matchlist_delete();
                        return;
                }
                if (fseek(tmpfp, mimeinfo->offset, SEEK_SET) < 0) {
                        FILE_OP_ERROR(mimeinfo->data.filename, "fseek");
                        claws_fclose(tmpfp);
-                       account_signatures_matchlist_delete();
+                       account_sigsep_matchlist_delete();
                        return;
                }
                debug_print("Viewing text content of type: %s (length: %d)\n", mimeinfo->subtype, mimeinfo->length);
@@ -1168,7 +1168,7 @@ textview_default:
                        textview_write_line(textview, buf, conv, TRUE);
                        if (textview->stop_loading) {
                                claws_fclose(tmpfp);
-                               account_signatures_matchlist_delete();
+                               account_sigsep_matchlist_delete();
                                return;
                        }
                        wrote += ftell(tmpfp)-i;
@@ -1181,7 +1181,7 @@ textview_default:
                claws_fclose(tmpfp);
        }
 
-       account_signatures_matchlist_delete();
+       account_sigsep_matchlist_delete();
 
        conv_code_converter_destroy(conv);
        procmime_force_encoding(0);
@@ -1219,7 +1219,7 @@ static void textview_show_html(TextView *textview, FILE *fp,
        parser = sc_html_parser_new(fp, conv);
        cm_return_if_fail(parser != NULL);
 
-       account_signatures_matchlist_create();
+       account_sigsep_matchlist_create();
 
        while ((str = sc_html_parse(parser)) != NULL) {
                if (parser->state == SC_HTML_HREF) {
@@ -1245,13 +1245,13 @@ static void textview_show_html(TextView *textview, FILE *fp,
                if (lines % 500 == 0)
                        GTK_EVENTS_FLUSH();
                if (textview->stop_loading) {
-                       account_signatures_matchlist_delete();
+                       account_sigsep_matchlist_delete();
                        return;
                }
        }
        textview_write_line(textview, "\n", NULL, FALSE);
 
-       account_signatures_matchlist_delete();
+       account_sigsep_matchlist_delete();
 
        sc_html_parser_destroy(parser);
 }
@@ -1266,7 +1266,7 @@ static void textview_show_ertf(TextView *textview, FILE *fp,
        parser = ertf_parser_new(fp, conv);
        cm_return_if_fail(parser != NULL);
 
-       account_signatures_matchlist_create();
+       account_sigsep_matchlist_create();
 
        while ((str = ertf_parse(parser)) != NULL) {
                textview_write_line(textview, str, NULL, FALSE);
@@ -1274,12 +1274,12 @@ static void textview_show_ertf(TextView *textview, FILE *fp,
                if (lines % 500 == 0)
                        GTK_EVENTS_FLUSH();
                if (textview->stop_loading) {
-                       account_signatures_matchlist_delete();
+                       account_sigsep_matchlist_delete();
                        return;
                }
        }
        
-       account_signatures_matchlist_delete();
+       account_sigsep_matchlist_delete();
 
        ertf_parser_destroy(parser);
 }
@@ -1621,8 +1621,8 @@ static void textview_write_line(TextView *textview, const gchar *str,
                        else if (strncmp(buf, "@@ ", 3) == 0 &&
                                        strcmp(buf+strlen(buf)-4, " @@\n") == 0)
                                fg_color = "diff-hunk";
-               } else if (account_signatures_matchlist_str_found(buf,"%s\n")
-                               || account_signatures_matchlist_str_found(buf, "- %s\n")
+               } else if (account_sigsep_matchlist_str_found(buf,"%s\n")
+                               || account_sigsep_matchlist_str_found(buf, "- %s\n")
                                || textview->is_in_signature) {
                        fg_color = "signature";
                        textview->is_in_signature = TRUE;