diff options
author | Eduardo Chappa <chappa@washington.edu> | 2021-12-27 09:44:48 -0700 |
---|---|---|
committer | Eduardo Chappa <chappa@washington.edu> | 2021-12-27 09:44:48 -0700 |
commit | 5d3178a435f355fde3219a6e32be837ba973b796 (patch) | |
tree | 8bfa999d5d1ec03c7af016756177abb93bfecce8 | |
parent | 1e6c61f80a9e2c5a456477ea42732f63d3b3118f (diff) | |
download | alpine-5d3178a435f355fde3219a6e32be837ba973b796.tar.xz |
* When the personal name of an address is encoded, and the personal name
is surrounded by quotes, these are not removed by Alpine at the time
to offer to take an address from a message to the addressbook. Reported
by David Prager Branner.
-rw-r--r-- | pith/pine.hlp | 7 | ||||
-rw-r--r-- | pith/string.c | 29 | ||||
-rw-r--r-- | pith/string.h | 1 | ||||
-rw-r--r-- | pith/takeaddr.c | 2 |
4 files changed, 38 insertions, 1 deletions
diff --git a/pith/pine.hlp b/pith/pine.hlp index b78e089a..63c1983a 100644 --- a/pith/pine.hlp +++ b/pith/pine.hlp @@ -140,7 +140,7 @@ with help text for the config screen and the composer that didn't have any reasonable place to be called from. Dummy change to get revision in pine.hlp ============= h_revision ================= -Alpine Commit 633 2021-12-24 14:36:46 +Alpine Commit 634 2021-12-27 09:44:44 ============= h_news ================= <HTML> <HEAD> @@ -256,6 +256,11 @@ Bugs addressed include: password file is not unlocked by cancellation, or the authentication for an XOAUTH2 server is cancelled, or the password of an account is changed. + +<LI> When the personal name of an address is encoded, and the personal name + is surrounded by quotes, these are not removed by Alpine at the time + to offer to take an address from a message to the addressbook. Reported + by David Prager Branner. </UL> <P>Version 2.25 adds new features and addresses bugs found in previous diff --git a/pith/string.c b/pith/string.c index 878ff5b4..479797b8 100644 --- a/pith/string.c +++ b/pith/string.c @@ -3012,3 +3012,32 @@ convert_decimal_to_alpha (char *rn, size_t len, long n, char l) if(i < len) rn[i] = '\0'; rn[len-1] = '\0'; } + +void +remove_quotes(unsigned char *name) +{ + unsigned char *s, *bos, *eos; + int startquote, endquote; + + startquote = endquote = 0; + + for(s = name; s && *s; s++){ + endquote = startquote && (*s == '"') ? 1 : 0; + if(endquote) + eos = s; + if(startquote == 0){ + if(*s == '"') + startquote = 1; + if(startquote) + bos = s; + } + if(startquote && endquote){ + if(bos == name && eos[1] == '\0'){ + for(s = name + 1; *s && s < eos; s++) + *(s-1) = *s; + *(s-1) = '\0'; + } + startquote = endquote = 0; + } + } +} diff --git a/pith/string.h b/pith/string.h index 9aeb3529..a877946b 100644 --- a/pith/string.h +++ b/pith/string.h @@ -153,5 +153,6 @@ time_t date_to_local_time_t(char *); void convert_decimal_to_roman (char *, size_t, long, char); void convert_decimal_to_alpha (char *, size_t, long, char); int timezone_offset_to_gmt(int *); +void remove_quotes(unsigned char *); #endif /* PITH_STRING_INCLUDED */ diff --git a/pith/takeaddr.c b/pith/takeaddr.c index 5dcef90a..6b73777a 100644 --- a/pith/takeaddr.c +++ b/pith/takeaddr.c @@ -2094,6 +2094,8 @@ fill_in_ta(TA_S **old_current, struct mail_address *addr, int checked, char *pri new_current->checked = checked != 0; new_current->addr = copyaddr(addr); decode_addr_names_to_utf8(new_current->addr); + if(new_current->addr && new_current->addr->personal) + remove_quotes(new_current->addr->personal); if(addr->host[0] == '.') new_current->strvalue = cpystr("Error in address (ok to try Take anyway)"); else{ |