aboutsummaryrefslogtreecommitdiff
path: root/src/compose.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2008-04-24 04:52:17 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2008-04-24 04:52:17 +0000
commit8390e12e45f209a0174318ed529068595c7f70d3 (patch)
tree82b00686474b5ca39952f2b310f146fdc51d38f5 /src/compose.c
parent983aea7a0e0e695c6cba6b6490d9d4d958b039e1 (diff)
exclude quote lines when notifying missing attachments.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1984 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/compose.c')
-rw-r--r--src/compose.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/compose.c b/src/compose.c
index af0e73d5..8df6a948 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -2859,10 +2859,12 @@ static gboolean compose_check_attachments(Compose *compose)
{
GtkTextView *text = GTK_TEXT_VIEW(compose->text);
GtkTextBuffer *buffer;
- GtkTextIter iter, pos;
+ GtkTextIter iter, line_end;
+ gchar *line;
gchar **strv;
gint i;
gboolean attach_found = FALSE;
+ gboolean valid = TRUE;
if (!prefs_common.check_attach)
return TRUE;
@@ -2876,17 +2878,31 @@ static gboolean compose_check_attachments(Compose *compose)
buffer = gtk_text_view_get_buffer(text);
gtk_text_buffer_get_start_iter(buffer, &iter);
+ line_end = iter;
strv = g_strsplit(prefs_common.check_attach_str, ",", -1);
- for (i = 0; strv[i] != NULL; i++) {
+ for (i = 0; strv[i] != NULL; i++)
g_strstrip(strv[i]);
- if (strv[i][0] == '\0')
+
+ while (valid) {
+ valid = gtk_text_iter_forward_to_line_end(&line_end);
+ line = gtk_text_buffer_get_text(buffer, &iter, &line_end,
+ FALSE);
+ iter = line_end;
+ if (get_quote_level(line) != -1)
continue;
- if (gtkut_text_buffer_find(buffer, &iter, strv[i], FALSE,
- &pos)) {
- attach_found = TRUE;
- break;
+
+ for (i = 0; strv[i] != NULL; i++) {
+ if (strv[i][0] == '\0')
+ continue;
+ if (strcasestr(line, strv[i])) {
+ attach_found = TRUE;
+ valid = FALSE;
+ break;
+ }
}
+
+ g_free(line);
}
g_strfreev(strv);