summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-03-02 13:09:33 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-03-02 13:09:33 +0300
commitdef8d3d1a9135748a9c3223107edea592067cad4 (patch)
treed38bd6841f5b3b280643619e3bf47d3e300a90e4 /utils
parentdb656e70f8d5a2e5522ef90d0b5127c8efe192ec (diff)
downloadrspamd-def8d3d1a9135748a9c3223107edea592067cad4.tar.gz
rspamd-def8d3d1a9135748a9c3223107edea592067cad4.zip
* Add compatibility with gmime24
Diffstat (limited to 'utils')
-rw-r--r--utils/url_extracter.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/utils/url_extracter.c b/utils/url_extracter.c
index 75dd5c1d3..8e16a689f 100644
--- a/utils/url_extracter.c
+++ b/utils/url_extracter.c
@@ -26,8 +26,13 @@
#include "../src/url.h"
#include "../src/message.h"
+#ifdef GMIME24
+static void
+mime_foreach_callback (GMimeObject *parent, GMimeObject *part, gpointer user_data)
+#else
static void
mime_foreach_callback (GMimeObject *part, gpointer user_data)
+#endif
{
struct worker_task *task = (struct worker_task *)user_data;
struct mime_part *mime_part;
@@ -50,7 +55,11 @@ mime_foreach_callback (GMimeObject *part, gpointer user_data)
g_mime_message_foreach_part() again here. */
message = g_mime_message_part_get_message ((GMimeMessagePart *) part);
+#ifdef GMIME24
+ g_mime_message_foreach (message, mime_foreach_callback, task);
+#else
g_mime_message_foreach_part (message, mime_foreach_callback, task);
+#endif
g_object_unref (message);
} else if (GMIME_IS_MESSAGE_PARTIAL (part)) {
/* message/partial */
@@ -76,7 +85,11 @@ mime_foreach_callback (GMimeObject *part, gpointer user_data)
if (g_mime_data_wrapper_write_to_stream (wrapper, part_stream) != -1) {
printf ("Write wrapper to stream\n");
part_content = g_mime_stream_mem_get_byte_array (GMIME_STREAM_MEM (part_stream));
+#ifdef GMIME24
+ type = (GMimeContentType *)g_mime_object_get_content_type (GMIME_OBJECT (part));
+#else
type = (GMimeContentType *)g_mime_part_get_content_type (GMIME_PART (part));
+#endif
mime_part = g_malloc (sizeof (struct mime_part));
mime_part->type = type;
mime_part->content = part_content;
@@ -141,7 +154,11 @@ main (int argc, char **argv)
/* free the parser (and the stream) */
g_object_unref (parser);
+#ifdef GMIME24
+ g_mime_message_foreach (message, mime_foreach_callback, &task);
+#else
g_mime_message_foreach_part (message, mime_foreach_callback, &task);
+#endif
TAILQ_FOREACH (url, &task.urls, next) {
printf ("Found url: %s, hostname: %s, data: %s\n", struri (url), url->host, url->data);