diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-12-22 16:27:09 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-12-22 16:27:09 +0000 |
commit | c5a11fc210c77e7b4a6405610bcc4c78bb578581 (patch) | |
tree | 1c12dae04f4e8b23058e71c05361b3bc9f5f7dee /src/libmime/email_addr.h | |
parent | 40f6e53fe3c30d5272c1efd4bbd2f527a92990aa (diff) | |
download | rspamd-c5a11fc210c77e7b4a6405610bcc4c78bb578581.tar.gz rspamd-c5a11fc210c77e7b4a6405610bcc4c78bb578581.zip |
[Feature] Add new function to parse mime addresses
Diffstat (limited to 'src/libmime/email_addr.h')
-rw-r--r-- | src/libmime/email_addr.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/libmime/email_addr.h b/src/libmime/email_addr.h index de91237db..f6a16d682 100644 --- a/src/libmime/email_addr.h +++ b/src/libmime/email_addr.h @@ -17,7 +17,8 @@ #define SRC_LIBMIME_EMAIL_ADDR_H_ #include "config.h" -#include "ref.h" +#include "libutil/mem_pool.h" +#include "libutil/ref.h" struct rspamd_mime_header; @@ -62,6 +63,26 @@ struct rspamd_email_address { struct rspamd_email_address * rspamd_email_address_from_smtp ( const gchar *str, guint len); +/** + * Parses email address from the mime header, decodes names and return the array + * of `rspamd_email_address`. If `src` is NULL, then this function creates a new + * array and adds a destructor to remove elements when `pool` is destroyed. + * Otherwise, addresses are appended to `src`. + * @param hdr + * @param len + * @return + */ +GPtrArray *rspamd_email_address_from_mime (rspamd_mempool_t *pool, + const gchar *hdr, + guint len, + GPtrArray *src); + +/** + * Destroys list of email addresses + * @param ptr + */ +void rspamd_email_address_list_destroy (gpointer ptr); + struct rspamd_email_address * rspamd_email_address_ref ( struct rspamd_email_address *addr); |