Avoid mail notifications on superfluous changes

(cont'd)

Fixes #3790
pull/225/head
Francis Lachapelle 2016-11-03 11:47:21 -04:00
parent 42597abf8d
commit c02c4aa834
3 changed files with 52 additions and 45 deletions

View File

@ -1,24 +1,22 @@
/*
Copyright (C) 2004-2005 SKYRIX Software AG
This file is part of SOPE.
SOPE is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public
License along with SOPE; see the file COPYING. If not, write to the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
/* iCalEventChanges.h - this file is part of SOPE
*
* Copyright (C) 2004-2016 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
// Created by znek on 31.08.04.
#ifndef __NGiCal_iCalEventChanges_H_
#define __NGiCal_iCalEventChanges_H_
@ -41,6 +39,7 @@
- (id)initWithFromEvent:(iCalEvent *)_from toEvent:(iCalEvent *)_to;
- (BOOL)hasChanges;
- (BOOL)hasMajorChanges;
- (BOOL)hasAttendeeChanges;
- (NSArray *)insertedAttendees;

View File

@ -1,22 +1,21 @@
/*
Copyright (C) 2004-2005 SKYRIX Software AG
This file is part of SOPE.
SOPE is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public
License along with SOPE; see the file COPYING. If not, write to the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
/* iCalEventChanges.m - this file is part of SOPE
*
* Copyright (C) 2004-2016 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#import <Foundation/NSArray.h>
@ -158,6 +157,13 @@
[self hasPropertyChanges];
}
- (BOOL)hasMajorChanges {
return
[self hasAttendeeChanges] ||
([self hasPropertyChanges] &&
([[self updatedProperties] count] > 1 || ![[self updatedProperties] containsObject: @"lastModified"]));
}
- (BOOL)hasAttendeeChanges {
return [[self insertedAttendees] count] > 0 ||
[[self deletedAttendees] count] > 0 ||

View File

@ -891,7 +891,7 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
withType: @"calendar:invitation"];
}
if ([changes hasChanges])
if ([changes hasMajorChanges])
[self sendReceiptEmailForObject: newEvent
addedAttendees: addedAttendees
deletedAttendees: deletedAttendees
@ -2275,11 +2275,13 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
} // if ([[newEvent attendees] count] || [[oldEvent attendees] count])
else
{
[self sendReceiptEmailForObject: newEvent
addedAttendees: nil
deletedAttendees: nil
updatedAttendees: nil
operation: EventUpdated];
changes = [iCalEventChanges changesFromEvent: oldEvent toEvent: newEvent];
if ([changes hasMajorChanges])
[self sendReceiptEmailForObject: newEvent
addedAttendees: nil
deletedAttendees: nil
updatedAttendees: nil
operation: EventUpdated];
}
} // else of if (isNew) ...