2011-10-25 [colin] 3.7.10cvs50
authorColin Leroy <colin@colino.net>
Tue, 25 Oct 2011 07:22:55 +0000 (07:22 +0000)
committerColin Leroy <colin@colino.net>
Tue, 25 Oct 2011 07:22:55 +0000 (07:22 +0000)
* src/compose.c
* src/messageview.c
* src/procmsg.c
* src/procmsg.h
Fix locking when sending a single message

ChangeLog
PATCHSETS
configure.ac
src/compose.c
src/messageview.c
src/procmsg.c
src/procmsg.h

index 6d116fe..c6fda1b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-10-25 [colin]     3.7.10cvs50
+
+       * src/compose.c
+       * src/messageview.c
+       * src/procmsg.c
+       * src/procmsg.h
+               Fix locking when sending a single message
+
 2011-10-25 [colin]     3.7.10cvs49
 
        * src/gtk/colorlabel.c
index e8bfc3e..13a9d2b 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.83.2.174 -r 1.83.2.175 src/mimeview.c;  ) > 3.7.10cvs47.patchset
 ( cvs diff -u -r 1.25.2.70 -r 1.25.2.71 src/stock_pixmap.c;  ) > 3.7.10cvs48.patchset
 ( cvs diff -u -r 1.2.2.35 -r 1.2.2.36 src/gtk/colorlabel.c;  cvs diff -u -r 1.1.2.20 -r 1.1.2.21 src/gtk/gtkcmclist.c;  ) > 3.7.10cvs49.patchset
+( cvs diff -u -r 1.382.2.587 -r 1.382.2.588 src/compose.c;  cvs diff -u -r 1.94.2.220 -r 1.94.2.221 src/messageview.c;  cvs diff -u -r 1.150.2.118 -r 1.150.2.119 src/procmsg.c;  cvs diff -u -r 1.60.2.56 -r 1.60.2.57 src/procmsg.h;  ) > 3.7.10cvs50.patchset
index 3217d40..5ce382f 100644 (file)
@@ -12,7 +12,7 @@ MINOR_VERSION=7
 MICRO_VERSION=10
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=49
+EXTRA_VERSION=50
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 0a20d22..f44abed 100644 (file)
@@ -5003,10 +5003,10 @@ gint compose_send(Compose *compose)
        }
        if (msgpath == NULL) {
                msgpath = folder_item_fetch_msg(folder, msgnum);
-               val = procmsg_send_message_queue(msgpath, &errstr, folder, msgnum, &queued_removed);
+               val = procmsg_send_message_queue_with_lock(msgpath, &errstr, folder, msgnum, &queued_removed);
                g_free(msgpath);
        } else {
-               val = procmsg_send_message_queue(msgpath, &errstr, folder, msgnum, &queued_removed);
+               val = procmsg_send_message_queue_with_lock(msgpath, &errstr, folder, msgnum, &queued_removed);
                claws_unlink(msgpath);
                g_free(msgpath);
        }
index b73fd46..5524362 100644 (file)
@@ -1066,7 +1066,7 @@ static gint disposition_notification_send(MsgInfo *msginfo)
 
        /* send it */
        path = folder_item_fetch_msg(queue, num);
-       ok = procmsg_send_message_queue(path, &foo, queue, num, &queued_removed);
+       ok = procmsg_send_message_queue_with_lock(path, &foo, queue, num, &queued_removed);
        g_free(path);
        g_free(foo);
        if (ok == 0 && !queued_removed)
index 30ca024..15fea2c 100644 (file)
@@ -845,6 +845,25 @@ static gboolean procmsg_is_last_for_account(FolderItem *queue, MsgInfo *msginfo,
 }
 
 static gboolean send_queue_lock = FALSE;
+
+gboolean procmsg_queue_lock(char **errstr)
+{
+       if (send_queue_lock) {
+               /* Avoid having to translate two similar strings */
+               log_warning(LOG_PROTOCOL, "%s\n", _("Already trying to send."));
+               if (errstr) {
+                       if (*errstr) g_free(*errstr);
+                       *errstr = g_strdup_printf(_("Already trying to send."));
+               }
+               return FALSE;
+       }
+       send_queue_lock = TRUE;
+       return TRUE;
+}
+void procmsg_queue_unlock(void)
+{
+       send_queue_lock = FALSE;
+}
 /*!
  *\brief       Send messages in queue
  *
@@ -861,23 +880,16 @@ gint procmsg_send_queue(FolderItem *queue, gboolean save_msgs, gchar **errstr)
        GSList *sorted_list = NULL;
        GNode *node, *next;
        
-       if (send_queue_lock) {
-               /* Avoid having to translate two similar strings */
-               log_warning(LOG_PROTOCOL, "%s\n", _("Already trying to send."));
-               if (errstr) {
-                       if (*errstr) g_free(*errstr);
-                       *errstr = g_strdup_printf(_("Already trying to send."));
-               }
+       if (!procmsg_queue_lock(errstr)) {
                toolbar_main_set_sensitive(mainwindow_get_mainwindow());
                return -1;
        }
-       send_queue_lock = TRUE;
        inc_lock();
        if (!queue)
                queue = folder_get_default_queue();
        
        if (queue == NULL) {
-               send_queue_lock = FALSE;
+               procmsg_queue_unlock();
                inc_unlock();
                return -1;
        }
@@ -937,7 +949,7 @@ gint procmsg_send_queue(FolderItem *queue, gboolean save_msgs, gchar **errstr)
                        node = next;
                }
        }
-       send_queue_lock = FALSE;
+       procmsg_queue_unlock();
        inc_unlock();
        toolbar_main_set_sensitive(mainwindow_get_mainwindow());
 
@@ -1812,6 +1824,17 @@ gint procmsg_send_message_queue(const gchar *file, gchar **errstr, FolderItem *q
        return result;
 }
 
+gint procmsg_send_message_queue_with_lock(const gchar *file, gchar **errstr, FolderItem *queue, gint msgnum, gboolean *queued_removed)
+{
+       gint val;
+       if (procmsg_queue_lock(errstr)) {
+               val = procmsg_send_message_queue(file, errstr, queue, msgnum, queued_removed);
+               procmsg_queue_unlock();
+               return val;
+       }
+       return -1;
+}
+
 static void update_folder_msg_counts(FolderItem *item, MsgInfo *msginfo, MsgPermFlags old_flags)
 {
        MsgPermFlags new_flags = msginfo->flags.perm_flags;
index 6b1a8f8..89fd67f 100644 (file)
@@ -330,6 +330,8 @@ void        procmsg_empty_all_trash         (void);
 gint   procmsg_send_queue              (FolderItem     *queue,
                                         gboolean        save_msgs,
                                         gchar          **errstr);
+gboolean procmsg_queue_lock            (gchar          **errstr);
+void     procmsg_queue_unlock          (void);
 gboolean procmsg_queue_is_empty        (FolderItem *queue);
 void   procmsg_print_message           (MsgInfo        *msginfo,
                                         const gchar    *cmdline);
@@ -344,6 +346,12 @@ MsgInfo *procmsg_msginfo_get_full_info_from_file
 void    procmsg_msginfo_free           (MsgInfo        *msginfo);
 guint   procmsg_msginfo_memusage       (MsgInfo        *msginfo);
 
+gint procmsg_send_message_queue_with_lock(const gchar *file,
+                                         gchar **errstr,
+                                         FolderItem *queue,
+                                         gint msgnum,
+                                         gboolean *queued_removed);
+
 gint procmsg_send_message_queue                (const gchar *file,
                                         gchar **errstr,
                                         FolderItem *queue,