summaryrefslogtreecommitdiff
path: root/libsieve
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2002-11-18 17:09:03 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2002-11-18 17:09:03 +0000
commit214760832d70f58e1d64e3b74bbac710f284546d (patch)
tree00e3397c80709edd4266076411cf527f7087cea2 /libsieve
parentca113f17982bffd2937b8f2b3751a48d2e96d6d7 (diff)
downloadmailutils-214760832d70f58e1d64e3b74bbac710f284546d.tar.gz
mailutils-214760832d70f58e1d64e3b74bbac710f284546d.tar.bz2
(sieve_get_mailer,sieve_set_mailer,sieve_get_daemo_email,sieve_set_daemon_email): New functions.
Diffstat (limited to 'libsieve')
-rw-r--r--libsieve/sieve.y53
1 files changed, 47 insertions, 6 deletions
diff --git a/libsieve/sieve.y b/libsieve/sieve.y
index c4919b93a..7ec7a9de1 100644
--- a/libsieve/sieve.y
+++ b/libsieve/sieve.y
@@ -361,39 +361,39 @@ sieve_machine_init (sieve_machine_t *pmach, void *data)
}
void
-sieve_machine_set_error (sieve_machine_t mach, sieve_printf_t error_printer)
+sieve_set_error (sieve_machine_t mach, sieve_printf_t error_printer)
{
mach->error_printer = error_printer ?
error_printer : _sieve_default_error_printer;
}
void
-sieve_machine_set_parse_error (sieve_machine_t mach, sieve_parse_error_t p)
+sieve_set_parse_error (sieve_machine_t mach, sieve_parse_error_t p)
{
mach->parse_error_printer = p ? p : _sieve_default_parse_error;
}
void
-sieve_machine_set_debug (sieve_machine_t mach, sieve_printf_t debug)
+sieve_set_debug (sieve_machine_t mach, sieve_printf_t debug)
{
mach->debug_printer = debug;
}
void
-sieve_machine_set_debug_level (sieve_machine_t mach, mu_debug_t dbg, int level)
+sieve_set_debug_level (sieve_machine_t mach, mu_debug_t dbg, int level)
{
mach->mu_debug = dbg;
mach->debug_level = level;
}
void
-sieve_machine_set_logger (sieve_machine_t mach, sieve_action_log_t logger)
+sieve_set_logger (sieve_machine_t mach, sieve_action_log_t logger)
{
mach->logger = logger;
}
void
-sieve_machine_set_ticket (sieve_machine_t mach, ticket_t ticket)
+sieve_set_ticket (sieve_machine_t mach, ticket_t ticket)
{
mach->ticket = ticket;
}
@@ -404,6 +404,46 @@ sieve_get_ticket (sieve_machine_t mach)
return mach->ticket;
}
+mailer_t
+sieve_get_mailer (sieve_machine_t mach)
+{
+ if (!mach->mailer)
+ mailer_create (&mach->mailer, NULL);
+ return mach->mailer;
+}
+
+void
+sieve_set_mailer (sieve_machine_t mach, mailer_t mailer)
+{
+ mailer_destroy (&mach->mailer);
+ mach->mailer = mailer;
+}
+
+#define MAILER_DAEMON_PFX "MAILER-DAEMON@"
+
+char *
+sieve_get_daemon_email (sieve_machine_t mach)
+{
+ if (!mach->daemon_email)
+ {
+ const char *domain = NULL;
+
+ mu_get_user_email_domain (&domain);
+ mach->daemon_email = sieve_palloc (&mach->memory_pool,
+ sizeof(MAILER_DAEMON_PFX) +
+ strlen (domain));
+ sprintf (mach->daemon_email, "%s%s", MAILER_DAEMON_PFX, domain);
+ }
+ return mach->daemon_email;
+}
+
+void
+sieve_set_daemon_email (sieve_machine_t mach, const char *email)
+{
+ sieve_pfree (&mach->memory_pool, (void *)mach->daemon_email);
+ mach->daemon_email = sieve_pstrdup (&mach->memory_pool, email);
+}
+
struct sieve_destr_record
{
sieve_destructor_t destr;
@@ -441,6 +481,7 @@ sieve_machine_destroy (sieve_machine_t *pmach)
list_do (mach->destr_list, _run_destructor, NULL);
list_destroy (&mach->destr_list);
sieve_slist_destroy (&mach->memory_pool);
+ mailer_destroy (&mach->mailer);
free (mach);
*pmach = NULL;
}

Return to:

Send suggestions and report system problems to the System administrator.