aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamon Chaplin <damon@ximian.com>2001-10-30 09:49:30 +0800
committerDamon Chaplin <damon@src.gnome.org>2001-10-30 09:49:30 +0800
commitdbff414ea8b585fb56d67cc80361e4bf2e26b78b (patch)
tree9de72d2d48d137f1751c5c39d101e6dbeb15bdc3
parent71657b574141241dda477a43463433a2bc5e6cd6 (diff)
downloadgsoc2013-evolution-dbff414ea8b585fb56d67cc80361e4bf2e26b78b.tar.gz
gsoc2013-evolution-dbff414ea8b585fb56d67cc80361e4bf2e26b78b.tar.zst
gsoc2013-evolution-dbff414ea8b585fb56d67cc80361e4bf2e26b78b.zip
renamed the library to libical-evolution.la, install ical.h into
2001-10-29 Damon Chaplin <damon@ximian.com> * src/libical/Makefile.am: renamed the library to libical-evolution.la, install ical.h into $includedir/evolution, with the other Evo headers. * src/libical/icalproperty.c (fold_property_line): new function to fold property lines around every 70 characters. Outlook Web Access doesn't seem to like some properties folded after the property name (e.g. UID, VTIMEZONE stuff.) Slight chance of data corruption here. * src/libical/icalvalue.c (icalvalue_text_as_ical_string): don't fold the lines here. * src/libical/icaltime.c (icaltime_from_string): DATE values should not have is_utc set to 1 - they don't have a timezone. * src/libical/icalvalue.c (icalvalue_utcoffset_as_ical_string): always round UTC offsets to the nearest minute, for compatability with Outlook. Should round data when parsing as well. svn path=/trunk/; revision=14396
-rw-r--r--libical/ChangeLog20
-rw-r--r--libical/configure.in2
-rw-r--r--libical/src/Makefile.am4
-rw-r--r--libical/src/libical/Makefile.am13
-rw-r--r--libical/src/libical/icalproperty.c70
-rw-r--r--libical/src/libical/icaltime.c2
-rw-r--r--libical/src/libical/icalvalue.c17
7 files changed, 104 insertions, 24 deletions
diff --git a/libical/ChangeLog b/libical/ChangeLog
index fde2b9b064..ed0ca6845e 100644
--- a/libical/ChangeLog
+++ b/libical/ChangeLog
@@ -1,3 +1,23 @@
+2001-10-29 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/Makefile.am: renamed the library to libical-evolution.la,
+ install ical.h into $includedir/evolution, with the other Evo headers.
+
+ * src/libical/icalproperty.c (fold_property_line): new function to
+ fold property lines around every 70 characters. Outlook Web Access
+ doesn't seem to like some properties folded after the property name
+ (e.g. UID, VTIMEZONE stuff.) Slight chance of data corruption here.
+
+ * src/libical/icalvalue.c (icalvalue_text_as_ical_string): don't fold
+ the lines here.
+
+ * src/libical/icaltime.c (icaltime_from_string): DATE values should
+ not have is_utc set to 1 - they don't have a timezone.
+
+ * src/libical/icalvalue.c (icalvalue_utcoffset_as_ical_string):
+ always round UTC offsets to the nearest minute, for compatability
+ with Outlook. Should round data when parsing as well.
+
2001-10-27 Damon Chaplin <damon@ximian.com>
* src/libical/icaltimezone.c (icaltimezone_get_display_name): added
diff --git a/libical/configure.in b/libical/configure.in
index 244f38a280..fae89b1f03 100644
--- a/libical/configure.in
+++ b/libical/configure.in
@@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(src)
-AM_INIT_AUTOMAKE(libical,0.23a)
+AM_INIT_AUTOMAKE(libical-evolution,0.23a)
AM_CONFIG_HEADER(config.h)
dnl Initialize maintainer mode
diff --git a/libical/src/Makefile.am b/libical/src/Makefile.am
index d6ba22c548..fea649ac50 100644
--- a/libical/src/Makefile.am
+++ b/libical/src/Makefile.am
@@ -4,4 +4,6 @@ else
PYTHON_DIR =
endif
-SUBDIRS = libical libicalss libicalvcal # $(PYTHON_DIR) test
+# For evolution we only build libical at present.
+SUBDIRS = libical
+#SUBDIRS = libical libicalss libicalvcal # $(PYTHON_DIR) test
diff --git a/libical/src/libical/Makefile.am b/libical/src/libical/Makefile.am
index 2173a5cc1f..e8075d58d9 100644
--- a/libical/src/libical/Makefile.am
+++ b/libical/src/libical/Makefile.am
@@ -2,7 +2,7 @@
# FILE: Makefile.am
# CREATOR: eric
#
-# $Id: Makefile.am,v 1.32 2001/10/05 20:23:26 ettore Exp $
+# $Id: Makefile.am,v 1.33 2001/10/30 01:49:30 damon Exp $
#
#
# (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
@@ -26,10 +26,10 @@
DESIGNDATA = $(top_srcdir)/design-data
ICALSCRIPTS = $(top_srcdir)/scripts
-lib_LTLIBRARIES = libical.la
+lib_LTLIBRARIES = libical-evolution.la
noinst_LTLIBRARIES = libical-static.la
-libical_static_la_SOURCES = $(libical_la_SOURCES)
+libical_static_la_SOURCES = $(libical_evolution_la_SOURCES)
libical_static_la_LDFLAGS = --all-static
YFLAGS = -d -v -t -pical_yy
@@ -46,9 +46,9 @@ INCLUDES = \
-I$(top_builddir)/src \
-I$(srcdir)
-libical_la_LDFLAGS = -version-info 0:0:0
+libical_evolution_la_LDFLAGS = -version-info 0:0:0
-libical_la_SOURCES = \
+libical_evolution_la_SOURCES = \
$(BUILT_SOURCES) \
icalarray.c \
icalarray.h \
@@ -98,7 +98,8 @@ libical_la_SOURCES = \
icallangbind.h \
icallangbind.c
-libicalincludedir = $(includedir)
+#libicalincludedir = $(includedir)/$(PACKAGE)
+libicalincludedir = $(includedir)/evolution
libicalinclude_HEADERS = ical.h
diff --git a/libical/src/libical/icalproperty.c b/libical/src/libical/icalproperty.c
index 3720432ebb..a872b17b7f 100644
--- a/libical/src/libical/icalproperty.c
+++ b/libical/src/libical/icalproperty.c
@@ -263,6 +263,49 @@ icalproperty_free (icalproperty* prop)
}
+/* This splits the property every 75 octects, as described in the spec.
+ It returns a tmp buffer.
+ NOTE: I'm not sure if it matters if we split a line in the middle of a
+ UTF-8 character. It probably won't look nice in a text editor. */
+static char*
+fold_property_line (char *text)
+{
+ int len, max_lines, line_length;
+ char *buf, *src, *dest, ch;
+
+ len = strlen (text);
+
+ /* The minimum length we split a line at is 65 characters, so calculate
+ the maximum number of newlines we will need. */
+ max_lines = ((len - 1) / 65);
+
+ /* Calculate the maximum size for the buffer we need, if we add a newline
+ character for each line, and a '\0' at the end. */
+ buf = icalmemory_tmp_buffer (len + max_lines + 1);
+
+ src = text;
+ dest = buf;
+ line_length = 0;
+ while (ch = *src) {
+ /* If the line is 65 characters or over, try to split at next space.
+ If it is 75 characters or over, split now. */
+ if ((line_length >= 65 && ch == ' ') || (line_length >= 75)) {
+ *dest++ = '\n';
+ *dest++ = ' ';
+ line_length = 0;
+ }
+
+ *dest++ = ch;
+ line_length++;
+
+ src++;
+ }
+ *dest = '\0';
+
+ return buf;
+}
+
+
char*
icalproperty_as_ical_string (icalproperty* prop)
{
@@ -305,8 +348,8 @@ icalproperty_as_ical_string (icalproperty* prop)
icalmemory_append_string(&buf, &buf_ptr, &buf_size, property_name);
- icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);
-
+ /* Outlook doesn't like a newline here. */
+ /*icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);*/
/* Determine what VALUE parameter to include. The VALUE parameters
@@ -353,10 +396,13 @@ icalproperty_as_ical_string (icalproperty* prop)
}
if(kind_string!=0){
- icalmemory_append_string(&buf, &buf_ptr, &buf_size, " ;");
- icalmemory_append_string(&buf, &buf_ptr, &buf_size, "VALUE=");
+ /* We aren't outputting a newline, so we don't want a space. */
+ /*icalmemory_append_string(&buf, &buf_ptr, &buf_size, " ;");*/
+ /*icalmemory_append_string(&buf, &buf_ptr, &buf_size, "VALUE=");*/
+ icalmemory_append_string(&buf, &buf_ptr, &buf_size, ";VALUE=");
icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string);
- icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);
+ /* No newline again. */
+ /*icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);*/
}
@@ -381,15 +427,13 @@ icalproperty_as_ical_string (icalproperty* prop)
continue;
}
- icalmemory_append_string(&buf, &buf_ptr, &buf_size, " ;");
+ icalmemory_append_string(&buf, &buf_ptr, &buf_size, ";");
icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string);
- icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);
-
}
/* Append value */
- icalmemory_append_string(&buf, &buf_ptr, &buf_size, " :");
+ icalmemory_append_string(&buf, &buf_ptr, &buf_size, ":");
value = icalproperty_get_value(prop);
@@ -407,9 +451,11 @@ icalproperty_as_ical_string (icalproperty* prop)
/* Now, copy the buffer to a tmp_buffer, which is safe to give to
the caller without worring about de-allocating it. */
-
- out_buf = icalmemory_tmp_buffer(strlen(buf)+1);
- strcpy(out_buf, buf);
+ /* We now use a function to fold the line properly every 75 characters. */
+ out_buf = fold_property_line (buf);
+
+ /*out_buf = icalmemory_tmp_buffer(strlen(buf)+1);*/
+ /*strcpy(out_buf, buf);*/
icalmemory_free_buffer(buf);
diff --git a/libical/src/libical/icaltime.c b/libical/src/libical/icaltime.c
index 3c99dfacf7..d28dbb215c 100644
--- a/libical/src/libical/icaltime.c
+++ b/libical/src/libical/icaltime.c
@@ -336,7 +336,7 @@ struct icaltimetype icaltime_from_string(const char* str)
}
} else if (size == 8) { /* A DATE */
- tt.is_utc = 1;
+ tt.is_utc = 0;
tt.is_date = 1;
} else { /* error */
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
diff --git a/libical/src/libical/icalvalue.c b/libical/src/libical/icalvalue.c
index b7852c3216..e708c35ac3 100644
--- a/libical/src/libical/icalvalue.c
+++ b/libical/src/libical/icalvalue.c
@@ -629,12 +629,18 @@ char* icalvalue_utcoffset_as_ical_string(icalvalue* value)
sign = '-';
}
+ /* We add 30 to +ve values or -29 to -ve values, since we will round to
+ the nearest minute, so we compatable with Outlook. */
+ if (data >= 0)
+ data += 30;
+ else
+ data -= 29;
+
h = data/3600;
m = (data - (h*3600))/ 60;
- s = (data - (h*3600) - (m*60));
+ /*s = (data - (h*3600) - (m*60));*/
+ s = 0;
- /* FIXME: We may want to always round to the nearest minute, to avoid
- interop problems with Outlook (2000). It doesn't like seconds here. */
if (s == 0)
sprintf(str,"%c%02d%02d",sign,abs(h),abs(m));
else
@@ -731,6 +737,10 @@ char* icalvalue_text_as_ical_string(icalvalue* value) {
}
}
+
+ /* We don't do folding here any more. We do it in
+ icalproperty_as_ical_string(). */
+#if 0
if (line_length > 65 && *p == ' '){
icalmemory_append_string(&str,&str_p,&buf_sz,"\n ");
line_length=0;
@@ -741,6 +751,7 @@ char* icalvalue_text_as_ical_string(icalvalue* value) {
icalmemory_append_string(&str,&str_p,&buf_sz,"\n ");
line_length=0;
}
+#endif
}