[Commits] [SCM] claws branch, gtk3, updated. 4.0.0-267-g2af46a6d1
wwp at claws-mail.org
wwp at claws-mail.org
Thu Sep 30 10:07:09 CEST 2021
The branch, gtk3 has been updated
via 2af46a6d14f61ad5d1f8af9bfa8cd134deabfe37 (commit)
from 1a475994eccbd14e95188c754f4957393300b5d0 (commit)
Summary of changes:
src/plugins/vcalendar/vcal_meeting_gtk.c | 34 ++++++++++++++++----------------
1 file changed, 17 insertions(+), 17 deletions(-)
- Log -----------------------------------------------------------------
commit 2af46a6d14f61ad5d1f8af9bfa8cd134deabfe37
Author: wwp <subscript at free.fr>
Date: Thu Sep 30 10:06:46 2021 +0200
Rework a bit the vcal export to file logic.
diff --git a/src/plugins/vcalendar/vcal_meeting_gtk.c b/src/plugins/vcalendar/vcal_meeting_gtk.c
index e884e6535..693747a6a 100644
--- a/src/plugins/vcalendar/vcal_meeting_gtk.c
+++ b/src/plugins/vcalendar/vcal_meeting_gtk.c
@@ -1893,7 +1893,7 @@ gboolean vcal_meeting_export_calendar(const gchar *path,
GSList *subs = NULL;
GSList *cur;
icalcomponent *calendar = NULL;
- gchar *file = NULL;
+ gchar *file;
gchar *tmpfile = get_tmp_file();
gchar *internal_file = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
"vcalendar", G_DIR_SEPARATOR_S,
@@ -1970,17 +1970,16 @@ putfile:
g_slist_free(list);
g_slist_free(subs);
- if (!path && !automatic)
- file = filesel_select_file_save(_("Export calendar to ICS"), NULL);
- else
- file = g_strdup(path);
-
if (automatic && (!path || strlen(path) == 0 || !vcalprefs.export_enable)) {
g_free(tmpfile);
- g_free(file);
return TRUE;
}
+ if (!path && !automatic)
+ file = filesel_select_file_save(_("Export calendar to ICS"), NULL);
+ else
+ file = g_strdup(path);
+
if (file
&& strncmp(file, "http://", 7)
&& strncmp(file, "https://", 8)
@@ -1989,10 +1988,10 @@ putfile:
&& strncmp(file, "ftp://", 6)) {
gchar *afile;
if (file[0] != G_DIR_SEPARATOR)
- afile=g_strdup_printf("%s%s%s", get_home_dir(),
+ afile = g_strdup_printf("%s%s%s", get_home_dir(),
G_DIR_SEPARATOR_S, file);
else
- afile=g_strdup(file);
+ afile = g_strdup(file);
if (move_file(tmpfile, afile, TRUE) != 0) {
log_error(LOG_PROTOCOL, _("Couldn't export calendar to '%s'\n"),
afile);
@@ -2012,7 +2011,8 @@ putfile:
}
}
g_free(tmpfile);
- g_free(file);
+ if (file)
+ g_free(file);
return res;
}
@@ -2022,7 +2022,7 @@ gboolean vcal_meeting_export_freebusy(const gchar *path, const gchar *user,
GSList *list = vcal_folder_get_waiting_events();
GSList *cur;
icalcomponent *calendar = NULL, *timezone = NULL, *tzc = NULL, *vfreebusy = NULL;
- gchar *file = NULL;
+ gchar *file;
gchar *tmpfile = get_tmp_file();
gchar *internal_file = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
"vcalendar", G_DIR_SEPARATOR_S,
@@ -2125,8 +2125,8 @@ gboolean vcal_meeting_export_freebusy(const gchar *path, const gchar *user,
g_free(tmpfile);
return TRUE;
}
- file = g_strdup(path);
+ file = g_strdup(path);
if (file
&& strncmp(file, "http://", 7)
@@ -2134,19 +2134,18 @@ gboolean vcal_meeting_export_freebusy(const gchar *path, const gchar *user,
&& strncmp(file, "webcal://", 9)
&& strncmp(file, "webcals://", 10)
&& strncmp(file, "ftp://", 6)) {
- gchar *afile = NULL;
+ gchar *afile;
if (file[0] != G_DIR_SEPARATOR)
- afile=g_strdup_printf("%s%s%s", get_home_dir(),
+ afile = g_strdup_printf("%s%s%s", get_home_dir(),
G_DIR_SEPARATOR_S, file);
else
- afile=g_strdup(file);
+ afile = g_strdup(file);
if (move_file(tmpfile, file, TRUE) != 0) {
log_error(LOG_PROTOCOL, _("Couldn't export free/busy to '%s'\n"),
afile);
res = FALSE;
}
g_free(afile);
- g_free(file);
} else if (file) {
FILE *fp = claws_fopen(tmpfile, "rb");
if (!strncmp(file, "webcal", 6)) {
@@ -2158,8 +2157,9 @@ gboolean vcal_meeting_export_freebusy(const gchar *path, const gchar *user,
res = vcal_curl_put(file, fp, filesize, user, (pass != NULL ? pass : ""));
claws_fclose(fp);
}
- g_free(file);
}
g_free(tmpfile);
+ if (file)
+ g_free(file);
return res;
}
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list