sync with 0.9.8cvs10
authorPaul Mangan <paul@claws-mail.org>
Wed, 28 Jan 2004 12:48:42 +0000 (12:48 +0000)
committerPaul Mangan <paul@claws-mail.org>
Wed, 28 Jan 2004 12:48:42 +0000 (12:48 +0000)
23 files changed:
ChangeLog
ChangeLog.claws
ChangeLog.jp
configure.ac
src/codeconv.c
src/common/base64.c
src/common/quoted-printable.c
src/common/utils.c
src/common/utils.h
src/common/xml.c
src/compose.c
src/enriched.c
src/html.c
src/imap.c
src/mainwindow.c
src/mainwindow.h
src/pop.c
src/prefs_account.c
src/procmime.c
src/procmsg.c
src/quote_fmt_parse.y
src/textview.c
src/unmime.c

index 247ca2137a39ba35ad6833cdba801dc081ed6f93..048e2b063ab3f0a235ae0088b156cd7eb3baa280 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,44 @@
+2004-01-28
+
+       * src/codeconv.c: conv_euctojis(): force JIS X 0201 Kana to JIS X 0208
+         conversion.
+
+2004-01-28
+
+       * src/imap.c: imap_get_msginfo(): fixed wrong counting.
+
+2004-01-28
+
+       * src/base64.c
+         src/codeconv.c
+         src/compose.c
+         src/html.c
+         src/imap.c
+         src/pop.c
+         src/prefs_account.c
+         src/procmime.c
+         src/procmsg.c
+         src/quote_fmt_parse.y
+         src/quoted-printable.c
+         src/textview.c
+         src/unmime.c
+         src/utils.c
+         src/utils.h
+         src/xml.c: fixed wrong type of argument for ctype functions (char
+         had been passed instead of unsigned char).
+
+
+2004-01-27
+
+       * src/mainwindow.[ch]: added MainWindow::messageview_cid.
+         Clear messageview when it is hidden.
+       * src/textview.c: show URL to the statusbar when its link is clicked.
+         textview_uri_security_check(): compare real URL and apparent one
+         and show warning if it seems to be a fake URL.
+       * src/utils.[ch]:
+         is_uri_string(): return TRUE if the string seems like a URL.
+         get_uri_path(): return URL except for its scheme part.
+
 2004-01-23
 
        * src/folder.[ch]: folder_item_fetch_all_msg(): new. It fetches all
 2004-01-23
 
        * src/folder.[ch]: folder_item_fetch_all_msg(): new. It fetches all
index af7e5b1caa5daac1ad3cb4fc8a4d9818ed0d1ef0..30416082da57dddc68771138422146188505cf46 100644 (file)
@@ -1,3 +1,8 @@
+2004-01-28 [paul]      0.9.8claws55
+
+       * sync with 0.9.8cvs10
+               see Changelog 2004-01-27 and 2004-01-28
+
 2004-01-26 [christoph] 0.9.8claws54
 
        * src/imap.c
 2004-01-26 [christoph] 0.9.8claws54
 
        * src/imap.c
index 2aa7b1c9aed200e50dcbd0739a9cf909900783a1..3f9237699c3b50a8d7d820b9d069921fb57f42af 100644 (file)
@@ -1,3 +1,45 @@
+2004-01-28
+
+       * src/codeconv.c: conv_euctojis(): JIS X 0201 ¥«¥Ê¤«¤é JIS X 0208
+         ¤Ø¶¯À©Åª¤ËÊÑ´¹¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+
+2004-01-28
+
+       * src/imap.c: imap_get_msginfo(): ´Ö°ã¤Ã¤Æ¥«¥¦¥ó¥È¤µ¤ì¤Æ¤·¤Þ¤¦¤Î¤ò
+         ½¤Àµ¡£
+
+2004-01-28
+
+        * src/base64.c
+         src/codeconv.c
+         src/compose.c
+         src/html.c
+         src/imap.c
+         src/pop.c
+         src/prefs_account.c
+         src/procmime.c
+         src/procmsg.c
+         src/quote_fmt_parse.y
+         src/quoted-printable.c
+         src/textview.c
+         src/unmime.c
+         src/utils.c
+         src/utils.h
+         src/xml.c: ctype ´Ø¿ô¤ËÂФ·¤Æ°ú¿ô¤Î·¿¤¬¸í¤Ã¤Æ¤¤¤¿¤Î¤ò½¤Àµ(unsigned
+         char ¤Ç¤Ê¤¯¤Æ char ¤òÅϤ·¤Æ¤¤¤¿)¡£
+
+2004-01-27
+
+       * src/mainwindow.[ch]: MainWindow::messageview_cid ¤òÄɲá£
+         ¥á¥Ã¥»¡¼¥¸¥Ó¥å¡¼¤¬±£¤µ¤ì¤¿¾ì¹ç¥¯¥ê¥¢¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+       * src/textview.c: ¥ê¥ó¥¯¤¬¥¯¥ê¥Ã¥¯¤µ¤ì¤¿¤é URL ¤ò¥¹¥Æ¡¼¥¿¥¹¥Ð¡¼¤Ë
+         É½¼¨¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+         textview_uri_security_check(): ¼ÂºÝ¤Î URL ¤Èɽ¼¨¤µ¤ì¤Æ¤¤¤ë URL ¤ò
+         Èæ³Ó¤·¡¢µ¶¤Î URL ¤Î²ÄǽÀ­¤¬¤¢¤ì¤Ð·Ù¹ð¤ò½Ð¤¹¤è¤¦¤Ë¤·¤¿¡£
+       * src/utils.[ch]:
+         is_uri_string(): Ê¸»úÎ󤬠URL ¤Ç¤¢¤ì¤Ð TRUE ¤òÊÖ¤¹¡£
+         get_uri_path(): URL ¤Î¥¹¥­¡¼¥àÉô°Ê³°¤ÎÉôʬ¤òÊÖ¤¹¡£
+
 2004-01-23
 
        * src/folder.[ch]: folder_item_fetch_all_msg(): ¿·µ¬¡£¥Õ¥©¥ë¥ÀÃæ¤Î
 2004-01-23
 
        * src/folder.[ch]: folder_item_fetch_all_msg(): ¿·µ¬¡£¥Õ¥©¥ë¥ÀÃæ¤Î
index 36a2cf3bc563d3e5a9937835554732fb35609b64..cf6fceb72368169eb041d3a9a996a6f88d63251c 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=8
 INTERFACE_AGE=0
 BINARY_AGE=0
 MICRO_VERSION=8
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=54
+EXTRA_VERSION=55
 if test $EXTRA_VERSION -eq 0; then
     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}claws
 else
 if test $EXTRA_VERSION -eq 0; then
     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}claws
 else
index 94ba39ef2c24698c173d510bbd96e7787e4ca2ca..d5517a5031e4fc83864e5676c9a37862cd71da52 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2003 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2004 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -173,6 +173,72 @@ void conv_jistoeuc(gchar *outbuf, gint outlen, const gchar *inbuf)
        *out = '\0';
 }
 
        *out = '\0';
 }
 
