skip quoted email addresses in textview:get_email_part()
authorAlfons Hoogervorst <alfons@proteus.demon.nl>
Sun, 27 May 2001 12:27:55 +0000 (12:27 +0000)
committerAlfons Hoogervorst <alfons@proteus.demon.nl>
Sun, 27 May 2001 12:27:55 +0000 (12:27 +0000)
ChangeLog.claws
src/textview.c

index d57905f02abab75b04c10b84683a4cb854439b75..3734ba6da786730c78bb8080c4108734f3f7acb8 100644 (file)
@@ -1,3 +1,10 @@
+2001-05-27 [alfons]
+
+       * src/textview.c:
+               
+               (get_email_part): skip quoted email addresses, like in e.g.
+               "'alfons@proteus.demon.nl'".
+
 2001-05-26 [alfons]
 
        Minor GUI fixes adding horizontal scrollbars to Hoa's matcher dialogs,
index af4110a049309ce6dc69d5bf25b9c2a4c9450a86..fa44ba929d4351b7c25b51e3c10e9eb258ccb53b 100644 (file)
@@ -473,6 +473,8 @@ static gchar *make_uri_string(const gchar *bp, const gchar *ep)
         !isspace(ch) && \
         !strchr("()<>\"", (ch)))
 
+#define IS_QUOTE(ch) ((ch) == '\'' || (ch) == '"')
+
 /* get_email_part() - retrieves an email address. Returns TRUE if succesful */
 static gboolean get_email_part(const gchar *start, const gchar *scanpos,
                               const gchar **bp, const gchar **ep)
@@ -522,9 +524,11 @@ static gboolean get_email_part(const gchar *start, const gchar *scanpos,
 
        if (!result) return FALSE;
 
-       /* we now have at least the address. now see if this is <bracketed>; in this
-        * case we also scan for the informative part. we could make this a useful
-        * function because it tries to parse out an email address backwards. :) */
+       /* 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_)) 
+               return FALSE;
+
+       /* see if this is <bracketed>; in this case we also scan for the informative part. */
        if (bp_ - 1 <= start || *(bp_ - 1) != '<' || *ep_ != '>')
                return TRUE;
 
@@ -588,6 +592,7 @@ static gboolean get_email_part(const gchar *start, const gchar *scanpos,
        return result;
 }
 
+#undef IS_QUOTE
 #undef IS_RFC822_CHAR
 
 static gchar *make_email_string(const gchar *bp, const gchar *ep)