From: Thorsten Maerz Date: Mon, 23 Jun 2003 12:27:50 +0000 (+0000) Subject: added mail_receive_hook X-Git-Tag: rel_0_9_3~53 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=fc02b48173ef0cb3d7ceac94e61dfea9092a6246 added mail_receive_hook --- diff --git a/ChangeLog.claws b/ChangeLog.claws index fbf799c93..9254116da 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -1,3 +1,9 @@ +2003-06-23 [thorsten] 0.9.0claws57 + + * src/pop.[ch] + added mail_receive_hook to allow modifications + directly after retrieval (e.g. adding headers). + 2003-06-23 [paul] 0.9.0claws56 * src/sourcewindow.c diff --git a/configure.ac b/configure.ac index 885d28086..06db10da3 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=9 MICRO_VERSION=0 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=claws56 +EXTRA_VERSION=claws57 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION dnl set $target diff --git a/src/pop.c b/src/pop.c index ee388207b..5c15b477f 100644 --- a/src/pop.c +++ b/src/pop.c @@ -39,6 +39,7 @@ #include "recv.h" #include "log.h" +#include "hooks.h" static gint pop3_greeting_recv (Pop3Session *session, const gchar *msg); @@ -300,13 +301,21 @@ static gint pop3_retr_recv(Pop3Session *session, const gchar *data, guint len) { gchar *file; gint drop_ok; + MailReceiveData mail_receive_data; + + mail_receive_data.session = session; + mail_receive_data.data = g_strndup(data, len); + hooks_invoke(MAIL_RECEIVE_HOOKLIST, &mail_receive_data); file = get_tmp_file(); - if (pop3_write_msg_to_file(file, data, len) < 0) { + if (pop3_write_msg_to_file(file, mail_receive_data.data, + strlen(mail_receive_data.data)) < 0) { g_free(file); + g_free(mail_receive_data.data); session->error_val = PS_IOERR; return -1; } + g_free(mail_receive_data.data); /* drop_ok: 0: success 1: don't receive -1: error */ drop_ok = inc_drop_message(file, session); diff --git a/src/pop.h b/src/pop.h index 67d3d2aa5..cfdea46e8 100644 --- a/src/pop.h +++ b/src/pop.h @@ -35,6 +35,14 @@ typedef struct _Pop3Session Pop3Session; #define POP3_SESSION(obj) ((Pop3Session *)obj) +#define MAIL_RECEIVE_HOOKLIST "mail_receive_hooklist" +struct _MailReceiveData +{ + Pop3Session *session; + char *data; +}; +typedef struct _MailReceiveData MailReceiveData; + typedef enum { POP3_READY, POP3_GREETING,