[dovecot-cvs] dovecot/src/plugins/mail-log mail-log-plugin.c, 1.1.2.3, 1.1.2.4

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


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

Modified Files:
      Tag: branch_1_0
	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.1.2.3
retrieving revision 1.1.2.4
diff -u -d -r1.1.2.3 -r1.1.2.4
--- mail-log-plugin.c	22 Feb 2007 14:27:22 -0000	1.1.2.3
+++ mail-log-plugin.c	28 Feb 2007 21:00:37 -0000	1.1.2.4
@@ -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