LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File libopensync-fix-vcal-reminder.diff of Package libopensync (Project mobile:synchronization:FACTORY)

Index: formats/vformats-xml/xml-vcal.c
===================================================================
--- formats/vformats-xml/xml-vcal.c	(Revision 1863)
+++ formats/vformats-xml/xml-vcal.c	(Revision 2505)
@@ -2018,6 +2018,8 @@
 			isruntime = TRUE;
 		}
 	}
+	
+	g_free(value);
 
 	startvtime = osxml_find_node(dtstart, "Content");
 
@@ -2027,26 +2029,28 @@
 	/* Duration */	
 	} else {
 		tmp = osxml_find_node(trigger, "Content");
+
 		duration = osync_time_alarmdu2sec(tmp);
 		g_free(tmp);
 
 		tmp = osxml_find_node(dtstart, "Content");
-		/* AlarmTrigger MUST be UTC (see rfc2445).
-		   So there is an offset to UTC of 0 seconds. */
-		if (osync_time_isutc(tmp))
-			osync_trace(TRACE_INTERNAL, "WARNNING: timestamp is not UTC: %s", tmp);
 
 		dtstarted = osync_time_vtime2unix(tmp, 0);
 
-		g_free(tmp);
-
 		dtstarted += duration;
 
 		runtime = osync_time_unix2vtime(&dtstarted);
+
+		if (!osync_time_isutc(tmp)) {
+			osync_trace(TRACE_INTERNAL, "WARNNING: timestamp is not UTC - converting reminder to localtime");
+			char *utc_runtime = runtime;
+			runtime = osync_time_vtime2localtime(utc_runtime, 0);
+			g_free(utc_runtime);
+		}
+
+		g_free(tmp);
 	}
 
-	g_free(value);
-
 	vformat_attribute_add_value(attr, runtime);
 	
 	add_value(attr, root, "AlarmDuration", encoding);