NULL, NULL, NULL},
{"port", "783", &config.port, P_INT,
NULL, NULL, NULL},
- {"max_size", "250", &config.max_size, P_INT,
- NULL, NULL, NULL},
{"receive_spam", "TRUE", &config.receive_spam, P_BOOL,
NULL, NULL, NULL},
{"save_folder", NULL, &config.save_folder, P_STRING,
NULL, NULL, NULL},
+ {"max_size", "250", &config.max_size, P_INT,
+ NULL, NULL, NULL},
+ {"timeout", "30", &config.timeout, P_INT,
+ NULL, NULL, NULL},
{NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
};
static gboolean msg_is_spam(FILE *fp)
{
- struct sockaddr addr;
+ struct transport trans;
struct message m;
gboolean is_spam = FALSE;
- if (lookup_host(config.hostname, config.port, &addr) != EX_OK) {
- debug_print("failed to look up spamd host\n");
+ transport_init(&trans);
+ trans.type = TRANSPORT_TCP;
+ trans.hostname = config.hostname;
+ trans.port = config.port;
+
+ if (transport_setup(&trans, flags) != EX_OK) {
+ debug_print("failed to setup transport\n");
return FALSE;
}
m.type = MESSAGE_NONE;
m.max_len = config.max_size * 1024;
- m.timeout = 30;
+ m.timeout = config.timeout;
if (message_read(fileno(fp), flags, &m) != EX_OK) {
debug_print("failed to read message\n");
return FALSE;
}
- if (message_filter(&addr, username, flags, &m) != EX_OK) {
+ if (message_filter(&trans, username, flags, &m) != EX_OK) {
debug_print("filtering the message failed\n");
message_cleanup(&m);
return FALSE;