diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2007-08-25 13:29:33 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2007-08-25 13:29:33 +0000 |
commit | e4b5d37def5023905e98bc0b6c6f81c2d56ba362 (patch) | |
tree | 76dbdd53079e4f05529c002284467820c8d5d0ef /src/wydawca.c | |
parent | 1107c4341552ecb568b43292fc219a73e0d49a0f (diff) | |
download | wydawca-e4b5d37def5023905e98bc0b6c6f81c2d56ba362.tar.gz wydawca-e4b5d37def5023905e98bc0b6c6f81c2d56ba362.tar.bz2 |
* configure.ac: Require mailutils for wydawca
* bootstrap: Require inttostr and strftime
* wydawca/mail.h: New file
* wydawca/mail.c: New file
* wydawca/Makefile.am: Add mail.c and mail.h
* wydawca/wydawca.c: Include mail.h
(stat_mask_p, make_stat_expansion): New functions
(logstats): Call mail_stats
(main): Call initialize mailer subsystem
* wydawca/sql.c, wydawca/sql.h: Keep usage reference count. Do not
deinitialize unless it falls to 0. Do not initialize if it is > 0.
* wydawca/verify.c (expand_param): Rewrite to allow long keywords
All callers updated.
* wydawca/wydawca.h (struct access_method): Keep reference count
(struct directory_pair): verify_method and gpg_key_method are
pointers to structs.
(struct kw_expansion): kw is char*
(count_collected_triplets): New function
(method_new): New function
* wydawca/config.c: reimplement verify-user and gpg-key
New keywords mailer, admin-address, from-address, mail-admin-stat
and admin-stat-message
* wydawca/process.c: Close methods only when their reference count
is 0.
* wydawca/method.c: Likewise.
(method_new): New function
* wydawca/wydawca.rc: Update
* wydawca/diskio.c: Minor changes
* wydawca/triplet.c (count_collected_triplets): New function
* jabberd/main.c: Minor change
git-svn-id: file:///svnroot/wydawca/trunk@295 6bb4bd81-ecc2-4fd4-a2d4-9571d19c0d33
Diffstat (limited to 'src/wydawca.c')
-rw-r--r-- | src/wydawca.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/wydawca.c b/src/wydawca.c index 398cadd..559970a 100644 --- a/src/wydawca.c +++ b/src/wydawca.c @@ -15,6 +15,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "wydawca.h" +#include "mail.h" char *conffile = SYSCONFDIR "/wydawca.rc" ; int debug_level; @@ -165,6 +166,45 @@ static char *stat_name[MAX_STAT] = { "symlinks removed", }; +static char *stat_kwname[MAX_STAT] = { + "stat:errors", + "stat:warnings", + "stat:bad_signatures", + "stat:access_violations", + "stat:complete_triplets", + "stat:incomplete_triplets", + "stat:bad_triplets", + "stat:expired_triplets", + "stat:triplet_success", + "stat:uploads", + "stat:archives", + "stat:symlinks", + "stat:rmsymlinks", +}; + +int +stat_mask_p (unsigned long mask) +{ + int i; + + for (i = 0; i < MAX_STAT; i++) + if (wydawca_stat[i] != 0 && (mask && STAT_MASK (i))) + return 1; + return 0; +} + +void +make_stat_expansion (struct kw_expansion *exp) +{ + int i; + char sbuf[INT_BUFSIZE_BOUND (wydawca_stat[0])]; + for (i = 0; i < MAX_STAT; i++) + { + exp[i].kw = stat_kwname[i]; + exp[i].value = xstrdup (uinttostr (wydawca_stat[i], sbuf)); + } +} + void logstats () { @@ -173,6 +213,8 @@ logstats () for (i = 0; i < MAX_STAT; i++) if (print_stats & STAT_MASK (i)) logmsg (LOG_INFO, "%s: %u", stat_name[i], wydawca_stat[i]); + + mail_stats (); } @@ -184,6 +226,7 @@ main (int argc, char **argv) int lint_mode = 0; program_name = argv[0]; + mu_register_all_mailer_formats (); while ((c = getopt_long (argc, argv, "c:dehntv", options, NULL)) != EOF) { switch (c) @@ -244,10 +287,15 @@ main (int argc, char **argv) log_printer = syslog_printer; } + mail_init (); + logmsg (LOG_NOTICE, "wydawca (%s) started", PACKAGE_STRING); scan_directories (); logmsg (LOG_NOTICE, "wydawca (%s) finished", PACKAGE_STRING); logstats (); + + mail_finish (); + exit (0); } |