Fix few implicit references warnings.
[claws.git] / src / plugins / vcalendar / vcal_folder.c
index d4a3b4f85d46763d556dcb7d10fc6fd640cafa02..e18240a95a9dbe0e1ded0b13df2e4ffaea6ecb66 100644 (file)
@@ -42,6 +42,7 @@
 #include "procheader.h"
 #include "folder.h"
 #include "folderview.h"
+#include "folder_item_prefs.h"
 #include "vcalendar.h"
 #include "vcal_folder.h"
 #include "vcal_prefs.h"
@@ -548,7 +549,7 @@ static gint feed_fetch(FolderItem *fitem, MsgNumberList ** list, gboolean *old_u
                        prop = icalcomponent_get_first_property(evt, ICAL_DTSTART_PROPERTY);
                        if (prop) {
                                ritr = icalrecur_iterator_new(recur, icalproperty_get_dtstart(prop));
-                               next = icalrecur_iterator_next(ritr); /* skip first one */                              
+                               next = icalrecur_iterator_next(ritr); /* skip first one */
                        }
                        
                        rprop = rprop2;
@@ -606,7 +607,7 @@ add_new:
                                item->evtlist = g_slist_prepend(item->evtlist, data);
                                data = NULL;
                        }
-                       if (rprop) {
+                       if (rprop && ritr) {
                                struct icaldurationtype ical_dur;
                                struct icaltimetype dtstart, dtend;
                                evt = icalcomponent_new_clone(evt);
@@ -622,7 +623,7 @@ add_new:
                                if (prop)
                                        dtend = icalproperty_get_dtend(prop);
                                ical_dur = icaltime_subtract(dtend, dtstart);
-                               next = icalrecur_iterator_next(ritr); 
+                               next = icalrecur_iterator_next(ritr);
                                if (!icaltime_is_null_time(next) &&
                                    !icaltime_is_null_time(dtstart) && i < 100) {
                                        prop = icalcomponent_get_first_property(evt, ICAL_DTSTART_PROPERTY);
@@ -1567,8 +1568,10 @@ void *url_read_thread(void *data)
        curl_easy_setopt(curl_ctx, CURLOPT_TIMEOUT, prefs_common_get_prefs()->io_timeout_secs);
        curl_easy_setopt(curl_ctx, CURLOPT_NOSIGNAL, 1);
 #if LIBCURL_VERSION_NUM >= 0x070a00
-       curl_easy_setopt(curl_ctx, CURLOPT_SSL_VERIFYPEER, 0);
-       curl_easy_setopt(curl_ctx, CURLOPT_SSL_VERIFYHOST, 0);
+       if(vcalprefs.ssl_verify_peer == FALSE) {
+               curl_easy_setopt(curl_ctx, CURLOPT_SSL_VERIFYPEER, 0);
+               curl_easy_setopt(curl_ctx, CURLOPT_SSL_VERIFYHOST, 0);
+       }
 #endif
        curl_easy_setopt(curl_ctx, CURLOPT_USERAGENT, 
                "Claws Mail vCalendar plugin "
@@ -1694,8 +1697,10 @@ gboolean vcal_curl_put(gchar *url, FILE *fp, gint filesize, const gchar *user, c
        curl_easy_setopt(curl_ctx, CURLOPT_READDATA, fp);
        curl_easy_setopt(curl_ctx, CURLOPT_HTTPHEADER, headers);
 #if LIBCURL_VERSION_NUM >= 0x070a00
-       curl_easy_setopt(curl_ctx, CURLOPT_SSL_VERIFYPEER, 0);
-       curl_easy_setopt(curl_ctx, CURLOPT_SSL_VERIFYHOST, 0);
+       if(vcalprefs.ssl_verify_peer == FALSE) {
+               curl_easy_setopt(curl_ctx, CURLOPT_SSL_VERIFYPEER, 0);
+               curl_easy_setopt(curl_ctx, CURLOPT_SSL_VERIFYHOST, 0);
+       }
 #endif
        curl_easy_setopt(curl_ctx, CURLOPT_USERAGENT, 
                "Claws Mail vCalendar plugin "
@@ -1910,14 +1915,12 @@ static void subscribe_cal_cb(GtkAction *action, gpointer data)
        if (tmp == NULL)
                return;
        
-       if (!strncmp(tmp, "http://", 7)) {
+       if (!strncmp(tmp, "http", 4)) {
                uri = tmp;
        } else if (!strncmp(tmp, "file://", 7)) {
                uri = tmp;
-       } else if (!strncmp(tmp, "https://", 8)) {
-               uri = tmp;
-       } else if (!strncmp(tmp, "webcal://", 9)) {
-               uri = g_strconcat("http://", tmp+9, NULL);
+       } else if (!strncmp(tmp, "webcal", 6)) {
+               uri = g_strconcat("http", tmp+6, NULL);
                g_free(tmp);
        } else {
                alertpanel_error(_("Could not parse the URL."));
@@ -1991,8 +1994,8 @@ gboolean vcal_subscribe_uri(Folder *folder, const gchar *uri)
        if (uri == NULL)
                return FALSE;
 
-       if (!strncmp(uri, "webcal://", 9)) {
-               tmp = g_strconcat("http://", uri+9, NULL);
+       if (!strncmp(uri, "webcal", 6)) {
+               tmp = g_strconcat("http", uri+6, NULL);
        } else {
                return FALSE;
        }
@@ -2219,8 +2222,8 @@ VCalEvent *vcal_get_event_from_ical(const gchar *ical, const gchar *charset)
                        struct icaltimetype itt;
                        icalproperty_free(prop);
                        GET_PROP(comp, prop, ICAL_DTSTART_PROPERTY);
-                       itt = icalproperty_get_dtstart(prop);
                        if (prop) {
+                               itt = icalproperty_get_dtstart(prop);
                                icalproperty_free(prop);
                                dtend = g_strdup(icaltime_as_ical_string(icaltime_add(itt,duration)));
                                TO_UTF8(dtend);