aboutsummaryrefslogtreecommitdiffstats
path: root/libical
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2001-01-19 22:55:26 +0800
committerJP Rosevear <jpr@src.gnome.org>2001-01-19 22:55:26 +0800
commit5b6b5aff4268e3d99193ea5087728603b0124b85 (patch)
treef9124aed03d74328f1a2a5df8db439f3bda7b752 /libical
parent01b71061169c94e7b7d1f3941a59e2bb9af43bd1 (diff)
downloadgsoc2013-evolution-5b6b5aff4268e3d99193ea5087728603b0124b85.tar.gz
gsoc2013-evolution-5b6b5aff4268e3d99193ea5087728603b0124b85.tar.zst
gsoc2013-evolution-5b6b5aff4268e3d99193ea5087728603b0124b85.zip
add -ve sign to output of duration if appropriate.
2001-01-19 JP Rosevear <jpr@ximian.com> * src/libical/icalvalue.c.in (icalvalue_duration_as_ical_string): add -ve sign to output of duration if appropriate. (icalvalue_trigger_as_ical_string): implement. not happy how this is done with the -1 for is_date trick but it will do for now and period does things in a similar way. svn path=/trunk/; revision=7645
Diffstat (limited to 'libical')
-rw-r--r--libical/src/libical/icalvalue.c.in30
1 files changed, 25 insertions, 5 deletions
diff --git a/libical/src/libical/icalvalue.c.in b/libical/src/libical/icalvalue.c.in
index 7adcecb990..ae48207f42 100644
--- a/libical/src/libical/icalvalue.c.in
+++ b/libical/src/libical/icalvalue.c.in
@@ -3,7 +3,7 @@
FILE: icalvalue.c
CREATOR: eric 02 May 1999
- $Id: icalvalue.c.in,v 1.1 2000/12/11 22:06:02 federico Exp $
+ $Id: icalvalue.c.in,v 1.2 2001/01/19 14:55:26 jpr Exp $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
@@ -838,7 +838,8 @@ void append_duration_segment(char** buf, char** buf_ptr, size_t* buf_size,
}
-char* icalvalue_duration_as_ical_string(icalvalue* value) {
+char* icalvalue_duration_as_ical_string(icalvalue* value)
+{
struct icaldurationtype data;
char *buf, *output_line;
@@ -851,6 +852,8 @@ char* icalvalue_duration_as_ical_string(icalvalue* value) {
buf = (char*)icalmemory_new_buffer(buf_size);
buf_ptr = buf;
+ if (data.is_neg)
+ icalmemory_append_string(&buf, &buf_ptr, &buf_size, "-");
icalmemory_append_string(&buf, &buf_ptr, &buf_size, "P");
@@ -1081,16 +1084,33 @@ char* icalvalue_period_as_ical_string(icalvalue* value) {
return str;
}
-char* icalvalue_trigger_as_ical_string(icalvalue* value) {
+char* icalvalue_trigger_as_ical_string(icalvalue* value)
+{
union icaltriggertype data;
char* str;
+ icalvalue *e;
+
icalerror_check_arg_rz( (value!=0),"value");
data = icalvalue_get_trigger(value);
-
+
str = (char*)icalmemory_tmp_buffer(60);
- sprintf(str,"icalvalue_trigger_as_ical_string is not implemented yet");
+ if (data.time.is_date != -1){
+ /* use the absolute date */
+ e = icalvalue_new_datetime(data.time);
+
+ strcpy (str, icalvalue_datetime_as_ical_string(e));
+
+ } else {
+ /* use the duration */
+ e = icalvalue_new_duration(data.duration);
+
+ strcpy (str, icalvalue_duration_as_ical_string(e));
+
+ }
+
+ icalvalue_free(e);
return str;
}