From 561fed0aa901f9a6286adaa4437cb5c44de86b84 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Mon, 6 Nov 2000 18:39:55 +0000 Subject: Handle both the position and weekday in the by_day field. 2000-11-06 Federico Mena Quintero * src/libical/icalvalue.c (icalvalue_recur_as_ical_string): Handle both the position and weekday in the by_day field. svn path=/trunk/; revision=6416 --- libical/src/libical/icalvalue.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'libical/src') diff --git a/libical/src/libical/icalvalue.c b/libical/src/libical/icalvalue.c index db0e58efe8..7c988a4d16 100644 --- a/libical/src/libical/icalvalue.c +++ b/libical/src/libical/icalvalue.c @@ -663,11 +663,16 @@ char* icalvalue_recur_as_ical_string(icalvalue* value) for(i=0; i< limit && array[i] != ICAL_RECURRENCE_ARRAY_MAX; i++){ if (j == 3) { /* BYDAY */ + short pos = icalrecurrencetype_day_position(array[i]); short dow = icalrecurrencetype_day_day_of_week(array[i]); char *daystr = icalenum_weekday_to_string(dow); - /* HACK, does not correctly handle the integer value */ - icalmemory_append_string(&str,&str_p,&buf_sz,daystr); + if (pos == 0) + icalmemory_append_string(&str,&str_p,&buf_sz,daystr); + else { + sprintf(temp,"%d%s",pos,daystr); + icalmemory_append_string(&str,&str_p,&buf_sz,temp); + } } else { sprintf(temp,"%d",array[i]); icalmemory_append_string(&str,&str_p,&buf_sz, temp); -- cgit v1.2.3