Dependency Graph

Dependency Graph
related to related to child of child of duplicate of duplicate of

View Issue Details

IDProjectCategoryView StatusLast Update
0004351SOGoActiveSyncpublic2018-07-22 18:12
Reporterflo_m Assigned Toludovic  
PriorityhighSeveritymajorReproducibilityalways
Status closedResolutionfixed 
PlatformAndroid 7.1.2 + Apple Calendar 9OSAndroid + macOS 10.12 
Product Version3.2.10 
Fixed in Version4.0.1 
Summary0004351: Calendar Alarms / Reminders gets not synced from Desktop to Mobile Activesync Clients
Description

I've set a standard Alarm for my created calendar entries to 15min before beginning on OS X. Whenever i create a new entry, it gets the alarm flag and gets synced to sogo web interface. The Alarm works finde in the WebUI, but doesnt show up in the synced activesync device, which means the entry is there but without any alarm setting.

I've checked several times.
BUT:
It is working if you set the alarm manually on creating an entry and set custom alarm and disable any sound and notify onliny. Then the alarm gets synced through sogo to activesync clients.

Is it possible to let sogo convert the alarm to only notify so that the activesync clients get the alarm right?

TagsNo tags attached.

Activities

flo_m

flo_m

2017-12-05 13:23

reporter   ~0012461

i've digged a little bit deeper.

This doesn't work with activesync:
BEGIN:VALARM
X-WR-ALARMUID:EDE3CF03-4C4F-4833-A896-E7FA43C37808
UID:EDE3CF03-4C4F-4833-A896-E7FA43C37808
TRIGGER:-PT15M
X-APPLE-DEFAULT-ALARM:TRUE
ATTACH;VALUE=URI:Basso
ACTION:AUDIO
END:VALARM

When creating an entry without default 15min in settings, e.g. setting the manual alarm to just notify, no sound:
BEGIN:VALARM
X-WR-ALARMUID:B7BC8282-4FEB-41BF-982F-FF65D240843D
UID:B7BC8282-4FEB-41BF-982F-FF65D240843D
TRIGGER;VALUE=DATE-TIME:19760401T005545Z
ACTION:NONE
END:VALARM
BEGIN:VALARM
X-WR-ALARMUID:782F2CDC-F51C-49B7-8466-42FEE28A0190
UID:782F2CDC-F51C-49B7-8466-42FEE28A0190
TRIGGER:-PT15M
DESCRIPTION:Erinnerung an ein Ereignis
ACTION:DISPLAY
END:VALARM

=> This works with activesync

So i think you have to treat the ACTION:AUDIO as a synonym for ACTIO:DISPLAY. In this case, entrys with notification+audio will get through activesync to the clients.

tfu

tfu

2017-12-19 11:21

reporter   ~0012474

Are you in the position to test a patch?

flo_m

flo_m

2017-12-19 11:49

reporter   ~0012476

yes, i could test a patch, if you can tell me what to do :-)

tfu

tfu

2017-12-19 12:26

reporter   ~0012477

Attached patch should sync a reminder regradless of its type.

flo_m

flo_m

2017-12-19 13:00

reporter   ~0012478

sorry, but i cannot see any patch attached? Am I doing something wrong?

tfu

tfu

2017-12-19 13:19

reporter  

0005-4351.patch (4,838 bytes)   
From 2e9a5a1697115775b6072994ba480f385949cd25 Mon Sep 17 00:00:00 2001
From: root <tfu@aon.at>
Date: Tue, 19 Dec 2017 13:14:32 +0100
Subject: [PATCH 5/5] 4351

---
 ActiveSync/iCalAlarm+ActiveSync.m | 36 +++++++++++++++++-------------------
 ActiveSync/iCalEvent+ActiveSync.m | 19 ++++++++-----------
 2 files changed, 25 insertions(+), 30 deletions(-)

