From 45bcb2aca96cacfc5f55fd8fdb2f6118eeff753f Mon Sep 17 00:00:00 2001 From: Colin Leroy Date: Mon, 8 Nov 2004 15:17:09 +0000 Subject: [PATCH] 2004-11-08 [colin] 0.9.12cvs142 * src/textview.c Really fix these mail URIs --- ChangeLog.claws | 5 +++++ PATCHSETS | 1 + configure.ac | 2 +- src/textview.c | 39 ++++++++++++++++++++++++++------------- 4 files changed, 33 insertions(+), 14 deletions(-) diff --git a/ChangeLog.claws b/ChangeLog.claws index e86625751..b266965b1 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -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 diff --git a/PATCHSETS b/PATCHSETS index 5144fe1a2..fe654c4db 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -124,3 +124,4 @@ ( 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 diff --git a/configure.ac b/configure.ac index c0d99ebb3..84e43e65e 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/src/textview.c b/src/textview.c index cbf9ed295..809d3e303 100644 --- a/src/textview.c +++ b/src/textview.c @@ -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'" */ - 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 ; 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" 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, -- 2.25.1