

![]() | 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: |
1 message in net.sourceforge.lists.courier-sqwebmail[sqwebmail] [PATCH] Forcing users to ...| From | Sent On | Attachments |
|---|---|---|
| Marcin Semeniuk | Jun 13, 2006 3:11 am | .patch |

![]() | 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] Forcing users to have unique filter names | Actions... |
|---|---|---|
| From: | Marcin Semeniuk (m.se...@net.icm.edu.pl) | |
| Date: | Jun 13, 2006 3:11:53 am | |
| List: | net.sourceforge.lists.courier-sqwebmail | |
| Attachments: | ||
Hello Sam,
With this patch, webmail force users to give different names to their filters, so user have better look what filters he have. Advanced users probably don't need it (they smart enough to give meaningful names to their filters), but most of our users need it ;)
best regards, Marcin Semeniuk
diff -r -u courier-0.53.2.20060607-org/maildir/maildirfilter.c
courier-0.53.2.20060607/maildir/maildirfilter.c
--- courier-0.53.2.20060607-org/maildir/maildirfilter.c 2006-06-13
11:24:32.000000000 +0200
+++ courier-0.53.2.20060607/maildir/maildirfilter.c 2006-06-13
11:24:50.000000000 +0200
@@ -98,6 +98,15 @@
*c == '`')
return (-1);
+ /* rule name: may not already exist */ + *errcode=MF_ERR_EXISTS; + + struct maildirfilterrule *pom; + for (pom=r->first; pom->next; pom=pom->next) { + if (p!=pom && !strcmp(name, pom->rulename)) + return (-1); + } + /* rule type: we must know what it is */
switch (type) {
diff -r -u courier-0.53.2.20060607-org/maildir/maildirfilter.h
courier-0.53.2.20060607/maildir/maildirfilter.h
--- courier-0.53.2.20060607-org/maildir/maildirfilter.h 2006-06-13
11:24:32.000000000 +0200
+++ courier-0.53.2.20060607/maildir/maildirfilter.h 2006-06-13
11:24:50.000000000 +0200
@@ -105,6 +105,7 @@
#define MF_ERR_BADRULEVALUE 4
#define MF_ERR_BADRULEFOLDER 5
#define MF_ERR_BADFROMHDR 6
+#define MF_ERR_EXISTS 7
#define MF_ERR_INTERNAL 100
/* Save/Load rules from the given file */
diff -r -u courier-0.53.2.20060607-org/webmail/html/en-us/filter.html
courier-0.53.2.20060607/webmail/html/en-us/filter.html
--- courier-0.53.2.20060607-org/webmail/html/en-us/filter.html 2006-06-13
11:24:32.000000000 +0200
+++ courier-0.53.2.20060607/webmail/html/en-us/filter.html 2006-06-13
11:24:50.000000000 +0200
@@ -15,6 +15,7 @@
[#$BADIMPORT=<span style="color: #ee0000">ERROR: You have an incompatible
existing mail filter, contact your system administrator</span><br />#]
[#$BADRULENAME=<span style="color: #ee0000">ERROR: Invalid or missing rule
name, please reenter</span><br />#]
+[#$EXISTS=<span style="color: #ee0000">ERROR: Rule name already exists, please
reenter</span><br />#]
[#$BADHEADER=<span style="color: #ee0000">ERROR: Invalid or missing header
name, please reenter</span><br />#]
[#$AUTOREPLY=<span style="color: #ee0000">ERROR: Invalid or missing autoreply
name, please reenter</span><br />#]
[#$BADVALUE=<span style="color: #ee0000">ERROR: Invalid or missing header
pattern or recipient address, please reenter</span><br />#]
diff -r -u courier-0.53.2.20060607-org/webmail/mailfilter.c
courier-0.53.2.20060607/webmail/mailfilter.c
--- courier-0.53.2.20060607-org/webmail/mailfilter.c 2006-06-13
11:24:32.000000000 +0200
+++ courier-0.53.2.20060607/webmail/mailfilter.c 2006-06-13 11:24:50.000000000
+0200
@@ -93,9 +93,10 @@
{
const char *p=internal_err;
+ if (*cgi("currentfilternum")) printf("<input name=\"currentfilternum\"" " type=\"hidden\"" - " value=\"%s\" />", p); + " value=\"%s\" />", cgi("currentfilternum")); if (p) printf("%s", getarg(p)); } @@ -574,6 +575,8 @@ internal_err="INTERNAL"; if (err_num == MF_ERR_BADRULENAME) internal_err= "BADRULENAME"; + if (err_num == MF_ERR_EXISTS) + internal_err= "EXISTS"; if (err_num == MF_ERR_BADRULEHEADER) internal_err= "BADHEADER"; if (err_num == MF_ERR_BADRULEVALUE)








.patch