

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
4 messages in net.sourceforge.lists.courier-sqwebmail[sqwebmail] [PATCH] Delete all messag...| From | Sent On | Attachments |
|---|---|---|
| Marcin Semeniuk | Jul 18, 2006 1:34 am | .patch |
| Alessio Cecchi | Jul 21, 2006 12:58 am | |
| Marcin Semeniuk | Jul 21, 2006 1:42 am | |
| Mark Constable | Jul 21, 2006 1:45 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | [sqwebmail] [PATCH] Delete all messages from Trash | Actions... |
|---|---|---|
| From: | Marcin Semeniuk (m.se...@net.icm.edu.pl) | |
| Date: | Jul 18, 2006 1:34:08 am | |
| List: | net.sourceforge.lists.courier-sqwebmail | |
| Attachments: | ||
Hello Sam,
Our users demanded simple way of deleting all messages from trash folder. I made patch that adds "Purge All" button. This can be easily turned off by site administrator (button is only displayed when [#$PURGEALL=...#] is defined in template). When user press "Purge All" button, confirmation window appear, this should prevents accidental mail removal.
best regards, Marcin Semeniuk
diff -u -r courier-0.53.2.20060709/maildir/maildirmake2.c
courier-0.53.2.20060709-work/maildir/maildirmake2.c
--- courier-0.53.2.20060709/maildir/maildirmake2.c 2004-03-14 03:26:29.000000000
+0100
+++ courier-0.53.2.20060709-work/maildir/maildirmake2.c 2006-07-17
14:19:43.000000000 +0200
@@ -64,7 +64,7 @@
return 0;
}
-int maildir_del(const char *maildir)
+int maildir_del_content(const char *maildir)
{
char *filenamebuf[100];
int n, i;
@@ -129,5 +129,13 @@
for (i=0; i<n; i++)
free(filenamebuf[i]);
} while (n);
+ return 0;
+}
+
+int maildir_del(const char *maildir)
+{
+ int rc;
+ if ((rc=maildir_del_content(maildir)) == -1)
+ return rc;
return rmdir(maildir) < 0 && errno != ENOENT ? -1:0;
}
diff -u -r courier-0.53.2.20060709/maildir/maildirmisc.h
courier-0.53.2.20060709-work/maildir/maildirmisc.h
--- courier-0.53.2.20060709/maildir/maildirmisc.h 2005-02-04 03:11:58.000000000
+0100
+++ courier-0.53.2.20060709-work/maildir/maildirmisc.h 2006-07-17
14:19:43.000000000 +0200
@@ -46,6 +46,8 @@
int maildir_del(const char *maildir);
+int maildir_del_content(const char *maildir); + char *maildir_name2dir(const char *maildir, /* DIR location */ const char *foldername); /* INBOX.name */
diff -u -r courier-0.53.2.20060709/webmail/folder.c
courier-0.53.2.20060709-work/webmail/folder.c
--- courier-0.53.2.20060709/webmail/folder.c 2006-07-08 01:17:18.000000000 +0200
+++ courier-0.53.2.20060709-work/webmail/folder.c 2006-07-17 14:19:43.000000000
+0200
@@ -267,6 +267,38 @@
{
rc=group_movedel( dir, &groupdel );
maildir_savefoldermsgs(dir);
+ }
+ else if (*cgi("cmdpurgeall"))
+ {
+ char *deldir;
+ struct maildir_info minfo;
+
+ if (maildir_info_imap_find(&minfo, dir, login_returnaddr())<0)
+ {
+ http_redirect_argu("&error=othererror&form=folder&pos=%s",
+ (unsigned long)pos);
+ return ;
+ }
+
+ if ((deldir=maildir_name2dir(minfo.homedir, minfo.maildir)) == NULL)
+ {
+ maildir_info_destroy(&minfo);
+ http_redirect_argu("&error=othererror&form=folder&pos=%s",
+ (unsigned long)pos);
+ return;
+ }
+
+ char *cur = malloc(strlen(deldir)+5);
+ strcpy(cur, deldir);
+ strcat(cur, "/cur");
+
+ rc=maildir_del_content(cur);
+ maildir_quota_recalculate(".");
+
+ maildir_info_destroy(&minfo);
+ free(deldir);
+ free(cur);
+
}
else if (*cgi("cmdmove"))
{
@@ -384,6 +416,9 @@
if (strcmp(cgi("error"), "noinsert") == 0)
printf("%s", getarg("NOINSERTPERM"));
+ if (strcmp(cgi("error"), "othererror") == 0) + printf("%s", getarg("OTHERERROR")); + if (strchr(sqwebmail_folder_rights, ACL_READ[0]) == NULL) { printf("%s", getarg("ACL")); @@ -4609,6 +4644,9 @@ folder_sent=getarg("SENT");
printf("<input type=\"hidden\" name=\"pos\" value=\"%s\" />", cgi("pos"));
+ if ((strcmp(sqwebmail_folder, INBOX "." TRASH) == 0) &&
(strlen(getarg("PURGEALL"))))
+ printf("<input type=\"submit\" name=\"cmdpurgeall\" value=\"%s\"
onclick=\"javascript: return deleteAll();\" />",
+ getarg("PURGEALL"));
printf("<input type=\"submit\" name=\"cmddel\" value=\"%s\" />%s<select
name=\"moveto\">",
strcmp(sqwebmail_folder, INBOX "." TRASH) == 0
? purgelab:deletelab,
diff -u -r courier-0.53.2.20060709/webmail/html/en-us/folder.html
courier-0.53.2.20060709-work/webmail/html/en-us/folder.html
--- courier-0.53.2.20060709/webmail/html/en-us/folder.html 2006-07-03
00:21:06.000000000 +0200
+++ courier-0.53.2.20060709-work/webmail/html/en-us/folder.html 2006-07-17
14:35:45.000000000 +0200
@@ -49,6 +49,16 @@
}
}
+
+function deleteAll()
+{
+ if (confirm("Do you really want to delete all messages from current folder
?")) {
+ return true;
+ }
+ return false;
+}
+
+
</script>
<!--
@@ -67,7 +77,8 @@
[#$JUMPTO=Jump to:#]
[#$NOMESSAGES=No messages...#]
[#$DELETE=Delete#]
-[#$PURGE=Purge#]
+[#$PURGEALL=Purge All#]
+[#$PURGE=Purge Selected#]
[#$ORMOVETO=, or move to:#]
[#$GO=Go#]
[#$FIRSTPAGE=@@first.png, width="48" height="24" alt="First Page" title="First
Page"@First@#]
@@ -84,6 +95,7 @@
[#$PERMERR=<span class="error">ERROR: You do not have the permission to create
messages in this folder, or you have exceeded your mail quota.</span>#]
[#$NODELPERM=<span class="error">ERROR: You do not have the permission to
remove messages from this folder.</span>#]
[#$NOINSERTPERM=<span class="error">ERROR: You do not have the permission to
insert messages into the destination folder.</span>#]
+[#$OTHERERROR=<span class="error">ERROR: Some error occurred, please try again
later or contact site administrator.</span>#]
[#$ACL=<span class="error">ERROR: You do not have the permission to open this
folder</span>#]
-->








.patch