View Issue Details

IDProjectCategoryView StatusLast Update
0000611Funambol SOGo Connectorpublic2010-05-21 13:48
Reporterwcronen Assigned Toludovic  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Fixed in Version1.0.8 
Summary0000611: Multiple calendars aren't synced correctly anymore. Sync-Tag is duplicated!
Description

There's a new buy syncing multiple selected calendars to phone (windows mobile).

This must be a new bug because it worked in a previous versions. I don't know wether this is a bug of the new SOGo 1.2.2 or of the Funambol connector 1.0.8 which I'm using?

You can successful sync the calendars to phone but if you edit the title on the phone and resync to SOGo the Sync-Tag is duplicated and you can see the tag also in the calendar's event.

Example:

Sync-Tag for your business calendar is "business" and the event is called "test".
After sync to phone, edit of the title on phone and resync the event in the SOGo calendar is called "[business] test".

TagsNo tags attached.

Activities

wcronen

wcronen

2010-05-11 20:51

reporter   ~0001001

Same problem with Outlook under Windows XP and Windows 7 using the latest Funambol sync client 8.5.4.

No fix for it?

wcronen

wcronen

2010-05-11 22:43

reporter   ~0001002

Last edited: 2010-05-11 22:48

This only occurs if modifying existing events.

Maybe an error in the function "updatevEventSyncItem" ?
Seems as so the "tag" is not removed before updating the event.

Or could it be an error of the v2->v1 conversion routines which Havard added?

ludovic

ludovic

2010-05-13 20:27

administrator   ~0001007

Reminder sent to: havardw

Havard, could you look at this?

havardw

havardw

2010-05-18 20:30

reporter   ~0001030

Sorry for the late reply, I've been away for a few days.

The analysis is correct, I've introduced an error in updates for events (and also tasks) when I changed the conversion routines. The title used was from before the tag was removed, and thus need to be updated.

I'll attach a patch that might fix this. Pleas note that this patch is NOT TESTED at all. I'm a bit short on time for the next week, I'll try to get some testing done then if no one beats me to it.

2010-05-18 20:31

 

duplicate_tag_fix.patch (2,825 bytes)   
Index: src/java/ca/inverse/sogo/engine/source/SOGoEventUtilities.java
===================================================================
--- src/java/ca/inverse/sogo/engine/source/SOGoEventUtilities.java	(revision 31)
+++ src/java/ca/inverse/sogo/engine/source/SOGoEventUtilities.java	(revision )
@@ -302,6 +302,8 @@
             userTZ = SOGoUtilities.getUserTimeZone(source, context, log);
             data = new CalendarData(item, userTZ, source.getDeviceCharset());
 			c_content = data.getContent();
+            event = data.getCalendar().getEvent();
+            c_title = event.getSummary().getPropertyValueAsString();
 
 			// If the event is tagged, we must untag it and check ACLs.
 			if (tag != null) {
@@ -320,9 +322,9 @@
 					throw new SyncSourceException("No access rights on " + collection + " - Modifier is needed");
 				
 				c_content = SOGoUtilities.removeTagFromContent(c_content, tag, source, context, log);
+                c_title = c_title.substring(tag.length() + 1);
 			}
 			
-			event = data.getCalendar().getEvent();
 			c_classification = SOGoUtilities.getClassification(event);
 			c_name = SOGoKey.encodeString(item.getKey().getKeyAsString());					
 			c_cycleinfo = null;
@@ -330,8 +332,7 @@
 
 			s_date = getStartDate(event, source, context, log);
 			e_date = getEndDate(event, source, context, log);
