Fix capitalization of a one Web[cC]al occurrence.
[claws.git] / src / plugins / vcalendar / vcal_folder.c
index 7951ab7dbd1e192e3e2ea09cf03dc5e7eb242f37..4cde1bce6ab0d4cadb1547cf1d39b066af2f7515 100644 (file)
@@ -34,6 +34,7 @@
 #include <unistd.h>
 #include <curl/curl.h>
 #include <curl/curlver.h>
+#include <ctype.h>
 
 #include "account.h"
 #include "utils.h"
@@ -610,7 +611,8 @@ add_new:
                        }
                        if (rprop && ritr) {
                                struct icaldurationtype ical_dur;
-                               struct icaltimetype dtstart, dtend;
+                               struct icaltimetype dtstart = icaltime_null_time();
+                               struct icaltimetype dtend = icaltime_null_time();
                                evt = icalcomponent_new_clone(evt);
                                prop = icalcomponent_get_first_property(evt, ICAL_RRULE_PROPERTY);
                                if (prop) {
@@ -620,9 +622,13 @@ add_new:
                                prop = icalcomponent_get_first_property(evt, ICAL_DTSTART_PROPERTY);
                                if (prop)
                                        dtstart = icalproperty_get_dtstart(prop);
+                               else
+                                       debug_print("event has no DTSTART!\n");
                                prop = icalcomponent_get_first_property(evt, ICAL_DTEND_PROPERTY);
                                if (prop)
                                        dtend = icalproperty_get_dtend(prop);
+                               else
+                                       debug_print("event has no DTEND!\n");
                                ical_dur = icaltime_subtract(dtend, dtstart);
                                next = icalrecur_iterator_next(ritr);
                                if (!icaltime_is_null_time(next) &&
@@ -1526,8 +1532,7 @@ gchar* get_item_event_list_for_date(FolderItem *item, EventTime date)
                        strcpy(result+e_len+2, (gchar *)cur->data);
                }
        }
-       slist_free_strings(strs);
-       g_slist_free(strs);
+       slist_free_strings_full(strs);
        return result;
 }
 
@@ -1642,7 +1647,6 @@ gchar *vcal_curl_read(const char *url, const gchar *label, gboolean verbose,
        thread_data *td;
 #ifdef USE_PTHREAD
        pthread_t pt;
-       pthread_attr_t pta;
 #endif
        void *res;
        gchar *error = NULL;
@@ -1657,10 +1661,7 @@ gchar *vcal_curl_read(const char *url, const gchar *label, gboolean verbose,
        STATUSBAR_PUSH(mainwindow_get_mainwindow(), label);
 
 #ifdef USE_PTHREAD
-       if (pthread_attr_init(&pta) != 0 ||
-           pthread_attr_setdetachstate(&pta, PTHREAD_CREATE_JOINABLE) != 0 ||
-           pthread_create(&pt, &pta, 
-                       url_read_thread, td) != 0) {
+       if (pthread_create(&pt, NULL, url_read_thread, td) != 0) {
                url_read_thread(td);    
        }
        while (!td->done)  {
@@ -1832,7 +1833,12 @@ static void update_subscription_finish(const gchar *uri, gchar *feed, gboolean v
                        g_free(error);
                return;
        }
-       if (strncmp(feed, "BEGIN:VCALENDAR", strlen("BEGIN:VCALENDAR"))) {
+
+       gchar *tmp = feed;
+       while (*tmp && isspace((unsigned char)*tmp))
+               tmp++;
+
+       if (strncmp(tmp, "BEGIN:VCALENDAR", strlen("BEGIN:VCALENDAR"))) {
                gchar *err_msg = _("This URL does not look like a Webcal URL:\n%s\n%s");
 
                if (verbose && manual_update) {
@@ -1942,7 +1948,7 @@ static void subscribe_cal_cb(GtkAction *action, gpointer data)
        gchar *uri = NULL;
        gchar *tmp = NULL;
 
-       tmp = input_dialog(_("Subscribe to Webcal"), _("Enter the WebCal URL:"), NULL);
+       tmp = input_dialog(_("Subscribe to Webcal"), _("Enter the Webcal URL:"), NULL);
        if (tmp == NULL)
                return;
        
@@ -1984,8 +1990,8 @@ static void unsubscribe_cal_cb(GtkAction *action, gpointer data)
        message = g_strdup_printf
                (_("Do you really want to unsubscribe?"));
        avalue = alertpanel_full(_("Delete subscription"), message,
-                                GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, 
-                                FALSE, NULL, ALERT_WARNING, G_ALERTDEFAULT);
+                                GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, ALERTFOCUS_FIRST, 
+                                FALSE, NULL, ALERT_WARNING);
        g_free(message);
        if (avalue != G_ALERTALTERNATE) return;