Commit bd7a5d36 bd7a5d3696006205cee339b71bc21fd0daec2531 by Sergey Poznyakoff

New option --quota-query

1 parent 59419388
...@@ -25,6 +25,7 @@ int ex_quota_tempfail; /* Return temporary failure if mailbox quota is ...@@ -25,6 +25,7 @@ int ex_quota_tempfail; /* Return temporary failure if mailbox quota is
25 int exit_code = EX_OK; /* Exit code to be used */ 25 int exit_code = EX_OK; /* Exit code to be used */
26 uid_t uid; /* Current user name */ 26 uid_t uid; /* Current user name */
27 char *quotadbname = NULL; /* Name of mailbox quota database */ 27 char *quotadbname = NULL; /* Name of mailbox quota database */
28 char *quota_query = NULL; /* SQL query to retrieve mailbox quota */
28 29
29 /* Debuggig options */ 30 /* Debuggig options */
30 int debug_level; /* General debugging level */ 31 int debug_level; /* General debugging level */
...@@ -63,8 +64,9 @@ Debug flags are:\n\ ...@@ -63,8 +64,9 @@ Debug flags are:\n\
63 static char args_doc[] = N_("recipient [recipient ...]"); 64 static char args_doc[] = N_("recipient [recipient ...]");
64 65
65 #define ARG_MULTIPLE_DELIVERY 1 66 #define ARG_MULTIPLE_DELIVERY 1
66 #define ARG_QUOTA_TEMPFAIL 2 67 #define ARG_QUOTA_TEMPFAIL 2
67 #define ARG_MESSAGE_ID_HEADER 3 68 #define ARG_MESSAGE_ID_HEADER 3
69 #define ARG_QUOTA_QUERY 4
68 70
69 static struct argp_option options[] = 71 static struct argp_option options[] =
70 { 72 {
...@@ -77,7 +79,11 @@ static struct argp_option options[] = ...@@ -77,7 +79,11 @@ static struct argp_option options[] =
77 { NULL, 'r', NULL, OPTION_ALIAS, NULL }, 79 { NULL, 'r', NULL, OPTION_ALIAS, NULL },
78 #ifdef USE_DBM 80 #ifdef USE_DBM
79 { "quota-db", 'q', N_("FILE"), 0, 81 { "quota-db", 'q', N_("FILE"), 0,
80 N_("Specify path to quota database"), 0 }, 82 N_("Specify path to quota DBM database"), 0 },
83 #endif
84 #ifdef USE_SQL
85 { "quota-query", ARG_QUOTA_QUERY, N_("STRING"), 0,
86 N_("SQL query to retrieve mailbox quota"), 0 },
81 #endif 87 #endif
82 { "sieve", 'S', N_("PATTERN"), 0, 88 { "sieve", 'S', N_("PATTERN"), 0,
83 N_("Set name pattern for user-defined sieve mail filters"), 0 }, 89 N_("Set name pattern for user-defined sieve mail filters"), 0 },
...@@ -136,6 +142,10 @@ parse_opt (int key, char *arg, struct argp_state *state) ...@@ -136,6 +142,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
136 case ARG_MESSAGE_ID_HEADER: 142 case ARG_MESSAGE_ID_HEADER:
137 message_id_header = arg; 143 message_id_header = arg;
138 break; 144 break;
145
146 case ARG_QUOTA_QUERY:
147 quota_query = arg;
148 break;
139 149
140 case 'r': 150 case 'r':
141 case 'f': 151 case 'f':
......