[dovecot-cvs] dovecot/src/lib-index/maildir maildir-build.c,1.14,1.15

cras at procontrol.fi cras at procontrol.fi
Mon Oct 28 10:32:32 EET 2002


Update of /home/cvs/dovecot/src/lib-index/maildir
In directory danu:/tmp/cvs-serv11925/lib-index/maildir

Modified Files:
	maildir-build.c 
Log Message:
Support W=rfc822.size flag in maildir file name.



Index: maildir-build.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/maildir/maildir-build.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- maildir-build.c	27 Oct 2002 06:37:18 -0000	1.14
+++ maildir-build.c	28 Oct 2002 08:32:30 -0000	1.15
@@ -17,6 +17,8 @@
 	MailIndexRecord *rec;
 	MailIndexUpdate *update;
 	struct stat st;
+	uoff_t virtual_size;
+	const char *p;
 	int failed;
 
 	i_assert(path != NULL);
@@ -34,6 +36,23 @@
 	mail_index_mark_flag_changes(index, rec, 0, rec->msg_flags);
 
 	update = index->update_begin(index, rec);
+
+	/* set virtual size if found from file name */
+	p = strstr(fname, ",W=");
+	if (p != NULL) {
+		p += 3;
+		virtual_size = 0;
+		while (*p >= '0' && *p <= '9') {
+			virtual_size = virtual_size * 10 + (*p - '0');
+			p++;
+		}
+
+		if (*p == ':' || *p == ',' || *p == '\0') {
+			index->update_field_raw(update, DATA_HDR_VIRTUAL_SIZE,
+						&virtual_size,
+						sizeof(virtual_size));
+		}
+	}
 
 	/* set internal date */
 	if (fd != -1 && fstat(fd, &st) == 0) {




More information about the dovecot-cvs mailing list