aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Rosevear <jpr@helixcode.com>2000-12-01 03:18:24 +0800
committerJP Rosevear <jpr@src.gnome.org>2000-12-01 03:18:24 +0800
commit24fdc5f5968e13dcc0501aac8b21d49e616fe5b3 (patch)
treefd929712dc2fdba085e97a866c185442579f0caf
parent5c542983e4f313c9e2f5b33b9106ed479ef46c23 (diff)
downloadgsoc2013-evolution-24fdc5f5968e13dcc0501aac8b21d49e616fe5b3.tar.gz
gsoc2013-evolution-24fdc5f5968e13dcc0501aac8b21d49e616fe5b3.tar.zst
gsoc2013-evolution-24fdc5f5968e13dcc0501aac8b21d49e616fe5b3.zip
Empty by_day entries are no longer indicated by ICAL_RECURRENCE_ARRAY_MAX
2000-11-30 JP Rosevear <jpr@helixcode.com> * conduits/calendar/calendar-conduit.c (local_record_from_comp): Empty by_day entries are no longer indicated by ICAL_RECURRENCE_ARRAY_MAX not SHRT_MAX. Calculate weekly and monthly by date recurrences properly (get_pilot_day): Convert ical day to corresponding integer for pilot day svn path=/trunk/; revision=6740
-rw-r--r--calendar/ChangeLog7
-rw-r--r--calendar/conduits/calendar/calendar-conduit.c58
2 files changed, 61 insertions, 4 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index c30990a93e..cd96b9f05f 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,12 @@
2000-11-30 JP Rosevear <jpr@helixcode.com>
+ * conduits/calendar/calendar-conduit.c (local_record_from_comp): Empty
+ by_day entries are no longer indicated by ICAL_RECURRENCE_ARRAY_MAX not
+ SHRT_MAX. Calculate weekly and monthly by date recurrences properly
+ (get_pilot_day): Convert ical day to corresponding integer for pilot day
+
+2000-11-30 JP Rosevear <jpr@helixcode.com>
+
* conduits/calendar/calendar-conduit.c: Debug message cleanups
(get_ical_day): Fix off-by-one error which affected weekly occurences.
(comp_from_remote_record): Monthly by day and by date were reversed
diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c
index 6f3c9e81de..cff1e6fe36 100644
--- a/calendar/conduits/calendar/calendar-conduit.c
+++ b/calendar/conduits/calendar/calendar-conduit.c
@@ -231,6 +231,29 @@ get_ical_day (int day)
return ICAL_NO_WEEKDAY;
}
+static int
+get_pilot_day (icalrecurrencetype_weekday wd)
+{
+ switch (wd) {
+ case ICAL_SUNDAY_WEEKDAY:
+ return 0;
+ case ICAL_MONDAY_WEEKDAY:
+ return 1;
+ case ICAL_TUESDAY_WEEKDAY:
+ return 2;
+ case ICAL_WEDNESDAY_WEEKDAY:
+ return 3;
+ case ICAL_THURSDAY_WEEKDAY:
+ return 4;
+ case ICAL_FRIDAY_WEEKDAY:
+ return 5;
+ case ICAL_SATURDAY_WEEKDAY:
+ return 6;
+ default:
+ return -1;
+ }
+}
+
static short
nth_weekday (int pos, icalrecurrencetype_weekday weekday)
{
@@ -330,7 +353,7 @@ local_record_from_comp (ECalLocalRecord *local, CalComponent *comp, ECalConduitC
local->local.ID = e_pilot_map_lookup_pid (ctxt->map, uid);
compute_status (ctxt, local, uid);
- local->appt = g_new0 (struct Appointment,1);
+ local->appt = g_new0 (struct Appointment, 1);
/* STOP: don't replace these with g_strdup, since free_Appointment
uses free to deallocate */
@@ -382,13 +405,40 @@ local_record_from_comp (ECalLocalRecord *local, CalComponent *comp, ECalConduitC
break;
case ICAL_WEEKLY_RECURRENCE:
local->appt->repeatType = repeatWeekly;
- for (i = 0; i<= 7 && recur->by_day[i] != SHRT_MAX; i++)
- local->appt->repeatDays[0] = 0;
+ for (i = 0; i <= 7 && recur->by_day[i] != ICAL_RECURRENCE_ARRAY_MAX; i++) {
+ icalrecurrencetype_weekday wd;
+
+ wd = icalrecurrencetype_day_day_of_week (recur->by_day[i]);
+ local->appt->repeatDays[get_pilot_day (wd)] = 1;
+ }
+
break;
case ICAL_MONTHLY_RECURRENCE:
- if (recur->by_month_day[0] != SHRT_MAX) {
+ if (recur->by_month_day[0] != ICAL_RECURRENCE_ARRAY_MAX) {
local->appt->repeatType = repeatMonthlyByDate;
+ break;
+ }
+
+ /* FIX ME Not going to work with -ve by_day */
+ local->appt->repeatType = repeatMonthlyByDay;
+ switch (icalrecurrencetype_day_position (recur->by_day[0])) {
+ case 1:
+ local->appt->repeatDay = dom1stSun;
+ break;
+ case 2:
+ local->appt->repeatDay = dom2ndSun;
+ break;
+ case 3:
+ local->appt->repeatDay = dom3rdSun;
+ break;
+ case 4:
+ local->appt->repeatDay = dom4thSun;
+ break;
+ case 5:
+ local->appt->repeatDay = domLastSun;
+ break;
}
+ local->appt->repeatDay += get_pilot_day (icalrecurrencetype_day_day_of_week (recur->by_day[0]));
break;
case ICAL_YEARLY_RECURRENCE:
local->appt->repeatType = repeatYearly;