[evolution-data-server] Bug 744785 - [IMAPx] Check for correct Date before using it in APPEND



commit 1dcbf0577fb5ab4c303e64280ecd8336008b322b
Author: Milan Crha <mcrha redhat com>
Date:   Thu Feb 26 11:38:54 2015 +0100

    Bug 744785 - [IMAPx] Check for correct Date before using it in APPEND

 camel/providers/imapx/Makefile.am          |    2 ++
 camel/providers/imapx/camel-imapx-server.c |   15 +++++++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/camel/providers/imapx/Makefile.am b/camel/providers/imapx/Makefile.am
index b8b2956..85c59ff 100644
--- a/camel/providers/imapx/Makefile.am
+++ b/camel/providers/imapx/Makefile.am
@@ -14,6 +14,7 @@ libcamelimapx_la_CPPFLAGS = \
        -I$(top_builddir)/camel \
        $(CAMEL_CFLAGS) \
        $(GIO_UNIX_CFLAGS) \
+       $(EVOLUTION_CALENDAR_CFLAGS) \
        -DG_LOG_DOMAIN=\"camel-imapx\" \
        $(CODE_COVERAGE_CFLAGS) \
        $(NULL)
@@ -63,6 +64,7 @@ libcamelimapx_la_LIBADD = \
        $(top_builddir)/camel/libcamel-1.2.la \
        $(CAMEL_LIBS) \
        $(GIO_UNIX_LIBS) \
+       $(EVOLUTION_CALENDAR_LIBS) \
        $(NULL)
 
 libcamelimapx_la_LDFLAGS = -avoid-version -module $(NO_UNDEFINED) \
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 12da658..b15b3dd 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -29,6 +29,8 @@
 #include <glib/gi18n-lib.h>
 #include <gio/gnetworking.h>
 
+#include <libical/ical.h>
+
 #ifndef G_OS_WIN32
 #include <glib-unix.h>
 #endif /* G_OS_WIN32 */
@@ -8586,6 +8588,7 @@ camel_imapx_server_append_message (CamelIMAPXServer *is,
                summary, message, NULL);
        info->uid = camel_pstring_strdup (uid);
        if (mi != NULL) {
+               struct icaltimetype icaltime;
                CamelMessageInfoBase *base_info = (CamelMessageInfoBase *) info;
                const CamelFlag *flag;
                const CamelTag *tag;
@@ -8611,8 +8614,20 @@ camel_imapx_server_append_message (CamelIMAPXServer *is,
                        tag = tag->next;
                }
 
+               if (date_time > 0) {
+                       icaltime = icaltime_from_timet (date_time, FALSE);
+                       if (!icaltime_is_valid_time (icaltime))
+                               date_time = -1;
+               }
+
                if (date_time <= 0)
                        date_time = camel_message_info_date_received (mi);
+
+               if (date_time > 0) {
+                       icaltime = icaltime_from_timet (date_time, FALSE);
+                       if (!icaltime_is_valid_time (icaltime))
+                               date_time = -1;
+               }
        }
 
        g_free (uid);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]