* src/main.c
authorAlfons Hoogervorst <alfons@proteus.demon.nl>
Thu, 20 Mar 2003 21:48:21 +0000 (21:48 +0000)
committerAlfons Hoogervorst <alfons@proteus.demon.nl>
Thu, 20 Mar 2003 21:48:21 +0000 (21:48 +0000)
* src/toolbar.c
* src/procmsg.c
don't send locked queue messages
(feature request "[ 705245 ] Locking message in outbox
 should prevent sending")

ChangeLog.claws
configure.ac
src/main.c
src/procmsg.c
src/toolbar.c

index 9e6da3a..ace0122 100644 (file)
@@ -1,3 +1,12 @@
+2003-03-20 [alfons]    0.8.11claws34
+
+       * src/main.c
+       * src/toolbar.c
+       * src/procmsg.c
+               don't send locked queue messages
+               (feature request "[ 705245 ] Locking message in outbox 
+                should prevent sending")
+
 2003-03-20 [christoph] 0.8.11claws33
 
        * src/folder.c
index 5683e8c..6b31cc4 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=11
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws33
+EXTRA_VERSION=claws34
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index a18a620..2cd5a01 100644 (file)
@@ -797,10 +797,13 @@ static void send_queue(void)
                Folder *folder = list->data;
 
                if (folder->queue) {
-                       if (procmsg_send_queue
-                               (folder->queue, prefs_common.savemsg) < 0)
+                       gint res = procmsg_send_queue
+                               (folder->queue, prefs_common.savemsg);
+
+                       if (res < 0)    
                                alertpanel_error(_("Some errors occurred while sending queued messages."));
-                       folder_item_scan(folder->queue);
+                       if (res)        
+                               folder_item_scan(folder->queue);
                        if (prefs_common.savemsg && folder->outbox) {
                                if (folder->outbox == def_outbox)
                                        def_outbox = NULL;
index f6266db..f650ef2 100644 (file)
@@ -464,9 +464,18 @@ void procmsg_empty_trash(void)
        }
 }
 
+/*!
+ *\brief       Send messages in queue
+ *
+ *\param       queue Queue folder to process
+ *\param       save_msgs Unused
+ *
+ *\return      Number of messages sent, negative if an error occurred
+ *             positive if no error occurred
+ */
 gint procmsg_send_queue(FolderItem *queue, gboolean save_msgs)
 {
-       gint ret = 0;
+       gint ret = 1, count = 0;
        GSList *list, *elem;
 
        if (!queue)
@@ -476,37 +485,42 @@ gint procmsg_send_queue(FolderItem *queue, gboolean save_msgs)
        folder_item_scan(queue);
        list = folder_item_get_msg_list(queue);
 
-
        for (elem = list; elem != NULL; elem = elem->next) {
                gchar *file;
                MsgInfo *msginfo;
                
                msginfo = (MsgInfo *)(elem->data);
-
-               file = folder_item_fetch_msg(queue, msginfo->msgnum);
-               if (file) {
-                       if (procmsg_send_message_queue(file) < 0) {
-                               g_warning("Sending queued message %d failed.\n", msginfo->msgnum);
-                               ret = -1;
-                       } else {
-                       /* CLAWS: 
-                        * We save in procmsg_send_message_queue because
-                        * we need the destination folder from the queue
-                        * header
-                                               
-                               if (save_msgs)
-                                       procmsg_save_to_outbox
-                                               (queue->folder->outbox,
-                                                file, TRUE);
-*/
-                               folder_item_remove_msg(queue, msginfo->msgnum);
+               if (!MSG_IS_LOCKED(msginfo->flags)) {
+                       file = folder_item_fetch_msg(queue, msginfo->msgnum);
+                       if (file) {
+                               if (procmsg_send_message_queue(file) < 0) {
+                                       g_warning("Sending queued message %d failed.\n", 
+                                                 msginfo->msgnum);
+                                       ret = -1;
+                               } else {
+                                       /* CLAWS: 
+                                        * We save in procmsg_send_message_queue because
+                                        * we need the destination folder from the queue
+                                        * header
+                                                       
+                                       if (save_msgs)
+                                               procmsg_save_to_outbox
+                                                       (queue->folder->outbox,
+                                                        file, TRUE);
+                                        */
+                                       count++; 
+                                       folder_item_remove_msg(queue, msginfo->msgnum);
+                               }
+                               g_free(file);
                        }
-                       g_free(file);
                }
+               /* FIXME: supposedly if only one message is locked, and queue
+                * is being flushed, the following free says something like 
+                * "freeing msg ## in folder (nil)". */
                procmsg_msginfo_free(msginfo);
        }
 
-       return ret;
+       return ret * count;
 }
 
 gint procmsg_remove_special_headers(const gchar *in, const gchar *out)
index 3ceedd2..1299b5a 100644 (file)
@@ -1984,10 +1984,12 @@ void send_queue_cb(gpointer data, guint action, GtkWidget *widget)
                Folder *folder = list->data;
 
                if (folder->queue) {
-                       if (procmsg_send_queue
-                               (folder->queue, prefs_common.savemsg) < 0)
+                       gint res = procmsg_send_queue
+                               (folder->queue, prefs_common.savemsg);
+                       if (res < 0) 
                                alertpanel_error(_("Some errors occurred while sending queued messages."));
-                       folder_item_scan(folder->queue);
+                       if (res)
+                               folder_item_scan(folder->queue);
                }
        }
 }