diff options
-rw-r--r-- | calendar/ChangeLog | 7 | ||||
-rw-r--r-- | calendar/conduits/calendar/calendar-conduit.c | 10 |
2 files changed, 14 insertions, 3 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index dbb63ec191..d4644fad33 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,10 @@ +2001-10-02 JP Rosevear <jpr@ximian.com> + + * conduits/calendar/calendar-conduit.c (nth_weekday): handle -1 as + well + (comp_from_remote_record): fix monthly by day recurrences and + handle "last" day type + 2001-10-01 Damon Chaplin <damon@ximian.com> * gui/dialogs/comp-editor.c (comp_editor_destroy): unref the page diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c index 0301cbfb90..676d65462c 100644 --- a/calendar/conduits/calendar/calendar-conduit.c +++ b/calendar/conduits/calendar/calendar-conduit.c @@ -326,9 +326,9 @@ is_empty_time (struct tm time) static short nth_weekday (int pos, icalrecurrencetype_weekday weekday) { - g_assert (pos > 0 && pos <= 5); + g_assert ((pos > 0 && pos <= 5) || (pos == -1)); - return (pos << 3) | (int) weekday; + return ((abs (pos) * 8) + weekday) * (pos < 0 ? -1 : 1); } static GList * @@ -704,7 +704,11 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, case repeatMonthlyByDay: recur.freq = ICAL_MONTHLY_RECURRENCE; recur.interval = appt.repeatFrequency; - recur.by_day[0] = nth_weekday (appt.repeatDay / 5, get_ical_day (appt.repeatDay % 5 - 1)); + if (appt.repeatDay < domLastSun) + recur.by_day[0] = nth_weekday ((appt.repeatDay / 7) + 1, + get_ical_day (appt.repeatDay % 7)); + else + recur.by_day[0] = nth_weekday (-1, get_ical_day (appt.repeatDay % 7)); break; case repeatMonthlyByDate: |