wmail: strip leading white-space when doing skip-name comparisons.
This commit is contained in:
parent
116d47e6e1
commit
b25ef198e3
|
@ -992,13 +992,15 @@ static void ParseMBoxFile( struct stat *fileStat )
|
||||||
if( fromFound )
|
if( fromFound )
|
||||||
UpdateChecksum( &checksum, buf );
|
UpdateChecksum( &checksum, buf );
|
||||||
|
|
||||||
if( fromFound && PREFIX_MATCHES( buf, "from: ", false ))
|
if( fromFound && PREFIX_MATCHES( buf, "From:", false ))
|
||||||
{
|
{
|
||||||
if( SkipSender( buf+6 ))
|
char *addr = buf + sizeof "From:";
|
||||||
|
|
||||||
|
if( SkipSender( addr ))
|
||||||
goto NEXTMAIL;
|
goto NEXTMAIL;
|
||||||
|
|
||||||
char *name;
|
char *name;
|
||||||
if(( name = ParseFromField( buf+6 )) == NULL )
|
if(( name = ParseFromField( addr )) == NULL )
|
||||||
{
|
{
|
||||||
WARNING( "Could not parse From field\n" );
|
WARNING( "Could not parse From field\n" );
|
||||||
break;
|
break;
|
||||||
|
@ -1008,9 +1010,10 @@ static void ParseMBoxFile( struct stat *fileStat )
|
||||||
++numMails;
|
++numMails;
|
||||||
fromFound = 0;
|
fromFound = 0;
|
||||||
checksum = 0;
|
checksum = 0;
|
||||||
} else if( config.considerStatusField &&
|
}
|
||||||
PREFIX_MATCHES( buf, "status: ", false ) &&
|
else if( config.considerStatusField &&
|
||||||
strstr( buf+8, config.readStatus ) == NULL )
|
PREFIX_MATCHES( buf, "Status:", false ) &&
|
||||||
|
strstr( buf + sizeof "Status:", config.readStatus ) == NULL )
|
||||||
{
|
{
|
||||||
RemoveLastName();
|
RemoveLastName();
|
||||||
--numMails;
|
--numMails;
|
||||||
|
@ -1030,7 +1033,7 @@ NEXTMAIL:
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ParseMaildirFile( const char *fileName, unsigned long checksum,
|
static void ParseMaildirFile( const char *fileName, unsigned long checksum,
|
||||||
struct stat *fileStat, bool isNewMail )
|
struct stat *fileStat, bool isNewMail )
|
||||||
{
|
{
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
struct utimbuf timeStruct;
|
struct utimbuf timeStruct;
|
||||||
|
@ -1044,13 +1047,15 @@ static void ParseMaildirFile( const char *fileName, unsigned long checksum,
|
||||||
|
|
||||||
while( fgets( buf, sizeof buf, f ) != NULL )
|
while( fgets( buf, sizeof buf, f ) != NULL )
|
||||||
{
|
{
|
||||||
if( PREFIX_MATCHES( buf, "from: ", false ))
|
if( PREFIX_MATCHES( buf, "From:", false ))
|
||||||
{
|
{
|
||||||
if( SkipSender( buf+6 ))
|
char *addr = buf + sizeof "From:";
|
||||||
|
|
||||||
|
if( SkipSender( addr ))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
char *name;
|
char *name;
|
||||||
if(( name = ParseFromField( buf+6 )) == NULL )
|
if(( name = ParseFromField( addr )) == NULL )
|
||||||
{
|
{
|
||||||
WARNING( "Could not parse From field\n" );
|
WARNING( "Could not parse From field\n" );
|
||||||
break;
|
break;
|
||||||
|
@ -1255,6 +1260,9 @@ static bool SkipSender( char *address )
|
||||||
if( address[len - 1] == '\n' )
|
if( address[len - 1] == '\n' )
|
||||||
address[len - 1] = '\0';
|
address[len - 1] = '\0';
|
||||||
|
|
||||||
|
while( isspace( *address ))
|
||||||
|
address++;
|
||||||
|
|
||||||
for( skipName = config.skipNames;
|
for( skipName = config.skipNames;
|
||||||
skipName != NULL && *skipName != NULL; skipName++ )
|
skipName != NULL && *skipName != NULL; skipName++ )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue