I coded up a patch to implement this feature (attached)

Michael.

----- Original Message -----
From: "Michael Bowe" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 03, 2003 4:48 PM
Subject: [qmailadmin] Feature request - display counts & limits


> When you go to the Email Accounts screen, there is a heading called "Total
> Accounts" that shows the number of mailboxes in use and also the mailbox
> limit
>
> Would it be possible to add this same functionality to the
aliases/forwards
> screen, the autoresponders screen, and the mailing list screens?
>
> This would allow end-user-postmasters to see how many of each item they
are
> allowed to create, rather than just receiving a "you have exceeded your
> limit" warning
>
> I took a look at the code and it appears all the required functions
already
> exist :
>   load_limits()
>   count_aliases()
>   count_forwards()
>   count_autoresponders()
>   count_mailinglists()
>
> So it should just be a job of adding a couple of new tokens to the
> template.c, and then adding the tokens to the html pages?
>
> I can hack something together if needed, but I am no C expert, so perhaps
> this job is better left to one of the more experienced programmers on this
> list?
>
> Michael.
>
>
>
######################################################
# This patch was written to add "Used : numused/limit" headers
# to the show aliases/forwards/autoresponders/mailinglists screens.
#  
# The show_users screen has had this functionality for a while
# so I thought it would make sense to also add it to the other
# screens.
#
# Apply the patch like this :
#   patch -p0 < qmailadmin-1.0.20-addcounts.diff.txt
#
# Michael Bowe <[EMAIL PROTECTED]> 5th June 2003.
######################################################

--- ../qmailadmin-1.0.20/template.c     Tue May 27 05:54:51 2003
+++ template.c  Thu Jun  5 13:54:30 2003
@@ -257,6 +257,54 @@
             check_user_forward_vacation(fgetc(fs));
             break;
 
+          /* show number of aliases */
+          /* Added by <[EMAIL PROTECTED]> 5th June 2003 */
+          case 'j':
+            load_limits();
+            count_aliases();
+            if(MaxAliases > -1) {
+              printf("%d/%d", CurAliases, MaxAliases);
+            } else {
+              printf("%d/%s", CurAliases, get_html_text("229"));
+            }
+            break;
+
+          /* show number of forwards */
+          /* Added by <[EMAIL PROTECTED]> 5th June 2003 */
+          case 'k':
+            load_limits();
+            count_forwards();
+            if(MaxForwards > -1) {
+              printf("%d/%d", CurForwards, MaxForwards);
+            } else {
+              printf("%d/%s", CurForwards, get_html_text("229"));
+            }
+            break;
+
+          /* show number of autoresponders */
+          /* Added by <[EMAIL PROTECTED]> 5th June 2003 */
+          case 'K':
+            load_limits();
+            count_autoresponders();
+            if(MaxAutoResponders > -1) {
+              printf("%d/%d", CurAutoResponders, MaxAutoResponders);
+            } else {
+              printf("%d/%s", CurAutoResponders, get_html_text("229"));
+            }
+            break;
+
+          /* show number of mailing lists */
+          /* Added by <[EMAIL PROTECTED]> 5th June 2003 */
+          case 'L':
+            load_limits();
+            count_mailinglists();
+            if(MaxMailingLists > -1) {
+              printf("%d/%d", CurMailingLists, MaxMailingLists);
+            } else {
+              printf("%d/%s", CurMailingLists, get_html_text("229"));
+            }
+            break;
+
           /* show the aliases stuff */
           case 'l':
             if (AdminType == DOMAIN_ADMIN) {
--- ../qmailadmin-1.0.20/html/show_users.html   Tue Apr 22 06:30:07 2003
+++ html/show_users.html        Thu Jun  5 13:57:34 2003
@@ -12,7 +12,7 @@
                                                        <font color="#ffffff" size="3">
                                                                <b>##X061 (##D)</b>
                                                                <br>
-                                                               <b>##X255 ##B</b>
+                                                               <b>[##X254 ##B]</b>
                                                        </font>
                                                </td>
                                        </tr>
--- ../qmailadmin-1.0.20/html/show_forwards.html        Tue Apr 22 06:30:05 2003
+++ html/show_forwards.html     Thu Jun  5 13:57:05 2003
@@ -11,6 +11,8 @@
                                                <td bgcolor="#000000" align="center" 
width="100%">
                                                        <font color="#ffffff" size="3">
                                                                <b>##X074/##X068</b>
+                                                               <br>
+                                                               <b>[##X122 ##X254 ##k, 
##X121 ##X254 ##j]</b>
                                                        </font>
                                                </td>
                                        </tr>
--- ../qmailadmin-1.0.20/html/show_autorespond.html     Tue Apr 22 06:30:04 2003
+++ html/show_autorespond.html  Thu Jun  5 13:57:15 2003
@@ -11,6 +11,8 @@
                                                <td bgcolor="#000000" align="center">
                                                        <font color="#ffffff" size="3">
                                                                <b>##X077</b>
+                                                               <br>
+                                                               <b>[##X254 ##K]</b>
                                                        </font>
                                                </td>
                                        </tr>
--- ../qmailadmin-1.0.20/html/show_mailinglist.html     Tue Apr 22 06:30:06 2003
+++ html/show_mailinglist.html  Thu Jun  5 13:56:54 2003
@@ -11,6 +11,8 @@
                                                <td bgcolor="#000000" align="center">
                                                        <font color="#ffffff" size="3">
                                                                <b>##X080</b>
+                                                               <br>
+                                                               <b>[##X254 ##L]</b>
                                                        </font>
                                                </td>
                                        </tr>

Reply via email to