* src/procmsg.c
authorChristoph Hohmann <reboot@gmx.ch>
Thu, 14 Mar 2002 11:38:12 +0000 (11:38 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Thu, 14 Mar 2002 11:38:12 +0000 (11:38 +0000)
* src/send.c
        fix local delivery
        (patch submitted by "Simon 'corecode' Schubert")
* src/prefs_common.c
* src/procmsg.c
        fix gcc 3.0 warning

ChangeLog.claws
configure.in
src/prefs_common.c
src/procmsg.c
src/send.c

index f93b595..e278b7a 100644 (file)
@@ -1,3 +1,13 @@
+2002-03-14 [christoph] 0.7.4claws3
+
+       * src/procmsg.c
+       * src/send.c
+               fix local delivery
+               (patch submitted by "Simon 'corecode' Schubert")
+       * src/prefs_common.c
+       * src/procmsg.c
+               fix gcc 3.0 warning
+
 2002-03-14 [paul]      0.7.4claws2
 
        * sync with sylpheed 0.7.4cvs2
index d5dbb51..4c49486 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=7
 MICRO_VERSION=4
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws2
+EXTRA_VERSION=claws3
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 0dd45cc..d07fb13 100644 (file)
@@ -3973,7 +3973,6 @@ static void prefs_nextunreadmsgdialog_set_optmenu(PrefParam *pparam)
        case NEXTUNREADMSGDIALOG_ASSUME_NO:
                gtk_option_menu_set_history(optmenu, 2);
                break;
-       default:
        }
 
        menu = gtk_option_menu_get_menu(optmenu);
index 4f69ba6..d7f5e89 100644 (file)
@@ -1045,6 +1045,7 @@ gint procmsg_send_message_queue(const gchar *file)
        gint hnum;
        PrefsAccount *mailac = NULL, *newsac = NULL;
        gchar *tmp = NULL;
+       int local = 0;
 
        g_return_val_if_fail(file != NULL, -1);
 
@@ -1079,7 +1080,6 @@ gint procmsg_send_message_queue(const gchar *file)
                case Q_SAVE_COPY_FOLDER:
                        if (!savecopyfolder) savecopyfolder = g_strdup(p);
                        break;
-               default:
                }
        }
        filepos = ftell(fp);
@@ -1117,8 +1117,10 @@ gint procmsg_send_message_queue(const gchar *file)
                } else if (mailac && mailac->use_mail_command &&
                           mailac->mail_command && (* mailac->mail_command)) {
                        mailval = send_message_local(mailac->mail_command, fp);
+                       local = 1;
                } else if (prefs_common.use_extsend && prefs_common.extsend_cmd) {
                        mailval = send_message_local(prefs_common.extsend_cmd, fp);
+                       local = 1;
                } else {
                        if (!mailac) {
                                mailac = account_find_from_smtp_server(from, smtpserver);
@@ -1144,8 +1146,16 @@ gint procmsg_send_message_queue(const gchar *file)
                        }
                }
                if (mailval < 0) {
-                       alertpanel_error(_("Error occurred while sending the message to %s ."),
-                                 mailac ? mailac->smtp_server : smtpserver);
+                       if (!local)
+                               alertpanel_error(
+                                       _("Error occurred while sending the message to `%s'."),
+                                       mailac ? mailac->smtp_server : smtpserver);
+                       else
+                               alertpanel_error(
+                                       _("Error occurred while sending the message with command `%s'."),
+                                       (mailac && mailac->use_mail_command && 
+                                        mailac->mail_command && (*mailac->mail_command)) ? 
+                                               mailac->mail_command : prefs_common.extsend_cmd);
                }
        }
 
index 4ae48d0..645be80 100644 (file)
@@ -31,6 +31,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <sys/time.h>
+#include <signal.h>
 #include <unistd.h>
 
 #include "intl.h"
@@ -214,6 +215,7 @@ gint send_message_local(const gchar *command, FILE *fp)
        FILE *pipefp;
        gchar buf[BUFFSIZE];
        int r;
+       sigset_t osig, mask;
 
        g_return_val_if_fail(command != NULL, -1);
        g_return_val_if_fail(fp != NULL, -1);
@@ -233,9 +235,19 @@ gint send_message_local(const gchar *command, FILE *fp)
                fputc('\n', pipefp);
        }
 
+       /* we need to block SIGCHLD, otherwise pspell's handler will wait()
+        * the pipecommand away and pclose will return -1 because of its
+        * failed wait4().
+        */
+       sigemptyset(&mask);
+       sigaddset(&mask, SIGCHLD);
+       sigprocmask(SIG_BLOCK, &mask, &osig);
+       
        r = pclose(pipefp);
+
+       sigprocmask(SIG_SETMASK, &osig, NULL);
        if (r != 0) {
-               g_warning(_("external command failed: %s\n"), command);
+               g_warning(_("external command `%s' failed with code `%i'\n"), command, r);
                return -1;
        }