aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/conduits/todo
diff options
context:
space:
mode:
authorJP Rosevear <jpr@helixcode.com>2000-09-21 05:13:41 +0800
committerJP Rosevear <jpr@src.gnome.org>2000-09-21 05:13:41 +0800
commit2f0f910e8113733d87dde0b51dbe3b925e7fc74e (patch)
tree297ee3d111e404bdc7a0047020687f017e594827 /calendar/conduits/todo
parentf8497c912d9418a6bef5082f6a77416859abf473 (diff)
downloadgsoc2013-evolution-2f0f910e8113733d87dde0b51dbe3b925e7fc74e.tar
gsoc2013-evolution-2f0f910e8113733d87dde0b51dbe3b925e7fc74e.tar.gz
gsoc2013-evolution-2f0f910e8113733d87dde0b51dbe3b925e7fc74e.tar.bz2
gsoc2013-evolution-2f0f910e8113733d87dde0b51dbe3b925e7fc74e.tar.lz
gsoc2013-evolution-2f0f910e8113733d87dde0b51dbe3b925e7fc74e.tar.xz
gsoc2013-evolution-2f0f910e8113733d87dde0b51dbe3b925e7fc74e.tar.zst
gsoc2013-evolution-2f0f910e8113733d87dde0b51dbe3b925e7fc74e.zip
Add since field to context
2000-09-20 JP Rosevear <jpr@helixcode.com> * conduits/todo/todo-conduit.h: Add since field to context * conduits/todo/todo-conduit.c (map_set_node_timet): New utility function (map_sax_start_element): Look for the map timestamp as well (map_write): Write the map timestamp (pre_sync): Use the map time stamp when looking for changed entries * pcs/cal-backend.c (cal_backend_log_sax_start_element): Make sure we are in a valid timestamp svn path=/trunk/; revision=5527
Diffstat (limited to 'calendar/conduits/todo')
-rw-r--r--calendar/conduits/todo/todo-conduit.c32
-rw-r--r--calendar/conduits/todo/todo-conduit.h1
2 files changed, 29 insertions, 4 deletions
diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c
index f456b6e81d..61bf8f9cab 100644
--- a/calendar/conduits/todo/todo-conduit.c
+++ b/calendar/conduits/todo/todo-conduit.c
@@ -149,24 +149,46 @@ map_name (EToDoConduitContext *ctxt)
{
char *filename;
+
filename = g_strdup_printf ("%s/evolution/local/Calendar/pilot-map-%d.xml", g_get_home_dir (), ctxt->cfg->pilot_id);
return filename;
}
static void
+map_set_node_timet (xmlNodePtr node, const char *name, time_t t)
+{
+ char *tstring;
+
+ tstring = g_strdup_printf ("%ld", t);
+ xmlSetProp (node, name, tstring);
+}
+
+static void
map_sax_start_element (void *data, const xmlChar *name,
const xmlChar **attrs)
{
EToDoConduitContext *ctxt = (EToDoConduitContext *)data;
-
+
+ if (!strcmp (name, "PilotMap")) {
+ while (attrs && *attrs != NULL) {
+ const xmlChar **val = attrs;
+
+ val++;
+ if (!strcmp (*attrs, "timestamp"))
+ ctxt->since = (time_t)strtoul (*val, NULL, 0);
+
+ attrs = ++val;
+ }
+ }
+
if (!strcmp (name, "map")) {
char *uid = NULL;
guint32 *pid = g_new (guint32, 1);
*pid = 0;
- while (*attrs != NULL) {
+ while (attrs && *attrs != NULL) {
const xmlChar **val = attrs;
val++;
@@ -217,6 +239,7 @@ map_write (EToDoConduitContext *ctxt, char *filename)
return -1;
}
doc->root = xmlNewDocNode(doc, NULL, "PilotMap", NULL);
+ map_set_node_timet (doc->root, "timestamp", time (NULL));
g_hash_table_foreach (ctxt->map, map_write_foreach, doc->root);
@@ -585,13 +608,14 @@ pre_sync (GnomePilotConduit *conduit,
handler.startElement = map_sax_start_element;
filename = map_name (ctxt);
- if (xmlSAXUserParseFile (&logSAXParser, ctxt, filename) < 0)
+ if (xmlSAXUserParseFile (&handler, ctxt, filename) < 0)
return -1;
g_free (filename);
/* Find the added, modified and deleted items */
- changes = cal_client_get_changed_uids (ctxt->client, CALOBJ_TYPE_TODO, 0);
+ changes = cal_client_get_changed_uids (ctxt->client, CALOBJ_TYPE_TODO,
+ ctxt->since);
for (l = changes; l != NULL; l = l->next) {
CalObjChange *coc = l->data;
diff --git a/calendar/conduits/todo/todo-conduit.h b/calendar/conduits/todo/todo-conduit.h
index 9e9a02e6db..20eb9ddd2d 100644
--- a/calendar/conduits/todo/todo-conduit.h
+++ b/calendar/conduits/todo/todo-conduit.h
@@ -63,6 +63,7 @@ struct _EToDoConduitContext {
gboolean calendar_load_tried;
gboolean calendar_load_success;
+ time_t since;
GList *uids;
GList *added;