diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-06-30 05:49:54 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-06-30 05:49:54 +0000 |
commit | f3fb1172b4b6ecf8254e52d03bb326f78cd58e57 (patch) | |
tree | 3d3da8c64e6ad1a1f1025fdf89d12bc43538a484 /src/compose.c | |
parent | 59e5f5b6f481f379846734755603bae75eb98460 (diff) |
when sending messages, check for line length limit and display warning if exceeds.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@386 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/compose.c')
-rw-r--r-- | src/compose.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/compose.c b/src/compose.c index 2f1dee05..5967cc0b 100644 --- a/src/compose.c +++ b/src/compose.c @@ -2625,6 +2625,7 @@ static gint compose_write_to_file(Compose *compose, const gchar *file, const gchar *body_charset; const gchar *src_charset = CS_INTERNAL; EncodingType encoding; + gint line; if ((fp = fopen(file, "wb")) == NULL) { FILE_OP_ERROR(file, "fopen"); @@ -2731,10 +2732,31 @@ static gint compose_write_to_file(Compose *compose, const gchar *file, src_charset, out_charset, body_charset, procmime_get_encoding_str(encoding)); + /* check for line length limit */ + if (encoding != ENC_QUOTED_PRINTABLE && encoding != ENC_BASE64 && + check_line_length(buf, 1000, &line) < 0) { + AlertValue aval; + gchar *msg; + + msg = g_strdup_printf + (_("Line %d exceeds the line length limit (998 bytes).\n" + "The contents of the message might be broken on the way to the delivery.\n" + "\n" + "Send it anyway?"), line + 1); + aval = alertpanel(_("Warning"), msg, _("Yes"), _("+No"), NULL); + if (aval != G_ALERTDEFAULT) { + g_free(msg); + fclose(fp); + unlink(file); + g_free(buf); + return -1; + } + } + /* write headers */ if (compose_write_headers(compose, fp, out_charset, body_charset, encoding, is_draft) < 0) { - g_warning(_("can't write headers\n")); + g_warning("can't write headers\n"); fclose(fp); unlink(file); g_free(buf); |