From: Art Cancro Date: Mon, 5 Jan 2009 21:04:57 +0000 (+0000) Subject: * icaltime_from_webform() now populates struct icaltimetype directly instead of conve... X-Git-Tag: v7.86~1653 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=05c44eb3f726caa4b2bab912ebd92068d7bb6644 * icaltime_from_webform() now populates struct icaltimetype directly instead of converting tm->time_t->icaltimetype. This fixes an edge case where the user submits a date that falls during DST but the *current* date is not DST, or vice versa; the old code got it wrong in this case. --- diff --git a/webcit/calendar_tools.c b/webcit/calendar_tools.c index b2d9fb090..334e6a7d3 100644 --- a/webcit/calendar_tools.c +++ b/webcit/calendar_tools.c @@ -122,27 +122,24 @@ void display_icaltimetype_as_webform(struct icaltimetype *t, char *prefix, int d */ void icaltime_from_webform(struct icaltimetype *t, char *prefix) { char vname[32]; - struct tm tm; - struct icaltimetype t2; - /* Stuff tm with zero values */ - memset(&tm, 0, sizeof(struct tm)); + /* Stuff with zero values */ + memset(t, 0, sizeof(struct icaltimetype)); - /* Get the year/month/date all in one shot */ - strptime((char*)BSTR(prefix), "%Y-%m-%d", &tm); + /* Get the year/month/date all in one shot -- it will be in ISO YYYY-MM-DD format */ + sscanf((char*)BSTR(prefix), "%04d-%02d-%02d", &t->year, &t->month, &t->day); /* hour */ sprintf(vname, "%s_hour", prefix); - tm.tm_hour = IBSTR(vname); + t->hour = IBSTR(vname); /* minute */ sprintf(vname, "%s_minute", prefix); - tm.tm_min = IBSTR(vname); + t->minute = IBSTR(vname); - /* now convert to icaltimetyepe */ - t2 = icaltime_from_timet_with_zone(mktime(&tm), 0, get_default_icaltimezone()); - t2.zone = get_default_icaltimezone(); - memcpy(t, &t2, sizeof(struct icaltimetype)); + /* time zone is set to the default zone for this server */ + t->is_utc = 0; + t->zone = get_default_icaltimezone(); } diff --git a/webcit/preferences.c b/webcit/preferences.c index a2efb4402..8118e6eb8 100644 --- a/webcit/preferences.c +++ b/webcit/preferences.c @@ -599,10 +599,9 @@ InitModule_PREFERENCES RegisterPreference("signature",_("Use this signature:"),PRF_QP_STRING); RegisterPreference("default_header_charset", _("Default character set for email headers:") ,PRF_STRING); RegisterPreference("emptyfloors", _("Show empty floors"), PRF_YESNO); - RegisterPreference("defaultfrom", _("Prefered Email Address"), PRF_STRING); - RegisterPreference("defaultname", _("Prefered Email Sendername"), PRF_STRING); - RegisterPreference("defaulthandle", _("Prefered Name for posting messages"), PRF_STRING); - + RegisterPreference("defaultfrom", _("Preferred email address"), PRF_STRING); + RegisterPreference("defaultname", _("Preferred display name for email messages"), PRF_STRING); + RegisterPreference("defaulthandle", _("Preferred display name for bulletin board posts"), PRF_STRING); RegisterNamespace("PREF:VALUE", 1, 2, tmplput_CFG_Value, CTX_NONE); RegisterNamespace("PREF:DESCR", 1, 1, tmplput_CFG_Descr, CTX_NONE);