aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/conduits
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2001-10-02 22:37:30 +0800
committerJP Rosevear <jpr@src.gnome.org>2001-10-02 22:37:30 +0800
commit7e61b6213f906bf5da46dffb19a847d37710ddd3 (patch)
treecbacf64b4bf23c5b05f8510ab05066771aaeb462 /calendar/conduits
parent1f42dd58510c9ba39863242c6da2d9d8fe024c1c (diff)
downloadgsoc2013-evolution-7e61b6213f906bf5da46dffb19a847d37710ddd3.tar.gz
gsoc2013-evolution-7e61b6213f906bf5da46dffb19a847d37710ddd3.tar.zst
gsoc2013-evolution-7e61b6213f906bf5da46dffb19a847d37710ddd3.zip
handle -1 as well (comp_from_remote_record): fix monthly by day
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 svn path=/trunk/; revision=13300
Diffstat (limited to 'calendar/conduits')
-rw-r--r--calendar/conduits/calendar/calendar-conduit.c10
1 files changed, 7 insertions, 3 deletions
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: