Package: watch-maildirs
Version: 1.1.1-1.1
Severity: wishlist
Tags: upstream patch


The watch_maildirs program only detects mailboxes starting with a '.', as
specified by the Maildir++ "standard".  Plain old Maildir does not use
a leading period for mailboxes, but is otherwise (for the purposes of this
program) identical.

The attached patch provides good-enough Maildir support for my daily use.

-- System Information:
Debian Release: 6.0
  APT prefers sid
  APT policy: (500, 'sid'), (500, 'unstable'), (500, 'testing'), (1, 
'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.36-toi+ (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages watch-maildirs depends on:
ii  libc6                         2.11.2-7   Embedded GNU C Library: Shared lib
ii  libgcc1                       1:4.4.5-10 GCC support library
ii  libglib2.0-0                  2.24.2-1   The GLib library of C routines
ii  libstdc++6                    4.4.5-10   The GNU Standard C++ Library v3

Versions of packages watch-maildirs recommends:
ii  openssh-server [ssh-server]   1:5.5p1-6  secure shell (SSH) server, for sec

watch-maildirs suggests no packages.

-- no debconf information
diff -rU3 mswatch-1.1.1/src/watch_maildirs/inotify/watcher_base.cc mswatch-1.1.1-1.1/src/watch_maildirs/inotify/watcher_base.cc
--- mswatch-1.1.1/src/watch_maildirs/inotify/watcher_base.cc	2008-09-11 22:20:04.000000000 -0400
+++ mswatch-1.1.1-1.1/src/watch_maildirs/inotify/watcher_base.cc	2011-01-10 13:20:50.000000000 -0500
@@ -41,7 +41,7 @@
 	if (event.mask & IN_DELETE_SELF)
 		exit(1);
 
-	if (!(event.mask & IN_ISDIR && !strncmp(event.name, ".", 1)))
+	if (!(event.mask & IN_ISDIR))
 		return; // event does not involve a Maildir
 
 	if (event.mask & (IN_CREATE | IN_MOVED_TO))
diff -rU3 mswatch-1.1.1/src/watch_maildirs/watch_maildirs.cc mswatch-1.1.1-1.1/src/watch_maildirs/watch_maildirs.cc
--- mswatch-1.1.1/src/watch_maildirs/watch_maildirs.cc	2008-09-11 22:20:04.000000000 -0400
+++ mswatch-1.1.1-1.1/src/watch_maildirs/watch_maildirs.cc	2011-01-11 12:11:35.000000000 -0500
@@ -63,8 +63,10 @@
 		return "INBOX";
 	else
 	{
-		assert(maildir[0] == '.');
-		return maildir.substr(1);
+		if (maildir[0] == '.')
+			return maildir.substr(1);
+		else
+			return maildir;
 	}
 }
 
diff -rU3 mswatch-1.1.1/src/watch_maildirs/watch_maildirs.h mswatch-1.1.1-1.1/src/watch_maildirs/watch_maildirs.h
--- mswatch-1.1.1/src/watch_maildirs/watch_maildirs.h	2010-02-17 18:06:46.000000000 -0500
+++ mswatch-1.1.1-1.1/src/watch_maildirs/watch_maildirs.h	2011-01-11 12:14:41.000000000 -0500
@@ -52,7 +52,7 @@
 // Notify that a maildir has been modified
 void send_maildir_modified(const char* imap_name);
 
-// Output the Malidir rooted at 'base_maildir' and all Maildir++s
+// Output the Malidir rooted at 'base_maildir' and all Maildir(++)s
 template<typename OutputIter>
 void add_maildirs(const char* base_maildir, OutputIter maildirs, OutputIter partial_maildirs)
 {
@@ -81,7 +81,11 @@
 		}
 		else if (ep->d_type != DT_DIR)
 			continue;
-		if (strncmp(ep->d_name, ".", 1))
+		if (!strcmp(ep->d_name, "cur"))
+			continue;
+		if (!strcmp(ep->d_name, "new"))
+			continue;
+		if (!strcmp(ep->d_name, "tmp"))
 			continue;
 		if (!strcmp(ep->d_name, ".") || !strcmp(ep->d_name, ".."))
 			continue;

Reply via email to