preps for fixing the email address scanner
authorAlfons Hoogervorst <alfons@proteus.demon.nl>
Thu, 3 May 2001 12:19:49 +0000 (12:19 +0000)
committerAlfons Hoogervorst <alfons@proteus.demon.nl>
Thu, 3 May 2001 12:19:49 +0000 (12:19 +0000)
ChangeLog.claws
src/textview.c

index f10b78e7f1f0a397393b3943013936dbb3e6e614..8e99a25de88c9f7e72387d6f408fa9da306f3bac 100644 (file)
@@ -1,10 +1,14 @@
+2001-05-03 [alfons]
+
+       * src/textview.c: re-edited, prepared for fixing the email address
+               scanner.
+
 2001-05-03 [darko]
 
        * src/prefs_common.c: use alfons' strftime ui code
        entry_datefmt and datefmt_sample widgets have to be
        global in this module because of this change
 
-
 2001-05-03 [hoa]
 
        * src/messageview.c
index ba1ff5afe34e59d1fce7824e29184b8e6b169aaf..49e6170a14678443bbcf963ec392999e9a54d325 100644 (file)
@@ -533,12 +533,16 @@ static gboolean get_email_part(const gchar *start, const gchar *scanpos,
                        result = TRUE;
                }
        }
-       
+
+       /* 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. :) */
        if (result) {
-               /* 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. :) */
                if ( ((bp_ - 1 > start) && *(bp_ - 1) == '<') &&  (*ep_ == '>')) {
+                       
+                       /* 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. */
                        char    closure_stack[128];
                        char   *ptr = closure_stack;
 #define FULL_STACK()   ((ptr - closure_stack) >= sizeof closure_stack) 
@@ -552,7 +556,8 @@ static gboolean get_email_part(const gchar *start, const gchar *scanpos,
 
                        ep_++;
 
-                       /* scan for the informative part */
+                       /* scan for the informative part. */
+                       
                        for (bp_ -= 2; bp_ >= start; bp_--) {
                                /* if closure on the stack keep scanning */
                                if (PEEK_STACK() == *bp_) {
@@ -563,11 +568,11 @@ static gboolean get_email_part(const gchar *start, const gchar *scanpos,
                                                PUSH_STACK(*bp_);
                                        }                                               
                                        else {
+                                               /* if nothing in the closure stack, do the special conditions
+                                                * the following if..else expression simply checks whether 
+                                                * a token is acceptable. if not acceptable, the clause
+                                                * should terminate the loop with a 'break' */
                                                if (!PEEK_STACK()) {
-                                                       /* if nothing in the closure stack, do the special conditions
-                                                        * the following if..else expression simply checks whether 
-                                                        * a token is acceptable. if not acceptable, the clause
-                                                        * should terminate the loop with a 'break' */
                                                        if ( *bp_ == '-' 
                                                        &&   (((bp_ - 1) >= start) && isalnum(*(bp_ - 1))) 
                                                        &&   (((bp_ + 1) < ep_)    && isalnum(*(bp_ + 1))) ) {