added mail_receive_hook
authorThorsten Maerz <torte@netztorte.de>
Mon, 23 Jun 2003 12:27:50 +0000 (12:27 +0000)
committerThorsten Maerz <torte@netztorte.de>
Mon, 23 Jun 2003 12:27:50 +0000 (12:27 +0000)
ChangeLog.claws
configure.ac
src/pop.c
src/pop.h

index fbf799c..9254116 100644 (file)
@@ -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
index 885d280..06db10d 100644 (file)
@@ -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
index ee38820..5c15b47 100644 (file)
--- 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);
index 67d3d2a..cfdea46 100644 (file)
--- 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,