[dovecot-cvs] dovecot/src/plugins/mail-log mail-log-plugin.c, 1.4, 1.5

tss at dovecot.org tss at dovecot.org
Wed Feb 28 21:00:43 UTC 2007


Update of /var/lib/cvs/dovecot/src/plugins/mail-log
In directory talvi:/tmp/cvs-serv17305

Modified Files:
	mail-log-plugin.c 
Log Message:
Fixed deleted/undeleted logging.



Index: mail-log-plugin.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/mail-log/mail-log-plugin.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- mail-log-plugin.c	22 Feb 2007 14:27:43 -0000	1.4
+++ mail-log-plugin.c	28 Feb 2007 21:00:39 -0000	1.5
@@ -63,14 +63,29 @@
 {
 	struct mail_private *mail = (struct mail_private *)_mail;
 	struct mail_log_mail *lmail = MAIL_LOG_CONTEXT(mail);
+	enum mail_flags old_flags, new_flags;
 
+	old_flags = mail_get_flags(_mail);
 	if (lmail->super.update_flags(_mail, modify_type, flags) < 0)
 		return -1;
 
-	if ((flags & MAIL_DELETED) == 0 && modify_type != MODIFY_REMOVE)
+	new_flags = old_flags;
+	switch (modify_type) {
+	case MODIFY_ADD:
+		new_flags |= flags;
+		break;
+	case MODIFY_REMOVE:
+		new_flags &= ~flags;
+		break;
+	case MODIFY_REPLACE:
+		new_flags = flags;
+		break;
+	}
+	if (((old_flags ^ new_flags) & MAIL_DELETED) == 0)
 		return 0;
 
-	mail_log_action(_mail, "deleted");
+	mail_log_action(_mail, (new_flags & MAIL_DELETED) != 0 ?
+			"deleted" : "undeleted");
 	return 0;
 }
 



More information about the dovecot-cvs mailing list