-			c_title = event.getSummary().getPropertyValueAsString();
-			
+
 			if (event.getLocation() != null) {
 				c_location = event.getLocation().getPropertyValueAsString();
 			} else {
Index: src/java/ca/inverse/sogo/engine/source/SOGoTaskUtilities.java
===================================================================
--- src/java/ca/inverse/sogo/engine/source/SOGoTaskUtilities.java	(revision 31)
+++ src/java/ca/inverse/sogo/engine/source/SOGoTaskUtilities.java	(revision )
@@ -286,6 +286,8 @@
             userTZ = SOGoUtilities.getUserTimeZone(source, context, log);
             data = new CalendarData(item, userTZ, source.getDeviceCharset());
 			c_content = data.getContent();
+            task = data.getCalendar().getTask();
+			c_title = task.getSummary().getPropertyValueAsString();
 
 			// If the event is tagged, we must untag it and check ACLs.
 			if (tag != null) {
@@ -304,11 +306,10 @@
 					throw new SyncSourceException("No access rights on " + collection + " - Modifier is needed");
 				
 				c_content = SOGoUtilities.removeTagFromContent(c_content, tag, source, context, log);
+                c_title = c_title.substring(tag.length() + 1);
 			}
 			
-			task = data.getCalendar().getTask();
 			c_name = SOGoKey.encodeString(item.getKey().getKeyAsString());
-			c_title = task.getSummary().getPropertyValueAsString();
 			c_classification = SOGoUtilities.getClassification(task);
 
             if (task.getComplete().getPropertyValue() == null) {
duplicate_tag_fix.patch (2,825 bytes)   
wcronen

wcronen

2010-05-18 21:45

reporter   ~0001033

Hi hardardw,

thanks for your efforts.

I'll test your patch the next days and report the results of my testing.

wcronen

wcronen

2010-05-18 23:48

reporter   ~0001034

It doesn't work :(

This should work for c_title:

tag = ("[" + tag + "]").toLowerCase();
if (c_title.toLowerCase().startsWith(tag)) {
c_title = c_title.substring(tag.length()+1);
}

But this is not the main problem. "c_title" is only used in the Quick-DB-Table. Where is this table for?
The Quick-Table seems to be only for the preview in SOGo?

In Thunderbird and if you go to the Edit-View in SOGo Webinterface there is still the hole tag!!

It seems as so the tag isn't removed in
c_content = SOGoUtilities.removeTagFromContent(c_content, tag, source, context, log);

The tag is still in "c_content". Is the function "removeTagFromContent" maybe faulty?!

wcronen

wcronen

2010-05-19 01:42

reporter   ~0001035

After several further tests I can say that "removeTagFromContent" seems to work.
The tags are stripped in the logs.

Instead the tags appear again around line 350 in the if-statement
if (doMerge) {....
in function "updatevEventSyncItem" of SOGoEventUtilities.java

havardw

havardw

2010-05-19 19:40

reporter   ~0001039

wcronen, the reappearance of the tag is probably because the merge code uses the event object instead of c_content, and this object was parsed from content with the tag included.

I've done a quick attempt at a patch that also modifies the title for the event object. Also, for the code example in comment 1034, I suppose you mean that I'd forgotten to account for the braces when calculating tag lenght? I just added 2 extra to the length, as I already know that the tag is there when I'm removing it.

ludovic: What I'd like to do here is to move tag removal into the CalendarData I created, to get rid of the extra parsing steps and to update all the different data types at once.

wcronen

wcronen

2010-05-19 20:56

reporter   ~0001040

Have you uploaded your 2nd patch? I can't see it here.

I'd really like to test your new patch.
Thx in advance.

2010-05-20 07:03

 

duplicate_tag_fix_v2.patch (2,951 bytes)   
Index: src/java/ca/inverse/sogo/engine/source/SOGoEventUtilities.java
===================================================================
--- src/java/ca/inverse/sogo/engine/source/SOGoEventUtilities.java	(revision 31)
+++ src/java/ca/inverse/sogo/engine/source/SOGoEventUtilities.java	(revision )
@@ -302,6 +302,8 @@
             userTZ = SOGoUtilities.getUserTimeZone(source, context, log);
             data = new CalendarData(item, userTZ, source.getDeviceCharset());
 			c_content = data.getContent();
+            event = data.getCalendar().getEvent();
+            c_title = event.getSummary().getPropertyValueAsString();
 
 			// If the event is tagged, we must untag it and check ACLs.
 			if (tag != null) {
@@ -320,9 +322,10 @@
 					throw new SyncSourceException("No access rights on " + collection + " - Modifier is needed");
 				
 				c_content = SOGoUtilities.removeTagFromContent(c_content, tag, source, context, log);
+                c_title = c_title.substring(tag.length() + 3);
+                event.getSummary().setPropertyValue(c_title);
 			}
 			
-			event = data.getCalendar().getEvent();
 			c_classification = SOGoUtilities.getClassification(event);
 			c_name = SOGoKey.encodeString(item.getKey().getKeyAsString());					
 			c_cycleinfo = null;
@@ -330,8 +333,7 @@
 
 			s_date = getStartDate(event, source, context, log);
 			e_date = getEndDate(event, source, context, log);
-			c_title = event.getSummary().getPropertyValueAsString();
-			
+
 			if (event.getLocation() != null) {
 				c_location = event.getLocation().getPropertyValueAsString();
 			} else {
Index: src/java/ca/inverse/sogo/engine/source/SOGoTaskUtilities.java
===================================================================
--- src/java/ca/inverse/sogo/engine/source/SOGoTaskUtilities.java	(revision 31)
+++ src/java/ca/inverse/sogo/engine/source/SOGoTaskUtilities.java	(revision )
@@ -286,6 +286,8 @@
             userTZ = SOGoUtilities.getUserTimeZone(source, context, log);
             data = new CalendarData(item, userTZ, source.getDeviceCharset());
 			c_content = data.getContent();
+            task = data.getCalendar().getTask();
+			c_title = task.getSummary().getPropertyValueAsString();
 
 			// If the event is tagged, we must untag it and check ACLs.
 			if (tag != null) {
@@ -304,11 +306,11 @@
 					throw new SyncSourceException("No access rights on " + collection + " - Modifier is needed");
 				
 				c_content = SOGoUtilities.removeTagFromContent(c_content, tag, source, context, log);
+                c_title = c_title.substring(tag.length() + 3);
+                task.getSummary().setPropertyValue(c_title);
 			}
 			
-			task = data.getCalendar().getTask();
 			c_name = SOGoKey.encodeString(item.getKey().getKeyAsString());
-			c_title = task.getSummary().getPropertyValueAsString();
 			c_classification = SOGoUtilities.getClassification(task);
 
             if (task.getComplete().getPropertyValue() == null) {
duplicate_tag_fix_v2.patch (2,951 bytes)   
havardw

havardw

2010-05-20 07:04

reporter   ~0001041

I've uploaded the patch now, I forgot that I can't upload and comment in one operation.

wcronen

wcronen

2010-05-20 20:06

reporter   ~0001043

Last edited: 2010-05-20 20:06

Great Job, Havard!!!

The 2nd patch works great. Now tags are removed from added/modified events before writing to the database.

@ludovic: Could you please include this 2nd patch in the svn version?

ludovic

ludovic

2010-05-21 13:48

administrator   ~0001045

The fix has been pushed.

Issue History

Date Modified Username Field Change
2010-05-07 23:04 wcronen New Issue
2010-05-11 20:51 wcronen Note Added: 0001001
2010-05-11 22:43 wcronen Note Added: 0001002
2010-05-11 22:48 wcronen Note Edited: 0001002
2010-05-13 20:27 ludovic Note Added: 0001007
2010-05-18 20:30 havardw Note Added: 0001030
2010-05-18 20:31 havardw File Added: duplicate_tag_fix.patch
2010-05-18 21:45 wcronen Note Added: 0001033
2010-05-18 23:48 wcronen Note Added: 0001034
2010-05-19 01:42 wcronen Note Added: 0001035
2010-05-19 19:40 havardw Note Added: 0001039
2010-05-19 20:56 wcronen Note Added: 0001040
2010-05-20 07:03 havardw File Added: duplicate_tag_fix_v2.patch
2010-05-20 07:04 havardw Note Added: 0001041
2010-05-20 20:06 wcronen Note Added: 0001043
2010-05-20 20:06 wcronen Note Edited: 0001043
2010-05-21 13:48 ludovic Note Added: 0001045
2010-05-21 13:48 ludovic Status new => resolved
2010-05-21 13:48 ludovic Fixed in Version => 1.0.8
2010-05-21 13:48 ludovic Resolution open => fixed
2010-05-21 13:48 ludovic Assigned To => ludovic