Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:pchenthill
evolution-data-server
daylight_savings.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File daylight_savings.diff of Package evolution-data-server
Index: servers/groupwise/e-gw-item.h =================================================================== --- servers/groupwise/e-gw-item.h (revision 7590) +++ servers/groupwise/e-gw-item.h (working copy) @@ -27,6 +27,7 @@ #include <libsoup/soup-soap-message.h> #include <libsoup/soup-soap-response.h> #include "e-gw-recur-utils.h" +#include "e-gw-timezone.h" G_BEGIN_DECLS @@ -299,6 +300,9 @@ int e_gw_item_get_trigger (EGwItem *item); void e_gw_item_set_trigger (EGwItem *item, int trigger); +void e_gw_item_set_timezone (EGwItem *item, EGwTimezone *timezone); +EGwTimezone *e_gw_item_get_timezone (EGwItem *item); + gboolean e_gw_item_has_attachment (EGwItem *item); typedef struct { Index: servers/groupwise/e-gw-recur-utils.c =================================================================== --- servers/groupwise/e-gw-recur-utils.c (revision 7590) +++ servers/groupwise/e-gw-recur-utils.c (working copy) @@ -25,8 +25,13 @@ #endif #include "e-gw-recur-utils.h" +#define OCCURENCE_MAX 7 + const char *days_of_week[7] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; +const char *occurrence_types [OCCURENCE_MAX] = {E_GW_ITEM_RECUR_OCCURRENCE_TYPE_FIRST, E_GW_ITEM_RECUR_OCCURRENCE_TYPE_SECOND, + E_GW_ITEM_RECUR_OCCURRENCE_TYPE_THIRD, E_GW_ITEM_RECUR_OCCURRENCE_TYPE_FOURTH, + E_GW_ITEM_RECUR_OCCURRENCE_TYPE_FIFTH, E_GW_ITEM_RECUR_OCCURRENCE_TYPE_LAST}; const char * e_gw_recur_get_day_of_week (short day) { @@ -36,5 +41,13 @@ return days_of_week [day-1]; } - - +const char * +e_gw_recur_get_occurrence_type (gshort pos) +{ + if (pos < -1 || pos > 4 || pos == 0) + return ""; + if (pos == -1) + return occurrence_types [OCCURENCE_MAX + pos]; + else + return occurrence_types [pos -1]; +} Index: servers/groupwise/e-gw-recur-utils.h =================================================================== --- servers/groupwise/e-gw-recur-utils.h (revision 7590) +++ servers/groupwise/e-gw-recur-utils.h (working copy) @@ -23,6 +23,7 @@ #ifndef E_GW_RECUR_UTILS_H #define E_GW_RECUR_UTILS_H +#include <glib.h> #define E_GW_ITEM_RECURRENCE_FREQUENCY_DAILY "Daily" #define E_GW_ITEM_RECURRENCE_FREQUENCY_WEEKLY "Weekly" @@ -65,8 +66,7 @@ #define E_GW_ITEM_RECUR_END_MARKER 0x7f7f - - const char *e_gw_recur_get_day_of_week (short day); +const char *e_gw_recur_get_occurrence_type (gshort pos); #endif Index: servers/groupwise/Makefile.am =================================================================== --- /home/test/cvs/gnome2/evolution-data-server/servers/groupwise/Makefile.am 2005-08-13 08:03:16.000000000 +0530 +++ servers/groupwise/Makefile.am 2007-01-25 15:53:00.000000000 +0530 @@ -38,7 +38,9 @@ libegroupwise_1_2_la_SOURCES = \ e-gw-recur-utils.h \ e-gw-proxy.h \ e-gw-proxy.c \ - build-timestamp.h + build-timestamp.h \ + e-gw-timezone.c \ + e-gw-timezone.h libegroupwise_1_2_la_LIBADD = \ $(E_DATA_SERVER_LIBS) \ @@ -54,6 +54,7 @@ libegroupwiseinclude_HEADERS = e-gw-container.h \ e-gw-message.h \ e-gw-item.h \ + e-gw-timezone.h \ e-gw-sendoptions.h \ e-gw-filter.h \ e-gw-recur-utils.h \ Index: servers/groupwise/e-gw-item.c =================================================================== --- servers/groupwise/e-gw-item.c (revision 7590) +++ servers/groupwise/e-gw-item.c (working copy) @@ -124,6 +124,10 @@ GHashTable *additions; GHashTable *updates; GHashTable *deletions; + + /* Timezone */ + EGwTimezone *timezone; + /*padding*/ unsigned int padding[10]; }; @@ -456,6 +460,11 @@ free_changes (priv->additions); free_changes (priv->deletions); free_changes (priv->updates); + + if (priv->timezone) { + g_object_unref (priv->timezone); + priv->timezone = NULL; + } } @@ -533,6 +542,7 @@ priv->link_info = NULL; priv->msg_body_id = NULL; priv->has_attachment = FALSE; + priv->timezone = NULL; item->priv = priv; @@ -2745,6 +2755,23 @@ return item->priv->link_info; } +void +e_gw_item_set_timezone (EGwItem *item, EGwTimezone *timezone) +{ + g_return_if_fail (timezone != NULL || E_IS_GW_TIMEZONE (timezone)); + g_return_if_fail (E_IS_GW_ITEM (item)); + + item->priv->timezone = timezone; +} + +EGwTimezone * +e_gw_item_get_timezone (EGwItem *item) +{ + g_return_val_if_fail (E_IS_GW_ITEM (item), NULL); + + return item->priv->timezone; +} + static void add_return_notification (SoupSoapMessage *msg, char *option, EGwItemReturnNotify value) { @@ -3218,6 +3245,10 @@ } e_gw_message_write_string_parameter (msg, "place", NULL, priv->place ? priv->place : ""); + /* Timezone */ + if (item->priv->timezone) + e_gw_timezone_append_to_soap_message (item->priv->timezone, msg); + break; case E_GW_ITEM_TYPE_TASK : Index: calendar/backends/groupwise/e-cal-backend-groupwise-utils.c =================================================================== --- calendar/backends/groupwise/e-cal-backend-groupwise-utils.c (revision 7590) +++ calendar/backends/groupwise/e-cal-backend-groupwise-utils.c (working copy) @@ -520,6 +520,81 @@ } } +static EGwTimezone * +build_gwtz_from_icaltz (icaltimezone *tz) +{ + icalcomponent *icalcomp, *subcomp[2]; + EGwTimezone *timezone; + char *tzid = NULL; + guint i; + + icalcomp = icaltimezone_get_component (tz); + timezone = e_gw_timezone_new (); + + tzid = icaltimezone_get_tzid (tz); + e_gw_timezone_set_id (timezone, tzid); + + subcomp [0] = icalcomponent_get_first_component (icalcomp, ICAL_XSTANDARD_COMPONENT); + subcomp [1] = icalcomponent_get_first_component (icalcomp, ICAL_XDAYLIGHT_COMPONENT); + + for (i=0; i<2 && subcomp [i]; i++) { + const char *tzname; + icalproperty *icalprop; + struct icaltimetype dtstart; + EGwTzComp *tzcomp; + gint utc_offset; + + tzcomp = e_gw_tzcomp_new (); + + icalprop = icalcomponent_get_first_property (subcomp [i], ICAL_TZNAME_PROPERTY); + if (icalprop) + tzname = icalproperty_get_tzname (icalprop); + if (tzname) + e_gw_tzcomp_set_name (tzcomp, tzname); + + icalprop = icalcomponent_get_first_property (subcomp [i], ICAL_RRULE_PROPERTY); + if (icalprop) { + struct icalrecurrencetype ical_recur; + + ical_recur = icalproperty_get_rrule (icalprop); + + if (ical_recur.by_month [0] != ICAL_RECURRENCE_ARRAY_MAX) + e_gw_tzcomp_set_month (tzcomp, ical_recur.by_month [0]); + + if (ical_recur.by_day [0] != ICAL_RECURRENCE_ARRAY_MAX) { + icalrecurrencetype_weekday weekday; + gint occurrence; + + weekday = icalrecurrencetype_day_day_of_week (ical_recur.by_day [0]); + e_gw_tzcomp_set_dayofweek (tzcomp, weekday); + + occurrence = icalrecurrencetype_day_position (ical_recur.by_day [0]); + /* FIXME Handle -2 second last, -3 third last etc */ + e_gw_tzcomp_set_occurrence (tzcomp, occurrence); + } + } + + icalprop = icalcomponent_get_first_property (subcomp [i], ICAL_TZOFFSETTO_PROPERTY); + + if (!icalprop) { + g_warning ("The timezone component does not have an utc offset \n"); + e_gw_tzcomp_free (tzcomp); + return NULL; + } + + utc_offset = icalproperty_get_tzoffsetto (icalprop); + e_gw_tzcomp_set_offset (tzcomp, utc_offset); + + dtstart = icalcomponent_get_dtstart (subcomp [i]); + e_gw_tzcomp_set_hour (tzcomp, dtstart.hour); + e_gw_tzcomp_set_minute (tzcomp, dtstart.minute); + + e_gw_timezone_set_component (timezone, tzcomp, i); + } + + return timezone; +} + static EGwItem * set_properties_from_cal_component (EGwItem *item, ECalComponent *comp, ECalBackendGroupwise *cbgw) { @@ -531,8 +606,9 @@ int *priority; GSList *categories; GSList *slist, *sl; - icaltimezone *default_zone, *utc; + icaltimezone *default_zone, *utc, *zone=NULL; struct icaltimetype itt_utc; + EGwTimezone *timezone = NULL; default_zone = e_cal_backend_groupwise_get_default_zone (cbgw); utc = icaltimezone_get_utc_timezone (); @@ -570,17 +646,22 @@ e_gw_item_set_trigger (item, duration); } - - /* end date */ e_cal_component_get_dtend (comp, &dt); if (dt.value) { - if (!icaltime_get_timezone (*dt.value)) - icaltime_set_timezone (dt.value, default_zone ? default_zone : utc); + if (dt.tzid) + zone = icaltimezone_get_builtin_timezone_from_tzid (dt.tzid); + if (!zone) + zone = default_zone; + + icaltime_set_timezone (dt.value, zone ? zone : utc); itt_utc = icaltime_convert_to_zone (*dt.value, utc); e_gw_item_set_end_date (item, icaltime_as_ical_string (itt_utc)); } - + + timezone = build_gwtz_from_icaltz (zone); + e_gw_item_set_timezone (item, timezone); + break; case E_CAL_COMPONENT_TODO : @@ -662,8 +743,13 @@ /* start date */ e_cal_component_get_dtstart (comp, &dt); if (dt.value) { - if (!icaltime_get_timezone (*dt.value)) - icaltime_set_timezone (dt.value, default_zone); + if (dt.tzid) + zone = icaltimezone_get_builtin_timezone_from_tzid (dt.tzid); + if (!zone) + zone = default_zone; + + icaltime_set_timezone (dt.value, zone ? zone : utc); + itt_utc = icaltime_convert_to_zone (*dt.value, utc); e_gw_item_set_start_date (item, icaltime_as_ical_string (itt_utc)); } else if (e_gw_item_get_item_type (item) == E_GW_ITEM_TYPE_APPOINTMENT) { --- /dev/null 2006-06-16 18:37:58.000000000 +0530 +++ servers/groupwise/e-gw-timezone.h 2007-01-24 11:56:51.000000000 +0530 @@ -0,0 +1,86 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Authors : + * Chenthill Palnisamy <pchenthill@novell.com> + * + * Copyright 2003, Novell, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU Lesser General Public + * License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ + + +#ifndef E_GW_TIMEZONE_H +#define E_GW_TIMEZONE_H + +#include <libsoup/soup-soap-message.h> + +G_BEGIN_DECLS + +#define E_TYPE_GW_TIMEZONE (e_gw_timezone_get_type ()) +#define E_GW_TIMEZONE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_GW_TIMEZONE, EGwTimezone)) +#define E_GW_TIMEZONE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_GW_TIMEZONE, EGwTimezoneClass)) +#define E_IS_GW_TIMEZONE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_GW_TIMEZONE)) +#define E_IS_GW_TIMEZONE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_GW_TIMEZONE)) + +typedef struct _EGwTimezone EGwTimezone; +typedef struct _EGwTimezoneClass EGwTimezoneClass; +typedef struct _EGwTimezonePrivate EGwTimezonePrivate; +typedef struct _EGwTzComp EGwTzComp; + +struct _EGwTimezone { + GObject parent; + EGwTimezonePrivate *priv; +}; + +struct _EGwTimezoneClass { + GObjectClass parent_class; +}; + +GType e_gw_timezone_get_type (void); +EGwTimezone *e_gw_timezone_new (void); +void e_gw_timezone_set_description (EGwTimezone *timezone, const char *desc); +void e_gw_timezone_set_id (EGwTimezone *timezone, const char *id); +void e_gw_timezone_set_component (EGwTimezone *timezone, EGwTzComp *tzcomp, gboolean daylight); + +const char *e_gw_timezone_get_description (EGwTimezone *timezone); +const char *e_gw_timezone_get_id (EGwTimezone *timezone); +const EGwTzComp *e_gw_timezone_get_component (EGwTimezone *timezone, gboolean daylight); + +EGwTzComp *e_gw_tzcomp_new (void); +void e_gw_tzcomp_set_name (EGwTzComp *comp, const char *name); +void e_gw_tzcomp_set_month (EGwTzComp *comp, gshort month); +void e_gw_tzcomp_set_day (EGwTzComp *comp, gshort day); +void e_gw_tzcomp_set_dayofweek (EGwTzComp *comp, gshort dayofweek); +void e_gw_tzcomp_set_hour (EGwTzComp *comp, gshort hour); +void e_gw_tzcomp_set_minute (EGwTzComp *comp, gshort minute); +void e_gw_tzcomp_set_offset (EGwTzComp *comp, gint offset); +void e_gw_tzcomp_set_occurrence (EGwTzComp *comp, gshort occurrence); + +const char *e_gw_tzcomp_get_name (EGwTzComp *comp); +gshort e_gw_tzcomp_get_month (EGwTzComp *comp); +gshort e_gw_tzcomp_get_day (EGwTzComp *comp); +gshort e_gw_tzcomp_get_dayofweek (EGwTzComp *comp); +gshort e_gw_tzcomp_get_hour (EGwTzComp *comp); +gshort e_gw_tzcomp_get_minute (EGwTzComp *comp); +gint e_gw_tzcomp_get_offset (EGwTzComp *comp); +gshort e_gw_tzcomp_get_occurrence (EGwTzComp *comp); + +void e_gw_tzcomp_free (EGwTzComp *tzcomp); + +void e_gw_timezone_append_to_soap_message (EGwTimezone *timezone, SoupSoapMessage *message); + +G_END_DECLS + +#endif --- /dev/null 2006-06-16 18:37:58.000000000 +0530 +++ servers/groupwise/e-gw-timezone.c 2007-01-25 14:47:48.000000000 +0530 @@ -0,0 +1,453 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Authors : + * Chenthill Palanisamy <pchenthill@novell.com> + * Copyright 2003, Novell, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU Lesser General Public + * License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <string.h> +#include <glib.h> +#include "e-gw-timezone.h" +#include "e-gw-message.h" +#include "e-gw-recur-utils.h" + +struct _EGwTimezonePrivate { + char *id; + char *desc; + EGwTzComp *standard; + EGwTzComp *daylight; +}; + +struct _EGwTzComp { + char *name; + gshort month; + gshort day; + gshort hour; + gshort minute; + gint offset; + + gshort dayofweek; + gshort occurrence; +}; + +static GObjectClass *parent_class = NULL; +static void e_gw_timezone_dispose (GObject *object); +static void e_gw_timezone_finalize (GObject *object); +static void e_gw_timezone_init (EGwTimezone *timezone, EGwTimezoneClass *klass); +static void e_gw_timezone_class_init (EGwTimezoneClass *klass); + +GType +e_gw_timezone_get_type (void) +{ + static GType type = 0; + + if (!type) { + static GTypeInfo info = { + sizeof (EGwTimezoneClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) e_gw_timezone_class_init, + NULL, NULL, + sizeof (EGwTimezone), + 0, + (GInstanceInitFunc) e_gw_timezone_init + }; + if (!(type = g_type_from_name ("EGwTimezone"))) + type = g_type_register_static (G_TYPE_OBJECT, "EGwTimezone",&info, 0); + } + + return type; +} + + +static void +e_gw_timezone_class_init (EGwTimezoneClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + parent_class = g_type_class_peek_parent (klass); + + object_class->dispose = e_gw_timezone_dispose; + object_class->finalize = e_gw_timezone_finalize; +} + +static void +e_gw_timezone_init (EGwTimezone *timezone, EGwTimezoneClass *klass) +{ + EGwTimezonePrivate *priv; + + priv = g_new0 (EGwTimezonePrivate, 1); + priv->id = NULL; + priv->desc = NULL; + priv->standard = NULL; + priv->daylight = NULL; + + timezone->priv = priv; +} + +static void +e_gw_timezone_dispose (GObject *object) +{ + +} + +static void +e_gw_timezone_finalize (GObject *object) +{ + EGwTimezone *timezone = (EGwTimezone *) object; + EGwTimezonePrivate *priv; + + g_return_if_fail (E_IS_GW_TIMEZONE (timezone)); + + priv = timezone->priv; + + if (priv->id) { + g_free (priv->id); + priv->id = NULL; + } + + if (priv->desc) { + g_free (priv->desc); + priv->desc = NULL; + } + + if (priv->standard) { + e_gw_tzcomp_free (priv->standard); + priv->standard = NULL; + } + + if (priv->daylight) { + e_gw_tzcomp_free (priv->daylight); + priv->daylight = NULL; + } + + g_free (priv); + timezone->priv = NULL; + + if (parent_class->finalize) + (* parent_class->finalize) (object); +} + +EGwTimezone * +e_gw_timezone_new (void) +{ + EGwTimezone *timezone; + + timezone = g_object_new (E_TYPE_GW_TIMEZONE, NULL); + + return timezone; +} + +void +e_gw_timezone_set_description (EGwTimezone *timezone, const char *desc) +{ + g_return_if_fail (desc != NULL); + g_return_if_fail (E_IS_GW_TIMEZONE (timezone)); + + if (timezone->priv->desc) + g_free (timezone->priv->desc); + + timezone->priv->desc = g_strdup (desc); +} + +void +e_gw_timezone_set_id (EGwTimezone *timezone, const char *id) +{ + g_return_if_fail (id != NULL); + g_return_if_fail (E_IS_GW_TIMEZONE (timezone)); + + if (timezone->priv->id) + g_free (timezone->priv->id); + + timezone->priv->id = g_strdup (id); +} + +void +e_gw_timezone_set_component (EGwTimezone *timezone, EGwTzComp *tzcomp, gboolean daylight) +{ + g_return_if_fail (tzcomp != NULL); + g_return_if_fail (E_IS_GW_TIMEZONE (timezone)); + + if (daylight) { + if (timezone->priv->daylight) + e_gw_tzcomp_free (timezone->priv->daylight); + timezone->priv->daylight = tzcomp; + + } else { + if (timezone->priv->standard) + e_gw_tzcomp_free (timezone->priv->standard); + timezone->priv->standard = tzcomp; + } +} + +const char * +e_gw_timezone_get_description (EGwTimezone *timezone) +{ + g_return_val_if_fail (E_IS_GW_TIMEZONE (timezone), NULL); + + return timezone->priv->desc; +} + +const char * +e_gw_timezone_get_id (EGwTimezone *timezone) +{ + g_return_val_if_fail (E_IS_GW_TIMEZONE (timezone), NULL); + + return timezone->priv->id; +} + +const EGwTzComp * +e_gw_timezone_get_component (EGwTimezone *timezone, gboolean daylight) +{ + g_return_val_if_fail (E_IS_GW_TIMEZONE (timezone), NULL); + + if (daylight) + return timezone->priv->daylight; + else + return timezone->priv->standard; +} + +EGwTzComp * +e_gw_tzcomp_new (void) +{ + EGwTzComp *tzcomp; + + tzcomp = g_new0 (EGwTzComp, 1); + + tzcomp->name = NULL; + tzcomp->day = -1; + tzcomp->dayofweek = -1; + tzcomp->hour = -1; + tzcomp->minute = -1; + + return tzcomp; +} + +void +e_gw_tzcomp_set_name (EGwTzComp *tzcomp, const char *name) +{ + g_return_if_fail (tzcomp != NULL); + g_return_if_fail (name != NULL); + + tzcomp->name = g_strdup (name); +} + +void +e_gw_tzcomp_set_month (EGwTzComp *tzcomp, gshort month) +{ + g_return_if_fail (tzcomp != NULL); + g_return_if_fail (month > 0 && month < 13); + + tzcomp->month = month; +} + +void +e_gw_tzcomp_set_day (EGwTzComp *tzcomp, gshort day) +{ + g_return_if_fail (tzcomp != NULL); + g_return_if_fail (day > 0 && day < 32); + + tzcomp->day = day; +} + +void +e_gw_tzcomp_set_dayofweek (EGwTzComp *tzcomp, gshort dayofweek) +{ + g_return_if_fail (tzcomp != NULL); + g_return_if_fail (dayofweek >=0 && dayofweek < 8); + + tzcomp->dayofweek = dayofweek; +} + +void +e_gw_tzcomp_set_hour (EGwTzComp *tzcomp, gshort hour) +{ + g_return_if_fail (tzcomp != NULL); + g_return_if_fail (hour >= 0 && hour < 24); + + tzcomp->hour = hour; +} + +void +e_gw_tzcomp_set_minute (EGwTzComp *tzcomp, gshort minute) +{ + g_return_if_fail (tzcomp != NULL); + g_return_if_fail (minute >= 0 && minute < 60); + + tzcomp->minute = minute; +} + +void +e_gw_tzcomp_set_offset (EGwTzComp *tzcomp, gint offset) +{ + g_return_if_fail (tzcomp != NULL); + + tzcomp->offset = offset; +} + +void +e_gw_tzcomp_set_occurrence (EGwTzComp *tzcomp, gshort occurrence) +{ + g_return_if_fail (tzcomp != NULL); + g_return_if_fail (occurrence >= -1 && occurrence != 0 && occurrence < 4); + + tzcomp->occurrence = occurrence; +} + +const char * +e_gw_tzcomp_get_name (EGwTzComp *tzcomp) +{ + g_return_val_if_fail (tzcomp != NULL, NULL); + + return tzcomp->name; +} + +gshort +e_gw_tzcomp_get_month (EGwTzComp *tzcomp) +{ + g_return_val_if_fail (tzcomp != NULL, -1); + + return tzcomp->month; +} + + +gshort +e_gw_tzcomp_get_day (EGwTzComp *tzcomp) +{ + g_return_val_if_fail (tzcomp != NULL, -1); + + return tzcomp->day; +} + +gshort +e_gw_tzcomp_get_dayofweek (EGwTzComp *tzcomp) +{ + g_return_val_if_fail (tzcomp != NULL, -1); + + return tzcomp->dayofweek; +} + +gshort +e_gw_tzcomp_get_hour (EGwTzComp *tzcomp) +{ + g_return_val_if_fail (tzcomp != NULL, -1); + + return tzcomp->hour; +} + +gshort +e_gw_tzcomp_get_minute (EGwTzComp *tzcomp) +{ + g_return_val_if_fail (tzcomp != NULL, -1); + + return tzcomp->minute; +} + +gint +e_gw_tzcomp_get_offset (EGwTzComp *tzcomp) +{ + g_return_val_if_fail (tzcomp != NULL, -1); + + return tzcomp->offset; +} + +gshort +e_gw_tzcomp_get_occurrence (EGwTzComp *tzcomp) +{ + g_return_val_if_fail (tzcomp != NULL, 0); + + return tzcomp->occurrence; +} + +void +e_gw_tzcomp_free (EGwTzComp *tzcomp) +{ + g_return_if_fail (tzcomp != NULL); + + if (tzcomp->name) { + g_free (tzcomp->name); + tzcomp->name = NULL; + } + + tzcomp->day = -1; + tzcomp->hour = -1; + tzcomp->dayofweek = -1; + tzcomp->minute = -1; + tzcomp->occurrence = 0; +} + +static void +append_tzcomp_to_soap (EGwTzComp *tzcomp, SoupSoapMessage *message) +{ + if (tzcomp->name) + e_gw_message_write_string_parameter (message, "name", NULL, tzcomp->name); + + if (tzcomp->month != -1) + e_gw_message_write_int_parameter (message, "month", NULL, tzcomp->month); + + if (tzcomp->day != -1) + e_gw_message_write_int_parameter (message, "day", NULL, tzcomp->day); + + if (tzcomp->dayofweek != -1) + e_gw_message_write_string_parameter_with_attribute (message, "dayOfWeek", NULL, e_gw_recur_get_day_of_week (tzcomp->dayofweek), + "occurrence", e_gw_recur_get_occurrence_type (tzcomp->occurrence)); + + if (tzcomp->hour != -1) + e_gw_message_write_int_parameter (message, "hour", NULL, tzcomp->hour); + + if (tzcomp->minute != -1) + e_gw_message_write_int_parameter (message, "minute", NULL, tzcomp->minute); + + e_gw_message_write_int_parameter (message, "offset", NULL, tzcomp->offset); +} + +void +e_gw_timezone_append_to_soap_message (EGwTimezone *timezone, SoupSoapMessage *message) +{ + EGwTimezonePrivate *priv; + + g_return_if_fail (timezone != NULL); + g_return_if_fail (message != NULL); + + priv = timezone->priv; + + soup_soap_message_start_element (message, "timezone", NULL, NULL); + + if (priv->id) + e_gw_message_write_string_parameter (message, "id", NULL, priv->id); + + if (priv->desc) + e_gw_message_write_string_parameter (message, "description", NULL, priv->desc); + + if (priv->standard) { + soup_soap_message_start_element (message, "standard", NULL, NULL); + append_tzcomp_to_soap (priv->standard, message); + soup_soap_message_end_element (message); + } + + if (priv->daylight) { + soup_soap_message_start_element (message, "daylight", NULL, NULL); + append_tzcomp_to_soap (priv->daylight, message); + soup_soap_message_end_element (message); + } + + soup_soap_message_end_element (message); +}
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor