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 6d116fea7a8504c2030196171c221f5b5caa402a..c6fda1b84f5c5d9a04cfa9aa993fe943361fc689 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 e8bfc3e53bcd580c1b2c2ae5150f691c55978639..13a9d2b4bc581c3c5618d58ebc106cc742dfd80f 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 3217d40e04b1634999f3fcdffe04d0952eabf04a..5ce382faf0b5144be6c0d84cd744f7e366290367 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 0a20d22af8f5ac31f9a137193e86a586842be484..f44abed808a914e5b1f29171c1400f8b7af44ade 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 b73fd4678b9740c5b0f7e383b3d86ea50b7ea748..5524362fe224368788655c318bca09c7e853ffc9 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 30ca024f8b3d8809e06e476b96de2f9a2d017218..15fea2c27c66359751523680316b0b9b38a13720 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 6b1a8f84478c1ef6c8b749fcc87d8ab65bf7f354..89fd67f51cee886b37a256c1215b6a9be52cf332 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,