bool Scheduler::acceptRequest(IncidenceBase *newIncBase, ScheduleMessage::Status /* status */) { if (newIncBase->type()=="FreeBusy") { // reply to this request is handled in korganizer's incomingdialog return true; } Incidence *newInc = dynamic_cast<Incidence *>( newIncBase ); if ( newInc ) { bool res = true; Incidence *exInc = mCalendar->incidenceFromSchedulingID( newIncBase->uid() ); if ( exInc ) { res = false; if ( (newInc->revision() > exInc->revision()) || (newInc->revision() == exInc->revision() && newInc->lastModified()>exInc->lastModified()) ) { mCalendar->deleteIncidence( exInc ); res = true; } } if ( res ) { // Move the uid to be the schedulingID and make a unique UID newInc->setSchedulingID( newInc->uid() ); newInc->setUid( CalFormat::createUniqueId() ); mCalendar->addIncidence(newInc); } deleteTransaction( newIncBase ); return res; } return false; }
bool Scheduler::acceptPublish( IncidenceBase *newIncBase, ScheduleMessage::Status status, Method method ) { if( newIncBase->type() == "FreeBusy" ) { return acceptFreeBusy( newIncBase, method ); } bool res = false; kdDebug(5800) << "Scheduler::acceptPublish, status=" << ScheduleMessage::statusName( status ) << endl; Incidence *newInc = static_cast<Incidence *>( newIncBase ); Incidence *calInc = mCalendar->incidence( newIncBase->uid() ); switch ( status ) { case ScheduleMessage::Unknown: case ScheduleMessage::PublishNew: case ScheduleMessage::PublishUpdate: res = true; if ( calInc ) { if ( (newInc->revision() > calInc->revision()) || (newInc->revision() == calInc->revision() && newInc->lastModified() > calInc->lastModified() ) ) { mCalendar->deleteIncidence( calInc ); } else res = false; } if ( res ) mCalendar->addIncidence( newInc ); break; case ScheduleMessage::Obsolete: res = true; break; default: break; } deleteTransaction( newIncBase ); return res; }