From 5b5ae41e209c41d310c8380b55f18cdc2097a289 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 12 Apr 2002 22:16:42 +0000 Subject: Treat commas as token delimeters. (WEEKDAY_CHARS): Use full weekday names 2002-04-12 Jeffrey Stedfast * broken-date-parser.c (datetok): Treat commas as token delimeters. (WEEKDAY_CHARS): Use full weekday names in case the broken mailer used the full names. (MONTH_CHARS): Same as above but for months. svn path=/trunk/; revision=16456 --- camel/ChangeLog | 8 ++++++++ camel/broken-date-parser.c | 45 +++++++++++++++++++++++---------------------- 2 files changed, 31 insertions(+), 22 deletions(-) (limited to 'camel') diff --git a/camel/ChangeLog b/camel/ChangeLog index 343e98921d..417c265a20 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,11 @@ +2002-04-12 Jeffrey Stedfast + + * broken-date-parser.c (datetok): Treat commas as token + delimeters. + (WEEKDAY_CHARS): Use full weekday names in case the broken mailer + used the full names. + (MONTH_CHARS): Same as above but for months. + 2002-04-11 Not Zed * providers/local/camel-spool-summary.c (spool_summary_sync_full): diff --git a/camel/broken-date-parser.c b/camel/broken-date-parser.c index 00971fa9c7..7bcff0ffd4 100644 --- a/camel/broken-date-parser.c +++ b/camel/broken-date-parser.c @@ -38,8 +38,8 @@ #define d(x) x #define NUMERIC_CHARS "1234567890" -#define WEEKDAY_CHARS "Sun,Mon,Tue,Wed,Thu,Fri,Sat," -#define MONTH_CHARS "JanFebMarAprMayJunJulAugSepOctNovDec" +#define WEEKDAY_CHARS "SundayMondayTuesdayWednesdayThursdayFridaySaturday" +#define MONTH_CHARS "JanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember" #define TIMEZONE_ALPHA_CHARS "UTCGMTESTEDTCSTCDTMSTPSTPDTZAMNY()" #define TIMEZONE_NUMERIC_CHARS "-+1234567890" #define TIME_CHARS "1234567890:" @@ -53,23 +53,23 @@ #define DATE_TOKEN_NON_TIMEZONE_NUMERIC (1 << 6) #define DATE_TOKEN_HAS_SIGN (1 << 7) -static unsigned int datetok_table[256] = { - 128,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111, - 111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111, - 111,111,111,111,111,111,111,111, 79, 79,111,175,109,175,111,111, - 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,119,111,111,111,111,111, - 111, 75,111, 79, 75, 79,105, 79,111,111,107,111,111, 73, 75,107, - 79,111,111, 73, 77, 79,111,109,111, 79, 79,111,111,111,111,111, - 111,105,107,107,109,105,111,107,109,109,111,111,107,111,105,105, - 107,111,105,111,105,105,107,111,111,107,111,111,111,111,111,111, - 111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111, - 111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111, - 111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111, - 111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111, - 111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111, - 111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111, - 111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111, - 111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111, +static unsigned char datetok_table[256] = { + 128,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111, + 111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111, + 111,111,111,111,111,111,111,111, 79, 79,111,175,111,175,111,111, + 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,119,111,111,111,111,111, + 111, 75,111, 79, 75, 79,105, 79,111,111,107,111,111, 73, 75,107, + 79,111,111, 73, 77, 79,111,109,111, 79, 79,111,111,111,111,111, + 111,105,107,107,109,105,111,107,105,105,111,111,107,107,105,105, + 107,111,105,105,105,105,107,111,111,105,111,111,111,111,111,111, + 111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111, + 111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111, + 111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111, + 111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111, + 111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111, + 111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111, + 111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111, + 111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111, }; /* hrm, is there a library for this shit? */ @@ -127,7 +127,7 @@ datetok (const char *date) mask = 0; /* find the end of this token */ - for (end = start; *end && !isspace ((int) *end) && (end > start ? !strchr ("-/", *end) : TRUE); end++) { + for (end = start; *end && !strchr ("-/,\t\r\n ", *end); end++) { mask |= datetok_table[*end]; } @@ -302,6 +302,7 @@ get_tzone (struct _date_token **token) return -1; } +/* This is where things get interesting... ;-) */ #define date_token_mask(t) (((struct _date_token *) t)->mask) #define is_numeric(t) ((date_token_mask (t) & DATE_TOKEN_NON_NUMERIC) == 0) @@ -403,9 +404,9 @@ decode_broken_date (struct _date_token *tokens, int *tzone) d(printf ("\n")); time = mktime (&tm); -#if defined(HAVE_TIMEZONE) +#if defined (HAVE_TIMEZONE) time -= timezone; -#elif defined(HAVE_TM_GMTOFF) +#elif defined (HAVE_TM_GMTOFF) time += tm.tm_gmtoff; #else #error Neither HAVE_TIMEZONE nor HAVE_TM_GMTOFF defined. Rerun autoheader, autoconf, etc. -- cgit v1.2.3