[Commits] compose.c 1.382.2.587 1.382.2.588 messageview.c 1.94.2.220 1.94.2.221 procmsg.c 1.150.2.118 1.150.2.119 procmsg.h 1.60.2.56 1.60.2.57

colin at claws-mail.org colin at claws-mail.org
Tue Oct 25 09:22:57 CEST 2011


Update of /home/claws-mail/claws/src
In directory claws-mail:/tmp/cvs-serv24577/src

Modified Files:
      Tag: gtk2
	compose.c messageview.c procmsg.c procmsg.h 
Log Message:
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

Index: compose.c
===================================================================
RCS file: /home/claws-mail/claws/src/compose.c,v
retrieving revision 1.382.2.587
retrieving revision 1.382.2.588
diff -u -d -r1.382.2.587 -r1.382.2.588
--- compose.c	22 Oct 2011 17:09:02 -0000	1.382.2.587
+++ compose.c	25 Oct 2011 07:22:55 -0000	1.382.2.588
@@ -5003,10 +5003,10 @@
 	}
 	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: messageview.c
===================================================================
RCS file: /home/claws-mail/claws/src/messageview.c,v
retrieving revision 1.94.2.220
retrieving revision 1.94.2.221
diff -u -d -r1.94.2.220 -r1.94.2.221
--- messageview.c	7 Oct 2011 10:06:26 -0000	1.94.2.220
+++ messageview.c	25 Oct 2011 07:22:55 -0000	1.94.2.221
@@ -1066,7 +1066,7 @@
 
 	/* 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: procmsg.h
===================================================================
RCS file: /home/claws-mail/claws/src/procmsg.h,v
retrieving revision 1.60.2.56
retrieving revision 1.60.2.57
diff -u -d -r1.60.2.56 -r1.60.2.57
--- procmsg.h	16 Feb 2011 07:16:15 -0000	1.60.2.56
+++ procmsg.h	25 Oct 2011 07:22:55 -0000	1.60.2.57
@@ -330,6 +330,8 @@
 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 @@
 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, 

Index: procmsg.c
===================================================================
RCS file: /home/claws-mail/claws/src/procmsg.c,v
retrieving revision 1.150.2.118
retrieving revision 1.150.2.119
diff -u -d -r1.150.2.118 -r1.150.2.119
--- procmsg.c	17 Oct 2011 11:02:44 -0000	1.150.2.118
+++ procmsg.c	25 Oct 2011 07:22:55 -0000	1.150.2.119
@@ -845,6 +845,25 @@
 }
 
 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 @@
 	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 @@
 			node = next;
 		}
 	}
-	send_queue_lock = FALSE;
+	procmsg_queue_unlock();
 	inc_unlock();
 	toolbar_main_set_sensitive(mainwindow_get_mainwindow());
 
@@ -1812,6 +1824,17 @@
 	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;



More information about the Commits mailing list