diff -urN courier-0.35.1/imap/fetch.c courier-0.35.1-quota/imap/fetch.c
--- courier-0.35.1/imap/fetch.c	Thu Sep  6 05:01:30 2001
+++ courier-0.35.1-quota/imap/fetch.c	Fri Oct 19 23:11:54 2001
@@ -154,8 +154,6 @@
 char    *p, *q, *r;
 int	rc=0;
 struct	imapflags old_flags;
-struct	stat	stat_buf;
-char	quotabuf[QUOTABUFSIZE];
 
 	get_message_flags(mi, 0, &old_flags);
 	p=malloc(strlen(mi->filename)+20);
@@ -172,44 +170,8 @@
 	strcat(strcat(strcpy(r, current_mailbox), "/cur/"), p);
 	if (strcmp(q, r))
 	{
-		if (!is_trash(current_mailbox)	/* Changes in TRASH take no
-						** effect.
-						*/
-			&& old_flags.deleted != flags->deleted
-			&& maildir_getquota(current_mailbox, quotabuf) == 0
-			&& fstat(fd, &stat_buf) == 0)
-		{
-		long	nbytes;
-		unsigned long unbytes;
-		int	nmsgs=1;
-		int	quotafd;
-
-			if (maildir_parsequota(mi->filename, &unbytes) == 0)
-				nbytes=unbytes;
-			else
-				nbytes=stat_buf.st_size;
-			if ( flags->deleted )
-			{
-				nbytes= -nbytes;
-				nmsgs= -nmsgs;
-			}
-			if ( maildir_checkquota(current_mailbox, &quotafd,
-				quotabuf, nbytes, nmsgs) && errno != EAGAIN &&
-				nbytes >= 0)
-			{
-				if (quotafd >= 0)	close(quotafd);
-				rc= -1;
-			}
-			else
-			{
-				maildir_addquota(current_mailbox, quotafd,
-					quotabuf, nbytes, nmsgs);
-				if (quotafd >= 0)	close(quotafd);
-			}
-		}
-
-		if (rc == 0)
-			rename(q, r);
+	  rc = 0;
+	  rename(q, r);
 	}
 	free(q);
 	free(r);
diff -urN courier-0.35.1/imap/imapd.c courier-0.35.1-quota/imap/imapd.c
--- courier-0.35.1/imap/imapd.c	Sun Aug 26 18:16:42 2001
+++ courier-0.35.1-quota/imap/imapd.c	Fri Oct 19 23:11:47 2001
@@ -660,7 +660,7 @@
 	}
 #endif
 #endif
-	if (!is_trash(mailbox) && maildir_getquota(mailbox, quotabuf) == 0)
+	if (maildir_getquota(mailbox, quotabuf) == 0)
 	{
 	int	quotafd;
 
@@ -1020,6 +1020,7 @@
 struct imapflags flags;
 char	*old_name;
 int	move_to_trash=0;
+char	quotabuf[QUOTABUFSIZE];
 
 	fetch_free_cache();
 
@@ -1029,6 +1030,13 @@
 
 	for (j=0; j < current_mailbox_info.nmessages; j++)
 	{
+	  
+	  long	nbytes= 0;
+	  unsigned long unbytes;
+	  int	nmsgs=1;
+	  int	quotafd;
+		    
+
 		get_message_flags(current_mailbox_info.msgs+j, 0, &flags);
 
 		if (!flags.deleted)
@@ -1036,6 +1044,25 @@
 
 		old_name=alloc_filename(current_mailbox,
 			current_mailbox_info.msgs[j].filename);
+
+
+		maildir_getquota(current_mailbox, quotabuf);
+		
+		if (maildir_parsequota(old_name,&unbytes) == 0 )
+		  nbytes=unbytes;
+		
+		nbytes= -nbytes;
+		nmsgs= -nmsgs;
+		
+		if ( maildir_checkquota(current_mailbox, &quotafd, quotabuf, nbytes, nmsgs) && errno != EAGAIN && nbytes >= 0)
+		  {
+		    if (quotafd >= 0)       close(quotafd);
+		  }
+		else
+		  {
+		    maildir_addquota(current_mailbox, quotafd, quotabuf, nbytes, nmsgs);
+		    if (quotafd >= 0)       close(quotafd);
+		  }
 
 		if (is_sharedsubdir(current_mailbox))
 		{
diff -urN courier-0.35.1/imap/storeinfo.c courier-0.35.1-quota/imap/storeinfo.c
--- courier-0.35.1/imap/storeinfo.c	Tue Aug 29 06:32:12 2000
+++ courier-0.35.1-quota/imap/storeinfo.c	Fri Oct 19 23:12:35 2001
@@ -262,8 +262,6 @@
 int	fd;
 
 	--n;
-	if (is_trash(info->destmailbox))
-		return (0);	/* No problems dumping everything into trash */
 
 	fd=imapscan_openfile(current_mailbox, &current_mailbox_info, n);
 	if (fd < 0)	return (0);
diff -urN courier-0.35.1/maildir/maildirquota.c courier-0.35.1-quota/maildir/maildirquota.c
--- courier-0.35.1/maildir/maildirquota.c	Tue Jul 24 14:27:13 2001
+++ courier-0.35.1-quota/maildir/maildirquota.c	Fri Oct 19 23:13:40 2001
@@ -549,7 +549,7 @@
 int	n;
 
 	if ( *subdir != '.' || strcmp(subdir, ".") == 0 ||
-		strcmp(subdir, "..") == 0 || strcmp(subdir, ".Trash") == 0)
+	     strcmp(subdir, "..") == 0 )
 		return (0);
 
 	p=(char *)malloc(strlen(dir)+strlen(subdir)+2);
@@ -587,7 +587,7 @@
 int	n;
 
 	if ( *subdir != '.' || strcmp(subdir, ".") == 0 ||
-		strcmp(subdir, "..") == 0 || strcmp(subdir, ".Trash") == 0)
+		strcmp(subdir, "..") == 0 )
 		return (0);
 
 	p=(char *)malloc(strlen(dir)+strlen(subdir)+2);
@@ -625,12 +625,10 @@
 			n += 3;
 			while (*n >= 'A' && *n <= 'Z')
 			{
-				if (*n == 'T')	break;
 				++n;
 			}
 			break;
 		}
-		if (*n == 'T')	continue;
 		n=de->d_name;
 
 
