aboutsummaryrefslogtreecommitdiffstats
path: root/perl/Rspamd/Task.xs
blob: dec521660f4422a5fd4af99ada4f3b7fd4323852 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
MODULE = Mail::Rspamd   PACKAGE = Mail::Rspamd::Task PREFIX = rspamd_task_
PROTOTYPES: DISABLE

Mail::Rspamd::Message
rspamd_task_get_message (task)
		Mail::Rspamd::Task task
	CODE:
		RETVAL = task->message;
	OUTPUT:
		RETVAL

void
rspamd_task_set_message (message)
		Mail::Rspamd::Message message
	CODE:
		g_object_unref (G_OBJECT(task->message));
		task->message = message;

SV*
rspamd_task_ip (task)
		Mail::Rspamd::Task task
	CODE:	
		RETVAL = newSVpv (inet_ntoa (task->from_addr), 0);
	OUTPUT:
		RETVAL

SV*
rspamd_task_from (task)
		Mail::Rspamd::Task task
	CODE:
		if (task->from == NULL) {
			XSRETURN_UNDEF;
		}
		RETVAL = newSVpv (task->from, 0);
	OUTPUT:
		RETVAL

void
rspamd_task_save_point (task)
		Mail::Rspamd::Task task
    CODE:
    	task->save.saved = 1;

void
rspamd_task_recall_filter (task)
		Mail::Rspamd::Task task
    CODE:
    	process_filters (task);

void
rspamd_task_insert_result (task, metric, symbol, flag)
		Mail::Rspamd::Task task
		const char *metric
		const char *symbol
		double flag
	CODE:
		insert_result (task, metric, symbol, flag);

Mail::Rspamd::Conf
rspamd_task_get_conf (task)
		Mail::Rspamd::Task task
	CODE:
		RETVAL = task->cfg;
	OUTPUT:
		RETVAL

AV*
rspamd_task_get_urls (task)
		Mail::Rspamd::Task task
	PREINIT:
		AV* retav;
		struct uri *url;
	CODE:
		retav = newAV ();
		TAILQ_FOREACH (url, &task.urls, next) {
			av_push (retav, newSVpv ((char *)g_strdup (struri (url)), 0));
		}

		RETVAL = retav;
	OUTPUT:
		RETVAL