+#define JIS_HWDAKUTEN          0x5e
+#define JIS_HWHANDAKUTEN       0x5f
+
+static gint conv_jis_hantozen(guchar *outbuf, guchar jis_code, guchar sound_sym)
+{
+       static guint16 h2z_tbl[] = {
+               /* 0x20 - 0x2f */
+               0x0000, 0x2123, 0x2156, 0x2157, 0x2122, 0x2126, 0x2572, 0x2521,
+               0x2523, 0x2525, 0x2527, 0x2529, 0x2563, 0x2565, 0x2567, 0x2543,
+               /* 0x30 - 0x3f */
+               0x213c, 0x2522, 0x2524, 0x2526, 0x2528, 0x252a, 0x252b, 0x252d,
+               0x252f, 0x2531, 0x2533, 0x2535, 0x2537, 0x2539, 0x253b, 0x253d,
+               /* 0x40 - 0x4f */
+               0x253f, 0x2541, 0x2544, 0x2546, 0x2548, 0x254a, 0x254b, 0x254c,
+               0x254d, 0x254e, 0x254f, 0x2552, 0x2555, 0x2558, 0x255b, 0x255e,
+               /* 0x50 - 0x5f */
+               0x255f, 0x2560, 0x2561, 0x2562, 0x2564, 0x2566, 0x2568, 0x2569,
+               0x256a, 0x256b, 0x256c, 0x256d, 0x256f, 0x2573, 0x212b, 0x212c
+       };
+
+       static guint16 dakuten_tbl[] = {
+               /* 0x30 - 0x3f */
+               0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x252c, 0x252e,
+               0x2530, 0x2532, 0x2534, 0x2536, 0x2538, 0x253a, 0x253c, 0x253e,
+               /* 0x40 - 0x4f */
+               0x2540, 0x2542, 0x2545, 0x2547, 0x2549, 0x0000, 0x0000, 0x0000,
+               0x0000, 0x0000, 0x2550, 0x2553, 0x2556, 0x2559, 0x255c, 0x0000
+       };
+
+       static guint16 handakuten_tbl[] = {
+               /* 0x4a - 0x4e */
+               0x2551, 0x2554, 0x2557, 0x255a, 0x255d
+       };
+
+       guint16 out_code;
+
+       jis_code &= 0x7f;
+       sound_sym &= 0x7f;
+
+       if (jis_code < 0x21 || jis_code > 0x5f)
+               return 0;
+
+       if (sound_sym == JIS_HWDAKUTEN &&
+           jis_code >= 0x36 && jis_code <= 0x4e) {
+               out_code = dakuten_tbl[jis_code - 0x30];
+               if (out_code != 0) {
+                       *outbuf = out_code >> 8;
+                       *(outbuf + 1) = out_code & 0xff;
+                       return 2;
+               }
+       }
+
+       if (sound_sym == JIS_HWHANDAKUTEN &&
+           jis_code >= 0x4a && jis_code <= 0x4e) {
+               out_code = handakuten_tbl[jis_code - 0x4a];
+               *outbuf = out_code >> 8;
+               *(outbuf + 1) = out_code & 0xff;
+               return 2;
+       }
+
+       out_code = h2z_tbl[jis_code - 0x20];
+       *outbuf = out_code >> 8;
+       *(outbuf + 1) = out_code & 0xff;
+       return 1;
+}
+
 void conv_euctojis(gchar *outbuf, gint outlen, const gchar *inbuf)
 {
        const guchar *in = inbuf;
 void conv_euctojis(gchar *outbuf, gint outlen, const gchar *inbuf)
 {
        const guchar *in = inbuf;
@@ -198,12 +264,34 @@ void conv_euctojis(gchar *outbuf, gint outlen, const gchar *inbuf)
                                }
                        }
                } else if (iseuchwkana1(*in)) {
                                }
                        }
                } else if (iseuchwkana1(*in)) {
-                       in++;
-                       if (iseuchwkana2(*in)) {
+                       if (iseuchwkana2(*(in + 1))) {
+#ifdef CONV_ALLOW_HWKANA
                                HW_IN();
                                HW_IN();
+                               in++;
                                *out++ = *in++ & 0x7f;
                                *out++ = *in++ & 0x7f;
+#else
+                               guchar jis_ch[2];
+                               gint len;
+
+                               if (iseuchwkana1(*(in + 2)) &&
+                                   iseuchwkana2(*(in + 3)))
+                                       len = conv_jis_hantozen
+                                               (jis_ch, *(in + 1), *(in + 3));
+                               else
+                                       len = conv_jis_hantozen
+                                               (jis_ch, *(in + 1), '\0');
+                               if (len == 0)
+                                       in += 2;
+                               else {
+                                       K_IN();
+                                       in += len * 2;
+                                       *out++ = jis_ch[0];
+                                       *out++ = jis_ch[1];
+                               }
+#endif
                        } else {
                                K_OUT();
                        } else {
                                K_OUT();
+                               in++;
                                if (*in != '\0' && !isascii(*in)) {
                                        *out++ = SUBST_CHAR;
                                        in++;
                                if (*in != '\0' && !isascii(*in)) {
                                        *out++ = SUBST_CHAR;
                                        in++;
@@ -1305,7 +1393,7 @@ const gchar *conv_get_outgoing_charset_str(void)
        const gchar *str;
 
        if (prefs_common.outgoing_charset) {
        const gchar *str;
 
        if (prefs_common.outgoing_charset) {
-               if (!isalpha(prefs_common.outgoing_charset[0])) {
+               if (!isalpha((guchar)prefs_common.outgoing_charset[0])) {
                        g_free(prefs_common.outgoing_charset);
                        prefs_common.outgoing_charset = g_strdup(CS_AUTO);
                } else if (strcmp(prefs_common.outgoing_charset, CS_AUTO) != 0)
                        g_free(prefs_common.outgoing_charset);
                        prefs_common.outgoing_charset = g_strdup(CS_AUTO);
                } else if (strcmp(prefs_common.outgoing_charset, CS_AUTO) != 0)
@@ -1404,13 +1492,13 @@ void conv_unmime_header(gchar *outbuf, gint outlen, const gchar *str,
 
 #define LBREAK_IF_REQUIRED(cond, is_plain_text)                                \
 {                                                                      \
 
 #define LBREAK_IF_REQUIRED(cond, is_plain_text)                                \
 {                                                                      \
-       if (len - (destp - dest) < MAX_LINELEN + 2) {                   \
+       if (len - (destp - (guchar *)dest) < MAX_LINELEN + 2) {         \
                *destp = '\0';                                          \
                return;                                                 \
        }                                                               \
                                                                        \
        if ((cond) && *srcp) {                                          \
                *destp = '\0';                                          \
                return;                                                 \
        }                                                               \
                                                                        \
        if ((cond) && *srcp) {                                          \
-               if (destp > dest && left < MAX_LINELEN - 1) {           \
+               if (destp > (guchar *)dest && left < MAX_LINELEN - 1) { \
                        if (isspace(*(destp - 1)))                      \
                                destp--;                                \
                        else if (is_plain_text && isspace(*srcp))       \
                        if (isspace(*(destp - 1)))                      \
                                destp--;                                \
                        else if (is_plain_text && isspace(*srcp))       \
@@ -1432,8 +1520,8 @@ void conv_encode_header(gchar *dest, gint len, const gchar *src,
        gint mimestr_len;
        gchar *mimesep_enc;
        gint left;
        gint mimestr_len;
        gchar *mimesep_enc;
        gint left;
-       const gchar *srcp = src;
-       gchar *destp = dest;
+       const guchar *srcp = src;
+       guchar *destp = dest;
        gboolean use_base64;
 
        if (MB_CUR_MAX > 1) {
        gboolean use_base64;
 
        if (MB_CUR_MAX > 1) {
@@ -1494,7 +1582,7 @@ void conv_encode_header(gchar *dest, gint len, const gchar *src,
                        gchar *part_str;
                        gchar *out_str;
                        gchar *enc_str;
                        gchar *part_str;
                        gchar *out_str;
                        gchar *enc_str;
-                       const gchar *p = srcp;
+                       const guchar *p = srcp;
                        gint out_str_len;
                        gint out_enc_str_len;
                        gint mime_block_len;
                        gint out_str_len;
                        gint out_enc_str_len;
                        gint mime_block_len;
index 7ed3c40afde9a8de55227e8e4efd3c60591d2951..484cd286abba40a12b7c6e293d4b5070bdd67747 100644 (file)
@@ -37,7 +37,7 @@ static const gchar base64val[128] = {
        41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1
 };
 
        41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1
 };
 
-#define BASE64VAL(c)   (isascii(c) ? base64val[(gint)(c)] : -1)
+#define BASE64VAL(c)   (isascii((guchar)c) ? base64val[(gint)(c)] : -1)
 
 void base64_encode(gchar *out, const guchar *in, gint inlen)
 {
 
 void base64_encode(gchar *out, const guchar *in, gint inlen)
 {
index 7e8da23e453bddc43227879aff83ea71c1d594de..bf99a234f927189859a67dd53a9f3bcc8cf527df 100644 (file)
@@ -94,7 +94,7 @@ gint qp_decode_line(gchar *str)
                        if (inp[1] && inp[2] &&
                            get_hex_value(outp, inp[1], inp[2]) == TRUE) {
                                inp += 3;
                        if (inp[1] && inp[2] &&
                            get_hex_value(outp, inp[1], inp[2]) == TRUE) {
                                inp += 3;
-                       } else if (inp[1] == '\0' || isspace(inp[1])) {
+                       } else if (inp[1] == '\0' || isspace((guchar)inp[1])) {
                                /* soft line break */
                                break;
                        } else {
                                /* soft line break */
                                break;
                        } else {
index 6c453cb09c54347295940e00eba4f720ec51b31c..0d6cc7a900b80f944850987fb01903238c08038f 100644 (file)
@@ -144,7 +144,7 @@ void ptr_array_free_strings(GPtrArray *array)
 
 gint to_number(const gchar *nstr)
 {
 
 gint to_number(const gchar *nstr)
 {
-       register const gchar *p;
+       register const guchar *p;
 
        if (*nstr == '\0') return -1;
 
 
        if (*nstr == '\0') return -1;
 
@@ -529,7 +529,7 @@ gboolean is_next_nonascii(const guchar *s)
        return FALSE;
 }
 
        return FALSE;
 }
 
-gint get_next_word_len(const gchar *s)
+gint get_next_word_len(const guchar *s)
 {
        gint len = 0;
 
 {
        gint len = 0;
 
@@ -575,7 +575,7 @@ gint subject_compare_for_sort(const gchar *s1, const gchar *s2)
 
 void trim_subject_for_compare(gchar *str)
 {
 
 void trim_subject_for_compare(gchar *str)
 {
-       gchar *srcp;
+       guchar *srcp;
 
        eliminate_parenthesis(str, '[', ']');
        eliminate_parenthesis(str, '(', ')');
 
        eliminate_parenthesis(str, '[', ']');
        eliminate_parenthesis(str, '(', ')');
@@ -588,7 +588,7 @@ void trim_subject_for_compare(gchar *str)
 
 void trim_subject_for_sort(gchar *str)
 {
 
 void trim_subject_for_sort(gchar *str)
 {
-       gchar *srcp;
+       guchar *srcp;
 
        g_strstrip(str);
 
 
        g_strstrip(str);
 
@@ -599,7 +599,7 @@ void trim_subject_for_sort(gchar *str)
 
 void trim_subject(gchar *str)
 {
 
 void trim_subject(gchar *str)
 {
-       register gchar *srcp, *destp;
+       register guchar *srcp, *destp;
        gchar op, cl;
        gint in_brace;
 
        gchar op, cl;
        gint in_brace;
 
@@ -631,7 +631,7 @@ void trim_subject(gchar *str)
 
 void eliminate_parenthesis(gchar *str, gchar op, gchar cl)
 {
 
 void eliminate_parenthesis(gchar *str, gchar op, gchar cl)
 {
-       register gchar *srcp, *destp;
+       register guchar *srcp, *destp;
        gint in_brace;
 
        srcp = destp = str;
        gint in_brace;
 
        srcp = destp = str;
@@ -713,7 +713,7 @@ void extract_parenthesis_with_skip_quote(gchar *str, gchar quote_chr,
 
 void eliminate_quote(gchar *str, gchar quote_chr)
 {
 
 void eliminate_quote(gchar *str, gchar quote_chr)
 {
-       register gchar *srcp, *destp;
+       register guchar *srcp, *destp;
 
        srcp = destp = str;
 
 
        srcp = destp = str;
 
@@ -748,7 +748,7 @@ void extract_quote(gchar *str, gchar quote_chr)
 
 void eliminate_address_comment(gchar *str)
 {
 
 void eliminate_address_comment(gchar *str)
 {
-       register gchar *srcp, *destp;
+       register guchar *srcp, *destp;
        gint in_brace;
 
        srcp = destp = str;
        gint in_brace;
 
        srcp = destp = str;
@@ -980,7 +980,7 @@ void remove_return(gchar *str)
 
 void remove_space(gchar *str)
 {
 
 void remove_space(gchar *str)
 {
-       register gchar *p = str;
+       register guchar *p = str;
        register gint spc;
 
        while (*p) {
        register gint spc;
 
        while (*p) {
@@ -996,7 +996,7 @@ void remove_space(gchar *str)
 
 void unfold_line(gchar *str)
 {
 
 void unfold_line(gchar *str)
 {
-       register gchar *p = str;
+       register guchar *p = str;
        register gint spc;
 
        while (*p) {
        register gint spc;
 
        while (*p) {
@@ -1075,15 +1075,15 @@ gboolean is_ascii_str(const guchar *str)
 
 gint get_quote_level(const gchar *str, const gchar *quote_chars)
 {
 
 gint get_quote_level(const gchar *str, const gchar *quote_chars)
 {
-       const gchar *first_pos;
-       const gchar *last_pos;
-       const gchar *p = str;
+       const guchar *first_pos;
+       const guchar *last_pos;
+       const guchar *p = str;
        gint quote_level = -1;
 
        /* speed up line processing by only searching to the last '>' */
        if ((first_pos = line_has_quote_char(str, quote_chars)) != NULL) {
                /* skip a line if it contains a '<' before the initial '>' */
        gint quote_level = -1;
 
        /* speed up line processing by only searching to the last '>' */
        if ((first_pos = line_has_quote_char(str, quote_chars)) != NULL) {
                /* skip a line if it contains a '<' before the initial '>' */
-               if (memchr(str, '<', first_pos - str) != NULL)
+               if (memchr(str, '<', first_pos - (const guchar *)str) != NULL)
                        return -1;
                last_pos = line_has_quote_char_last(first_pos, quote_chars);
        } else
                        return -1;
                last_pos = line_has_quote_char_last(first_pos, quote_chars);
        } else
@@ -1252,7 +1252,7 @@ gchar **strsplit_parenthesis(const gchar *str, gchar op, gchar cl,
                        n++;
                        str = s_cl + 1;
 
                        n++;
                        str = s_cl + 1;
 
-                       while (*str && isspace(*str)) str++;
+                       while (*str && isspace(*(guchar *)str)) str++;
                        if (*str != op) {
                                string_list = g_slist_prepend(string_list,
                                                              g_strdup(""));
                        if (*str != op) {
                                string_list = g_slist_prepend(string_list,
                                                              g_strdup(""));
@@ -1398,7 +1398,7 @@ gchar *trim_string(const gchar *str, gint len)
 GList *uri_list_extract_filenames(const gchar *uri_list)
 {
        GList *result = NULL;
 GList *uri_list_extract_filenames(const gchar *uri_list)
 {
        GList *result = NULL;
-       const gchar *p, *q;
+       const guchar *p, *q;
        gchar *file;
 
        p = uri_list;
        gchar *file;
 
        p = uri_list;
@@ -1443,6 +1443,88 @@ GList *uri_list_extract_filenames(const gchar *uri_list)
        } \
 }
 
        } \
 }
 
+/* Converts two-digit hexadecimal to decimal.  Used for unescaping escaped 
+ * characters
+ */
+static gint axtoi(const gchar *hexstr)
+{
+       gint hi, lo, result;
+       
+       hi = hexstr[0];
+       if ('0' <= hi && hi <= '9') {
+               hi -= '0';
+       } else
+               if ('a' <= hi && hi <= 'f') {
+                       hi -= ('a' - 10);
+               } else
+                       if ('A' <= hi && hi <= 'F') {
+                               hi -= ('A' - 10);
+                       }
+
+       lo = hexstr[1];
+       if ('0' <= lo && lo <= '9') {
+               lo -= '0';
+       } else
+               if ('a' <= lo && lo <= 'f') {
+                       lo -= ('a'-10);
+               } else
+                       if ('A' <= lo && lo <= 'F') {
+                               lo -= ('A' - 10);
+                       }
+       result = lo + (16 * hi);
+       return result;
+}
+
+gboolean is_uri_string(const gchar *str)
+{
+       return (g_strncasecmp(str, "http://", 7) == 0 ||
+               g_strncasecmp(str, "https://", 8) == 0 ||
+               g_strncasecmp(str, "ftp://", 6) == 0 ||
+               g_strncasecmp(str, "www.", 4) == 0);
+}
+
+gchar *get_uri_path(const gchar *uri)
+{
+       if (g_strncasecmp(uri, "http://", 7) == 0)
+               return (gchar *)(uri + 7);
+       else if (g_strncasecmp(uri, "https://", 8) == 0)
+               return (gchar *)(uri + 8);
+       else if (g_strncasecmp(uri, "ftp://", 6) == 0)
+               return (gchar *)(uri + 6);
+       else
+               return (gchar *)uri;
+}
+
+/* Decodes URL-Encoded strings (i.e. strings in which spaces are replaced by
+ * plusses, and escape characters are used)
+ */
+void decode_uri(gchar *decoded_uri, const gchar *encoded_uri)
+{
+       gchar *dec = decoded_uri;
+       const gchar *enc = encoded_uri;
+
+       while (*enc) {
+               if (*enc == '%') {
+                       enc++;
+                       if (isxdigit((guchar)enc[0]) &&
+                           isxdigit((guchar)enc[1])) {
+                               *dec = axtoi(enc);
+                               dec++;
+                               enc += 2;
+                       }
+               } else {
+                       if (*enc == '+')
+                               *dec = ' ';
+                       else
+                               *dec = *enc;
+                       dec++;
+                       enc++;
+               }
+       }
+
+       *dec = '\0';
+}
+
 gint scan_mailto_url(const gchar *mailto, gchar **to, gchar **cc, gchar **bcc,
                     gchar **subject, gchar **body)
 {
 gint scan_mailto_url(const gchar *mailto, gchar **to, gchar **cc, gchar **bcc,
                     gchar **subject, gchar **body)
 {
@@ -3068,77 +3150,6 @@ void encode_uri(gchar *encoded_uri, gint bufsize, const gchar *uri)
        encoded_uri[k] = 0;
 }
 
        encoded_uri[k] = 0;
 }
 
-/* Converts two-digit hexadecimal to decimal.  Used for unescaping escaped 
- * characters
- */
-static gint axtoi(const gchar *hexstr)
-{
-       gint hi, lo, result;
-       
-       hi = hexstr[0];
-       if ('0' <= hi && hi <= '9') {
-               hi -= '0';
-       } else
-               if ('a' <= hi && hi <= 'f') {
-                       hi -= ('a' - 10);
-               } else
-                       if ('A' <= hi && hi <= 'F') {
-                               hi -= ('A' - 10);
-                       }
-
-       lo = hexstr[1];
-       if ('0' <= lo && lo <= '9') {
-               lo -= '0';
-       } else
-               if ('a' <= lo && lo <= 'f') {
-                       lo -= ('a'-10);
-               } else
-                       if ('A' <= lo && lo <= 'F') {
-                               lo -= ('A' - 10);
-                       }
-       result = lo + (16 * hi);
-       return result;
-}
-
-
-/* Decodes URL-Encoded strings (i.e. strings in which spaces are replaced by
- * plusses, and escape characters are used)
- */
-
-void decode_uri(gchar *decoded_uri, const gchar *encoded_uri)
-{
-       const gchar *encoded;
-       gchar *decoded;
-
-       encoded = encoded_uri;
-       decoded = decoded_uri;
-
-       while (*encoded) {
-               if (*encoded == '%') {
-                       encoded++;
-                       if (isxdigit(encoded[0])
-                           && isxdigit(encoded[1])) {
-                               *decoded = (gchar) axtoi(encoded);
-                               decoded++;
-                               encoded += 2;
-                       }
-               }
-               else if (*encoded == '+') {
-                       *decoded = ' ';
-                       decoded++;
-                       encoded++;
-               }
-               else {
-                       *decoded = *encoded;
-                       decoded++;
-                       encoded++;
-               }
-       }
-
-       *decoded = '\0';
-}
-
-
 gint open_uri(const gchar *uri, const gchar *cmdline)
 {
        gchar buf[BUFFSIZE];
 gint open_uri(const gchar *uri, const gchar *cmdline)
 {
        gchar buf[BUFFSIZE];
index fb050950ce121a3f3ffaeb8ec4df57d5727cb950..cef9f76322a5d48d07ed159b483e9b4d64b4bbc2 100644 (file)
@@ -222,7 +222,7 @@ wchar_t *wcscasestr         (const wchar_t *haystack,
 gint get_mbs_len               (const gchar    *s);
 
 gboolean is_next_nonascii      (const guchar *s);
 gint get_mbs_len               (const gchar    *s);
 
 gboolean is_next_nonascii      (const guchar *s);
-gint get_next_word_len         (const gchar *s);
+gint get_next_word_len         (const guchar *s);
 
 /* functions for string parsing */
 gint subject_compare                   (const gchar    *s1,
 
 /* functions for string parsing */
 gint subject_compare                   (const gchar    *s1,
@@ -307,6 +307,8 @@ gchar *trim_string                  (const gchar    *str,
                                         gint            len);
 
 GList *uri_list_extract_filenames      (const gchar    *uri_list);
                                         gint            len);
 
 GList *uri_list_extract_filenames      (const gchar    *uri_list);
+gboolean is_uri_string                 (const gchar    *str);
+gchar *get_uri_path                    (const gchar    *uri);
 void decode_uri                                (gchar          *decoded_uri,
                                         const gchar    *encoded_uri);
 gint scan_mailto_url                   (const gchar    *mailto,
 void decode_uri                                (gchar          *decoded_uri,
                                         const gchar    *encoded_uri);
 gint scan_mailto_url                   (const gchar    *mailto,
index 7fd59086c47848b40ba65416ca079f145834929b..c2969f211bd454aeb19707b2145971d9a022da7b 100644 (file)
@@ -179,7 +179,7 @@ gint xml_get_dtd(XMLFile *file)
 gint xml_parse_next_tag(XMLFile *file)
 {
        gchar buf[XMLBUFSIZE];
 gint xml_parse_next_tag(XMLFile *file)
 {
        gchar buf[XMLBUFSIZE];
-       gchar *bufp = buf;
+       guchar *bufp = buf;
        XMLTag *tag;
        gint len;
 
        XMLTag *tag;
        gint len;
 
index 9ae2385188d1916920dbf3201ff74d1d0897ac9a..c2947a6e00352e76cd694bf7bf30f15d004de830 100644 (file)
@@ -1840,7 +1840,8 @@ static void compose_reply_set_entry(Compose *compose, MsgInfo *msginfo,
        }
 
        if (msginfo->subject && *msginfo->subject) {
        }
 
        if (msginfo->subject && *msginfo->subject) {
-               gchar *buf, *buf2, *p;
+               gchar *buf, *buf2;
+               guchar *p;
 
                buf = p = g_strdup(msginfo->subject);
                p += subject_get_prefix_length(p);
 
                buf = p = g_strdup(msginfo->subject);
                p += subject_get_prefix_length(p);
@@ -2348,7 +2349,7 @@ static void compose_wrap_line(Compose *compose)
                        if (ch_len == 1 
                            && strchr(prefs_common.quote_chars, *cbuf))
                                quoted = 1;
                        if (ch_len == 1 
                            && strchr(prefs_common.quote_chars, *cbuf))
                                quoted = 1;
-                       else if (ch_len != 1 || !isspace(*cbuf))
+                       else if (ch_len != 1 || !isspace(*(guchar *)cbuf))
                                quoted = 0;
 
                        line_end = 0;
                                quoted = 0;
 
                        line_end = 0;
@@ -2395,15 +2396,16 @@ static void compose_wrap_line(Compose *compose)
                        ch_len = 1;
                }
 
                        ch_len = 1;
                }
 
-               if (ch_len == 1 && isspace(*cbuf))
+               if (ch_len == 1 && isspace(*(guchar *)cbuf))
                        space = 1;
 
                if (ch_len == 1 && *cbuf == '\n') {
                        guint replace = 0;
                        space = 1;
 
                if (ch_len == 1 && *cbuf == '\n') {
                        guint replace = 0;
-                       if (last_ch_len == 1 && !isspace(last_ch)) {
+                       if (last_ch_len == 1 && !isspace((guchar)last_ch)) {
                                if (cur_pos + 1 < p_end) {
                                        GET_CHAR(cur_pos + 1, cbuf, ch_len);
                                if (cur_pos + 1 < p_end) {
                                        GET_CHAR(cur_pos + 1, cbuf, ch_len);
-                                       if (ch_len == 1 && !isspace(*cbuf))
+                                       if (ch_len == 1 &&
+                                           !isspace(*(guchar *)cbuf))
                                                replace = 1;
                                }
                        }
                                                replace = 1;
                                }
                        }
@@ -2434,7 +2436,7 @@ static void compose_wrap_line(Compose *compose)
                        gint tlen = ch_len;
 
                        GET_CHAR(line_pos - 1, cbuf, ch_len);
                        gint tlen = ch_len;
 
                        GET_CHAR(line_pos - 1, cbuf, ch_len);
-                       if (ch_len == 1 && isspace(*cbuf)) {
+                       if (ch_len == 1 && isspace(*(guchar *)cbuf)) {
                                gtk_stext_set_point(text, line_pos);
                                gtk_stext_backward_delete(text, 1);
                                p_end--;
                                gtk_stext_set_point(text, line_pos);
                                gtk_stext_backward_delete(text, 1);
                                p_end--;
@@ -2530,7 +2532,7 @@ static guint get_indent_length(GtkSText *text, guint start_pos, guint text_len)
                        break;
                case WAIT_FOR_INDENT_CHAR_OR_SPACE:
                        if (is_indent == FALSE && is_space == FALSE &&
                        break;
                case WAIT_FOR_INDENT_CHAR_OR_SPACE:
                        if (is_indent == FALSE && is_space == FALSE &&
-                           !isupper(cbuf[0]))
+                           !isupper((guchar)cbuf[0]))
                                goto out;
                        if (is_space == TRUE) {
                                alnum_cnt = 0;
                                goto out;
                        if (is_space == TRUE) {
                                alnum_cnt = 0;
@@ -2544,7 +2546,7 @@ static guint get_indent_length(GtkSText *text, guint start_pos, guint text_len)
                        }
                        break;
                case WAIT_FOR_INDENT_CHAR:
                        }
                        break;
                case WAIT_FOR_INDENT_CHAR:
-                       if (is_indent == FALSE && !isupper(cbuf[0]))
+                       if (is_indent == FALSE && !isupper((guchar)cbuf[0]))
                                goto out;
                        if (is_indent == TRUE) {
                                if (alnum_cnt > 0 
                                goto out;
                        if (is_indent == TRUE) {
                                if (alnum_cnt > 0 
@@ -2721,7 +2723,7 @@ static void compose_wrap_line_all_full(Compose *compose, gboolean autowrap)
 
                                /* insert space if it's alphanumeric */
                                if ((cur_pos != line_pos) &&
 
                                /* insert space if it's alphanumeric */
                                if ((cur_pos != line_pos) &&
-                                   ((clen > 1) || isalnum(cb[0]))) {
+                                   ((clen > 1) || isalnum((guchar)cb[0]))) {
                                        gtk_stext_insert(text, NULL, NULL,
                                                        NULL, " ", 1);
                                        tlen++;
                                        gtk_stext_insert(text, NULL, NULL,
                                                        NULL, " ", 1);
                                        tlen++;
@@ -2762,7 +2764,7 @@ static void compose_wrap_line_all_full(Compose *compose, gboolean autowrap)
                }
 
                /* possible line break */
                }
 
                /* possible line break */
-               if (ch_len == 1 && isspace(*cbuf)) {
+               if (ch_len == 1 && isspace(*(guchar *)cbuf)) {
                        line_pos = cur_pos + 1;
                        line_len = cur_len + ch_len;
                }
                        line_pos = cur_pos + 1;
                        line_len = cur_len + ch_len;
                }
@@ -2788,7 +2790,7 @@ static void compose_wrap_line_all_full(Compose *compose, gboolean autowrap)
                        GET_CHAR(line_pos - 1, cbuf, clen);
 
                        /* if next character is space delete it */
                        GET_CHAR(line_pos - 1, cbuf, clen);
 
                        /* if next character is space delete it */
-                       if (clen == 1 && isspace(*cbuf)) {
+                       if (clen == 1 && isspace(*(guchar *)cbuf)) {
                                if (p_pos + i_len != line_pos ||
                                    !gtk_stext_is_uri_string
                                        (text, line_pos, tlen)) {
                                if (p_pos + i_len != line_pos ||
                                    !gtk_stext_is_uri_string
                                        (text, line_pos, tlen)) {
index bd846eef146ccc48e4fffa79059555fd975bca42..92597c96aa2b59baf0142a0f375f8e01b842d3e2 100644 (file)
@@ -170,7 +170,7 @@ static ERTFState ertf_parse_tag(ERTFParser *parser)
        ertf_get_parenthesis (parser, buf, sizeof(buf));
        
        for (p = buf; *p != '\0'; p++) {
        ertf_get_parenthesis (parser, buf, sizeof(buf));
        
        for (p = buf; *p != '\0'; p++) {
-               if (isspace (*p)) {
+               if (isspace (*(guchar *)p)) {
                        *p = '\0';
                        break;
                }
                        *p = '\0';
                        break;
                }
index f10c55b26ae6739f9fca3ff0dfb6c0211793928c..47d6adcbd3a538a509171487b3bea8243216845f 100644 (file)
@@ -519,7 +519,7 @@ static HTMLTag *html_get_tag(const gchar *str)
 {
        HTMLTag *tag;
        gchar *tmp;
 {
        HTMLTag *tag;
        gchar *tmp;
-       gchar *tmpp;
+       guchar *tmpp;
 
        g_return_val_if_fail(str != NULL, NULL);
 
 
        g_return_val_if_fail(str != NULL, NULL);
 
@@ -664,7 +664,7 @@ static HTMLState html_parse_tag(HTMLParser *parser)
                   !strcmp(tag->name, "li")     ||
                   !strcmp(tag->name, "table")  ||
                   !strcmp(tag->name, "tr")     ||
                   !strcmp(tag->name, "li")     ||
                   !strcmp(tag->name, "table")  ||
                   !strcmp(tag->name, "tr")     ||
-                  (tag->name[0] == 'h' && isdigit(tag->name[1]))) {
+                  (tag->name[0] == 'h' && isdigit((guchar)tag->name[1]))) {
                if (!parser->newline) {
                        parser->space = FALSE;
                        html_append_char(parser, '\n');
                if (!parser->newline) {
                        parser->space = FALSE;
                        html_append_char(parser, '\n');
@@ -673,7 +673,7 @@ static HTMLState html_parse_tag(HTMLParser *parser)
        } else if (!strcmp(tag->name, "/table") ||
                   (tag->name[0] == '/' &&
                    tag->name[1] == 'h' &&
        } else if (!strcmp(tag->name, "/table") ||
                   (tag->name[0] == '/' &&
                    tag->name[1] == 'h' &&
-                   isdigit(tag->name[1]))) {
+                   isdigit((guchar)tag->name[1]))) {
                if (!parser->empty_line) {
                        parser->space = FALSE;
                        if (!parser->newline) html_append_char(parser, '\n');
                if (!parser->empty_line) {
                        parser->space = FALSE;
                        if (!parser->newline) html_append_char(parser, '\n');
@@ -721,7 +721,7 @@ static void html_parse_special(HTMLParser *parser)
                html_append_str(parser, val, -1);
                parser->state = HTML_NORMAL;
                return;
                html_append_str(parser, val, -1);
                parser->state = HTML_NORMAL;
                return;
-       } else if (symbol_name[1] == '#' && isdigit(symbol_name[2])) {
+       } else if (symbol_name[1] == '#' && isdigit((guchar)symbol_name[2])) {
                gint ch;
 
                ch = atoi(symbol_name + 2);
                gint ch;
 
                ch = atoi(symbol_name + 2);
index c520f92a80547ef1169b4b754efcf774c1dcb904..6e0fe80a9b5e53589bb596071471e2aa31fcc2ed 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2003 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2004 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1981,7 +1981,7 @@ static SockInfo *imap_init_sock(SockInfo *sock)
 
 static GList *imap_parse_namespace_str(gchar *str)
 {
 
 static GList *imap_parse_namespace_str(gchar *str)
 {
-       gchar *p = str;
+       guchar *p = str;
        gchar *name;
        gchar *separator;
        IMAPNameSpace *namespace;
        gchar *name;
        gchar *separator;
        IMAPNameSpace *namespace;
@@ -2173,7 +2173,7 @@ static gchar *imap_parse_atom(SockInfo *sock, gchar *src,
        g_return_val_if_fail(str != NULL, cur_pos);
 
        /* read the next line if the current response buffer is empty */
        g_return_val_if_fail(str != NULL, cur_pos);
 
        /* read the next line if the current response buffer is empty */
-       while (isspace(*cur_pos)) cur_pos++;
+       while (isspace(*(guchar *)cur_pos)) cur_pos++;
        while (*cur_pos == '\0') {
                if ((nextline = sock_getline(sock)) == NULL)
                        return cur_pos;
        while (*cur_pos == '\0') {
                if ((nextline = sock_getline(sock)) == NULL)
                        return cur_pos;
@@ -2184,7 +2184,7 @@ static gchar *imap_parse_atom(SockInfo *sock, gchar *src,
                debug_print("IMAP4< %s\n", nextline);
                g_free(nextline);
 
                debug_print("IMAP4< %s\n", nextline);
                g_free(nextline);
 
-               while (isspace(*cur_pos)) cur_pos++;
+               while (isspace(*(guchar *)cur_pos)) cur_pos++;
        }
 
        if (!strncmp(cur_pos, "NIL", 3)) {
        }
 
        if (!strncmp(cur_pos, "NIL", 3)) {
@@ -2239,7 +2239,7 @@ static gchar *imap_get_header(SockInfo *sock, gchar *cur_pos, gchar **headers,
 
        g_return_val_if_fail(str != NULL, cur_pos);
 
 
        g_return_val_if_fail(str != NULL, cur_pos);
 
-       while (isspace(*cur_pos)) cur_pos++;
+       while (isspace(*(guchar *)cur_pos)) cur_pos++;
 
        g_return_val_if_fail(*cur_pos == '{', cur_pos);
 
 
        g_return_val_if_fail(*cur_pos == '{', cur_pos);
 
@@ -2266,7 +2266,7 @@ static gchar *imap_get_header(SockInfo *sock, gchar *cur_pos, gchar **headers,
        *headers = g_strndup(cur_pos, len);
        cur_pos += len;
 
        *headers = g_strndup(cur_pos, len);
        cur_pos += len;
 
-       while (isspace(*cur_pos)) cur_pos++;
+       while (isspace(*(guchar *)cur_pos)) cur_pos++;
        while (*cur_pos == '\0') {
                if ((nextline = sock_getline(sock)) == NULL)
                        return cur_pos;
        while (*cur_pos == '\0') {
                if ((nextline = sock_getline(sock)) == NULL)
                        return cur_pos;
@@ -2276,7 +2276,7 @@ static gchar *imap_get_header(SockInfo *sock, gchar *cur_pos, gchar **headers,
                debug_print("IMAP4< %s\n", nextline);
                g_free(nextline);
 
                debug_print("IMAP4< %s\n", nextline);
                g_free(nextline);
 
-               while (isspace(*cur_pos)) cur_pos++;
+               while (isspace(*(guchar *)cur_pos)) cur_pos++;
        }
 
        return cur_pos;
        }
 
        return cur_pos;
@@ -3493,7 +3493,7 @@ static gchar *imap_locale_to_modified_utf7(const gchar *from)
                        norm_utf7_len -= 2;
                        from_tmp++;
                        from_len--;
                        norm_utf7_len -= 2;
                        from_tmp++;
                        from_len--;
-               } else if (IS_PRINT(*from_tmp)) {
+               } else if (IS_PRINT(*(guchar *)from_tmp)) {
                        /* printable ascii char */
                        *norm_utf7_p = *from_tmp;
                        norm_utf7_p++;
                        /* printable ascii char */
                        *norm_utf7_p = *from_tmp;
                        norm_utf7_p++;
@@ -3505,7 +3505,7 @@ static gchar *imap_locale_to_modified_utf7(const gchar *from)
 
                        /* unprintable char: convert to UTF-7 */
                        p = from_tmp;
 
                        /* unprintable char: convert to UTF-7 */
                        p = from_tmp;
-                       while (!IS_PRINT(*p) && conv_len < from_len) {
+                       while (!IS_PRINT(*(guchar *)p) && conv_len < from_len) {
                                mb_len = mblen(p, MB_LEN_MAX);
                                if (mb_len <= 0) {
                                        g_warning("wrong multibyte sequence\n");
                                mb_len = mblen(p, MB_LEN_MAX);
                                if (mb_len <= 0) {
                                        g_warning("wrong multibyte sequence\n");
index b4b9d49c2022147c621ca989385bb2fc72dde4f5..2c81f0a7268cc6ccc8da12ad8772ec73f3f28e98 100644 (file)
@@ -938,6 +938,8 @@ MainWindow *main_window_create(SeparateType type)
                (GTK_STATUSBAR(statusbar), "Folder View");
        mainwin->summaryview_cid = gtk_statusbar_get_context_id
                (GTK_STATUSBAR(statusbar), "Summary View");
                (GTK_STATUSBAR(statusbar), "Folder View");
        mainwin->summaryview_cid = gtk_statusbar_get_context_id
                (GTK_STATUSBAR(statusbar), "Summary View");
+       mainwin->messageview_cid = gtk_statusbar_get_context_id
+               (GTK_STATUSBAR(statusbar), "Message View");
 
        /* allocate colors for summary view and folder view */
        summaryview->color_marked.red = summaryview->color_marked.green = 0;
 
        /* allocate colors for summary view and folder view */
        summaryview->color_marked.red = summaryview->color_marked.green = 0;
@@ -1433,6 +1435,9 @@ void main_window_toggle_message_view(MainWindow *mainwin)
                              GTK_ARROW_DOWN, GTK_SHADOW_OUT);
        }
 
                              GTK_ARROW_DOWN, GTK_SHADOW_OUT);
        }
 
+       if (mainwin->messageview->visible == FALSE)
+               messageview_clear(mainwin->messageview);
+
        main_window_set_menu_sensitive(mainwin);
 
        prefs_common.msgview_visible = mainwin->messageview->visible;
        main_window_set_menu_sensitive(mainwin);
 
        prefs_common.msgview_visible = mainwin->messageview->visible;
index 596576dc1fe72ddadc220d0450967ab0ded47fbc..f75843252a59e26cdb085a13778d7856059d2ce7 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2004 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -119,6 +119,7 @@ struct _MainWindow
        gint mainwin_cid;
        gint folderview_cid;
        gint summaryview_cid;
        gint mainwin_cid;
        gint folderview_cid;
        gint summaryview_cid;
+       gint messageview_cid;
 
        ToolbarStyle toolbar_style;
 
 
        ToolbarStyle toolbar_style;
 
index b03e8f888d8177c6e0d9dd1d2aec3d06bff50266..2fd15a9b6bb9e4d49a89f094fda600afb62934c5 100644 (file)
--- a/src/pop.c
+++ b/src/pop.c
@@ -708,7 +708,7 @@ static gint pop3_session_recv_msg(Session *session, const gchar *msg)
 {
        Pop3Session *pop3_session = POP3_SESSION(session);
        Pop3ErrorValue val = PS_SUCCESS;
 {
        Pop3Session *pop3_session = POP3_SESSION(session);
        Pop3ErrorValue val = PS_SUCCESS;
-       const gchar *body;
+       const guchar *body;
 
        body = msg;
        if (pop3_session->state != POP3_GETRANGE_UIDL_RECV &&
 
        body = msg;
        if (pop3_session->state != POP3_GETRANGE_UIDL_RECV &&
index 19024b1a4ac105f0ce6fa001238986d9204e22bf..7eb44a4334d0846b9a48742c638ee8e25b9dd6fc 100644 (file)
@@ -580,7 +580,7 @@ PrefsAccount *prefs_account_new(void)
 
 void prefs_account_read_config(PrefsAccount *ac_prefs, const gchar *label)
 {
 
 void prefs_account_read_config(PrefsAccount *ac_prefs, const gchar *label)
 {
-       const gchar *p = label;
+       const guchar *p = label;
        gint id;
 
        g_return_if_fail(ac_prefs != NULL);
        gint id;
 
        g_return_if_fail(ac_prefs != NULL);
index 2a76be3c04b45f1131307db5ad2b2b6ee1b14e94..cbce8e020addd8c406f6368eef5d552708388719 100644 (file)
@@ -794,7 +794,8 @@ GList *procmime_get_mime_type_list(void)
        GList *list = NULL;
        FILE *fp;
        gchar buf[BUFFSIZE];
        GList *list = NULL;
        FILE *fp;
        gchar buf[BUFFSIZE];
-       gchar *p, *delim;
+       guchar *p;
+       gchar *delim;
        MimeType *mime_type;
 
        if (mime_type_list) 
        MimeType *mime_type;
 
        if (mime_type_list) 
index 75e5c1f5999447fd7dfc40eba1dbe1f2d3c6d6cc..522d65131a7e2deaec455af6a74a1519a837f723 100644 (file)
@@ -550,7 +550,7 @@ void procmsg_get_filter_keyword(MsgInfo *msginfo, gchar **header, gchar **key,
                        SET_FILTER_KEY("header \"List-Id\"", H_LIST_ID);
                        extract_list_id_str(*key);
                } else if (hentry[H_X_SEQUENCE].body != NULL) {
                        SET_FILTER_KEY("header \"List-Id\"", H_LIST_ID);
                        extract_list_id_str(*key);
                } else if (hentry[H_X_SEQUENCE].body != NULL) {
-                       gchar *p;
+                       guchar *p;
 
                        SET_FILTER_KEY("X-Sequence", H_X_SEQUENCE);
                        p = *key;
 
                        SET_FILTER_KEY("X-Sequence", H_X_SEQUENCE);
                        p = *key;
index 13cb1aacae80926e211097fa1bc35ef14ba8bb87..605cbd9a01e479063b2f7485f399179f82c5dcce 100644 (file)
@@ -131,7 +131,7 @@ int quote_fmtwrap(void)
        return 1;
 }
 
        return 1;
 }
 
-static int isseparator(char ch)
+static int isseparator(int ch)
 {
        return isspace(ch) || ch == '.' || ch == '-';
 }
 {
        return isspace(ch) || ch == '.' || ch == '-';
 }
@@ -284,7 +284,7 @@ special:
        | SHOW_FIRST_NAME
        {
                if (msginfo->fromname) {
        | SHOW_FIRST_NAME
        {
                if (msginfo->fromname) {
-                       gchar *p;
+                       guchar *p;
                        gchar *str;
 
                        str = alloca(strlen(msginfo->fromname) + 1);
                        gchar *str;
 
                        str = alloca(strlen(msginfo->fromname) + 1);
@@ -333,7 +333,7 @@ special:
 #define MAX_SENDER_INITIAL 20
                if (msginfo->fromname) {
                        gchar tmp[MAX_SENDER_INITIAL];
 #define MAX_SENDER_INITIAL 20
                if (msginfo->fromname) {
                        gchar tmp[MAX_SENDER_INITIAL];
-                       gchar *p;
+                       guchar *p;
                        gchar *cur;
                        gint len = 0;
 
                        gchar *cur;
                        gint len = 0;
 
index 0f4baec3238b43c95d188aa88a408deb7e119eae..5c9486bb11a54b732d7e6497bffc76c15911edda 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2003 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2004 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -141,6 +141,7 @@ static void textview_write_body             (TextView       *textview,
 static void textview_show_html         (TextView       *textview,
                                         FILE           *fp,
                                         CodeConverter  *conv);
 static void textview_show_html         (TextView       *textview,
                                         FILE           *fp,
                                         CodeConverter  *conv);
+
 static void textview_write_line                (TextView       *textview,
                                         const gchar    *str,
                                         CodeConverter  *conv);
 static void textview_write_line                (TextView       *textview,
                                         const gchar    *str,
                                         CodeConverter  *conv);
@@ -148,6 +149,7 @@ static void textview_write_link             (TextView       *textview,
                                         const gchar    *str,
                                         const gchar    *uri,
                                         CodeConverter  *conv);
                                         const gchar    *str,
                                         const gchar    *uri,
                                         CodeConverter  *conv);
+
 static GPtrArray *textview_scan_header (TextView       *textview,
                                         FILE           *fp);
 static void textview_show_header       (TextView       *textview,
 static GPtrArray *textview_scan_header (TextView       *textview,
                                         FILE           *fp);
 static void textview_show_header       (TextView       *textview,
@@ -163,8 +165,6 @@ static gint textview_button_released        (GtkWidget      *widget,
                                         GdkEventButton *event,
                                         TextView       *textview);
 
                                         GdkEventButton *event,
                                         TextView       *textview);
 
-static void textview_uri_list_remove_all(GSList                *uri_list);
-
 static void textview_smooth_scroll_do          (TextView       *textview,
                                                 gfloat          old_value,
                                                 gfloat          last_value,
 static void textview_smooth_scroll_do          (TextView       *textview,
                                                 gfloat          old_value,
                                                 gfloat          last_value,
@@ -174,6 +174,10 @@ static void textview_smooth_scroll_one_line        (TextView       *textview,
 static gboolean textview_smooth_scroll_page    (TextView       *textview,
                                                 gboolean        up);
 
 static gboolean textview_smooth_scroll_page    (TextView       *textview,
                                                 gboolean        up);
 
+static gboolean textview_uri_security_check    (TextView       *textview,
+                                                RemoteURI      *uri);
+static void textview_uri_list_remove_all       (GSList         *uri_list);
+
 
 TextView *textview_create(void)
 {
 
 TextView *textview_create(void)
 {
@@ -715,7 +719,9 @@ static gboolean get_uri_part(const gchar *start, const gchar *scanpos,
 
        /* find end point of URI */
        for (ep_ = scanpos; *ep_ != '\0'; ep_++) {
 
        /* find end point of URI */
        for (ep_ = scanpos; *ep_ != '\0'; ep_++) {
-               if (!isgraph(*ep_) || !isascii(*ep_) || strchr("()<>\"", *ep_))
+               if (!isgraph(*(const guchar *)ep_) ||
+                   !isascii(*(const guchar *)ep_) ||
+                   strchr("()<>\"", *ep_))
                        break;
        }
 
                        break;
        }
 
@@ -727,7 +733,9 @@ static gboolean get_uri_part(const gchar *start, const gchar *scanpos,
 
 #define IS_REAL_PUNCT(ch)      (ispunct(ch) && ((ch) != '/')) 
 
 
 #define IS_REAL_PUNCT(ch)      (ispunct(ch) && ((ch) != '/')) 
 
-       for (; ep_ - 1 > scanpos + 1 && IS_REAL_PUNCT(*(ep_ - 1)); ep_--)
+       for (; ep_ - 1 > scanpos + 1 &&
+              IS_REAL_PUNCT(*(const guchar *)(ep_ - 1));
+            ep_--)
                ;
 
 #undef IS_REAL_PUNCT
                ;
 
 #undef IS_REAL_PUNCT
@@ -841,17 +849,19 @@ static gboolean get_email_part(const gchar *start, const gchar *scanpos,
        g_return_val_if_fail(dom_tab, FALSE);   
 
        /* scan start of address */
        g_return_val_if_fail(dom_tab, FALSE);   
 
        /* scan start of address */
-       for (bp_ = scanpos - 1; bp_ >= start && IS_RFC822_CHAR(*bp_); bp_--)
+       for (bp_ = scanpos - 1;
+            bp_ >= start && IS_RFC822_CHAR(*(const guchar *)bp_); bp_--)
                ;
 
        /* TODO: should start with an alnum? */
        bp_++;
                ;
 
        /* TODO: should start with an alnum? */
        bp_++;
-       for (; bp_ < scanpos && !IS_ASCII_ALNUM(*bp_); bp_++)
+       for (; bp_ < scanpos && !IS_ASCII_ALNUM(*(const guchar *)bp_); bp_++)
                ;
 
        if (bp_ != scanpos) {
                /* scan end of address */
                ;
 
        if (bp_ != scanpos) {
                /* scan end of address */
-               for (ep_ = scanpos + 1; *ep_ && IS_RFC822_CHAR(*ep_); ep_++)
+               for (ep_ = scanpos + 1;
+                    *ep_ && IS_RFC822_CHAR(*(const guchar *)ep_); ep_++)
                        if (*ep_ == '.') {
                                prelast_dot = last_dot;
                                last_dot = ep_;
                        if (*ep_ == '.') {
                                prelast_dot = last_dot;
                                last_dot = ep_;
@@ -864,7 +874,8 @@ static gboolean get_email_part(const gchar *start, const gchar *scanpos,
                        }
 
                /* TODO: really should terminate with an alnum? */
                        }
 
                /* TODO: really should terminate with an alnum? */
-               for (; ep_ > scanpos && !IS_ASCII_ALNUM(*ep_); --ep_)
+               for (; ep_ > scanpos && !IS_ASCII_ALNUM(*(const guchar *)ep_);
+                    --ep_)
                        ;
                ep_++;
 
                        ;
                ep_++;
 
@@ -958,6 +969,7 @@ static gboolean get_email_part(const gchar *start, const gchar *scanpos,
 }
 
 #undef IS_QUOTE
 }
 
 #undef IS_QUOTE
+#undef IS_ASCII_ALNUM
 #undef IS_RFC822_CHAR
 
 static gchar *make_email_string(const gchar *bp, const gchar *ep)
 #undef IS_RFC822_CHAR
 
 static gchar *make_email_string(const gchar *bp, const gchar *ep)
@@ -1181,7 +1193,7 @@ void textview_write_link(TextView *textview, const gchar *str,
 
        strcrchomp(buf);
 
 
        strcrchomp(buf);
 
-       for (bufp = buf; isspace(*bufp); bufp++)
+       for (bufp = buf; isspace(*(guchar *)bufp); bufp++)
                gtk_stext_insert(text, textview->msgfont, NULL, NULL, bufp, 1);
 
        if (prefs_common.enable_color) {
                gtk_stext_insert(text, textview->msgfont, NULL, NULL, bufp, 1);
 
        if (prefs_common.enable_color) {
@@ -1809,70 +1821,6 @@ static gint show_url_timeout_cb(gpointer data)
                return FALSE;
 }
 
                return FALSE;
 }
 
-/*!
- *\brief    Check to see if a web URL has been disguised as a different
- *          URL (possible with HTML email).
- *
- *\param    uri The uri to check
- *
- *\param    textview The TextView the URL is contained in
- *
- *\return   gboolean TRUE if the URL is ok, or if the user chose to open
- *          it anyway, otherwise FALSE          
- */
-static gboolean uri_security_check(RemoteURI *uri, TextView *textview) 
-{
-       gchar *clicked_str;
-       gboolean retval = TRUE;
-
-       if (g_strncasecmp(uri->uri, "http:", 5) &&
-           g_strncasecmp(uri->uri, "https:", 6) &&
-           g_strncasecmp(uri->uri, "www.", 4)) 
-               return retval;
-
-       clicked_str = gtk_editable_get_chars(GTK_EDITABLE(textview->text),
-                                            uri->start,
-                                            uri->end);
-       if (clicked_str == NULL)
-               return TRUE;
-
-       if (strcmp(clicked_str, uri->uri) &&
-           (!g_strncasecmp(clicked_str, "http:",  5) ||
-            !g_strncasecmp(clicked_str, "https:", 6) ||
-            !g_strncasecmp(clicked_str, "www.",   4))) {
-               gchar *str;
-               retval = FALSE;
-
-               /* allow uri->uri    == http://somewhere.com
-                  and   clicked_str ==        somewhere.com */
-               str = g_strconcat("http://", clicked_str, NULL);
-
-               if (!g_strcasecmp(str, uri->uri))
-                       retval = TRUE;
-               g_free(str);
-       }
-
-       if (retval == FALSE) {
-               gchar *msg = NULL;
-               AlertValue resp;
-
-               msg = g_strdup_printf(_("The real URL (%s) is different from\n"
-                                       "the apparent URL (%s).  \n"
-                                       "Open it anyway?"),
-                                       uri->uri, clicked_str);
-               resp = alertpanel(_("Warning"), 
-                                 msg,
-                                 _("Yes"), 
-                                 _("No"),
-                                 NULL);
-               g_free(msg);
-               if (resp == G_ALERTDEFAULT)
-                       retval = TRUE;
-       } 
-       g_free(clicked_str);
-       return retval;
-}
-
 static gint textview_button_pressed(GtkWidget *widget, GdkEventButton *event,
                                    TextView *textview)
 {
 static gint textview_button_pressed(GtkWidget *widget, GdkEventButton *event,
                                    TextView *textview)
 {
@@ -1955,7 +1903,7 @@ static gint textview_button_released(GtkWidget *widget, GdkEventButton *event,
                                                compose_new(account, uri->uri + 7, NULL);
                                        }
                                } else {
                                                compose_new(account, uri->uri + 7, NULL);
                                        }
                                } else {
-                                       if (uri_security_check(uri, textview) == TRUE) 
+                                       if (textview_uri_security_check(textview, uri) == TRUE) 
                                                open_uri(uri->uri,
                                                         prefs_common.uri_cmd);
                                }
                                                open_uri(uri->uri,
                                                         prefs_common.uri_cmd);
                                }
@@ -1968,6 +1916,59 @@ static gint textview_button_released(GtkWidget *widget, GdkEventButton *event,
        return FALSE;
 }
 
        return FALSE;
 }
 
+/*!
+ *\brief    Check to see if a web URL has been disguised as a different
+ *          URL (possible with HTML email).
+ *
+ *\param    uri The uri to check
+ *
+ *\param    textview The TextView the URL is contained in
+ *
+ *\return   gboolean TRUE if the URL is ok, or if the user chose to open
+ *          it anyway, otherwise FALSE          
+ */
+static gboolean textview_uri_security_check(TextView *textview, RemoteURI *uri)
+{
+       gchar *visible_str;
+       gboolean retval = TRUE;
+
+       if (is_uri_string(uri->uri) == FALSE)
+               return TRUE;
+
+       visible_str = gtk_editable_get_chars(GTK_EDITABLE(textview->text),
+                                            uri->start, uri->end);
+       if (visible_str == NULL)
+               return TRUE;
+
+       if (strcmp(visible_str, uri->uri) != 0 && is_uri_string(visible_str)) {
+               gchar *uri_path;
+               gchar *visible_uri_path;
+
+               uri_path = get_uri_path(uri->uri);
+               visible_uri_path = get_uri_path(visible_str);
+               if (strcmp(uri_path, visible_uri_path) != 0)
+                       retval = FALSE;
+       }
+
+       if (retval == FALSE) {
+               gchar *msg;
+               AlertValue aval;
+
+               msg = g_strdup_printf(_("The real URL (%s) is different from\n"
+                                       "the apparent URL (%s).\n"
+                                       "Open it anyway?"),
+                                     uri->uri, visible_str);
+               aval = alertpanel(_("Warning"), msg, _("Yes"), _("No"), NULL);
+               g_free(msg);
+               if (aval == G_ALERTDEFAULT)
+                       retval = TRUE;
+       }
+
+       g_free(visible_str);
+
+       return retval;
+}
+
 static void textview_uri_list_remove_all(GSList *uri_list)
 {
        GSList *cur;
 static void textview_uri_list_remove_all(GSList *uri_list)
 {
        GSList *cur;
index dc2b4f4704d2fa47f87c283f00cf1ab0534240d4..e7dce0985e1a3af01eb2faab8fd5288d617857de 100644 (file)
@@ -38,7 +38,6 @@ void unmime_header(gchar *out, const gchar *str)
 {
        const gchar *p = str;
        gchar *outp = out;
 {
        const gchar *p = str;
        gchar *outp = out;
-       const gchar *sp;
        const gchar *eword_begin_p, *encoding_begin_p, *text_begin_p,
                    *eword_end_p;
        gchar charset[32];
        const gchar *eword_begin_p, *encoding_begin_p, *text_begin_p,
                    *eword_end_p;
        gchar charset[32];
@@ -76,8 +75,10 @@ void unmime_header(gchar *out, const gchar *str)
                        p = eword_begin_p;
                } else {
                        /* ignore spaces between encoded words */
                        p = eword_begin_p;
                } else {
                        /* ignore spaces between encoded words */
+                       const gchar *sp;
+
                        for (sp = p; sp < eword_begin_p; sp++) {
                        for (sp = p; sp < eword_begin_p; sp++) {
-                               if (!isspace(*sp)) {
+                               if (!isspace(*(const guchar *)sp)) {
                                        memcpy(outp, p, eword_begin_p - p);
                                        outp += eword_begin_p - p;
                                        p = eword_begin_p;
                                        memcpy(outp, p, eword_begin_p - p);
                                        outp += eword_begin_p - p;
                                        p = eword_begin_p;