aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/protocol.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-02-28 22:43:48 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-02-28 22:43:48 +0000
commit79c19905d02ca1bc5802c791b8c7be41fd65e506 (patch)
tree74f2303d2b5ee534367d9785302d68a138563a9f /src/libserver/protocol.c
parent158c9f6a505cf40d850ab3cae4dc115b80bf3a1d (diff)
downloadrspamd-79c19905d02ca1bc5802c791b8c7be41fd65e506.tar.gz
rspamd-79c19905d02ca1bc5802c791b8c7be41fd65e506.zip
Add routines to set recipients and sender for a task.
Diffstat (limited to 'src/libserver/protocol.c')
-rw-r--r--src/libserver/protocol.c38
1 files changed, 6 insertions, 32 deletions
diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c
index 1b38c2b2c..2a43d0549 100644
--- a/src/libserver/protocol.c
+++ b/src/libserver/protocol.c
@@ -234,7 +234,6 @@ rspamd_protocol_handle_headers (struct rspamd_task *task,
gchar *headern, *tmp;
gboolean res = TRUE, validh;
struct rspamd_http_header *h;
- InternetAddressList *tmp_addr;
LL_FOREACH (msg->headers, h)
{
@@ -272,20 +271,10 @@ rspamd_protocol_handle_headers (struct rspamd_task *task,
case 'f':
case 'F':
if (g_ascii_strcasecmp (headern, FROM_HEADER) == 0) {
- task->from_envelope = internet_address_list_parse_string (
- h->value->str);
- if (task->from_envelope) {
-#ifdef GMIME24
- rspamd_mempool_add_destructor (task->task_pool,
- (rspamd_mempool_destruct_t) g_object_unref,
- task->from_envelope);
-#else
- rspamd_mempool_add_destructor (task->task_pool,
- (rspamd_mempool_destruct_t) internet_address_list_destroy,
- task->from_envelope);
-#endif
+ if (!rspamd_task_add_sender (task, h->value->str)) {
+ msg_err ("bad from header: '%s'", h->value->str);
+ validh = FALSE;
}
- debug_task ("read from header, value: %v", h->value);
}
else {
debug_task ("wrong header: %s", headern);
@@ -316,25 +305,10 @@ rspamd_protocol_handle_headers (struct rspamd_task *task,
case 'r':
case 'R':
if (g_ascii_strcasecmp (headern, RCPT_HEADER) == 0) {
- if (task->rcpt_envelope == NULL) {
- task->rcpt_envelope = internet_address_list_new ();
-#ifdef GMIME24
- rspamd_mempool_add_destructor (task->task_pool,
- (rspamd_mempool_destruct_t) g_object_unref,
- task->rcpt_envelope);
-#else
- rspamd_mempool_add_destructor (task->task_pool,
- (rspamd_mempool_destruct_t) internet_address_list_destroy,
- task->rcpt_envelope);
-#endif
+ if (!rspamd_task_add_recipient (task, h->value->str)) {
+ msg_err ("bad from header: '%s'", h->value->str);
+ validh = FALSE;
}
- tmp_addr = internet_address_list_parse_string (h->value->str);
- internet_address_list_append (task->rcpt_envelope, tmp_addr);
-#ifdef GMIME24
- g_object_unref (tmp_addr);
-#else
- internet_address_list_destroy (tmp_addr);
-#endif
debug_task ("read rcpt header, value: %v", h->value);
}
else {