2004-11-08 [colin] 0.9.12cvs142
authorColin Leroy <colin@colino.net>
Mon, 8 Nov 2004 15:17:09 +0000 (15:17 +0000)
committerColin Leroy <colin@colino.net>
Mon, 8 Nov 2004 15:17:09 +0000 (15:17 +0000)
* src/textview.c
Really fix these mail URIs

ChangeLog.claws
PATCHSETS
configure.ac
src/textview.c

index e86625751224715ef44fc1eca7bb959341a27fe4..b266965b11d45afbe37563e82adf15ac5414e300 100644 (file)
@@ -1,3 +1,8 @@
+2004-11-08 [colin]     0.9.12cvs142
+
+       * src/textview.c
+               Really fix these mail URIs
+
 2004-11-08 [colin]     0.9.12cvs141
 
        * src/textview.c
index 5144fe1a22910d08a966148d4e30e6d7c357d6fb..fe654c4db771eed1e5a9403a505c1bcfbd23036b 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.3087 -r 1.3088 ChangeLog.claws; cvs diff -u -r 1.451 -r 1.452 src/compose.c; cvs diff -u -r 1.90 -r 1.91 src/procmime.c; cvs diff -u -r 1.1 -r 1.2 src/plugins/trayicon/README; ) > 0.9.12cvs139.patchset
 ( cvs diff -u -r 1.452 -r 1.453 src/compose.c; ) > 0.9.12cvs140.patchset
 ( cvs diff -u -r 1.126 -r 1.127 src/textview.c; ) > 0.9.12cvs141.patchset
+( cvs diff -u -r 1.127 -r 1.128 src/textview.c; ) > 0.9.12cvs142.patchset
index c0d99ebb342837d0bfb415467a31d3bb69df2a17..84e43e65e42cedd12dee7092c639b5e4129807bc 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=12
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=141
+EXTRA_VERSION=142
 EXTRA_RELEASE=
 
 if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then
index cbf9ed295ede0906aafd678809e35aee27ef3855..809d3e303135352526edea14bb474ca832c54986 100644 (file)
@@ -784,7 +784,7 @@ static gboolean get_email_part(const gchar *start, const gchar *scanpos,
        const gchar *last_dot = NULL;
        const gchar *prelast_dot = NULL;
        const gchar *last_tld_char = NULL;
-
+       
        /* the informative part of the email address (describing the name
         * of the email address owner) may contain quoted parts. the
         * closure stack stores the last encountered quotes. */
@@ -852,8 +852,30 @@ static gboolean get_email_part(const gchar *start, const gchar *scanpos,
 
        if (!result) return FALSE;
 
+       if (*(bp_ - 1) == '"' && *(ep_) == '"' 
+       && *(ep_ + 1) == ' ' && *(ep_ + 2) == '<'
+       && IS_RFC822_CHAR(*(ep_ + 3))) {
+               /* this informative part with an @ in it is 
+                * followed by the email address */
+               ep_ += 3;
+               
+               /* go to matching '>' (or next non-rfc822 char, like \n) */
+               for (; *ep_ != '>' && *ep != '\0' && IS_RFC822_CHAR(*ep_); ep_++)
+                       ;
+                       
+               /* include the bracket */
+               if (*ep_ == '>') ep_++;
+               
+               /* include the leading quote */         
+               bp_--;
+
+               *ep = ep_;
+               *bp = bp_;
+               return TRUE;
+       }
+
        /* skip if it's between quotes "'alfons@proteus.demon.nl'" <alfons@proteus.demon.nl> */
-       if (bp_ - 1 > start && IS_QUOTE(*(bp_ - 1)) && IS_QUOTE(*ep_)) 
+       if (bp_ - 1 > start && IS_QUOTE(*(bp_ - 1)) && IS_QUOTE(*ep_))
                return FALSE;
 
        /* see if this is <bracketed>; in this case we also scan for the informative part. */
@@ -916,7 +938,7 @@ static gboolean get_email_part(const gchar *start, const gchar *scanpos,
 
        *ep = ep_;
        *bp = bp_;
-
+       
        return result;
 }
 
@@ -1004,7 +1026,7 @@ static void textview_make_clickable_parts(TextView *textview,
                const gchar     *bp, *ep;       /* text position */
                gint             pti;           /* index in parse table */
                struct txtpos   *next;          /* next */
-       } head = {NULL, NULL, 0,  NULL}, *last = &head, *next = NULL;
+       } head = {NULL, NULL, 0,  NULL}, *last = &head;
 
        GtkSText *text = GTK_STEXT(textview->text);
 
@@ -1047,15 +1069,6 @@ static void textview_make_clickable_parts(TextView *textview,
                for (last = head.next; last != NULL;
                     normal_text = last->ep, last = last->next) {
                        RemoteURI *uri;
-                       next = last->next;
-                       /* fix "colin@colino.net" <colin@colino.net> types of URIs
-                       /* FIXME would be better to fix it in the email parser */
-                       if (next && next->bp == last->ep) {
-                               next->bp = last->bp;
-                               if (*(next->bp -1 )=='"' && strchr(next->bp, '"'))
-                                       next->bp--;
-                               continue;
-                       }
                        uri = g_new(RemoteURI, 1);
                        if (last->bp - normal_text > 0)
                                gtk_stext_insert(text, font,