aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2020-06-14 13:16:41 +0300
committerSergey Poznyakoff <gray@gnu.org>2020-06-14 13:16:41 +0300
commit3d9bdf4a0efd58202aa2b847d1fdc0afb2760345 (patch)
tree5cbbe136c02b18021adb3b441a29de6eb2619bdf
parent49de98a30b8b5b45d30bcd4b8136a5b4cfe80fcd (diff)
downloadwydawca-3d9bdf4a0efd58202aa2b847d1fdc0afb2760345.tar.gz
wydawca-3d9bdf4a0efd58202aa2b847d1fdc0afb2760345.tar.bz2
Use grecs with wordsplit v1.1
m---------grecs0
-rw-r--r--modules/mailutils/mod_mailutils.c25
2 files changed, 9 insertions, 16 deletions
diff --git a/grecs b/grecs
Subproject b47bfb2cc836d3961bd0b8a4748e5dbb42e3727 Subproject 893d875a4065acb757fef55876c391b1dd07004
diff --git a/modules/mailutils/mod_mailutils.c b/modules/mailutils/mod_mailutils.c
index 2ca231d..ca27a8e 100644
--- a/modules/mailutils/mod_mailutils.c
+++ b/modules/mailutils/mod_mailutils.c
@@ -23,11 +23,13 @@
23#include <wydawca/cfg.h> 23#include <wydawca/cfg.h>
24#include <mailutils/mailutils.h> 24#include <mailutils/mailutils.h>
25#include <wydawca/wordsplit.h> 25#include <wydawca/wordsplit.h>
26#include <pthread.h>
26 27
27#define WY_MODULE mod_mailutils 28#define WY_MODULE mod_mailutils
28 29
29static int mailer_opened;
30static mu_mailer_t mailer; 30static mu_mailer_t mailer;
31static pthread_mutex_t mailer_mutex = PTHREAD_MUTEX_INITIALIZER;
32
31static mu_address_t admin_address; 33static mu_address_t admin_address;
32static mu_address_t from_address; 34static mu_address_t from_address;
33unsigned long mail_admin_mask; 35unsigned long mail_admin_mask;
@@ -354,18 +356,14 @@ mail_send_message(mu_address_t rcpt, const char *text, const char *signer_key)
354 mu_debug_set_category_level(MU_DEBCAT_MAILER, level); 356 mu_debug_set_category_level(MU_DEBCAT_MAILER, level);
355 } 357 }
356 358
357 if (!mailer_opened) { 359 pthread_mutex_lock(&mailer_mutex);
358 if ((rc = mu_mailer_open(mailer, 0))) { 360 if ((rc = mu_mailer_open(mailer, 0))) {
359 mu_url_t url = NULL; 361 mu_url_t url = NULL;
360 mu_mailer_get_url(mailer, &url); 362 mu_mailer_get_url(mailer, &url);
361 wy_log(LOG_CRIT, _("opening mailer `%s' failed: %s"), 363 wy_log(LOG_CRIT, _("opening mailer `%s' failed: %s"),
362 url ? mu_url_to_string(url) : "(unknown URL)", 364 url ? mu_url_to_string(url) : "(unknown URL)",
363 mu_strerror(rc)); 365 mu_strerror(rc));
364 return; 366 } else {
365 }
366 mailer_opened = 1;
367 }
368
369 if (signer_key) 367 if (signer_key)
370 sign_message(&msg, signer_key); 368 sign_message(&msg, signer_key);
371 369
@@ -375,6 +373,10 @@ mail_send_message(mu_address_t rcpt, const char *text, const char *signer_key)
375 wy_log(LOG_CRIT, _("cannot send message: %s"), mu_strerror(rc)); 373 wy_log(LOG_CRIT, _("cannot send message: %s"), mu_strerror(rc));
376 } 374 }
377 375
376 mu_mailer_close(mailer);
377 }
378 pthread_mutex_unlock(&mailer_mutex);
379
378 mu_message_destroy(&msg, mu_message_get_owner(msg)); 380 mu_message_destroy(&msg, mu_message_get_owner(msg));
379} 381}
380 382
@@ -602,15 +604,6 @@ wy_config(grecs_node_t *node)
602 return evt; 604 return evt;
603} 605}
604 606
605void
606wy_flush(void)
607{
608 if (mailer_opened) {
609 mu_mailer_close(mailer);
610 mailer_opened = 0;
611 }
612}
613
614static mu_address_t 607static mu_address_t
615get_uploader_email(wy_triplet_t *trp, const char **errp) 608get_uploader_email(wy_triplet_t *trp, const char **errp)
616{ 609{

Return to:

Send suggestions and report system problems to the System administrator.