Commit 13c96f59 13c96f59c1c862bb62a70f8a6831768d4a576f77 by Sergey Poznyakoff

(--bulletin-source, --bulletin-db): New options

1 parent e93b9d64
1 /* GNU Mailutils -- a suite of utilities for electronic mail 1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2 Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
3 2005 Free Software Foundation, Inc. 3 2005, 2007 Free Software Foundation, Inc.
4 4
5 GNU Mailutils is free software; you can redistribute it and/or modify 5 GNU Mailutils is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
...@@ -64,29 +64,53 @@ static void pop3d_log_connection (int fd); ...@@ -64,29 +64,53 @@ static void pop3d_log_connection (int fd);
64 const char *program_version = "pop3d (" PACKAGE_STRING ")"; 64 const char *program_version = "pop3d (" PACKAGE_STRING ")";
65 static char doc[] = N_("GNU pop3d -- the POP3 daemon"); 65 static char doc[] = N_("GNU pop3d -- the POP3 daemon");
66 66
67 #define OPT_LOGIN_DELAY 257 67 #define OPT_LOGIN_DELAY 257
68 #define OPT_STAT_FILE 258 68 #define OPT_STAT_FILE 258
69 #define OPT_EXPIRE 259 69 #define OPT_EXPIRE 259
70 #define OPT_EXPIRE_ON_EXIT 260 70 #define OPT_EXPIRE_ON_EXIT 260
71 #define OPT_TLS_REQUIRED 261 71 #define OPT_TLS_REQUIRED 261
72 #define OPT_BULLETIN_SOURCE 262
73 #define OPT_BULLETIN_DB 263
72 74
73 static struct argp_option options[] = { 75 static struct argp_option options[] = {
76 #define GRP 0
77 { NULL, 0, NULL, 0,
78 N_("General options"), GRP },
74 {"undelete", 'u', NULL, 0, 79 {"undelete", 'u', NULL, 0,
75 N_("Undelete all messages on startup"), 0}, 80 N_("Undelete all messages on startup"), GRP+1},
76 #ifdef ENABLE_LOGIN_DELAY
77 {"login-delay", OPT_LOGIN_DELAY, N_("SECONDS"), 0,
78 N_("Allowed delay between the two successive logins"), 0},
79 {"stat-file", OPT_STAT_FILE, N_("FILENAME"), 0,
80 N_("Name of login statistics file"), 0},
81 #endif
82 {"expire", OPT_EXPIRE, N_("DAYS"), 0, 81 {"expire", OPT_EXPIRE, N_("DAYS"), 0,
83 N_("Expire read messages after the given number of days"), 0}, 82 N_("Expire read messages after the given number of days"), GRP+1},
84 {"delete-expired", OPT_EXPIRE_ON_EXIT, NULL, 0, 83 {"delete-expired", OPT_EXPIRE_ON_EXIT, NULL, 0,
85 N_("Delete expired messages upon closing the mailbox"), 0}, 84 N_("Delete expired messages upon closing the mailbox"), GRP+1},
86 #ifdef WITH_TLS 85 #ifdef WITH_TLS
87 {"tls-required", OPT_TLS_REQUIRED, NULL, 0, 86 {"tls-required", OPT_TLS_REQUIRED, NULL, 0,
88 N_("Always require STLS before entering authentication phase")}, 87 N_("Always require STLS before entering authentication phase")},
89 #endif 88 #endif
89 #undef GRP
90
91 #define GRP 10
92 #ifdef ENABLE_LOGIN_DELAY
93 { NULL, 0, NULL, 0,
94 N_("Login delay control"), GRP },
95 {"login-delay", OPT_LOGIN_DELAY, N_("SECONDS"), 0,
96 N_("Allowed delay between the two successive logins"), GRP+1},
97 {"stat-file", OPT_STAT_FILE, N_("FILENAME"), 0,
98 N_("Name of login statistics file"), GRP+1},
99 #endif
100
101 #undef GRP
102
103 #define GRP 20
104 { NULL, 0, NULL, 0,
105 N_("Bulletin control"), GRP },
106 { "bulletin-source", OPT_BULLETIN_SOURCE, N_("MBOX"), 0,
107 N_("Set source mailbox to get bulletins from"), GRP+1 },
108 #ifdef USE_DBM
109 { "bulletin-db", OPT_BULLETIN_DB, N_("FILE"), 0,
110 N_("Set the bulletin database file name"), GRP+1 },
111 #endif
112 #undef GRP
113
90 {NULL, 0, NULL, 0, NULL, 0} 114 {NULL, 0, NULL, 0, NULL, 0}
91 }; 115 };
92 116
...@@ -160,6 +184,16 @@ pop3d_parse_opt (int key, char *arg, struct argp_state *astate) ...@@ -160,6 +184,16 @@ pop3d_parse_opt (int key, char *arg, struct argp_state *astate)
160 initial_state = INITIAL; 184 initial_state = INITIAL;
161 break; 185 break;
162 #endif 186 #endif
187
188 case OPT_BULLETIN_SOURCE:
189 set_bulletin_source (arg);
190 break;
191
192 #ifdef USE_DBM
193 case OPT_BULLETIN_DB:
194 set_bulletin_db (arg);
195 break;
196 #endif
163 197
164 default: 198 default:
165 return ARGP_ERR_UNKNOWN; 199 return ARGP_ERR_UNKNOWN;
...@@ -179,6 +213,9 @@ main (int argc, char **argv) ...@@ -179,6 +213,9 @@ main (int argc, char **argv)
179 213
180 mu_argp_init (program_version, NULL); 214 mu_argp_init (program_version, NULL);
181 MU_AUTH_REGISTER_ALL_MODULES(); 215 MU_AUTH_REGISTER_ALL_MODULES();
216 /* Register the desired formats. */
217 mu_register_local_mbox_formats ();
218
182 #ifdef WITH_TLS 219 #ifdef WITH_TLS
183 mu_tls_init_argp (); 220 mu_tls_init_argp ();
184 #endif /* WITH_TLS */ 221 #endif /* WITH_TLS */
...@@ -210,9 +247,6 @@ main (int argc, char **argv) ...@@ -210,9 +247,6 @@ main (int argc, char **argv)
210 } 247 }
211 } 248 }
212 249
213 /* Register the desired formats. */
214 mu_register_local_mbox_formats ();
215
216 /* Set the signal handlers. */ 250 /* Set the signal handlers. */
217 signal (SIGINT, pop3d_signal); 251 signal (SIGINT, pop3d_signal);
218 signal (SIGQUIT, pop3d_signal); 252 signal (SIGQUIT, pop3d_signal);
......