[Commits] att_remover.c 1.1.2.27 1.1.2.28

pawel at claws-mail.org pawel at claws-mail.org
Wed Feb 15 21:14:09 CET 2012


Update of /home/claws-mail/plugins/att_remover/src
In directory srv:/tmp/cvs-serv13320/src

Modified Files:
      Tag: gtk2
	att_remover.c 
Log Message:
2012-02-15 [pawel]	1.0.13cvs1

	* src/att_remover.c
		Fix crasher when removing attachments from
		forwarded messages

Index: att_remover.c
===================================================================
RCS file: /home/claws-mail/plugins/att_remover/src/Attic/att_remover.c,v
retrieving revision 1.1.2.27
retrieving revision 1.1.2.28
diff -u -d -r1.1.2.27 -r1.1.2.28
--- att_remover.c	5 Dec 2011 15:12:29 -0000	1.1.2.27
+++ att_remover.c	15 Feb 2012 20:14:06 -0000	1.1.2.28
@@ -145,6 +145,9 @@
 	return msgnum;
 }
 
+#define MIMEINFO_NOT_ATTACHMENT(m) \
+	((m)->type == MIMETYPE_MESSAGE || (m)->type == MIMETYPE_MULTIPART)
+
 static void remove_attachments_cb(GtkWidget *widget, AttRemover *attremover)
 {
 	MainWindow *mainwin = mainwindow_get_mainwindow();
@@ -174,7 +177,7 @@
 	inc_lock();
 	
 	while (partinfo && iter_valid) {
-		if (partinfo->type == MIMETYPE_MULTIPART) {
+		if (MIMEINFO_NOT_ATTACHMENT(partinfo)) {
     			last = partinfo;
     			partinfo = procmime_mimeinfo_next(partinfo);
 			continue;
@@ -206,7 +209,7 @@
 		/* multipart/{alternative,mixed,related} make sense
 		   only when they have at least 2 nodes, remove last
 		   one and move it one level up if otherwise  */
-		if (partinfo->type == MIMETYPE_MULTIPART &&
+		if (MIMEINFO_NOT_ATTACHMENT(partinfo) &&
 			g_node_n_children(partinfo->node) < 2)
 		{
 			gint pos = g_node_child_position(parent->node, partinfo->node);		
@@ -220,8 +223,9 @@
 			
 			child = g_node_last_child(parent->node);
 			partinfo = child ? child->data : parent;
+			continue;
 		}
-		
+
 		if (partinfo->node->prev) {
 			partinfo = (MimeInfo *) partinfo->node->prev->data;
 			if (partinfo->node->children) {
@@ -277,7 +281,7 @@
 		return;
 		
 	while (partinfo) {
-		if (partinfo->type == MIMETYPE_MULTIPART) {
+		if (MIMEINFO_NOT_ATTACHMENT(partinfo)) {
     			partinfo = procmime_mimeinfo_next(partinfo);
 			continue;
 		}



More information about the Commits mailing list