aboutsummaryrefslogtreecommitdiff
path: root/libsylph/utils.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2007-01-12 04:51:04 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2007-01-12 04:51:04 +0000
commite8ea75f1bd6f868a996f799b140ba8b6c8f5ebec (patch)
tree59d2740ff437cff0fc0978e41359f2fd41090abd /libsylph/utils.c
parent2b1b7b9a86db5473eafc8c89a6caeeb1e463b22c (diff)
fixed stray quote character appearing after encoding mail headers.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1470 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph/utils.c')
-rw-r--r--libsylph/utils.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/libsylph/utils.c b/libsylph/utils.c
index 663d121f..f8f5d005 100644
--- a/libsylph/utils.c
+++ b/libsylph/utils.c
@@ -468,13 +468,19 @@ gint str_find_format_times(const gchar *haystack, gchar ch)
gboolean is_next_nonascii(const gchar *s)
{
const gchar *p;
+ gboolean in_quote = FALSE;
/* skip head space */
for (p = s; *p != '\0' && g_ascii_isspace(*p); p++)
;
- for (; *p != '\0' && !g_ascii_isspace(*p); p++) {
- if (*(guchar *)p > 127 || *(guchar *)p < 32)
+ while (*p != '\0') {
+ if (!in_quote && g_ascii_isspace(*p))
+ break;
+ if (*p == '"')
+ in_quote ^= TRUE;
+ else if (*(guchar *)p > 127 || *(guchar *)p < 32)
return TRUE;
+ ++p;
}
return FALSE;
@@ -482,12 +488,19 @@ gboolean is_next_nonascii(const gchar *s)
gint get_next_word_len(const gchar *s)
{
+ const gchar *p = s;
gint len = 0;
+ gboolean in_quote = FALSE;
- for (; *s != '\0' && !g_ascii_isspace(*s); s++, len++)
- ;
+ while (*p != '\0') {
+ if (!in_quote && g_ascii_isspace(*p))
+ break;
+ if (*p == '"')
+ in_quote ^= TRUE;
+ ++p;
+ }
- return len;
+ return p - s;
}
/* compare subjects */