aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-04-13 06:16:42 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-04-13 06:16:42 +0800
commit5b5ae41e209c41d310c8380b55f18cdc2097a289 (patch)
treebcc8c7fa209904527e9496a2cc1c107383cb6d4f /camel
parent883cf4d18043bef8c5d44902ecec4379757cf35c (diff)
downloadgsoc2013-evolution-5b5ae41e209c41d310c8380b55f18cdc2097a289.tar.gz
gsoc2013-evolution-5b5ae41e209c41d310c8380b55f18cdc2097a289.tar.zst
gsoc2013-evolution-5b5ae41e209c41d310c8380b55f18cdc2097a289.zip
Treat commas as token delimeters. (WEEKDAY_CHARS): Use full weekday names
2002-04-12 Jeffrey Stedfast <fejj@ximian.com> * 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
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog8
-rw-r--r--camel/broken-date-parser.c45
2 files changed, 31 insertions, 22 deletions
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 <fejj@ximian.com>
+
+ * 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 <NotZed@Ximian.com>
* 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.