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/utils.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/utils.c')
-rw-r--r-- | src/utils.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c index f5ba1125..932c8320 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1133,6 +1133,32 @@ gint get_quote_level(const gchar *str) return quote_level; } +gint check_line_length(const gchar *str, gint max_chars, gint *line) +{ + const gchar *p = str, *q; + gint cur_line = 0, len; + + while ((q = strchr(p, '\n')) != NULL) { + len = q - p + 1; + if (len > max_chars) { + if (line) + *line = cur_line; + return -1; + } + p = q + 1; + ++cur_line; + } + + len = strlen(p); + if (len > max_chars) { + if (line) + *line = cur_line; + return -1; + } + + return 0; +} + gchar *strstr_with_skip_quote(const gchar *haystack, const gchar *needle) { register guint haystack_len, needle_len; |