1 message in net.sourceforge.lists.courier-users[courier-users] A small patch for som...
FromSent OnAttachments
ma...@intron.acMay 27, 2006 12:03 pm.diff
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[courier-users] A small patch for some small display problemsActions...
From:ma...@intron.ac (ma@intron.ac)
Date:May 27, 2006 12:03:30 pm
List:net.sourceforge.lists.courier-users
Attachments:

See the attachment.

Hunk @@ -1068,7 +1068,7 @@

Translate folder name like ".Sent.*" when form=folders.

Hunks @@ -1146,6 +1146,7 @@ @@ -1178,6 +1179,7 @@ @@ -1185,8 +1187,22 @@ @@ -1222,10 +1238,9 @@ (Only "if(flag_new_name_buf) free(p);")

Translate folder name in drop-down list when form=readmsg.

Hunk @@ -1222,10 +1238,9 @@ (Only "list_folder(p);")

Display translated folder name in drop-down list. Since I have dealt with "Inbox.*" in hunk @@ -1185,8 +1187,22 @@, here we needn't skip the first "." again. What's more, the pointer "p" probably points to a newly allocated buffer (See the hunk @@ -1185,8 +1187,22 @@), and it must be kept until the buffer is freed.

------------------------------------------------------------------------ From Beijing, China

--- folder.c.orig Tue Mar 14 07:36:16 2006 +++ folder.c Sun May 28 02:27:06 2006 @@ -1068,7 +1068,7 @@ printf("%s", n_drafts); else if (strcmp(p, INBOX "." TRASH) == 0) printf("%s", n_trash); - else if (strcmp(p, INBOX "." SENT) == 0) + else if (strncmp(p, INBOX "." SENT, strlen(INBOX "." SENT)) == 0) printf("%s", n_sent); else list_folder(path); @@ -1146,6 +1146,7 @@ size_t i; const char *p; int has_shared=0; + int flag_new_name_buf;

maildir_listfolders(inbox_pfix, homedir, &folders); for (i=0; folders[i]; i++) @@ -1178,6 +1179,7 @@ continue;

p=folders[i]; + flag_new_name_buf=0;

if (strcmp(p, INBOX) == 0) p=folder_inbox; @@ -1185,8 +1187,22 @@ p=folder_drafts; else if (strcmp(p, INBOX "." TRASH) == 0) p=folder_trash; - else if (strcmp(p, INBOX "." SENT) == 0) - p=folder_sent; + else if (strncmp(p, INBOX "." SENT, strlen(INBOX "." SENT)) == 0) + { + char *q; + + q=malloc(strlen(folder_sent)+strlen(p)-strlen(INBOX "." SENT)+1); + strcpy(q, folder_sent); + strcat(q, p+strlen(INBOX "." SENT)); + p=q; + /* We must free newly allocated buffer below. + * Although there's a "continue;" below, if the program goes here, + * it will NOT meet the "continue;". */ + flag_new_name_buf=1; + } + else if(strncmp(p, INBOX ".", strlen(INBOX ".")) == 0) + p+=strlen(INBOX "."); + if (!p) p=folders[i];

if (strncmp(folders[i], SHARED ".", sizeof(SHARED)) == 0) @@ -1222,10 +1238,9 @@ printf("%s.", getarg("PUBLICFOLDERS")); }

- p=strchr(folders[i], '.'); - - list_folder(p ? p+1:folders[i]); + list_folder(p); printf("</option>\n"); + if(flag_new_name_buf) free(p); } maildir_freefolders(&folders); }