diff --git a/ActiveSync/iCalAlarm+ActiveSync.m b/ActiveSync/iCalAlarm+ActiveSync.m
index 8ca05c0..a74b707 100644
--- a/ActiveSync/iCalAlarm+ActiveSync.m
+++ b/ActiveSync/iCalAlarm+ActiveSync.m
@@ -45,27 +45,23 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 - (NSString *) activeSyncRepresentationInContext: (WOContext *) context
 {
   NSMutableString *s;
+  NSCalendarDate *nextAlarmDate;
+  NSInteger delta;
 
   s = [NSMutableString string];
+
+  nextAlarmDate = [self nextAlarmDate];
+  delta = (int)(([[(iCalEvent *)parent startDate] timeIntervalSince1970] - [nextAlarmDate timeIntervalSince1970])/60);
   
-  if ([[self action] caseInsensitiveCompare: @"DISPLAY"] == NSOrderedSame)
+  if ([parent isKindOfClass: [iCalEvent class]])
     {
-      NSCalendarDate *nextAlarmDate;
-      NSInteger delta;
-      
-      nextAlarmDate = [self nextAlarmDate];
-      delta = (int)(([[(iCalEvent *)parent startDate] timeIntervalSince1970] - [nextAlarmDate timeIntervalSince1970])/60);
-      
-      if ([parent isKindOfClass: [iCalEvent class]])
-        {
-          // don't send negative reminder - not supported
-          if (delta > 0)
-            [s appendFormat: @"<Reminder xmlns=\"Calendar:\">%d</Reminder>", (int)delta];
-        }
-      else
-        {
-          [s appendFormat: @"<ReminderTime xmlns=\"Task:\">%@</ReminderTime>", [nextAlarmDate activeSyncRepresentationInContext: context]];
-        }
+      // don't send negative reminder - not supported
+      if (delta > 0)
+        [s appendFormat: @"<Reminder xmlns=\"Calendar:\">%d</Reminder>", (int)delta];
+    }
+  else
+    {
+      [s appendFormat: @"<ReminderTime xmlns=\"Task:\">%@</ReminderTime>", [nextAlarmDate activeSyncRepresentationInContext: context]];
     }
   
   return s;
@@ -86,7 +82,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
       trigger = [iCalTrigger elementWithTag: @"TRIGGER"];
       [trigger setValueType: @"DURATION"];
       [self setTrigger: trigger];
-      [self setAction: @"DISPLAY"];
+      if (![self  action])
+        [self setAction: @"DISPLAY"];
 
       // SOGo web ui only supports 1w but not 2w (custom reminder only supports min/hours/days)
       // 1week = -P1W
@@ -123,7 +120,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
         }
 
       [self setTrigger: trigger];
-      [self setAction: @"DISPLAY"];
+      if (![self  action])
+        [self setAction: @"DISPLAY"];
     }
 }
 
diff --git a/ActiveSync/iCalEvent+ActiveSync.m b/ActiveSync/iCalEvent+ActiveSync.m
index 7a66adb..b33d6fa 100644
--- a/ActiveSync/iCalEvent+ActiveSync.m
+++ b/ActiveSync/iCalEvent+ActiveSync.m
@@ -321,7 +321,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     {
       iCalAlarm *alarm;
       
-      alarm = [self firstDisplayOrAudioAlarm];
+      alarm = [self firstSupportedAlarm];
       [s appendString: [alarm activeSyncRepresentationInContext: context]];
     }
 
@@ -447,6 +447,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   NSCalendarDate *oldstart;
   NSTimeZone *userTimeZone;
   iCalTimeZone *tz;
+  iCalAlarm *alarm;
   id o;
   int deltasecs;
 
@@ -582,23 +583,19 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
         }
     }
 
