--- mailwatch-mailbox-mbox.c 2011-10-27 11:38:43.000000000 -0400 +++ /tmp/gveldman/mailwatch-mailbox-mbox.c 2011-10-27 11:34:07.000000000 -0400 @@ -46,6 +46,7 @@ #endif #include +#include #include #include @@ -54,6 +55,7 @@ #define XFCE_MAILWATCH_MBOX_MAILBOX( p ) ( (XfceMailwatchMboxMailbox *) p ) #define BORDER ( 8 ) +#define NEW_MESG_REGEX "^From +[^ ]+ +[^ ]+ +[^ ]+ +[0-9]{1,2} +[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2} +[0-9]{4}$" typedef struct { XfceMailwatchMailbox xfce_mailwatch_mailbox; @@ -77,6 +79,11 @@ gchar *mailbox; struct stat st; guint num_new = 0; + regex_t regexnewmesg; + + if ( regcomp(®exnewmesg, NEW_MESG_REGEX, REG_EXTENDED|REG_NOSUB) != 0 ) { + return; + } g_mutex_lock( mbox->settings_mutex ); if ( !mbox->fn ) { @@ -146,7 +153,8 @@ p[nl] = 0; if ( !in_header ) { - if ( !strncmp( p, "From ", 5 ) ) { + /* if ( !strncmp( p, "From ", 5 ) ) { */ + if ( regexec(®exnewmesg, p, 0, NULL, 0) == 0 ) { in_header = TRUE; cur_new = TRUE; } @@ -195,6 +203,7 @@ mbox->size = st.st_size; } g_free( mailbox ); + regfree(®exnewmesg); } gpointer