upas/Mail: avoid showing empty To: and CC: lines in compose windows

This commit is contained in:
Alex Musolino 2021-06-30 12:23:45 +00:00
parent a5c4ac4804
commit 2929a3bf67

View file

@ -200,13 +200,17 @@ show(Biobuf *fd, char *type, char **addrs, int naddrs)
if(naddrs == 0)
return;
qsort(addrs, naddrs, sizeof(char*), strpcmp);
for(i = 1; i < naddrs; i++){
if(strcmp(addrs[i-1], addrs[i]) == 0)
addrs[i-1] = nil;
}
Bprint(fd, "%s: ", type);
for(i = 0; i < naddrs; i++){
if(i > 0 && strcmp(addrs[i-1], addrs[i]) == 0)
if(addrs[i] == nil)
continue;
w += Bprint(fd, "%s%s", sep, addrs[i]);
sep = ", ";
if(w > 50){
if(w > 50 && i < naddrs-1){
w = 0;
sep = "";
Bprint(fd, "\n%s: ", type);