aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog18
-rw-r--r--calendar/cal-util/calobj.c30
-rw-r--r--calendar/calobj.c30
-rw-r--r--calendar/pcs/calobj.c30
-rw-r--r--calendar/timeutil.c16
5 files changed, 110 insertions, 14 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 1b4a413eb2..7f71d04c2a 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,21 @@
+1999-07-14 Miguel de Icaza <miguel@gnu.org>
+
+ * calobj.c (ical_gen_uid): Returns a UID.
+ (ical_object_new): Use a UID when creating an event. Should get
+ syncing done easier.
+
+1999-07-14 Nicholas J Kreucher <nick@poetic.com>
+
+ * calobj.c (skip_numbers): Actually skip over the numbers.
+ (ical_object_to_vobject): Test the proper variable for storing the
+ proper information.
+
+1999-07-14 Jean-Noel Guiheneuf <jean-noel.guiheneuf@wanadoo.fr>
+
+ * timeutil.c (time_add_month): Fixed the problem with next month
+ going from a 31-day to a 30-day by adjusting the date to the
+ closest day at the end of the month.
+
1999-06-07 Mike McEwan <mike@lotusland.demon.co.uk>
* timeutil.c (time_add_month): Tell ktime' that we don't know
diff --git a/calendar/cal-util/calobj.c b/calendar/cal-util/calobj.c
index 7b85fdc54c..0ab8c1c004 100644
--- a/calendar/cal-util/calobj.c
+++ b/calendar/cal-util/calobj.c
@@ -10,10 +10,33 @@
#include <string.h>
#include <glib.h>
#include <ctype.h>
+#include <unistd.h>
#include "calobj.h"
#include "timeutil.h"
#include "../libversit/vcc.h"
+static char *
+ical_gen_uid (void)
+{
+ static char *domain;
+ time_t t = time (NULL);
+
+ if (!domain){
+ char buffer [128];
+
+ getdomainname (buffer, sizeof (buffer)-1);
+ domain = g_strdup (domain);
+ }
+
+ return g_strdup_printf (
+ "%s-%d-%d-%d@%s",
+ isodate_from_time_t (t),
+ getpid (),
+ getgid (),
+ getppid (),
+ domain);
+}
+
iCalObject *
ical_object_new (void)
{
@@ -23,7 +46,8 @@ ical_object_new (void)
ico->seq = -1;
ico->dtstamp = time (NULL);
-
+ ico->uid = ical_gen_uid ();
+
return ico;
}
@@ -165,7 +189,7 @@ skip_numbers (char **str)
if (!isdigit (**str))
return;
while (**str && isdigit (**str))
- ;
+ (*str)++;
}
}
@@ -939,7 +963,7 @@ ical_object_to_vobject (iCalObject *ical)
store_list (o, VCCategoriesProp, ical->categories);
/* resources */
- if (ical->categories)
+ if (ical->resources)
store_list (o, VCCategoriesProp, ical->resources);
/* priority */
diff --git a/calendar/calobj.c b/calendar/calobj.c
index 7b85fdc54c..0ab8c1c004 100644
--- a/calendar/calobj.c
+++ b/calendar/calobj.c
@@ -10,10 +10,33 @@
#include <string.h>
#include <glib.h>
#include <ctype.h>
+#include <unistd.h>
#include "calobj.h"
#include "timeutil.h"
#include "../libversit/vcc.h"
+static char *
+ical_gen_uid (void)
+{
+ static char *domain;
+ time_t t = time (NULL);
+
+ if (!domain){
+ char buffer [128];
+
+ getdomainname (buffer, sizeof (buffer)-1);
+ domain = g_strdup (domain);
+ }
+
+ return g_strdup_printf (
+ "%s-%d-%d-%d@%s",
+ isodate_from_time_t (t),
+ getpid (),
+ getgid (),
+ getppid (),
+ domain);
+}
+
iCalObject *
ical_object_new (void)
{
@@ -23,7 +46,8 @@ ical_object_new (void)
ico->seq = -1;
ico->dtstamp = time (NULL);
-
+ ico->uid = ical_gen_uid ();
+
return ico;
}
@@ -165,7 +189,7 @@ skip_numbers (char **str)
if (!isdigit (**str))
return;
while (**str && isdigit (**str))
- ;
+ (*str)++;
}
}
@@ -939,7 +963,7 @@ ical_object_to_vobject (iCalObject *ical)
store_list (o, VCCategoriesProp, ical->categories);
/* resources */
- if (ical->categories)
+ if (ical->resources)
store_list (o, VCCategoriesProp, ical->resources);
/* priority */
diff --git a/calendar/pcs/calobj.c b/calendar/pcs/calobj.c
index 7b85fdc54c..0ab8c1c004 100644
--- a/calendar/pcs/calobj.c
+++ b/calendar/pcs/calobj.c
@@ -10,10 +10,33 @@
#include <string.h>
#include <glib.h>
#include <ctype.h>
+#include <unistd.h>
#include "calobj.h"
#include "timeutil.h"
#include "../libversit/vcc.h"
+static char *
+ical_gen_uid (void)
+{
+ static char *domain;
+ time_t t = time (NULL);
+
+ if (!domain){
+ char buffer [128];
+
+ getdomainname (buffer, sizeof (buffer)-1);
+ domain = g_strdup (domain);
+ }
+
+ return g_strdup_printf (
+ "%s-%d-%d-%d@%s",
+ isodate_from_time_t (t),
+ getpid (),
+ getgid (),
+ getppid (),
+ domain);
+}
+
iCalObject *
ical_object_new (void)
{
@@ -23,7 +46,8 @@ ical_object_new (void)
ico->seq = -1;
ico->dtstamp = time (NULL);
-
+ ico->uid = ical_gen_uid ();
+
return ico;
}
@@ -165,7 +189,7 @@ skip_numbers (char **str)
if (!isdigit (**str))
return;
while (**str && isdigit (**str))
- ;
+ (*str)++;
}
}
@@ -939,7 +963,7 @@ ical_object_to_vobject (iCalObject *ical)
store_list (o, VCCategoriesProp, ical->categories);
/* resources */
- if (ical->categories)
+ if (ical->resources)
store_list (o, VCCategoriesProp, ical->resources);
/* priority */
diff --git a/calendar/timeutil.c b/calendar/timeutil.c
index 77a468471e..10b9483af0 100644
--- a/calendar/timeutil.c
+++ b/calendar/timeutil.c
@@ -141,11 +141,10 @@ time_add_month (time_t time, int months)
{
struct tm *tm = localtime (&time);
time_t new_time;
+ int mday;
- /* FIXME: this will not work correctly when switching, say, from a 31-day month to a 30-day
- * month. Figure out the number of days in the month and go to the nearest "limit" day.
- */
-
+ mday = tm->tm_mday;
+
tm->tm_mon += months;
tm->tm_isdst = -1;
if ((new_time = mktime (tm)) == -1){
@@ -153,7 +152,14 @@ time_add_month (time_t time, int months)
print_time_t (time);
return time;
}
- return new_time;
+ tm = localtime (&new_time);
+ if (tm->tm_mday < mday){
+ tm->tm_mon--;
+ tm->tm_mday = time_days_in_month (tm->tm_year+1900, tm->tm_mon);
+ return new_time = mktime (tm);
+ }
+ else
+ return new_time;
}
time_t