diff -u -r --new-file wmmail-0.64-11/ChangeLog wmmail-0.64-11-sylpheed-pending-autoconf-automake/ChangeLog
--- wmmail-0.64-11/ChangeLog	2004-02-17 14:31:52.000000000 +0100
+++ wmmail-0.64-11-sylpheed-pending-autoconf-automake/ChangeLog	2004-02-18 01:24:38.000000000 +0100
@@ -1,5 +1,10 @@
 $Id: ChangeLog,v 1.10 2000/07/03 09:03:54 bryan.chan Exp $
 
+----begin changelog for patch from Alberto Gonz'alez Palomo <matmota@matracas.org>----
+- 2004-02-17: Ported 'mailbox->last_update' refactoring to 'src/sylpheed.c'.
+- 2003-02-01: Added support for Sylplheed <http://sylpheed.good-day.net/> mail
+  folders.
+----end changelog for patch----
 ----begin changelog for patch from Daniel Richard G. <skunk@iskunk.org>----
 - Factored out 'mailbox->last_update = time(NULL)' from the various
   mailbox-checking modules to wmmail.c (at least mbox.c wasn't properly
diff -u -r --new-file wmmail-0.64-11/configure.in wmmail-0.64-11-sylpheed-pending-autoconf-automake/configure.in
--- wmmail-0.64-11/configure.in	2004-02-17 14:31:52.000000000 +0100
+++ wmmail-0.64-11-sylpheed-pending-autoconf-automake/configure.in	2004-02-18 01:21:42.000000000 +0100
@@ -118,6 +118,14 @@
 fi
 AC_SUBST(MH_SUPPORT)
 
+AC_ARG_ENABLE(sylpheed, [  --disable-sylpheed	  disable sylpheed folder support], , enable_sylpheed=yes)
+if test "$enable_sylpheed" = yes; then
+  SYLPHEED_SUPPORT="#define SYLPHEED_SUPPORT"
+else
+  SYLPHEED_SUPPORT="#undef SYLPHEED_SUPPORT"
+fi
+AC_SUBST(SYLPHEED_SUPPORT)
+
 AC_ARG_ENABLE(maildir, [  --disable-maildir	  disable MailDir support], , enable_maildir=yes)
 if test "$enable_maildir" = yes; then
   MAILDIR_SUPPORT="#define MAILDIR_SUPPORT"
diff -u -r --new-file wmmail-0.64-11/debian/WMMail.1 wmmail-0.64-11-sylpheed-pending-autoconf-automake/debian/WMMail.1
--- wmmail-0.64-11/debian/WMMail.1	2004-02-17 14:31:53.000000000 +0100
+++ wmmail-0.64-11-sylpheed-pending-autoconf-automake/debian/WMMail.1	2004-02-18 01:24:07.000000000 +0100
@@ -21,7 +21,7 @@
 .\" License along with this manual; if not, write to the Free
 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 .\" MA  02111-1307  USA
-.TH WMMail.app 1 "26 Sep 2002" "WMMail.app 0.64" "Window Maker"
+.TH WMMail.app 1 "01 Feb 2003" "WMMail.app 0.64" "Window Maker"
 .SH NAME
 WMMail.app \- Window Maker Mail.app
 .SH SYNOPSIS
@@ -168,6 +168,9 @@
 mail; same number of new mails or fewer, no change; more new mails
 than last time, new mail.
 .TP
+.B sylpheed
+Same as mh.
+.TP
 .B maildir
 \fIPath\fP (string), the path to the mailbox. The state is determined
 in the same way as for \fImboxes\fP.
@@ -238,7 +241,7 @@
       UpdateInterval = 60;
 .\"      ExecuteOnUpdate = "";
       Options = {
-        Path = "~bryan/Mail/inbox"
+        Path = "~bryan/Mail/inbox";
       };
     },
     {
@@ -346,6 +349,9 @@
 by Mike Wagner <wagner@cadillac.siemens.com> and Jamie Zawinski
 <jwz@netscape.com>.
 .P
+The Sylpheed support was adapted from GKrellM's Mailwatch plugin version 2.1, 
+http://gkrellm.luon.net/mailwatch.phtml
+.P
 \fBWMMail.app\fP also contains code from:
 .TP
 .B Window Maker (http://windowmaker.org/)
diff -u -r --new-file wmmail-0.64-11/src/Makefile.am wmmail-0.64-11-sylpheed-pending-autoconf-automake/src/Makefile.am
--- wmmail-0.64-11/src/Makefile.am	2000-07-03 11:51:01.000000000 +0200
+++ wmmail-0.64-11-sylpheed-pending-autoconf-automake/src/Makefile.am	2004-02-18 01:21:42.000000000 +0100
@@ -25,8 +25,10 @@
 
 wmmail_PROGRAMS	= WMMail
 
-WMMail_SOURCES	= global.c imap.c list.c maildir.c mbox.c mh.c net.c pop3.c \
+WMMail_SOURCES	= global.c \
+		  imap.c list.c maildir.c mbox.c mh.c sylpheed.c net.c pop3.c \
 		  properties.c std_icons.c wmmail.c wmutil.c 
 
-noinst_HEADERS	= config.h imap.h list.h maildir.h mbox.h mh.h net.h pop3.h \
+noinst_HEADERS	= config.h \
+		  imap.h list.h maildir.h mbox.h mh.h sylpheed.h net.h pop3.h \
 		  properties.h std_icons.h wmmail.h wmutil.h
diff -u -r --new-file wmmail-0.64-11/src/config.h.in wmmail-0.64-11-sylpheed-pending-autoconf-automake/src/config.h.in
--- wmmail-0.64-11/src/config.h.in	2000-07-03 11:51:01.000000000 +0200
+++ wmmail-0.64-11-sylpheed-pending-autoconf-automake/src/config.h.in	2004-02-18 01:21:42.000000000 +0100
@@ -50,6 +50,9 @@
 /* support for mh folders */
 @MH_SUPPORT@
 
+/* support for sylpheed folders (similar to mh)*/
+@SYLPHEED_SUPPORT@
+
 /* support for MailDir */
 @MAILDIR_SUPPORT@
 
diff -u -r --new-file wmmail-0.64-11/src/properties.c wmmail-0.64-11-sylpheed-pending-autoconf-automake/src/properties.c
--- wmmail-0.64-11/src/properties.c	2004-02-17 14:31:53.000000000 +0100
+++ wmmail-0.64-11-sylpheed-pending-autoconf-automake/src/properties.c	2004-02-18 01:21:42.000000000 +0100
@@ -607,6 +607,11 @@
       mailbox->type = TYPE_MH;
     else
 #endif
+#ifdef SYLPHEED_SUPPORT
+    if (!strcasecmp(mailbox_type_text, "sylpheed"))
+      mailbox->type = TYPE_SYLPHEED;
+    else
+#endif
 #ifdef MAILDIR_SUPPORT
     if (!strcasecmp(mailbox_type_text, "maildir"))
       mailbox->type = TYPE_MAILDIR;
@@ -630,6 +635,9 @@
 #ifdef MH_SUPPORT
             "\"mh\", "
 #endif
+#ifdef SYLPHEED_SUPPORT
+            "\"sylpheed\", "
+#endif
 #ifdef MAILDIR_SUPPORT
             "\"MailDir\", "
 #endif
diff -u -r --new-file wmmail-0.64-11/src/sylpheed.c wmmail-0.64-11-sylpheed-pending-autoconf-automake/src/sylpheed.c
--- wmmail-0.64-11/src/sylpheed.c	1970-01-01 01:00:00.000000000 +0100
+++ wmmail-0.64-11-sylpheed-pending-autoconf-automake/src/sylpheed.c	2004-02-18 01:34:28.000000000 +0100
@@ -0,0 +1,241 @@
+/*
+ * WMMail - Window Maker Mail
+ *
+ * Copyright (c) 1996, 1997, 1998  Per Liden
+ * Copyright (c) 1997, 1998  Bryan Chan
+ * Copyright (c) 2003, 2004 Alberto Gonz'alez Palomo
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * sylpheed.c: functions to handle Sylpheed-style mail folders
+ *
+ * Version 1.0, 2003-02-01
+ * Modified from mh.c version 1.1, following the code in GKrellM
+ * Mailwatch plugin version 2.1, function "check_sylpheed_maildir()".
+ *
+ * GKrellM Mailwatch: http://gkrellm.luon.net/mailwatch.phtml
+ * Sylpheed: http://sylpheed.good-day.net/
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <ctype.h>
+#include <dirent.h>
+#include <time.h>
+#include <unistd.h>
+#include "wmmail.h"
+#include "wmutil.h"
+
+#ifdef SYLPHEED_SUPPORT
+
+/* 
+ * Supported key(s) in the Options dictionary:
+ *
+ *   Path
+ *
+ * This module contains routines to check a Sylpheed-style (similar
+ * to MH) mail folder during the periodic update of wmmail_status.
+ * We can classify a given mail folder as being in one of the states
+ * listed below.
+ *
+ * The states and their corresponding effects on wmmail_status are:
+ *
+ *   - no folder or empty folder                NO_MAIL
+ *   - no new mails                             OLD_MAIL
+ *   - same number of new mails or fewer        no change
+ *   - more new mails than last time            NEW_MAIL
+ *
+ * We assume that overriding automatically changes wmmail_status
+ * to OLD_MAIL.
+ *
+ */
+
+/* internal function */
+static int count_mail(char *, int *, int *);
+
+
+#define GET_ENTRY(x,y,z) { proplist_t sub_key = PLMakeString(z); \
+                           y = PLGetDictionaryEntry(x, sub_key); \
+                           PLRelease(sub_key); }
+
+int SYLPHEED_check(Mailbox *mailbox, int *beep, int *redraw, int *run)
+{
+  proplist_t  path;
+  char       *mailbox_path;
+  int         prev_status, 
+              prev_new_mail_count;
+
+  prev_status = mailbox->status;
+  prev_new_mail_count = mailbox->new_mail_count;
+
+  GET_ENTRY(mailbox->options, path, "Path");
+  if (path == NULL)
+  {
+    croak("mailbox \"%s\" missing option \"Path\"; ignored", mailbox->name);
+    return False;
+  }
+  else if (!PLIsString(path))
+  {
+    croak("mailbox \"%s\" has invalid path; ignored", mailbox->name);
+    return False;
+  }
+  else
+    mailbox_path = expand_path(PLGetString(path));
+
+  if ( count_mail(mailbox_path,
+                  &mailbox->total_mail_count,
+                  &mailbox->new_mail_count)   )
+  {
+    if (mailbox->total_mail_count == 0)
+    {
+      /* there is no mail in the mailbox */
+      mailbox->status = NO_MAIL;
+    }
+    else if (mailbox->new_mail_count == 0)
+    {
+      /* there are no new mails */
+      mailbox->status = OLD_MAIL;
+    }
+    else if (mailbox->new_mail_count > prev_new_mail_count)
+    {
+      /* new mails have arrived! */
+      if (mailbox->status == NEW_MAIL && always_new_mail_exec)
+        *run |= True;
+      else if (mailbox->status == NEW_MAIL)
+        *run |= False;
+      else
+        *run |= True;
+
+      *beep = True;
+
+      mailbox->status = NEW_MAIL;
+    }
+
+    /* else no change */
+  }
+  else
+  {
+    /* no such mailbox */
+    croak("error reading Sylpheed folder \"%s\"; ignored", mailbox->name);
+    wfree(mailbox_path);
+    return False;
+  }
+
+  *redraw |= (prev_status != mailbox->status);
+
+  wfree(mailbox_path);
+  return True;
+}
+
+
+#define SYLPHEED_MESSAGE_IS_NEW    1
+#define SYLPHEED_MESSAGE_IS_UNREAD 2
+#define COUNT_UNREAD_AS_NEW False
+
+static int count_mail(char *path, int *total_mail_count, int *new_mail_count)
+{
+  struct dirent *entry;
+  DIR           *folder;
+  FILE          *seq;
+  char           buf[512];
+  int            new_mail = 0,
+                 all_mail = 0,
+                 first_unseen = 0,
+                 last_unseen = 0;
+  int version;/* Read from ".sylpheed_mark": format version.        */
+  int num;    /* Read from ".sylpheed_mark": message number.        */
+  int flags;  /* Read from ".sylpheed_mark": message flags.         */
+  int files_seen   = 0;/* Files mentioned in the ".sylpheed_mark" file.   */
+  int files_in_dir = 0;/* Files physically in the directory (folder).     */
+
+  /* Count total messages. */
+  if ( !(folder = opendir(path)) )
+  {
+    croak("cannot open directory %s", path);
+    return False;
+  }
+
+  while ((entry = readdir(folder)) != NULL)
+  {
+    char *tmp = entry->d_name;
+    int   is_message = True;
+
+    while (*tmp) { (void) (isdigit(*tmp++) || (is_message = False)); }
+
+    if (is_message) { files_in_dir++; }
+  }
+
+  closedir(folder);
+
+  sprintf(buf, "%s/.sylpheed_mark", path);
+
+  /* find the new messages in the folder */
+  if (seq = fopen(buf, "r"))
+  {
+    if (fread(&version, sizeof(version), 1, seq) != 1 || version != 2)
+    {
+	fclose(seq);
+        croak(".sylpheed_mark format version not supported: %d", version);
+        return False;
+    }
+
+    while (fread(&num, sizeof(num), 1, seq) == 1)
+    {
+	if (fread(&flags, sizeof(flags), 1, seq) != 1)
+	    break;
+
+	if (flags & SYLPHEED_MESSAGE_IS_NEW)
+	    new_mail++;
+	else if (COUNT_UNREAD_AS_NEW && flags & SYLPHEED_MESSAGE_IS_UNREAD)
+	    new_mail++;
+
+	files_seen++;
+    }
+    
+    if (files_seen < files_in_dir)
+      {
+        /* This happens when new messages arrive and Sylpheed still hasn't
+         * processed that folder, such as when it's not running.
+         */
+	new_mail += (files_in_dir - files_seen);
+        all_mail = files_in_dir;
+      }
+    else
+      {
+        /* files_seen should never be greater than files_in_dir, unless
+         * the .sylpheed_mark file gets corrupted. We take all_mail from
+         * it, so that hopefully the user would notice if this number is
+         * bigger than the number of actual message files.
+         */
+        all_mail = files_seen;
+      }
+
+    fclose(seq);
+  }
+  else
+  {
+    croak(".sylpheed_mark not found or unreadable in %s", path);
+    return False;
+  }
+
+  *total_mail_count = all_mail;
+  *new_mail_count = new_mail;
+
+  return True;
+}
+
+#endif
diff -u -r --new-file wmmail-0.64-11/src/sylpheed.h wmmail-0.64-11-sylpheed-pending-autoconf-automake/src/sylpheed.h
--- wmmail-0.64-11/src/sylpheed.h	1970-01-01 01:00:00.000000000 +0100
+++ wmmail-0.64-11-sylpheed-pending-autoconf-automake/src/sylpheed.h	2004-02-18 01:21:42.000000000 +0100
@@ -0,0 +1,37 @@
+/*
+ * WMMail - Window Maker Mail
+ *
+ * Copyright (c) 1996, 1997, 1998  Per Liden
+ * Copyright (c) 1997, 1998  Bryan Chan
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * sylpheed.h: function prototypes for sylpheed.c
+ *
+ * Version 1.0, 2003-02-01
+ *
+ */
+
+#ifndef SYLPHEED_H
+#define SYLPHEED_H
+
+#include "wmmail.h"
+
+int SYLPHEED_check(Mailbox *,    /* pointer to Mailbox structure */
+                   int *,        /* whether we should beep */
+                   int *,        /* whether we should redraw */
+                   int *);       /* whether we should execute-on-new-mail */
+
+#endif
diff -u -r --new-file wmmail-0.64-11/src/wmmail.c wmmail-0.64-11-sylpheed-pending-autoconf-automake/src/wmmail.c
--- wmmail-0.64-11/src/wmmail.c	2004-02-17 14:31:53.000000000 +0100
+++ wmmail-0.64-11-sylpheed-pending-autoconf-automake/src/wmmail.c	2004-02-18 01:21:42.000000000 +0100
@@ -55,6 +55,10 @@
 #  include "mh.h"
 #endif
 
+#ifdef SYLPHEED_SUPPORT
+#  include "sylpheed.h"
+#endif
+
 #ifdef MAILDIR_SUPPORT
 #  include "maildir.h"
 #endif
@@ -100,7 +104,7 @@
 
 void help(void)
 {
-  fprintf(stderr, 
+  fprintf(stderr,
     "WMMail version %s%s by Bryan Chan (bryan.chan@utoronto.ca)\n"
     "based on asmail version 0.50, by Per Liden (per@rsn.hk-r.se)\n"
     "\n"
@@ -603,6 +607,11 @@
 	  ret = MH_check(mailbox, &beep, &redraw, &run);
         else
 #endif
+#ifdef SYLPHEED_SUPPORT
+        if (IS_SYLPHEED(mailbox))
+	  ret = SYLPHEED_check(mailbox, &beep, &redraw, &run);
+        else
+#endif
 #ifdef MAILDIR_SUPPORT
         if (IS_MAILDIR(mailbox))
 	  ret = MAILDIR_check(mailbox, &beep, &redraw, &run);
diff -u -r --new-file wmmail-0.64-11/src/wmmail.h wmmail-0.64-11-sylpheed-pending-autoconf-automake/src/wmmail.h
--- wmmail-0.64-11/src/wmmail.h	2004-02-17 14:31:53.000000000 +0100
+++ wmmail-0.64-11-sylpheed-pending-autoconf-automake/src/wmmail.h	2004-02-18 01:21:42.000000000 +0100
@@ -77,14 +77,17 @@
 #ifdef MH_SUPPORT
 #  define TYPE_MH            (1<<1)
 #endif
+#ifdef SYLPHEED_SUPPORT
+#  define TYPE_SYLPHEED      (1<<2)
+#endif
 #ifdef MAILDIR_SUPPORT
-#  define TYPE_MAILDIR       (1<<2)
+#  define TYPE_MAILDIR       (1<<3)
 #endif
 #ifdef POP3_SUPPORT
-#  define TYPE_POP3          (1<<3)
+#  define TYPE_POP3          (1<<4)
 #endif
 #ifdef IMAP_SUPPORT
-#  define TYPE_IMAP          (1<<4)
+#  define TYPE_IMAP          (1<<5)
 #endif
 
 #ifdef MBOX_SUPPORT
@@ -93,6 +96,9 @@
 #ifdef MH_SUPPORT
 #  define IS_MH(x)           ((x)->type & TYPE_MH)
 #endif
+#ifdef SYLPHEED_SUPPORT
+#  define IS_SYLPHEED(x)     ((x)->type & TYPE_SYLPHEED)
+#endif
 #ifdef MAILDIR_SUPPORT
 #  define IS_MAILDIR(x)      ((x)->type & TYPE_MAILDIR)
 #endif
