From: Alfons Hoogervorst Date: Thu, 3 May 2001 12:19:49 +0000 (+0000) Subject: preps for fixing the email address scanner X-Git-Tag: before-scoring~7 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=1a7e41e842f2e2fc862ecdce7188e754a2160e50;hp=da0afa7627a33c077a68ea0aeac034453f3c26a3 preps for fixing the email address scanner --- diff --git a/ChangeLog.claws b/ChangeLog.claws index f10b78e7f..8e99a25de 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -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 diff --git a/src/textview.c b/src/textview.c index ba1ff5afe..49e6170a1 100644 --- a/src/textview.c +++ b/src/textview.c @@ -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 ; 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 ; 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))) ) {