aboutsummaryrefslogtreecommitdiffstats
path: root/perl/Rspamd
diff options
context:
space:
mode:
Diffstat (limited to 'perl/Rspamd')
-rw-r--r--perl/Rspamd/Config.xs141
-rw-r--r--perl/Rspamd/ContentType.xs87
-rw-r--r--perl/Rspamd/Hash.xs284
-rw-r--r--perl/Rspamd/InternetAddress.xs174
-rw-r--r--perl/Rspamd/Message.xs330
-rw-r--r--perl/Rspamd/Object.xs166
-rw-r--r--perl/Rspamd/Part.xs198
-rw-r--r--perl/Rspamd/Task.xs104
-rw-r--r--perl/Rspamd/TextPart.xs40
9 files changed, 0 insertions, 1524 deletions
diff --git a/perl/Rspamd/Config.xs b/perl/Rspamd/Config.xs
deleted file mode 100644
index 49b26db2f..000000000
--- a/perl/Rspamd/Config.xs
+++ /dev/null
@@ -1,141 +0,0 @@
-MODULE = Mail::Rspamd PACKAGE = Mail::Rspamd::Config PREFIX = rspamd_config_
-PROTOTYPES: DISABLE
-
-SV *
-rspamd_config_get_scalar (cfg, param)
- Mail::Rspamd::Config cfg
- const char *param
- CODE:
- struct config_scalar *sc;
- int val;
-
- sc = g_hash_table_lookup (cfg->cfg_params, param);
- if (sc == NULL) {
- XSRETURN_UNDEF;
- }
- else {
- switch (sc->type) {
- case SCALAR_TYPE_SIZE:
- RETVAL = newSViv ((int)(*(size_t *)sc->pointer));
- break;
- case SCALAR_TYPE_INT:
- case SCALAR_TYPE_UINT:
- RETVAL = newSViv (*(int *)sc->pointer);
- break;
- case SCALAR_TYPE_STR:
- RETVAL = newSVpv ((char *)sc->pointer, 0);
- break;
- }
- }
-
-
-void
-rspamd_config_set_scalar (cfg, param, value)
- Mail::Rspamd::Config cfg
- const char *param
- SV* value
- CODE:
- char *param, *charval;
- int intval;
-
- sc = g_hash_table_lookup (cfg->cfg_params, param);
- if (sc == NULL) {
- XSRETURN_UNDEF;
- }
- else {
- switch (sc->type) {
- case SCALAR_TYPE_SIZE:
- intval = (int)SvIV (value);
- *((size_t *)sc->pointer) = intval;
- break;
- case SCALAR_TYPE_INT:
- case SCALAR_TYPE_UINT:
- intval = (int)SvIV (value);
- *((int *)sc->pointer) = intval;
- break;
- case SCALAR_TYPE_STR:
- charval = (char *)SvPVX (value);
- *((char **)sc->pointer) = charval;
- break;
- }
- }
-
-HV *
-rspamd_config_get_metric (r, name)
- Mail::Rspamd::Config cfg
- const char *name
- CODE:
- struct metric *val;
-
- val = g_hash_table_lookup (r->metrics, name);
- if (val == NULL) {
- XSRETURN_UNDEF;
- }
- else {
- RETVAL = newHV();
-
- (void)hv_store_ent (RETVAL,
- newSVpv ("name", sizeof ("name") - 1),
- newSVpv (val->name, strlen (val->name)), 0);
- (void)hv_store_ent (RETVAL,
- newSVpv ("func_name", sizeof ("func_name") - 1),
- newSVpv (val->func_name, strlen (val->func_name)), 0);
- (void)hv_store_ent (RETVAL,
- newSVpv ("required_score", sizeof ("required_score") - 1),
- newSVnv (val->required_score), 0);
- sv_2mortal((SV*)RETVAL);
- }
- OUTPUT:
- RETVAL
-
-HV *
-rspamd_config_get_statfile (r, name)
- Mail::Rspamd::Config cfg
- const char *name
- CODE:
- struct statfile *val;
- char *name;
-
- val = g_hash_table_lookup (r->statfiles, name);
- if (val == NULL) {
- XSRETURN_UNDEF;
- }
- else {
- RETVAL = newHV();
-
- (void)hv_store_ent (RETVAL,
- newSVpv ("alias", sizeof ("alias") - 1),
- newSVpv (val->alias, strlen (val->alias)), 0);
- (void)hv_store_ent (RETVAL,
- newSVpv ("pattern", sizeof ("pattern") - 1),
- newSVpv (val->pattern, strlen (val->pattern)), 0);
- (void)hv_store_ent (RETVAL,
- newSVpv ("metric", sizeof ("metric") - 1),
- newSVpv (val->metric, strlen (val->metric)), 0);
- (void)hv_store_ent (RETVAL,
- newSVpv ("weight", sizeof ("weight") - 1),
- newSVnv (val->weight), 0);
- (void)hv_store_ent (RETVAL,
- newSVpv ("size", sizeof ("size") - 1),
- newSViv (val->size), 0);
- sv_2mortal((SV*)RETVAL);
- }
- OUTPUT:
- RETVAL
-
-SV*
-rspamd_config_get_module_param (r, modulename, paramname)
- Mail::Rspamd::Config cfg
- const char *modulename
- const char *paramname
- CODE:
- char *value;
-
- value = get_module_opt (r, modulename, paramname);
- if (value == NULL) {
- XSRETURN_UNDEF;
- }
- RETVAL = newSVpv (value, 0);
- OUTPUT:
- RETVAL
-
diff --git a/perl/Rspamd/ContentType.xs b/perl/Rspamd/ContentType.xs
deleted file mode 100644
index dae8a35ad..000000000
--- a/perl/Rspamd/ContentType.xs
+++ /dev/null
@@ -1,87 +0,0 @@
-MODULE = Mail::Rspamd PACKAGE = Mail::Rspamd::ContentType PREFIX = rspamd_content_type_
-
-Mail::Rspamd::ContentType
-rspamd_content_type_new (Class = "Mail::Rspamd::ContentType", name = 0, subname = 0)
- CASE: items == 2
- char * Class;
- const char * name;
- CODE:
- RETVAL = g_mime_content_type_new_from_string (name);
- plist = g_list_prepend (plist, RETVAL);
- OUTPUT:
- RETVAL
- CASE: items == 3
- char * Class;
- const char * name;
- const char * subname;
- CODE:
- RETVAL = g_mime_content_type_new (name, subname);
- plist = g_list_prepend (plist, RETVAL);
- OUTPUT:
- RETVAL
-
-void
-DESTROY (mime_type)
- Mail::Rspamd::ContentType mime_type
- CODE:
- if (g_list_find(plist,mime_type)) {
- g_mime_content_type_destroy(mime_type);
- plist = g_list_remove(plist, mime_type);
- }
-
-SV *
-rspamd_content_type_to_string (mime_type)
- Mail::Rspamd::ContentType mime_type
- PREINIT:
- char * type;
- CODE:
- type = g_mime_content_type_to_string (mime_type);
- if (!type)
- XSRETURN_UNDEF;
- RETVAL = newSVpv(type, 0);
- g_free (type);
- OUTPUT:
- RETVAL
-
-gboolean
-rspamd_content_type_is_type (mime_type, type, subtype)
- Mail::Rspamd::ContentType mime_type
- const char * type
- const char * subtype
- CODE:
- RETVAL = g_mime_content_type_is_type (mime_type, type, subtype);
- OUTPUT:
- RETVAL
-
-void
-rspamd_content_type_set_parameter (mime_type, attribute, value)
- Mail::Rspamd::ContentType mime_type
- const char * attribute
- const char * value
- CODE:
- g_mime_content_type_set_parameter (mime_type, attribute, value);
-
-const char *
-rspamd_content_type_get_parameter (mime_type, attribute)
- Mail::Rspamd::ContentType mime_type
- const char * attribute
- CODE:
- RETVAL = g_mime_content_type_get_parameter (mime_type, attribute);
- OUTPUT:
- RETVAL
-
-char *
-rspamd_content_type_type (ctype)
- Mail::Rspamd::ContentType ctype
- CODE:
- RETVAL = ctype->type;
- OUTPUT:
- RETVAL
-
-char *
-rspamd_content_type_subtype (ctype)
- Mail::Rspamd::ContentType ctype
- CODE:
- RETVAL = ctype->subtype;
- OUTPUT:
- RETVAL
diff --git a/perl/Rspamd/Hash.xs b/perl/Rspamd/Hash.xs
deleted file mode 100644
index abf75ce7e..000000000
--- a/perl/Rspamd/Hash.xs
+++ /dev/null
@@ -1,284 +0,0 @@
-MODULE = Mail::Rspamd PACKAGE = Mail::Rspamd::Hash::Header PREFIX=hash_
-
-Mail::Rspamd::Hash::Header
-hash_TIEHASH (Class, objptr)
- char * Class
- Mail::Rspamd::Message objptr
- PREINIT:
- hash_header * hash;
- CODE:
- hash = g_malloc (sizeof (hash_header));
- hash->keyindex = 0;
- hash->objptr = objptr;
- hash->fetchvalue = NULL;
- RETVAL = hash;
- OUTPUT:
- RETVAL
-
-void
-hash_DESTROY (obj)
- Mail::Rspamd::Hash::Header obj
- CODE:
- obj->objptr = NULL;
- g_free (obj);
-
-void
-hash_FETCH (obj, key)
- Mail::Rspamd::Hash::Header obj
- const char * key
- PREINIT:
- Mail__Rspamd__Message msg;
- GList *gret = NULL, *item;
- AV * retav;
- I32 gimme = GIMME_V;
- PPCODE:
- msg = obj->objptr;
-
- /* THE HACK - FETCH method would get value indirectly from NEXTKEY */
- if (obj->keyindex != -1 && obj->fetchvalue != NULL) {
- XPUSHs (sv_2mortal (newSVpv (obj->fetchvalue, 0)));
- obj->fetchvalue == NULL;
- XSRETURN(1);
- }
-
- obj->fetchvalue = NULL;
-
- gret = message_get_header (NULL, msg, key);
-
- if (!gret || gret->data == NULL) {
- if (gret) {
- g_list_free(gret);
- }
-
- XSRETURN(0);
- } else {
- if (gret->next == NULL) { // one value
- XPUSHs (sv_2mortal (newSVpv ((char *)(gret->data), 0)));
- } else {
- if (gimme == G_ARRAY) {
- item = gret;
- while (item && item->data) {
- XPUSHs (sv_2mortal (newSVpv ((char *)(item->data), 0)));
- item = item->next;
- }
- } else if (gimme == G_SCALAR) {
- retav = newAV();
- item = gret;
- while (item && item->data) {
- av_push (retav, newSVpv ((char *)g_strdup ((item->data)), 0));
- item = item->next;
- }
- XPUSHs (newRV_noinc ((SV *)retav));
- }
- }
- }
- if (gret) {
- item = gret;
- while (item) {
- if (item->data) {
- g_free((char *)(item->data));
- }
- item = item->next;
- }
- g_list_free(gret);
- }
-
-void
-hash_STORE (obj, key, svmixed)
- Mail::Rspamd::Hash::Header obj
- const char * key
- SV * svmixed
- PREINIT:
- Mail__Rspamd__Message msg;
- char * value;
- SV * svvalue;
- svtype svvaltype;
- STRLEN vallen;
- CODE:
- /* only one value can be stored - no arrays allowed by perl */
- msg = obj->objptr;
-
- svvalue = svmixed;
- if (SvROK (svmixed)) {
- svvalue = SvRV(svmixed);
- }
- svvaltype = SvTYPE (svvalue);
-
- if (SvGMAGICAL(svvalue)) {
- mg_get(svvalue);
- }
-
- /* delete header for the first array item */
- g_mime_object_remove_header (GMIME_OBJECT(msg), key);
-
- if (svvaltype == SVt_PVAV) {
- AV * avvalue;
- I32 i, avlen;
- SV * svtmp;
-
- /* set header */
- avvalue = (AV *)svvalue;
- avlen = av_len(avvalue);
- for (i=avlen; i>=0; --i) {
- svtmp = (SV *)(*(av_fetch (avvalue, i, 0)));
-
- if (SvGMAGICAL(svtmp)) {
- mg_get(svtmp);
- }
-
- if (svtmp && SvPOKp(svtmp)) {
- value = (char *)SvPV(svtmp, vallen);
- message_set_header (msg, key, value);
- }
- }
- } else if (SvPOK(svvalue) || SvIOK(svvalue) || SvNOK(svvalue)) {
- value = (char *)SvPV (svvalue, vallen);
- message_set_header (msg, key, value);
- } else { /* assume scalar value */
- /* undefined value -> remove header */
- if (!(SvOK(svvalue))) {
- g_mime_object_remove_header (GMIME_OBJECT(msg), key);
- }
- }
-
-gboolean
-hash_EXISTS (obj, key)
- Mail::Rspamd::Hash::Header obj
- const char * key
- PREINIT:
- Mail__Rspamd__Message msg;
- GList *gret, *item;
- CODE:
- msg = obj->objptr;
- gret = message_get_header (NULL, msg, key);
- RETVAL = (gret != NULL && gret->data != NULL);
- if (gret) {
- item = gret;
- while (item) {
- if (item->data) {
- g_free((char *)(item->data));
- }
- item = item->next;
- }
- g_list_free(gret);
- }
- OUTPUT:
- RETVAL
-
-void
-hash_DELETE(obj, key)
- Mail::Rspamd::Hash::Header obj
- const char * key
- CODE:
- g_mime_object_remove_header (GMIME_OBJECT(obj->objptr), key);
-
-void
-hash_NEXTKEY(obj, lastkey = NULL)
- Mail::Rspamd::Hash::Header obj
- const char * lastkey
- ALIAS:
- Mail::Rspamd::Hash::Header::FIRSTKEY = 1
- PREINIT:
- const char * key = NULL;
- const char * value = NULL;
- Mail__Rspamd__Message msg;
- I32 gimme = GIMME_V;
- gint i, j, found;
-#ifdef GMIME24
- GMimeHeaderList *hl;
- GMimeHeaderIter *iter;
-#else
- local_GMimeHeader * header;
-#endif
- struct raw_header *h;
- INIT:
- if (ix == 1) {
- obj->keyindex = -1;
- }
- PPCODE:
- msg = obj->objptr;
- ++obj->keyindex;
- i = obj->keyindex;
-#ifdef GMIME24
- hl = g_mime_object_get_header_list (GMIME_OBJECT (msg));
- j = 0;
- found = 0;
- if (g_mime_header_list_get_iter (hl, iter)) {
- while (g_mime_header_iter_is_valid (iter)) {
- if (j >= i) {
- key = g_mime_header_iter_get_name (iter);
- value = g_mime_header_iter_get_value (iter);
- found = 1;
- break;
- }
- if (!g_mime_header_iter_next (iter)) {
- break;
- }
- }
- }
-#else
- header = GMIME_OBJECT(msg)->headers;
-
- h = header->headers;
- j = 0;
- found = 0;
- while (h) {
- if (j >= i) {
- key = h->name;
- value = h->value;
- found = 1;
- break;
- }
- j++;
- h = h->next;
- }
-#endif
-
- if (!found && key == NULL) {
- obj->keyindex = -1;
- }
-
- /* THE HACK - FETCH method would get value indirectly */
- obj->fetchvalue = NULL;
-
- if (key) {
- XPUSHs (sv_2mortal (newSVpv (key, 0)));
- if (gimme != G_SCALAR && value) {
- XPUSHs (sv_2mortal (newSVpv (value, 0)));
- }
- /* THE HACK - FETCH method would get value indirectly */
- obj->fetchvalue = (char *)value;
- }
-
-#ifndef GMIME24
-
-void
-hash_CLEAR(obj)
- Mail::Rspamd::Hash::Header obj
- PREINIT:
- Mail__Rspamd__Message message;
- local_GMimeHeader *header;
- CODE:
- message = obj->objptr;
-
- g_free (message->from);
- message->from = NULL;
-
- g_free (message->reply_to);
- message->reply_to = NULL;
-
- /* destroy all recipients */
- g_hash_table_foreach_remove (message->recipients, recipients_destroy, NULL);
-
- g_free (message->subject);
- message->subject = NULL;
-
- g_free (message->message_id);
- message->message_id = NULL;
-
- /* free all the headers */
- header = GMIME_OBJECT(message)->headers;
- g_mime_header_destroy (header);
- GMIME_OBJECT(message)->headers = g_mime_header_new ();
-
-#endif
diff --git a/perl/Rspamd/InternetAddress.xs b/perl/Rspamd/InternetAddress.xs
deleted file mode 100644
index 6ccf30ce3..000000000
--- a/perl/Rspamd/InternetAddress.xs
+++ /dev/null
@@ -1,174 +0,0 @@
-MODULE = Mail::Rspamd PACKAGE = Mail::Rspamd::InternetAddress PREFIX = rspamd_internet_address_
-
-Mail::Rspamd::InternetAddress
-rspamd_internet_address_new (Class, name, address)
- CASE: items <= 1
- char * Class
- CODE:
-#ifdef GMIME24
- XSRETURN_UNDEF;
-#else
- RETVAL = internet_address_new ();
- plist = g_list_prepend (plist, RETVAL);
-#endif
- OUTPUT:
- RETVAL
- CASE: items == 2
- char * Class
- char * name
- CODE:
-#ifdef GMIME24
- RETVAL = internet_address_group_new (name);
-#else
- RETVAL = internet_address_new_group (name);
-#endif
- plist = g_list_prepend (plist, RETVAL);
- OUTPUT:
- RETVAL
- CASE: items == 3
- char * Class
- char * name
- char * address
- CODE:
-#ifdef GMIME24
- RETVAL = internet_address_mailbox_new (name, address);
-#else
- RETVAL = internet_address_new_name (name, address);
-#endif
- plist = g_list_prepend (plist, RETVAL);
- OUTPUT:
- RETVAL
-
-void
-DESTROY(ia)
- Mail::Rspamd::InternetAddress ia
- CODE:
- if (g_list_find (plist,ia)) {
- internet_address_unref (ia);
- plist = g_list_remove (plist, ia);
- }
-
-AV *
-rspamd_internet_address_parse_string (str)
- const char * str
- PREINIT:
- InternetAddressList * addrlist;
- AV * retav;
- int i;
- CODE:
-#ifdef GMIME24
- addrlist = internet_address_list_parse_string (str);
-#else
- addrlist = internet_address_parse_string (str);
-#endif
- retav = newAV ();
-#ifdef GMIME24
- i = internet_address_list_length (addrlist);
- while (i > 0) {
- SV * address = newSViv(0);
- sv_setref_pv (address, "Mail::Rspamd::InternetAddress", (Mail__Rspamd__InternetAddress)internet_address_list_get_address (addrlist, i));
- av_push (retav, address);
- -- i;
- }
-#else
- while (addrlist) {
- SV * address = newSViv (0);
- sv_setref_pv (address, "Mail::Rspamd::InternetAddress", (Mail__Rspamd__InternetAddress)(addrlist->address));
- av_push (retav, address);
- addrlist = addrlist->next;
- }
-#endif
- RETVAL = retav;
- OUTPUT:
- RETVAL
-
-#ifdef GMIME24
-
-void
-interface_ia_set (ia, value)
- Mail::Rspamd::InternetAddress ia
- char * value
- INTERFACE_MACRO:
- XSINTERFACE_FUNC
- XSINTERFACE_FUNC_RSPAMD_IA_SET
- INTERFACE:
- set_name
-
-#else
-
-void
-interface_ia_set (ia, value)
- Mail::Rspamd::InternetAddress ia
- char * value
- INTERFACE_MACRO:
- XSINTERFACE_FUNC
- XSINTERFACE_FUNC_RSPAMD_IA_SET
- INTERFACE:
- set_name
- set_addr
-
-#endif
-
-SV *
-rspamd_internet_address_to_string (ia, encode = TRUE)
- Mail::Rspamd::InternetAddress ia
- gboolean encode
- PREINIT:
- char * textdata;
- CODE:
- textdata = internet_address_to_string (ia, encode);
- if (textdata == NULL) {
- XSRETURN_UNDEF;
- }
- RETVAL = newSVpv (textdata, 0);
- OUTPUT:
- RETVAL
-
-void
-rspamd_internet_address_set_group (ia, ...)
- Mail::Rspamd::InternetAddress ia
- PREINIT:
- Mail__Rspamd__InternetAddress addr;
- InternetAddressList * addrlist = NULL;
- int i;
- CODE:
- if (items < 2) {
- XSRETURN_UNDEF;
- }
- for (i = items - 1; i > 0; --i) {
- /* retrieve each address from the perl array */
- if (sv_derived_from (ST (items - i), "Mail::Rspamd::InternetAddress")) {
- IV tmp = SvIV ((SV*)SvRV (ST (items - i)));
- addr = INT2PTR (Mail__Rspamd__InternetAddress, tmp);
- }
- if (addr) {
-#ifdef GMIME24
- internet_address_list_add (addrlist, addr);
-#else
- internet_address_list_append (addrlist, addr);
-#endif
- }
- }
- if (addrlist) {
- internet_address_set_group (ia, addrlist);
- }
-
-void
-rspamd_internet_address_add_member (ia, member)
- Mail::Rspamd::InternetAddress ia
- Mail::Rspamd::InternetAddress member
- CODE:
- internet_address_add_memeber (ia, member);
-
-Mail::Rspamd::InternetAddressType
-rspamd_internet_address_type (ia)
- Mail::Rspamd::InternetAddress ia
- CODE:
-#ifndef GMIME24
- RETVAL = ia->type;
-#else
- XSRETURN_UNDEF;
-#endif
- OUTPUT:
- RETVAL
-
diff --git a/perl/Rspamd/Message.xs b/perl/Rspamd/Message.xs
deleted file mode 100644
index c9a21886e..000000000
--- a/perl/Rspamd/Message.xs
+++ /dev/null
@@ -1,330 +0,0 @@
-MODULE = Mail::Rspamd PACKAGE = Mail::Rspamd::Message PREFIX = rspamd_message_
-
-Mail::Rspamd::Message
-rspamd_message_new(Class, pretty_headers = FALSE)
- char * Class
- gboolean pretty_headers
- CODE:
- RETVAL = g_mime_message_new (pretty_headers);
- plist = g_list_prepend(plist, RETVAL);
- OUTPUT:
- RETVAL
-
-void
-DESTROY(message)
- Mail::Rspamd::Message message
- CODE:
- if (g_list_find(plist,message)) {
- g_mime_object_unref (GMIME_OBJECT (message));
- plist = g_list_remove(plist, message);
- }
-
-void
-rspamd_message_add_recipient(message, type, name, address)
- Mail::Rspamd::Message message
- char * type
- const char * name
- const char * address
- CODE:
-#ifndef GMIME24
- g_mime_message_add_recipient (message, type, name, address);
-#else
- if (!g_strcasecmp (type, "to")) {
- g_mime_message_add_recipient (message, GMIME_RECIPIENT_TYPE_TO, name, address);
- }
- else if (!g_strcasecmp (type, "cc")) {
- g_mime_message_add_recipient (message, GMIME_RECIPIENT_TYPE_CC, name, address);
- }
- else if (!g_strcasecmp (type, "bcc")) {
- g_mime_message_add_recipient (message, GMIME_RECIPIENT_TYPE_BCC, name, address);
- }
-#endif
-
-void
-rspamd_message_add_recipients_from_string(message, type, recipients)
- Mail::Rspamd::Message message
- char * type
- const char * recipients
- CODE:
-#ifndef GMIME24
- g_mime_message_add_recipients_from_string (message, type, recipients);
-#else
- /* XXX: add code here */
- XSRETURN_UNDEF;
-#endif
-
-
-AV *
-rspamd_message_get_recipients(message, type)
- Mail::Rspamd::Message message
- const char * type
- PREINIT:
- InternetAddressList * rcpt;
- AV * retav;
- int i;
- CODE:
- retav = newAV();
-#ifndef GMIME24
- rcpt = (InternetAddressList *)g_mime_message_get_recipients (message, type);
- while (rcpt) {
- SV * address = newSViv(0);
- sv_setref_pv(address, "Mail::Rspamd::InternetAddress", (Mail__Rspamd__InternetAddress)(rcpt->address));
- av_push(retav, address);
- rcpt = rcpt->next;
- }
-#else
- if (!g_strcasecmp (type, "to")) {
- rcpt = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO);
- }
- else if (!g_strcasecmp (type, "cc")) {
- rcpt = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_CC);
- }
- else if (!g_strcasecmp (type, "bcc")) {
- rcpt = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_BCC);
- }
- i = internet_address_list_length (rcpt);
- while (i > 0) {
- SV * address = newSViv(0);
- sv_setref_pv(address, "Mail::Rspamd::InternetAddress", (Mail__Rspamd__InternetAddress)internet_address_list_get_address(rcpt, i));
- av_push(retav, address);
- -- i;
- }
-#endif
- RETVAL = retav;
- OUTPUT:
- RETVAL
-
-
-void
-interface_m_set (message, value)
- Mail::Rspamd::Message message
- char * value
- INTERFACE_MACRO:
- XSINTERFACE_FUNC
- XSINTERFACE_FUNC_RSPAMD_MESSAGE_SET
- INTERFACE:
- set_subject
- set_message_id
- set_reply_to
- set_sender
-
-const char *
-interface_m_get (message)
- Mail::Rspamd::Message message
- INTERFACE_MACRO:
- XSINTERFACE_FUNC
- XSINTERFACE_FUNC_RSPAMD_MESSAGE_SET
- INTERFACE:
- get_subject
- get_message_id
- get_reply_to
- get_sender
-
- # date
-void
-rspamd_message_set_date (message, date, gmt_offset)
- Mail::Rspamd::Message message
- time_t date
- int gmt_offset
- CODE:
- g_mime_message_set_date (message, date, gmt_offset);
-
-void
-rspamd_message_set_date_from_string (message, str)
- Mail::Rspamd::Message message
- const char * str
- PREINIT:
- time_t date;
- int offset = 0;
- CODE:
- date = g_mime_utils_header_decode_date (str, &offset);
- g_mime_message_set_date (message, date, offset);
-
-
-void
-rspamd_message_get_date (message)
- Mail::Rspamd::Message message
- PREINIT:
- time_t date;
- int gmt_offset;
- I32 gimme = GIMME_V;
- char * str;
- PPCODE:
- if (gimme == G_SCALAR) {
-#ifdef GMIME24
- str = g_mime_message_get_date_as_string (message);
-#else
- str = g_mime_message_get_date_string (message);
-#endif
- if (str) {
- XPUSHs (sv_2mortal (newSVpv (str,0)));
- g_free (str);
- }
- } else if (gimme == G_ARRAY) {
- g_mime_message_get_date (message, &date, &gmt_offset);
- XPUSHs (sv_2mortal (newSVnv (date)));
- XPUSHs (sv_2mortal (newSViv (gmt_offset)));
- }
-
-void
-rspamd_message_set_header (message, field, value)
- Mail::Rspamd::Message message
- const char * field
- const char * value
- CODE:
-#ifdef GMIME24
- g_mime_object_set_header (GMIME_OBJECT (message), field, value);
-#else
- g_mime_message_set_header (message, field, value);
-#endif
-
-void
-rspamd_message_remove_header (message, field)
- Mail::Rspamd::Message message
- const char * field
- CODE:
-#ifdef GMIME24
- g_mime_object_remove_header (GMIME_OBJECT (message), field);
-#else
- g_mime_message_remove_header (message, field);
-#endif
-
-
-void
-rspamd_message_add_header (message, field, value)
- Mail::Rspamd::Message message
- const char * field
- const char * value
- CODE:
-#ifdef GMIME24
- g_mime_object_set_header (GMIME_OBJECT (message), field, value);
-#else
- g_mime_message_set_header (message, field, value);
-#endif
-
-const char *
-rspamd_message_get_header (message, field)
- Mail::Rspamd::Message message
- const char * field
- CODE:
-#ifdef GMIME24
- RETVAL = g_mime_object_get_header (GMIME_OBJECT (message), field);
-#else
- RETVAL = g_mime_message_get_header (message, field);
-#endif
- OUTPUT:
- RETVAL
-
-void
-rspamd_message_set_mime_part (message, mime_part)
- Mail::Rspamd::Message message
- Mail::Rspamd::Object mime_part
- CODE:
- g_mime_message_set_mime_part (message, GMIME_OBJECT (mime_part));
- plist = g_list_remove (plist, mime_part);
-
-#if !defined(GMIME24)
-SV *
-rspamd_message_get_body (message, want_plain = 1, is_html = 0)
- CASE: items == 1
- Mail::Rspamd::Message message
- PREINIT:
- gboolean want_plain = 1;
- gboolean is_html;
- char * textdata;
- CODE:
- textdata = g_mime_message_get_body (message, want_plain, &is_html);
- if (textdata == NULL)
- XSRETURN_UNDEF;
- RETVAL = newSVpv (textdata, 0);
- g_free (textdata);
- OUTPUT:
- RETVAL
- CASE: items == 2
- Mail::Rspamd::Message message
- gboolean want_plain
- PREINIT:
- gboolean is_html;
- char * textdata;
- CODE:
- textdata = g_mime_message_get_body (message, want_plain, &is_html);
- if (textdata == NULL)
- XSRETURN_UNDEF;
- RETVAL = newSVpv (textdata, 0);
- g_free (textdata);
- OUTPUT:
- RETVAL
- CASE: items == 3
- Mail::Rspamd::Message message
- gboolean want_plain
- gboolean &is_html
- PREINIT:
- char * textdata;
- CODE:
- textdata = g_mime_message_get_body (message, want_plain, &is_html);
- if (textdata == NULL) {
- RETVAL = &PL_sv_undef;
- }
- RETVAL = newSVpv (textdata, 0);
- g_free (textdata);
- OUTPUT:
- is_html
- RETVAL
-
-#endif
-
-SV *
-rspamd_message_get_headers(message)
- Mail::Rspamd::Message message
- PREINIT:
- char * textdata;
- CODE:
-#ifdef GMIME24
- textdata = g_mime_object_get_headers (GMIME_OBJECT (message));
-#else
- textdata = g_mime_message_get_headers (message);
-#endif
- if (textdata == NULL) {
- RETVAL = &PL_sv_undef;
- }
- RETVAL = newSVpv (textdata, 0);
- g_free (textdata);
- OUTPUT:
- RETVAL
-
-void
-rspamd_message_foreach_part (message, callback, svdata)
- Mail::Rspamd::Message message
- SV * callback
- SV * svdata
- PREINIT:
- struct _user_data_sv *data;
-
- CODE:
- data = g_new0 (struct _user_data_sv, 1);
- data->svuser_data = newSVsv (svdata);
- data->svfunc = newSVsv (callback);
- g_mime_message_foreach_part (message, call_sub_foreach, data);
- g_free (data);
-
-SV *
-get_mime_part(message)
- Mail::Rspamd::Message message
- PREINIT:
- GMimeObject * mime_object;
- CODE:
- if (message->mime_part != NULL) {
- RETVAL = newSViv(4);
- mime_object = GMIME_OBJECT (message->mime_part);
- if (GMIME_IS_PART(mime_object)) {
- sv_setref_pv(RETVAL, "Mail::Rspamd::Part", (Mail__Rspamd__Part)mime_object);
- } else {
- plist = g_list_prepend(plist, RETVAL);
- }
- g_mime_object_ref( mime_object );
- } else {
- RETVAL = &PL_sv_undef;
- }
- OUTPUT:
- RETVAL
-
diff --git a/perl/Rspamd/Object.xs b/perl/Rspamd/Object.xs
deleted file mode 100644
index 2f56fb995..000000000
--- a/perl/Rspamd/Object.xs
+++ /dev/null
@@ -1,166 +0,0 @@
-MODULE = Mail::Rspamd PACKAGE = Mail::Rspamd::Object PREFIX = rspamd_object_
-
-void
-rspamd_object_set_content_type (mime_object, content_type)
- Mail::Rspamd::Object mime_object
- Mail::Rspamd::ContentType content_type
- CODE:
- g_mime_object_set_content_type (mime_object, content_type);
- plist = g_list_remove (plist, content_type);
-
-Mail::Rspamd::ContentType
-rspamd_object_get_content_type (mime_object)
- Mail::Rspamd::Object mime_object
- PREINIT:
- char * textdata;
- GMimeContentType *ct;
- CODE:
- ct = (GMimeContentType *)g_mime_object_get_content_type (mime_object);
- textdata = g_mime_content_type_to_string (ct);
- RETVAL = g_mime_content_type_new_from_string (textdata);
- plist = g_list_prepend (plist, RETVAL);
- g_free (textdata);
- OUTPUT:
- RETVAL
-
-void
-rspamd_object_set_content_type_parameter (mime_object, name, value)
- Mail::Rspamd::Object mime_object
- const char * name
- const char * value
- CODE:
- gmime_object_set_content_type_parameter (mime_object, name, value);
-
-const char *
-rspamd_object_get_content_type_parameter (mime_object, name)
- Mail::Rspamd::Object mime_object
- const char * name
- CODE:
- RETVAL = g_mime_object_get_content_type_parameter (mime_object, name);
- OUTPUT:
- RETVAL
-
-void
-rspamd_object_set_content_id (mime_object, content_id)
- Mail::Rspamd::Object mime_object
- const char * content_id
- CODE:
- g_mime_object_set_content_id (mime_object, content_id);
-
-const char *
-rspamd_object_get_content_id(mime_object)
- Mail::Rspamd::Object mime_object
- CODE:
- RETVAL = g_mime_object_get_content_id (mime_object);
- OUTPUT:
- RETVAL
-
-
-void
-rspamd_object_add_header (mime_object, field, value)
- Mail::Rspamd::Object mime_object
- const char * field
- const char * value
- CODE:
- g_mime_object_add_header (mime_object, field, value);
-
-void
-rspamd_object_set_header (mime_object, field, value)
- Mail::Rspamd::Object mime_object
- const char * field
- const char * value
- CODE:
- g_mime_object_set_header (mime_object, field, value);
-
-const char *
-rspamd_object_get_header (mime_object, field)
- Mail::Rspamd::Object mime_object
- const char * field
- CODE:
- RETVAL = g_mime_object_get_header (mime_object, field);
- OUTPUT:
- RETVAL
-
-void
-rspamd_object_remove_header (mime_object, field)
- Mail::Rspamd::Object mime_object
- const char * field
- CODE:
- g_mime_object_remove_header (mime_object, field);
-
-SV *
-rspamd_object_get_headers(mime_object)
- Mail::Rspamd::Object mime_object
- PREINIT:
- char * textdata;
- CODE:
- textdata = g_mime_object_get_headers(mime_object);
- if (textdata == NULL) {
- XSRETURN_UNDEF;
- }
- RETVAL = newSVpv (textdata, 0);
- g_free (textdata);
- OUTPUT:
- RETVAL
-
-SV *
-rspamd_object_to_string(mime_object)
- Mail::Rspamd::Object mime_object
- PREINIT:
- char * textdata;
- CODE:
- textdata = g_mime_object_to_string (mime_object);
- if (textdata) {
- RETVAL = newSVpv (textdata, 0);
- g_free (textdata);
- } else {
- XSRETURN_UNDEF;
- }
- OUTPUT:
- RETVAL
-
-guint
-rspamd_object_get_content_length(mime_object)
- Mail::Rspamd::Object mime_object
- PREINIT:
- guint lsize = 0;
- GMimePart * mime_part;
- CODE:
- if (mime_object) {
- if (GMIME_IS_PART(mime_object)) { // also MESSAGE_PARTIAL
- mime_part = GMIME_PART(mime_object);
- lsize = (mime_part->content && mime_part->content->stream) ?
- g_mime_stream_length (mime_part->content->stream) : 0;
- if (lsize) {
-#ifdef GMIME24
- GMimeContentEncoding enc;
-
- enc = _mime_part_get_encoding (mime_part);
- switch (enc) {
- case GMIME_CONTENT_ENCODING_BASE64:
- lsize = BASE64_ENCODE_LEN (lsize);
- break;
- case GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE:
- lsize = QP_ENCODE_LEN (lsize);
- break;
- }
-#else
- GMimePartEncodingType enc;
-
- enc = g_mime_part_get_encoding (mime_part);
- switch (enc) {
- case GMIME_PART_ENCODING_BASE64:
- lsize = BASE64_ENCODE_LEN (lsize);
- break;
- case GMIME_PART_ENCODING_QUOTEDPRINTABLE:
- lsize = QP_ENCODE_LEN (lsize);
- break;
- }
-#endif
- }
- }
- }
- RETVAL = lsize;
- OUTPUT:
- RETVAL
-
diff --git a/perl/Rspamd/Part.xs b/perl/Rspamd/Part.xs
deleted file mode 100644
index 5401a1e08..000000000
--- a/perl/Rspamd/Part.xs
+++ /dev/null
@@ -1,198 +0,0 @@
-MODULE = Mail::Rspamd PACKAGE = Mail::Rspamd::Part PREFIX = rspamd_part
-
-Mail::Rspamd::Part
-g_mime_part_new (Class = "Mail::Rspamd::Part", type = "text", subtype = "plain")
- char * Class;
- const char * type;
- const char * subtype;
- CODE:
- RETVAL = g_mime_part_new_with_type (type, subtype);
- plist = g_list_prepend (plist, RETVAL);
- OUTPUT:
- RETVAL
-
-void
-DESTROY (mime_part)
- Mail::Rspamd::Part mime_part
- CODE:
- if (g_list_find (plist,mime_part)) {
- g_object_unref (G_OBJECT (mime_part));
- plist = g_list_remove (plist, mime_part);
- }
-
-void
-interface_p_set(mime_part, value)
- Mail::Rspamd::Part mime_part
- char * value
- INTERFACE_MACRO:
- XSINTERFACE_FUNC
- XSINTERFACE_FUNC_RSPAMD_PART_SET
- INTERFACE:
- set_content_description
- set_content_md5
- set_content_location
- set_filename
-
-
-const char *
-interface_p_get(mime_part)
- Mail::Rspamd::Part mime_part
- INTERFACE_MACRO:
- XSINTERFACE_FUNC
- XSINTERFACE_FUNC_RSPAMD_PART_SET
- INTERFACE:
- get_content_description
- get_content_md5
- get_content_location
- get_filename
-
-#if !defined(GMIME24)
-
-void
-rspamd_part_set_content_header (mime_part, field, value)
- Mail::Rspamd::Part mime_part
- const char * field
- const char * value
- CODE:
- g_mime_part_set_content_header (mime_part, field, value);
-
-const char *
-rspamd_part_get_content_header (mime_part, field)
- Mail::Rspamd::Part mime_part
- const char * field
- CODE:
- RETVAL = g_mime_part_get_content_header (mime_part, field);
- OUTPUT:
- RETVAL
-
-#endif
-
-void
-rspamd_part_set_content_type (mime_part, content_type)
- Mail::Rspamd::Part mime_part
- Mail::Rspamd::ContentType content_type
- CODE:
- g_mime_part_set_content_type (mime_part, content_type);
- plist = g_list_remove (plist, content_type);
-
-
-void
-rspamd_part_set_encoding (mime_part, encoding)
- Mail::Rspamd::Part mime_part
- Mail::Rspamd::PartEncodingType encoding
- CODE:
- g_mime_part_set_encoding (mime_part, encoding);
-
-Mail::Rspamd::PartEncodingType
-rspamd_part_get_encoding (mime_part)
- Mail::Rspamd::Part mime_part
- CODE:
- RETVAL = g_mime_part_get_encoding (mime_part);
- OUTPUT:
- RETVAL
-
-const char *
-rspamd_part_encoding_to_string (encoding)
- Mail::Rspamd::PartEncodingType encoding
- PREINIT:
- CODE:
-#ifdef GMIME24
- RETVAL = g_mime_content_encoding_to_string (encoding);
-#else
- RETVAL = g_mime_part_encoding_to_string (encoding);
-#endif
- OUTPUT:
- RETVAL
-
-Mail::Rspamd::PartEncodingType
-rspamd_part_encoding_from_string (encoding)
- const char * encoding
- CODE:
-#ifdef GMIME24
- RETVAL = g_mime_content_encoding_from_string (encoding);
-#else
- RETVAL = g_mime_part_encoding_from_string (encoding);
-#endif
- OUTPUT:
- RETVAL
-
-void
-rspamd_part_add_content_disposition_parameter (mime_part, name, value)
- Mail::Rspamd::Part mime_part
- const char * name
- const char * value
- CODE:
-#ifdef GMIME24
- g_mime_object_add_content_disposition_parameter (GMIME_OBJECT (mime_part), name, value);
-#else
- g_mime_part_add_content_disposition_parameter (mime_part, name, value);
-#endif
-
-const char *
-rspamd_part_get_content_disposition_parameter (mime_part, name)
- Mail::Rspamd::Part mime_part
- const char * name
- CODE:
-#ifdef GMIME24
- RETVAL = g_mime_object_get_content_disposition_parameter (GMIME_OBJECT (mime_part), name);
-#else
- RETVAL = g_mime_part_get_content_disposition_parameter (mime_part, name);
-#endif
- OUTPUT:
- RETVAL
-
-
-void
-rspamd_part_set_pre_encoded_content(mime_part, content, encoding)
- Mail::Rspamd::Part mime_part
- SV * content
- Mail::Rspamd::PartEncodingType encoding
- PREINIT:
- char * data;
- STRLEN len;
- CODE:
- data = SvPV (content, len);
- g_mime_part_set_pre_encoded_content (mime_part, data, len, encoding);
-
-
-SV *
-rspamd_part_get_content(mime_part)
- Mail::Rspamd::Part mime_part
- PREINIT:
-#ifdef GMIME24
- GMimeDataWrapper *wrapper;
- GMimeStream *part_stream;
- GByteArray *part_content;
-#else
- guint len;
- const char * content_char;
-#endif
- SV * content;
- CODE:
- ST(0) = &PL_sv_undef;
-#ifdef GMIME24
- if (!(mime_part->content) || !(mime_part->content->stream) ||
- (wrapper = g_mime_part_get_content_object (mime_part)) == NULL) {
-#else
- if (!(mime_part->content) || !(mime_part->content->stream) ||
- (content_char = g_mime_part_get_content (mime_part, &len)) == NULL) {
-#endif
- return;
- }
- content = sv_newmortal ();
- SvUPGRADE (content, SVt_PV);
- SvREADONLY_on (content);
-#ifdef GMIME24
- part_stream = g_mime_stream_mem_new ();
- g_mime_data_wrapper_write_to_stream (wrapper, part_stream);
- part_content = g_mime_stream_mem_get_byte_array (GMIME_STREAM_MEM (part_stream));
- SvPVX(content) = (char *) (part_content->data);
- SvCUR_set (content, part_content->len);
-#else
- SvPVX(content) = (char *) (content_char);
- SvCUR_set (content, len);
-#endif
- SvLEN_set (content, 0);
- SvPOK_only (content);
- ST(0) = content;
-
diff --git a/perl/Rspamd/Task.xs b/perl/Rspamd/Task.xs
deleted file mode 100644
index e46a1148c..000000000
--- a/perl/Rspamd/Task.xs
+++ /dev/null
@@ -1,104 +0,0 @@
-
-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, NULL);
-
-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
-
-AV*
-rspamd_task_get_text_parts (task)
- Mail::Rspamd::Task task
- PREINIT:
- AV* retav;
- GList *cur;
- SV* ps;
- CODE:
- retav = newAV ();
- cur = g_list_first (task->text_parts);
- while (cur) {
- ps = newSViv (0);
- sv_setref_pv (ps, "Mail::Rspamd::TextPart", (Mail__Rspamd__TextPart)(cur->data));
- av_push(retav, ps);
- cur = g_list_next (task->text_parts);
- }
-
- RETVAL = retav;
- OUTPUT:
- RETVAL
-
diff --git a/perl/Rspamd/TextPart.xs b/perl/Rspamd/TextPart.xs
deleted file mode 100644
index 485ee7bcc..000000000
--- a/perl/Rspamd/TextPart.xs
+++ /dev/null
@@ -1,40 +0,0 @@
-MODULE = Mail::Rspamd PACKAGE = Mail::Rspamd::TextPart PREFIX = rspamd_text_part_
-
-SV *
-rspamd_text_part_get_content (mime_part)
- Mail::Rspamd::TextPart mime_part
- PREINIT:
- SV* content;
- CODE:
- ST(0) = &PL_sv_undef;
- content = sv_newmortal ();
- SvUPGRADE (content, SVt_PV);
- SvREADONLY_on (content);
- SvPVX(content) = (char *) (mime_part->content->data);
- SvCUR_set (content, mime_part->content->len);
- SvLEN_set (content, 0);
- SvPOK_only (content);
- ST(0) = content;
-
-char *
-rspamd_text_part_get_fuzzy (mime_part)
- Mail::Rspamd::TextPart mime_part
- CODE:
- RETVAL = mime_part->fuzzy->hash_pipe;
-
-int
-rspamd_text_part_compare_distance (mime_part, other)
- Mail::Rspamd::TextPart mime_part
- Mail::Rspamd::TextPart other
- CODE:
- RETVAL = fuzzy_compare_hashes (mime_part->fuzzy, other->fuzzy);
- OUTPUT:
- RETVAL
-
-int
-rspamd_text_part_is_html (mime_part)
- Mail::Rspamd::TextPart mime_part
- CODE:
- RETVAL = mime_part->is_html;
- OUTPUT:
- RETVAL