Re: gnome-pim confusion




This is just lovely. I made the necessary address-conduit changes and
tested this patch. After one very minor adjustment (the month was
drifting), it works like a charm. The fixed patch is attached. The new
address-conduit is commited to HEAD. Without the gnomecard patch it
works as before, and with it, it works as desired.

So Alan or Russell please commit the new patch and it will all be working.

Thanks evereyone.
-Vadim

Index: card.c
===================================================================
RCS file: /cvs/gnome/gnome-pim/gnomecard/card.c,v
retrieving revision 1.32
diff -u -r1.32 card.c
--- card.c	2000/01/03 05:28:38	1.32
+++ card.c	2000/02/17 06:25:43
@@ -845,10 +845,10 @@
 		     ss = strtok (NULL, "-"), i++)
 		  switch (i) {
 		   case 0:
-			  rev.tm.tm_year = atoi(ss);
+			  rev.tm.tm_year = atoi(ss) - 1900;
 			  break;
 		   case 1:
-			  rev.tm.tm_mon = atoi(ss);
+			  rev.tm.tm_mon = atoi(ss) - 1;
 			  break;
 		   case 2:
 			  rev.tm.tm_mday = atoi(ss);
@@ -1408,6 +1408,27 @@
 	return str;
 }
 
+char *card_rev_str(CardRev rev)
+{
+	char *str;
+        size_t len;
+
+        len = 20;
+
+        if (rev.utc)
+            len += 1;           /* Use 'Z' for zone */
+        
+	str = malloc(len);
+	snprintf(str, 20, "%04d-%02d-%02dT%02d:%02d:%02d",
+                 rev.tm.tm_year+1900, rev.tm.tm_mon+1, rev.tm.tm_mday,
+                 rev.tm.tm_hour, rev.tm.tm_min, rev.tm.tm_sec);
+
+        if (rev.utc)
+            strcpy(str+19, "Z");
+        
+	return str;
+}
+
 char *card_timezn_str(CardTimeZone timezn)
 {
 	char *str;
@@ -1460,6 +1481,15 @@
 		vprop = addPropValue(vobj, VCBirthDateProp, date_str);
 		free(date_str);
 		add_CardProperty(vprop, &crd->bday.prop);
+	}
+
+	if (crd->rev.prop.used) {
+		char *date_str;
+		
+		date_str = card_rev_str(crd->rev);
+		vprop = addPropValue(vobj, VCLastRevisedProp, date_str);
+		free(date_str);
+		add_CardProperty(vprop, &crd->rev.prop);
 	}
 
 	if (crd->xtension.l) {
Index: card.h
===================================================================
RCS file: /cvs/gnome/gnome-pim/gnomecard/card.h,v
retrieving revision 1.20
diff -u -r1.20 card.h
--- card.h	1999/10/13 08:47:02	1.20
+++ card.h	2000/02/17 06:25:43
@@ -266,6 +266,7 @@
 extern char         *card_to_string (Card *card);
 
 extern char *card_bday_str (CardBDay bday);
+extern char *card_rev_str(CardRev rev);
 extern char *card_timezn_str (CardTimeZone timezn);
 extern char *card_geopos_str (CardGeoPos geopos);
 
Index: dialog.c
===================================================================
RCS file: /cvs/gnome/gnome-pim/gnomecard/dialog.c,v
retrieving revision 1.38
diff -u -r1.38 dialog.c
--- dialog.c	1999/10/11 03:09:44	1.38
+++ dialog.c	2000/02/17 06:25:43
@@ -197,6 +197,13 @@
 	/* link to new phone list */
 	crd->phone.l = phonelist_get_entries (ce->phonelist);
 
+        /* Update revision */
+        tt = time(NULL);
+        tm = gmtime(&tt);
+        crd->rev.utc = 0;
+        crd->rev.tm = *tm;
+        crd->rev.prop.used = TRUE;
+        
 	/* key data */
         MY_FREE(crd->key.data);
 	



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]