aboutsummaryrefslogtreecommitdiff
path: root/src/wydawca.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2013-03-10 22:39:23 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2013-03-10 22:39:23 +0200
commit87602f5492b842f734dffe22f4e2f85dbc6ce713 (patch)
tree3e7e04bca15e8af5c981a78619e2d95f03b45c67 /src/wydawca.c
parent826bb71c57d903f760c89406f93d19fe0c131de0 (diff)
downloadwydawca-87602f5492b842f734dffe22f4e2f85dbc6ce713.tar.gz
wydawca-87602f5492b842f734dffe22f4e2f85dbc6ce713.tar.bz2
Replace mail notification with module event notification framework.
The new framework is to be general-purpose; the mail notification is implemented as a module. Althoug the program is operational, the change is not completed yet. In particular, the docs are out of date and the tests will mostly fail. * .gitignore: Update. * Makefile.am (SUBDIRS): Add modules. * configure.ac: Mailutils is now optional (though highly recommended). (AC_CONFIG_FILES): Build modules/Makefile and modules/mailutils/Makefile. * modules/Makefile.am: New file. * modules/mailutils/Makefile.am: New file. * modules/mailutils/mod_mailutils.c: New file. * src/mail.c: Remove. * src/mail.h: Remove. * src/event.c: New file. * src/Makefile.am (wydawca_SOURCES): Update. (LDADD): Remove MAILUTILS_LIBS. * src/config.c: Remove mail-related configuration statements. Add module-related ones instead. * src/wydawca.h (notification_event) <ev_statistics>: New event. (notification_target): Remove. (notification) <tgt,sign_keys,msg>: Remove. <statmask>: New member. (register_message_template): Remove. (notify_stats,notify_flush): New protos. (notification_target_str): Remove. (format_fn): Remove. (module) <next,modinit,open> <flush,close>: New members. <notify>: Change signature. (modules_close, module_set_init) (module_flush): New protos. (debug_level): Rename to wy_debug_level. All uses changed. (wy_version): New extern. (admin_stat_message,admin_stat_sign_key): Remove. (default_notification): New global. (triplet_expand_param,triplet_expand_dictionary_query): The file_triplet argument is const pointer. (assert_string_arg): Rename to wy_assert_string_arg. * src/wydawca.c (debug_level): Rename to wy_debug_level. (wy_version): New global. (logstats): Call notify_stats. (main): Call modules_close. * src/module.c: Keep modules in a singly-linked list instead of a symtab. Provide new functions. * src/net.c: Update. * src/dictionary.c: Update. * src/directive.c: Update. * src/diskio.c: Update. * src/exec.c: Update. * src/gpg.c: Update. * src/job.c (wydawca_scanner): Call notify_flush. * src/null.c: Update. * src/process.c: Update. * src/sql.c: Update. * src/tcpwrap.c: Update. * src/triplet.c: Update. * src/verify.c: Update. * src/watcher.c: Update.
Diffstat (limited to 'src/wydawca.c')
-rw-r--r--src/wydawca.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/wydawca.c b/src/wydawca.c
index 1506b56..6c342c9 100644
--- a/src/wydawca.c
+++ b/src/wydawca.c
@@ -15,7 +15,6 @@
with wydawca. If not, see <http://www.gnu.org/licenses/>. */
#include "wydawca.h"
-#include "mail.h"
char *program_name;
uid_t wydawca_uid;
@@ -23,7 +22,8 @@ gid_t wydawca_gid;
size_t wydawca_supp_groupc;
gid_t *wydawca_supp_groups;
char *conffile = SYSCONFDIR "/wydawca.rc";
-int debug_level;
+const char *wy_version = "wydawca (" PACKAGE_STRING ")";
+int wy_debug_level;
int dry_run_mode;
int log_to_stderr = -1; /* -1 means autodetect */
int log_facility = LOG_LOCAL1;
@@ -212,11 +212,11 @@ logstats()
gettext(stat_name[i]), wydawca_stat[i]);
}
- mail_stats();
+ notify_stats();
}
void
-grecs_print_diag(grecs_locus_t * locus, int err, int errcode, const char *msg)
+grecs_print_diag(grecs_locus_t *locus, int err, int errcode, const char *msg)
{
char *locstr = NULL;
@@ -329,8 +329,6 @@ main(int argc, char **argv)
program_name = argv[0];
proginfo.print_version_hook = version_hook;
- mu_register_all_mailer_formats();
- mu_stdstream_setup(MU_STDSTREAM_RESET_NONE);
config_init();
x_argv = argv;
@@ -343,7 +341,7 @@ main(int argc, char **argv)
if (!p) {
logmsg(LOG_CRIT, _("GPGMe version check failed"));
exit(EX_UNAVAILABLE);
- } else if (debug_level > 3)
+ } else if (wy_debug_level > 3)
logmsg(LOG_DEBUG, _("using GPGME version %s"), p);
if (argc)
@@ -377,14 +375,10 @@ main(int argc, char **argv)
log_to_stderr = (!daemon_mode || foreground) && isatty(0);
grecs_log_to_stderr = log_to_stderr;
- mu_log_tag = syslog_tag;
- mu_log_facility = log_facility;
if (!log_to_stderr) {
openlog(syslog_tag, LOG_PID, log_facility);
log_printer = syslog_printer;
}
- mu_stdstream_strerr_setup(log_to_stderr ?
- MU_STRERR_STDERR : MU_STRERR_SYSLOG);
if (getgid() == 0) {
if (wydawca_uid == 0) {
@@ -399,7 +393,6 @@ main(int argc, char **argv)
exit(EX_UNAVAILABLE);
}
- mail_init();
wydawca_lock_init();
logmsg(LOG_NOTICE, _("wydawca (%s) started"), PACKAGE_STRING);
@@ -410,10 +403,10 @@ main(int argc, char **argv)
} else
wydawca_daemon();
+ modules_close();
+
logmsg(LOG_NOTICE, _("wydawca (%s) finished"), PACKAGE_STRING);
- mail_finish();
-
if (reconfigure) {
int i;
for (i = getdtablesize(); i > 2; i--)

Return to:

Send suggestions and report system problems to the System administrator.