diff options
Diffstat (limited to 'src/mail.c')
-rw-r--r-- | src/mail.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -270,58 +270,58 @@ mail_send_message (mu_address_t rcpt, const char *text, { int rc; mu_message_t msg; mu_stream_t stream = NULL; mu_header_t hdr; static char *x_mailer = "wydawca (" PACKAGE_STRING ")"; size_t size; char *buf; const char *sval; mu_static_memory_stream_create (&stream, text, strlen (text)); rc = mu_stream_to_message (stream, &msg); mu_stream_unref (stream); if (rc) { logmsg (LOG_CRIT, _("cannot create message: %s"), mu_strerror (rc)); return; } mu_message_get_header (msg, &hdr); mu_header_append (hdr, "X-Mailer", x_mailer); if (rcpt) { mu_address_to_string (rcpt, NULL, 0, &size); - buf = xmalloc (size + 1); + buf = grecs_malloc (size + 1); mu_address_to_string (rcpt, buf, size + 1, NULL); mu_header_set_value (hdr, "To", buf, 1); free (buf); if (from_address && mu_header_sget_value (hdr, "From", &sval)) { mu_address_to_string (from_address, NULL, 0, &size); - buf = xmalloc (size + 1); + buf = grecs_malloc (size + 1); mu_address_to_string (from_address, buf, size + 1, NULL); mu_header_set_value (hdr, "From", buf, 1); free (buf); } } if (debug_level > 1) { mu_debug_level_t level; mu_debug_get_category_level (MU_DEBCAT_MAILER, &level); level |= MU_DEBUG_LEVEL_MASK (MU_DEBUG_TRACE0) | MU_DEBUG_LEVEL_MASK (MU_DEBUG_PROT); if (debug_level > 2) level |= MU_DEBUG_LEVEL_MASK (MU_DEBUG_TRACE7); mu_debug_set_category_level (MU_DEBCAT_MAILER, level); } if (!mailer_opened) { if ((rc = mu_mailer_open (mailer, 0))) { mu_url_t url = NULL; mu_mailer_get_url (mailer, &url); @@ -413,59 +413,59 @@ resolve_message_template (const char *name) void mail_stats () { struct metadef *exp; time_t t; const char *tmpl; char *text; size_t tc; if (!admin_stat_message || !stat_mask_p (mail_admin_mask) || !mailer) return; if (!admin_address) { logmsg (LOG_ERR, _("cannot mail statistics: admin-address not defined")); return; } if (debug_level) { size_t size; char *buf; mu_address_to_string (admin_address, NULL, 0, &size); - buf = xmalloc (size + 1); + buf = grecs_malloc (size + 1); mu_address_to_string (admin_address, buf, size + 1, NULL); logmsg (LOG_DEBUG, _("sending stats to %s"), buf); free (buf); } tc = timer_get_count () * 3; exp = make_stat_expansion (tc + 1); time (&t); exp[0].kw = "date"; - exp[0].value = exp[0].storage = xstrdup (ctime (&t)); + exp[0].value = exp[0].storage = grecs_strdup (ctime (&t)); exp[0].value [strlen (exp[0].value) - 1] = 0; timer_fill_meta (exp + 1, tc); tmpl = resolve_message_template (admin_stat_message); if (!tmpl) { logmsg (LOG_ERR, _("undefined message reference: %s"), admin_stat_message); return; } text = meta_expand_string (tmpl, exp, NULL, NULL, NULL); mail_send_message (admin_address, text, admin_stat_sign_key); free (text); meta_free (exp); timer_free_meta (exp + 1, tc); free (exp); } mu_address_t get_uploader_email (struct uploader_info *info, struct file_triplet *trp, const char **errp) { @@ -577,106 +577,106 @@ do_notify (struct file_triplet *trp, enum notification_event ev, rcpt = get_uploader_email (trp->uploader, trp, &errp); break; case notify_owner: rcpt = get_recipient (trp->spool->dictionary[project_owner_dict], trp, &errp); } if (!rcpt && ntf->tgt != notify_read) { logmsg (LOG_ERR, _("not notifying %s (project %s) about %s: %s"), notification_target_str (ntf->tgt), trp->project, notification_event_str (ev), gettext (errp)); return; } if (debug_level) { if (rcpt) { size_t size; char *buf; mu_address_to_string (rcpt, NULL, 0, &size); - buf = xmalloc (size + 1); + buf = grecs_malloc (size + 1); mu_address_to_string (rcpt, buf, size + 1, NULL); logmsg (LOG_DEBUG, _("notifying %s (project %s) about %s"), buf, trp->project, notification_event_str (ev)); free (buf); } else logmsg (LOG_DEBUG, _("notifying message recipients (project %s) about %s"), trp->project, notification_event_str (ev)); } msg = resolve_message_template (ntf->msg); if (!msg) logmsg (LOG_ERR, _("undefined message reference: %s"), ntf->msg); else { char *text = triplet_expand_param (msg, trp); mail_send_message (rcpt, text, ntf->sign_keys); free (text); } mu_address_destroy (&rcpt); } void notify (struct notification *notification_list, struct file_triplet *trp, enum notification_event ev) { struct notification *p; for (p = notification_list; p; p = p->next) if (p->ev == ev) do_notify (trp, ev, p); /* FIXME */ } const char * expand_email_admin (struct metadef *def, void *data) { size_t size; if (mu_address_to_string (admin_address, NULL, 0, &size) == 0) { size++; - def->storage = xmalloc (size); + def->storage = grecs_malloc (size); mu_address_to_string (admin_address, def->storage, size, NULL); def->value = def->storage; } else def->value = ""; return def->value; } const char * expand_email_owner (struct metadef *def, void *data) { struct file_triplet *trp = data; mu_address_t addr; const char *errp; size_t size; addr = get_recipient (trp->spool->dictionary[project_owner_dict], trp, &errp); if (!addr) { logmsg (LOG_ERR, _("cannot get email of the %s's owner: %s"), trp->project, gettext (errp)); def->value = ""; } else if (mu_address_to_string (addr, NULL, 0, &size) == 0) { size++; - def->storage = xmalloc (size); + def->storage = grecs_malloc (size); mu_address_to_string (addr, def->storage, size, NULL); def->value = def->storage; mu_address_destroy (&addr); } else def->value = ""; return def->value; } |