From: Tom C. <tom...@us...> - 2004-12-31 01:02:52
|
Update of /cvsroot/qmailadmin/qmailadmin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29919 Modified Files: Tag: stable-1_2 ChangeLog command.c qmailadmin.c qmailadmin.h template.c Log Message: add quick links section to main menu Index: qmailadmin.c =================================================================== RCS file: /cvsroot/qmailadmin/qmailadmin/qmailadmin.c,v retrieving revision 1.6.2.4 retrieving revision 1.6.2.5 diff -u -d -r1.6.2.4 -r1.6.2.5 --- qmailadmin.c 20 Nov 2004 01:10:41 -0000 1.6.2.4 +++ qmailadmin.c 31 Dec 2004 01:02:40 -0000 1.6.2.5 @@ -36,11 +36,14 @@ #include <vauth.h> #include <vlimits.h> +#include "alias.h" #include "auth.h" +#include "autorespond.h" #include "cgi.h" #include "command.h" #include "config.h" #include "limits.h" +#include "mailinglist.h" #include "printh.h" #include "qmailadmin.h" #include "show.h" @@ -414,3 +417,65 @@ } closedir(mydir); } + +void quickAction (char *username, int action) +{ + /* This feature sponsored by PinkRoccade Public Sector, Sept 2004 */ + + struct stat fileinfo; + char dotqmailfn[MAX_BUFF]; + char *space, *ar, *ez; + char *aliasline; + + /* Note that all of the functions called from quickAction() assume + * that the username to modify is in a global called "ActionUser" + * It would be better to pass this information as a parameter, but + * that's how it was originally done. The code in command.c that + * calls quickAction() passes ActionUser as the username parameter + * in hopes that someday we'll remove the globals and pass parameters. + */ + + /* first check for alias/forward, autorepsonder (or even mailing list) */ + aliasline = valias_select (username, Domain); + if (aliasline != NULL) { + /* Autoresponder/Mailing List detection algorithm: + * We're looking for either '/autorespond ' or '/ezmlm-reject ' to + * appear in the first line, before a space appears + */ + space = strstr (aliasline, " "); + ar = strstr (aliasline, "/autorespond "); + ez = strstr (aliasline, "/ezmlm-reject "); + if (ar && space && (ar < space)) { + /* autorepsonder */ + if (action == ACTION_MODIFY) modautorespond(); + else if (action == ACTION_DELETE) delautorespond(); + } else if (ez && space && (ez < space)) { + /* mailing list (cdb-backend only) */ + if (action == ACTION_MODIFY) modmailinglist(); + else if (action == ACTION_DELETE) delmailinglist(); + } else { + /* it's just a forward/alias of some sort */ + if (action == ACTION_MODIFY) moddotqmail(); + else if (action == ACTION_DELETE) deldotqmail(); + } + } else if (vauth_getpw (username, Domain)) { + /* POP/IMAP account */ + if (action == ACTION_MODIFY) moduser(); + else if (action == ACTION_DELETE) deluser(); + } else { + /* check for mailing list on SQL backend (not in valias_select) */ + snprintf (dotqmailfn, sizeof(dotqmailfn), ".qmail-%s", username); + str_replace (dotqmailfn+7, '.', ':'); + if (stat (dotqmailfn, &fileinfo) == 0) { + /* mailing list (MySQL backend) */ + if (action == ACTION_MODIFY) modmailinglist(); + else if (action == ACTION_DELETE) delmailinglist(); + } else { + /* user does not exist */ + snprinth (StatusMessage, sizeof(StatusMessage), "%s (%H@%H)", + get_html_text("153"), username, Domain); + show_menu(Username, Domain, Mytime); + vclose(); + } + } +} Index: ChangeLog =================================================================== RCS file: /cvsroot/qmailadmin/qmailadmin/ChangeLog,v retrieving revision 1.15.2.46 retrieving revision 1.15.2.47 diff -u -d -r1.15.2.46 -r1.15.2.47 --- ChangeLog 31 Dec 2004 00:58:02 -0000 1.15.2.46 +++ ChangeLog 31 Dec 2004 01:02:40 -0000 1.15.2.47 @@ -3,6 +3,12 @@ 1.2.7 - unreleased + Tom Collins + - Add Quick Links section to main menu. Admins can now enter an + email address and go directly to the modify or delete page, + regardless of address type (mailbox, forward, list, etc.). + Thanks to PinkRoccade Public Sector for sponsoring this feature. + 1.2.6 - released 24-Dec-04 Tom Collins Index: qmailadmin.h =================================================================== RCS file: /cvsroot/qmailadmin/qmailadmin/qmailadmin.h,v retrieving revision 1.1.1.1.2.3 retrieving revision 1.1.1.1.2.4 diff -u -d -r1.1.1.1.2.3 -r1.1.1.1.2.4 --- qmailadmin.h 20 Nov 2004 01:10:41 -0000 1.1.1.1.2.3 +++ qmailadmin.h 31 Dec 2004 01:02:40 -0000 1.1.1.1.2.4 @@ -48,8 +48,12 @@ #define NUM_SQL_OPTIONS 6 +#define ACTION_MODIFY 1 +#define ACTION_DELETE 2 + void del_id_files( char *); void init_globals(); +void quickAction (char *username, int action); /* copied from maildirquota.c in vpopmail * it really needs to get into vpopmail.h somehow Index: template.c =================================================================== RCS file: /cvsroot/qmailadmin/qmailadmin/template.c,v retrieving revision 1.7.2.8 retrieving revision 1.7.2.9 diff -u -d -r1.7.2.8 -r1.7.2.9 --- template.c 2 Dec 2004 00:07:43 -0000 1.7.2.8 +++ template.c 31 Dec 2004 01:02:40 -0000 1.7.2.9 @@ -467,7 +467,7 @@ /* display the main menu */ /* move this to a function... */ case 'v': - printh ("<font size=\"2\" color=\"#000000\"><b>%H</b></font><br>", + printh ("<font size=\"2\" color=\"#000000\"><b>%H</b></font><br><br>", Domain); printf ( "<font size=\"2\" color=\"#ff0000\"><b>%s</b></font><br>", @@ -540,9 +540,6 @@ if (AdminType == DOMAIN_ADMIN) { printf ("<br>"); - printf ( - "<font size=\"2\" color=\"#ff0000\"><b>%s</b></font><br>", - get_html_text("124")); if (MaxPopAccounts != 0) { printh ( Index: command.c =================================================================== RCS file: /cvsroot/qmailadmin/qmailadmin/command.c,v retrieving revision 1.2.2.4 retrieving revision 1.2.2.5 diff -u -d -r1.2.2.4 -r1.2.2.5 --- command.c 20 Nov 2004 01:10:41 -0000 1.2.2.4 +++ command.c 31 Dec 2004 01:02:40 -0000 1.2.2.5 @@ -48,6 +48,30 @@ if (strcmp(TmpBuf2, "showmenu") == 0 ) { show_menu(Username, Domain, Mytime); + } else if (strcmp(TmpBuf2, "quick") == 0) { + /* This feature sponsored by PinkRoccade Public Sector, Sept 2004 */ + + char moddel[20]; + /* we use global ActionUser here because the functions that + * quickAction calls expect the username in that global. + */ + GetValue(TmpCGI, ActionUser, "modu=", sizeof(ActionUser)); + lowerit (ActionUser); /* convert username to lower case */ + GetValue(TmpCGI, moddel, "MODIFY=", sizeof(moddel)); + if (*moddel) { + quickAction (ActionUser, ACTION_MODIFY); + } else { + GetValue(TmpCGI, moddel, "DELETE=", sizeof(moddel)); + if (*moddel) { + quickAction (ActionUser, ACTION_DELETE); + } else { + /* malformed request -- missing fields */ + show_menu(Username, Domain, Mytime); + vclose(); + exit(0); + } + } + } else if (strcmp(TmpBuf2, "showusers") == 0) { GetValue(TmpCGI, Pagenumber, "page=", sizeof(Pagenumber)); GetValue(TmpCGI, SearchUser, "searchuser=", sizeof(SearchUser)); |