X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=lib-mime%2Frfc822.c;h=8d192884d6d6e7f8bcddc6b5606777b5fbcc0c9d;hp=22e54a46c15b2ba80cab16ac050162c991d9db48;hb=85832555b8d510499b13bc454e458382d36e195d;hpb=7a368b3670a90656b2e0e724ed3efd79221f3d31 diff --git a/lib-mime/rfc822.c b/lib-mime/rfc822.c index 22e54a4..8d19288 100644 --- a/lib-mime/rfc822.c +++ b/lib-mime/rfc822.c @@ -452,22 +452,19 @@ rfc822_write_address(char *buf, ssize_t buflen, address_t *addr, int display) buf[pos++] = ' '; } - while (addr) { + for (; addr; addr = addr->next) { pos += rfc822_write_address_single(buf + pos, buflen + 1 - pos, addr, display); - /* if there is another address, and its not a group mailbox name or - group terminator, add a comma to separate the addresses */ + if (!addr->group && addr->next && addr->next->mailbox) { + /* if there is another address, and its not a group mailbox name or + group terminator, add a comma to separate the addresses */ if (pos + 2 >= buflen) - goto done; - if (!buflen) - goto done; + break; buf[pos++] = ','; buf[pos++] = ' '; } - - addr = addr->next; } done: