/*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2012 Hiroyuki Yamamoto & The Claws Mail Team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2015 Hiroyuki Yamamoto & The Claws Mail Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
#ifdef HAVE_CONFIG_H
}
p = filename;
+ g_string_append(cmd, "\"");
#ifdef G_OS_UNIX
- while ((q = strpbrk(p, "$\"`'\\ \t*?[]&|;<>()!#~")) != NULL) {
+ while ((q = strpbrk(p, "$\"`\\~")) != NULL) {
escape_ch[1] = *q;
*q = '\0';
g_string_append(cmd, p);
g_string_append(cmd, p);
#else
- g_string_append(cmd, "\"");
g_string_append(cmd, filename);
- g_string_append(cmd, "\"");
#endif
+ g_string_append(cmd, "\"");
g_free(filename);
return TRUE;
g_free(filename);
if (ret < 0) {
- alertpanel_error(_("Can't get part of multipart message: %s"), strerror(-ret));
+ alertpanel_error(_("Can't get part of multipart message: %s"), g_strerror(-ret));
g_free(part_filename);
return FALSE;
}
gint body_pos, MimeInfo *partinfo,
void (*callback)(void *data), void *data)
{
- GSList *children_list = NULL;
+ GSList *children_list = NULL, *cur = NULL;
gint is_ok = TRUE;
gint msg_list_len;
Children *children;
((action_type & ACTION_SINGLE) == 0 || msg_list_len == 1))
children->open_in = 1;
- if (action_type & ACTION_SINGLE) {
- GSList *cur;
+ /* Pre-fetch bodies, makes it easier on IMAP (see bug #3011) */
+ for (cur = msg_list; cur; cur = cur->next) {
+ gchar *dummy;
+ msginfo = (MsgInfo *)cur->data;
+
+ dummy = procmsg_get_message_file((MsgInfo *)cur->data);
+ if (dummy)
+ g_free(dummy);
+ else
+ is_ok = FALSE;
+ }
+ if (is_ok && (action_type & ACTION_SINGLE)) {
for (cur = msg_list; cur && is_ok == TRUE; cur = cur->next) {
msginfo = (MsgInfo *)cur->data;
if (!msginfo) {
}
g_free(cmd);
}
- } else {
+ } else if (is_ok) {
cmd = parse_action_cmd(action, NULL, msg_list, partinfo,
user_str, user_hidden_str, sel_str);
if (cmd) {
Children *children)
{
gint chld_in, chld_out, chld_err;
- gchar **argv, *ret_str;
+ gchar **argv, *ret_str, *trim_cmd;
GPid pid;
ChildInfo *child_info;
gint follow_child;
ret_str = g_locale_from_utf8(cmd, strlen(cmd),
&by_read, &by_written,
NULL);
- if (ret_str && by_written)
- argv = strsplit_with_quote(ret_str, " ", 0);
- else
- argv = strsplit_with_quote(cmd, " ", 0);
+ if (!ret_str || !by_written)
+ ret_str = g_strdup(cmd);
+
+ trim_cmd = ret_str;
+
+ while (g_ascii_isspace(trim_cmd[0]))
+ trim_cmd++;
+#ifdef G_OS_UNIX
+ argv = g_new0(gchar *, 4);
+ argv[0] = g_strdup("/bin/sh");
+ argv[1] = g_strdup("-c");
+ argv[2] = g_strdup(trim_cmd);
+ argv[3] = 0;
+#else
+ argv = strsplit_with_quote(trim_cmd, " ", 0);
+#endif
g_free(ret_str);
if (follow_child) {
if (!result) {
alertpanel_error(_("Could not fork to execute the following "
"command:\n%s\n%s"),
- cmd, error->message);
- g_free(error);
+ cmd, error ? error->message : _("Unknown error"));
+ if (error)
+ g_error_free(error);
return NULL;
}
r = close(chld_in);
child_info->chld_in = -1; /* No more input */
if (r != 0)
- debug_print("%s(%d)", strerror(errno), errno);
+ debug_print("%s(%d)", g_strerror(errno), errno);
}
return child_info;
gtk_box_pack_start(GTK_BOX(input_hbox), entry, TRUE, TRUE, 0);
if (children->action_type & ACTION_USER_HIDDEN_IN) {
gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
-#ifdef MAEMO
- hildon_gtk_entry_set_input_mode(GTK_ENTRY(entry),
- HILDON_GTK_INPUT_MODE_FULL |
- HILDON_GTK_INPUT_MODE_INVISIBLE);
-#endif
}
gtk_widget_show(entry);
modified_something = TRUE;
last_item = nmi->folder;
}
- procmsg_msginfo_free (nmi);
+ procmsg_msginfo_free (&nmi);
if (summaryview && summaryview->displayed &&
summaryview->folder_item == msginfo->folder &&
summary_get_msgnum(summaryview, summaryview->displayed) == msginfo->msgnum)
r = close(child_info->chld_in);
child_info->chld_in = -1;
if (r != 0)
- debug_print("%s(%d)", strerror(errno), errno);
+ debug_print("%s(%d)", g_strerror(errno), errno);
child_info->chld_in = -1;
debug_print("Input to grand child sent.\n");
}