« Return to Thread: Sunbird Alerts cannot be dismissed

Sunbird Alerts cannot be dismissed

by Adam Tauno Williams :: Rate this Message:

Reply to Author | View in Thread

<http://bugzilla.opengroupware.org/bugzilla/show_bug.cgi?id=1876>

When an alarm is dismissed Sunbird/Lightning the alarm is sent back to
ZideStore like:

BEGIN:VALARM
TRIGGER;VALUE=DURATION:-P1W
X-MOZ-LASTACK:20080702T211432Z
DESCRIPTION:Mozilla Alarm: hfhfdhd
ACTION:DISPLAY
END:VALARM

Note the 'extended' attribute "X-MOZ-LASTACK".    This is *not* encoded
into
the evoReminder,  then ZideStore dutifully returns -

BEGIN:VALARM
ACTION:DISPLAY
DESCRIPTION:Mozilla Alarm: hfhfdhd
TRIGGER;VALUE=DURATION;RELATED=START:-P1W
END:VALARM

The encoding is performed by the "alarmsToCSV" method of the
"SxAppointmentMessageParser"; this only captures the core attributes.
The iCalObject looks like it always ignores 'extended' (X-*) attributes
so I assume the value is lost by the time the data gets to
"alarmsToCSV"?

--<quote iCalObject>--------------
- (void)takeValue:(id)_value forXKey:(id)_key {
  /* extended keys are ignored by default */
}

- (void)handleTakeValue:(id)_value forUnboundKey:(NSString *)_key {
  if ([_key hasPrefix:@"X-"]) {
    [self takeValue:_value forXKey:_key];
  }
  else {
    NSLog(@"0x%08x[%@]: ignoring attempt to set unbound key '%@'",
          self, NSStringFromClass([self class]), _key);
  }
}
--</quote>-------------------------

Also the Logic command appointment::get-ical
(Logic/LSScheduler/LSGetICalForAppointmentsCommand.m) does the reverse
of SxAppointmentMessageParser's alarmsToCSV and likewise only processes
specific attributes.

<aside>Wouldn't an "appointment::from-ical" command be better than
parsing to iCal in a distant class (SxAppointmentMessageParser) and
rendering to iCal in a Logic class?</aside>

So I'm wondering how to work around the issue;  it renders the calendar
client effectively locked if an alarm is triggered.   One brute-force
solution would be to introduce a default the simply disables the
evoReminder field - alarms either not stored or not delivered to the
client.  Otherwise I can't see a solution since [it seems] all X-*
fields are lost in parsing [in SOPE].

The only way [I can see] to preserve the value is to patch SOPE
(attached) to add the X-MOZ-LASTACK to the iCalAlarm object.  I don't
know if that will be acceptable to other SOPE consumers?  With this
patch the data is available for ZideStore (I've tested that) and the
alarm code would just have to be modified to include this value if
present.

[X-MOZ-LASTACK.patch]

Index: sope-ical/NGiCal/NGiCal.xmap
===================================================================
--- sope-ical/NGiCal/NGiCal.xmap (revision 1622)
+++ sope-ical/NGiCal/NGiCal.xmap (working copy)
@@ -63,6 +63,7 @@
 
       attributes = {
         rrule = recurrenceRule;
+        "X-MOZ-LASTACK" = lastACK;
       };
     };
     
@@ -273,7 +274,11 @@
     "X-LIC-LOCATION" = {
       class = NSString;
     };
-    
+
+    "X-MOZ-LASTACK" = {
+      class = NSString;
+    };
+
     "X-WR-TIMEZONE" = {
       rejectWithContent = YES;
     };
Index: sope-ical/NGiCal/iCalAlarm.h
===================================================================
--- sope-ical/NGiCal/iCalAlarm.h (revision 1622)
+++ sope-ical/NGiCal/iCalAlarm.h (working copy)
@@ -33,6 +33,7 @@
   NSString *action;
   id       attach;
   NSString *recurrenceRule;
+  NSString *lastACK;
 }
 
 /* accessors */
@@ -41,6 +42,7 @@
 - (id)attach;
 - (NSString *)comment;
 - (NSString *)action;
+- (NSString *)lastACK;
 - (void)setRecurrenceRule:(NSString *)_recurrenceRule;
 - (NSString *)recurrenceRule;
 
Index: sope-ical/NGiCal/iCalAlarm.m
===================================================================
--- sope-ical/NGiCal/iCalAlarm.m (revision 1622)
+++ sope-ical/NGiCal/iCalAlarm.m (working copy)
@@ -29,6 +29,7 @@
   [self->comment        release];
   [self->action         release];
   [self->attach         release];
+  [self->lastACK        release];
   [self->recurrenceRule release];
   [super dealloc];
 }
@@ -44,6 +45,7 @@
   new->comment        = [self->comment copyWithZone:_zone];
   new->action         = [self->action copyWithZone:_zone];
   new->attach         = [self->attach copyWithZone:_zone];
+  new->lastACK        = [self->lastACK copyWithZone:_zone];
   new->recurrenceRule = [self->recurrenceRule copyWithZone:_zone];
   
   return new;
@@ -79,6 +81,13 @@
   return self->action;
 }
 
+- (void)setLastACK:(NSString *)_value {
+  ASSIGNCOPY(self->lastACK, _value);
+}
+- (NSString *)lastACK {
+  return self->lastACK;
+}
+
 - (void)setRecurrenceRule:(NSString *)_recurrenceRule {
   ASSIGN(self->recurrenceRule, _recurrenceRule);
 }
@@ -107,4 +116,12 @@
   return ms;
 }
 
+/* KVC */
+
+- (void)takeValue:(id)_value forXKey:(id)_key {
+  if ([_key isEqualToString:@"X-MOZ-LASTACK"])
+    [self setLastACK:_value];
+}
+
+
 @end /* iCalAlarm */

 « Return to Thread: Sunbird Alerts cannot be dismissed

LightInTheBox - Buy quality products at wholesale price!