-  //
-  // If an alarm is deinfed with an action != DISPLAY, we ignore the alarm - don't want to overwrite. 
-  //
-  if ([self hasAlarms] && [[[[self alarms] objectAtIndex: 0] action] caseInsensitiveCompare: @"DISPLAY"] != NSOrderedSame)
-    {
-      // Ignore the alarm for now
-    }
-  else if ((o = [theValues objectForKey: @"Reminder"]) && [o length])
+  if ((o = [theValues objectForKey: @"Reminder"]) && [o length])
     {           
+      if ([self hasAlarms])
+        alarm = [[self firstSupportedAlarm] mutableCopy];
+      else
+        alarm = [[iCalAlarm alloc] init];
+
       // NOTE: Outlook sends a 15 min reminder (18 hour for allday) if no reminder is specified  
       // although no default reminder is defined (File -> Options -> Clendar -> Calendar Options - > Default Reminders)
       //
       // http://answers.microsoft.com/en-us/office/forum/office_2013_release-outlook/desktop-outlook-calendar-creates-entries-with/9aef72d8-81bb-4a32-a6ab-bf7d216fb811?page=5&tm=1395690285088 
       //
-      iCalAlarm *alarm;
       
-      alarm = [[iCalAlarm alloc] init];
       [alarm takeActiveSyncValues: theValues  inContext: context];
 
       [self removeAllAlarms];
-- 
2.1.4

0005-4351.patch (4,838 bytes)   
tfu

tfu

2017-12-19 18:33

reporter  

4351-v3.diff (4,882 bytes)   
diff --git a/ActiveSync/iCalAlarm+ActiveSync.m b/ActiveSync/iCalAlarm+ActiveSync.m
index f50ec55..a74b707 100644
--- a/ActiveSync/iCalAlarm+ActiveSync.m
+++ b/ActiveSync/iCalAlarm+ActiveSync.m
@@ -45,27 +45,23 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 - (NSString *) activeSyncRepresentationInContext: (WOContext *) context
 {
   NSMutableString *s;
+  NSCalendarDate *nextAlarmDate;
+  NSInteger delta;
 
   s = [NSMutableString string];
+
+  nextAlarmDate = [self nextAlarmDate];
+  delta = (int)(([[(iCalEvent *)parent startDate] timeIntervalSince1970] - [nextAlarmDate timeIntervalSince1970])/60);
   
-  if ([[self action] caseInsensitiveCompare: @"DISPLAY"] == NSOrderedSame)
+  if ([parent isKindOfClass: [iCalEvent class]])
     {
-      NSCalendarDate *nextAlarmDate;
-      NSInteger delta;
-      
-      nextAlarmDate = [self nextAlarmDate];
-      delta = (int)(([[(iCalEvent *)parent startDate] timeIntervalSince1970] - [nextAlarmDate timeIntervalSince1970])/60);
-      
-      if ([parent isKindOfClass: [iCalEvent class]])
-        {
-          // don't send negative reminder - not supported
-          if (delta > 0)
-            [s appendFormat: @"<Reminder xmlns=\"Calendar:\">%d</Reminder>", (int)delta];
-        }
-      else
-        {
-          [s appendFormat: @"<ReminderTime xmlns=\"Task:\">%@</ReminderTime>", [nextAlarmDate activeSyncRepresentationInContext: context]];
-        }
+      // don't send negative reminder - not supported
+      if (delta > 0)
+        [s appendFormat: @"<Reminder xmlns=\"Calendar:\">%d</Reminder>", (int)delta];
+    }
+  else
+    {
+      [s appendFormat: @"<ReminderTime xmlns=\"Task:\">%@</ReminderTime>", [nextAlarmDate activeSyncRepresentationInContext: context]];
     }
   
   return s;
@@ -86,7 +82,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
       trigger = [iCalTrigger elementWithTag: @"TRIGGER"];
       [trigger setValueType: @"DURATION"];
       [self setTrigger: trigger];
-      [self setAction: @"DISPLAY"];
+      if (![self  action])
+        [self setAction: @"DISPLAY"];
 
       // SOGo web ui only supports 1w but not 2w (custom reminder only supports min/hours/days)
       // 1week = -P1W
@@ -115,8 +112,16 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
       trigger = [iCalTrigger elementWithTag: @"TRIGGER"];
       [trigger setValueType: @"DATE-TIME"];
       [trigger setSingleValue: [NSString stringWithFormat: @"%@Z", [o iCalFormattedDateTimeString]] forKey: @""];
+
+      if  ((o = [theValues objectForKey: @"ReminderSet"]))
+        {
+          if ([o intValue] == 0)
+             [trigger setValue: 0 ofAttribute: @"x-webstatus" to: @"triggered"];
+        }
+
       [self setTrigger: trigger];
-      [self setAction: @"DISPLAY"];
+      if (![self  action])
+        [self setAction: @"DISPLAY"];
     }
 }
 
diff --git a/ActiveSync/iCalEvent+ActiveSync.m b/ActiveSync/iCalEvent+ActiveSync.m
index 7a66adb..b33d6fa 100644
--- a/ActiveSync/iCalEvent+ActiveSync.m
+++ b/ActiveSync/iCalEvent+ActiveSync.m
@@ -321,7 +321,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     {
       iCalAlarm *alarm;
       
-      alarm = [self firstDisplayOrAudioAlarm];
+      alarm = [self firstSupportedAlarm];
       [s appendString: [alarm activeSyncRepresentationInContext: context]];
     }
 
@@ -447,6 +447,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   NSCalendarDate *oldstart;
   NSTimeZone *userTimeZone;
   iCalTimeZone *tz;
+  iCalAlarm *alarm;
   id o;
   int deltasecs;
 
@@ -582,23 +583,19 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
         }
     }
 
-  //
-  // If an alarm is deinfed with an action != DISPLAY, we ignore the alarm - don't want to overwrite. 
-  //
-  if ([self hasAlarms] && [[[[self alarms] objectAtIndex: 0] action] caseInsensitiveCompare: @"DISPLAY"] != NSOrderedSame)
-    {
-      // Ignore the alarm for now
-    }
-  else if ((o = [theValues objectForKey: @"Reminder"]) && [o length])
+  if ((o = [theValues objectForKey: @"Reminder"]) && [o length])
     {           
+      if ([self hasAlarms])
+        alarm = [[self firstSupportedAlarm] mutableCopy];
+      else
+        alarm = [[iCalAlarm alloc] init];
+
       // NOTE: Outlook sends a 15 min reminder (18 hour for allday) if no reminder is specified  
       // although no default reminder is defined (File -> Options -> Clendar -> Calendar Options - > Default Reminders)
       //
       // http://answers.microsoft.com/en-us/office/forum/office_2013_release-outlook/desktop-outlook-calendar-creates-entries-with/9aef72d8-81bb-4a32-a6ab-bf7d216fb811?page=5&tm=1395690285088 
       //
-      iCalAlarm *alarm;
       
-      alarm = [[iCalAlarm alloc] init];
       [alarm takeActiveSyncValues: theValues  inContext: context];
 
       [self removeAllAlarms];
4351-v3.diff (4,882 bytes)   
tfu

tfu

2017-12-19 18:34

reporter   ~0012480

I just uploaded 4351-v3.diff (ignore the other file).

flo_m

flo_m

2017-12-20 08:12

reporter   ~0012481

sorry for the noob question, but i cannot insert this patch in my live environment, right? If not, can you tell me how to appply the patch?

flo_m

flo_m

2017-12-27 14:44

reporter   ~0012490

any update on this?

flo_m

flo_m

2018-07-13 08:39

reporter   ~0012952

Quick Update:
After 4.01 Update, this now works like a charme for standard Calendars!

BUT if you have shared calendars from other sogo users, the alarm still gets not synced through to the AES Device.

(If account b shres cal with a, then a still gets no alarms for calendars owned by b)

tfu

tfu

2018-07-15 10:53

reporter   ~0012964

Have you set the property 'Show Alarms' for the subscribed calendar?

flo_m

flo_m

2018-07-22 18:10

reporter   ~0012968

yeah, this worked. Thank you very much!

Related Changesets

sogo: master c495e14c

2018-03-14 13:16

ludovic


Details Diff
(fix) improved alarms syncing with EAS devices (fixes 0004351) Affected Issues
0004351
mod - ActiveSync/iCalAlarm+ActiveSync.m Diff File
mod - ActiveSync/iCalEvent+ActiveSync.m Diff File
mod - NEWS Diff File

Issue History

Date Modified Username Field Change
2017-12-05 12:06 flo_m New Issue
2017-12-05 13:23 flo_m Note Added: 0012461
2017-12-19 11:21 tfu Note Added: 0012474
2017-12-19 11:49 flo_m Note Added: 0012476
2017-12-19 12:26 tfu Note Added: 0012477
2017-12-19 13:00 flo_m Note Added: 0012478
2017-12-19 13:19 tfu File Added: 0005-4351.patch
2017-12-19 18:33 tfu File Added: 4351-v3.diff
2017-12-19 18:34 tfu Note Added: 0012480
2017-12-20 08:12 flo_m Note Added: 0012481
2017-12-27 14:44 flo_m Note Added: 0012490
2018-03-14 17:19 ludovic Changeset attached => sogo master c495e14c
2018-03-14 17:19 ludovic Assigned To => ludovic
2018-03-14 17:19 ludovic Resolution open => fixed
2018-03-14 17:20 ludovic Status new => resolved
2018-03-14 17:20 ludovic Fixed in Version => 4.0.1
2018-07-13 08:39 flo_m Note Added: 0012952
2018-07-13 08:39 flo_m Status resolved => feedback
2018-07-13 08:39 flo_m Resolution fixed => reopened
2018-07-15 10:53 tfu Note Added: 0012964
2018-07-22 18:10 flo_m Note Added: 0012968
2018-07-22 18:10 flo_m Status feedback => assigned
2018-07-22 18:12 ludovic Status assigned => closed
2018-07-22 18:12 ludovic Resolution reopened => fixed