[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdepimlibs/KDE/4.11] akonadi/calendar: Don't send CANCEL to attendees when deleting an event we did
From:       Sergio Martins <iamsergio () gmail ! com>
Date:       2013-10-31 1:57:48
Message-ID: E1VbhW8-0007A7-LZ () scm ! kde ! org
[Download RAW message or body]

Git commit 1a8fa1ac755ecd71991116ffffa3362d25126e85 by Sergio Martins.
Committed on 31/10/2013 at 01:36.
Pushed by smartins into branch 'KDE/4.11'.

Don't send CANCEL to attendees  when deleting an event we didn't organize.

When deleting something that's not ours, only a REPLY with
PartStat=Declined must be sent, and to the organizer only.

Due to a bug, CANCEL was being sent to everybody, as if we were
the organizer.

Unit-test will go in master.

Bug 318394 should be similar, but for modification instead of deletion.

BUG: 217211
BUG: 306755
CCBUG: 318394
FIXED-IN: 4.11.3

M  +12   -7    akonadi/calendar/incidencechanger.cpp

http://commits.kde.org/kdepimlibs/1a8fa1ac755ecd71991116ffffa3362d25126e85

diff --git a/akonadi/calendar/incidencechanger.cpp b/akonadi/calendar/incidencechanger.cpp
index 8da036e..d07e91b 100644
--- a/akonadi/calendar/incidencechanger.cpp
+++ b/akonadi/calendar/incidencechanger.cpp
@@ -460,15 +460,20 @@ bool IncidenceChanger::Private::handleInvitationsBeforeChange( const Change::Ptr
         Q_ASSERT( !change->originalItems.isEmpty() );
         foreach( const Akonadi::Item &item, change->originalItems ) {
           Q_ASSERT( item.hasPayload<KCalCore::Incidence::Ptr>() );
-          Incidence::Ptr incidence = item.payload<KCalCore::Incidence::Ptr>();
-          if ( !incidence->supportsGroupwareCommunication() )
+          Incidence::Ptr incidence = CalendarUtils::incidence( item );
+          if ( !incidence->supportsGroupwareCommunication() ) {
             continue;
-          status = handler.sendIncidenceDeletedMessage( KCalCore::iTIPCancel, incidence );
-          if ( change->atomicOperationId ) {
-            mInvitationStatusByAtomicOperation.insert( change->atomicOperationId, status );
           }
-          result = status != ITIPHandlerHelper::ResultFailAbortUpdate;
-          //TODO: with some status we want to break immediately
+          // We only send CANCEL if we're the organizer.
+          // If we're not, then we send REPLY with PartStat=Declined in handleInvitationsAfterChange()
+          if ( Akonadi::CalendarUtils::thatIsMe( incidence->organizer()->email() ) ) {
+            status = handler.sendIncidenceDeletedMessage( KCalCore::iTIPCancel, incidence );
+            if ( change->atomicOperationId ) {
+              mInvitationStatusByAtomicOperation.insert( change->atomicOperationId, status );
+            }
+            result = status != ITIPHandlerHelper::ResultFailAbortUpdate;
+            //TODO: with some status we want to break immediately
+          }
         }
       }
       break;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic