[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[tpop3d-discuss][PATCH]: delete maildirsize file if it exists; be nicer
From: |
Arkadiusz Miskiewicz |
Subject: |
[tpop3d-discuss][PATCH]: delete maildirsize file if it exists; be nicer for Maildir++ folders |
Date: |
Fri, 9 Dec 2005 10:03:25 +0100 |
User-agent: |
KMail/1.9 |
Hi,
Currently tpop3d isn't capable of working with Maildir++
folders.
Each application accessing Maildir++ folder is supposed to update
maildir/maildirsize file after changing Maildir++ contents. The problem
is that tpop3d isn't doing that and we end up with maildirsize containing
data about already deleted messages (which fools quota calculation
in maildir++ capable software).
The attached patch makes tpop3d usefull in such cases by just
removing maildirsize file when there were some deletions of messages.
The other Maildir++ capable software accessing maildir will just recreate
maildirsize file.
Please apply, it's agains cvs version from about month ago.
diff -ur tpop3d-1.5.3.org/maildir.c tpop3d-1.5.3/maildir.c
--- tpop3d-1.5.3.org/maildir.c 2005-12-09 11:07:44.370963000 +0100
+++ tpop3d-1.5.3/maildir.c 2005-12-09 11:16:45.570963000 +0100
@@ -502,10 +502,14 @@
* Apply deletions to a maildir. */
int maildir_apply_changes(mailbox M) {
struct indexpoint *m;
+ struct stat st;
+ char *maildirsizefile;
+ int maildirsizefile_update = 0;
if (!M) return 1;
for (m = M->index; m < M->index + M->num; ++m) {
if (m->deleted) {
+ maildirsizefile_update++;
if (unlink(m->filename) == -1)
log_print(LOG_ERR, "maildir_apply_changes: unlink(%s): %m",
m->filename);
/* Warn but proceed anyway. */
@@ -521,6 +525,16 @@
}
}
+ if (maildirsizefile_update) {
+ /* we don't recreate maildirsize file; we delete it and depend on
recreation
+ * by MTA or other software accessing mailbox */
+ maildirsizefile = xmalloc(strlen(M->name) + strlen("/maildirsize")
+ 1);
+ sprintf(maildirsizefile, "%s/maildirsize", M->name);
+ if (stat(maildirsizefile, &st) == 0 && S_ISREG(st.st_mode))
+ unlink(maildirsizefile);
+ xfree(maildirsizefile);
+ }
+
return 1;
}
--
Arkadiusz MiĆkiewicz PLD/Linux Team
http://www.t17.ds.pwr.wroc.pl/~misiek/ http://ftp.pld-linux.org/
- [tpop3d-discuss][PATCH]: delete maildirsize file if it exists; be nicer for Maildir++ folders,
Arkadiusz Miskiewicz <=