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) if(naddrs == 0)
return; return;
qsort(addrs, naddrs, sizeof(char*), strpcmp); 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); Bprint(fd, "%s: ", type);
for(i = 0; i < naddrs; i++){ for(i = 0; i < naddrs; i++){
if(i > 0 && strcmp(addrs[i-1], addrs[i]) == 0) if(addrs[i] == nil)
continue; continue;
w += Bprint(fd, "%s%s", sep, addrs[i]); w += Bprint(fd, "%s%s", sep, addrs[i]);
sep = ", "; sep = ", ";
if(w > 50){ if(w > 50 && i < naddrs-1){
w = 0; w = 0;
sep = ""; sep = "";
Bprint(fd, "\n%s: ", type); Bprint(fd, "\n%s: ", type);