* Copyright (C) 2016 Andy Green <andy@warmcat.com>
*
* This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
+ * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation:
* version 2.1 of the License.
*
}
}
-/**
- * lws_email_init() - Initialize a struct lws_email
- *
- * @email: struct lws_email to init
- * @loop: libuv loop to use
- * @max_content: max email content size
- *
- * Prepares a struct lws_email for use ending SMTP
- */
-
LWS_VISIBLE LWS_EXTERN int
lws_email_init(struct lws_email *email, uv_loop_t *loop, int max_content)
{
email->content = lws_malloc(max_content);
if (!email->content)
return 1;
+
email->max_content_size = max_content;
uv_timer_init(loop, &email->timeout_email);
return 0;
}
-/**
- * lws_email_check() - Request check for new email
- *
- * @email: struct lws_email context to check
- *
- * Schedules a check for new emails in 1s... call this when you have queued an
- * email for send.
- */
-
LWS_VISIBLE LWS_EXTERN void
lws_email_check(struct lws_email *email)
{
uv_timer_start(&email->timeout_email, uv_timeout_cb_email, 1000, 0);
}
-/**
- * lws_email_destroy() - stop using the struct lws_email
- *
- * @email: the struct lws_email context
- *
- * Stop sending email using @email and free allocations
- */
-
LWS_VISIBLE LWS_EXTERN void
lws_email_destroy(struct lws_email *email)
{
lws_free_set_NULL(email->content);
uv_timer_stop(&email->timeout_email);
+ uv_close((uv_handle_t *)&email->timeout_email, NULL);
}