$rr->setFrequency(RecurrenceRule::Monthly);
$byday = new vectordaypos();
$byday->push(new DayPos(2, kolabformat::Monday));
$byday->push(new DayPos(-1, kolabformat::Friday));
$rr->setByday($byday);
$e1->setRecurrenceRule($rr);
$xml = kolabformat::writeEvent($e1);
#print $xml;
assertcontains($xml, '<byday>2MO</byday><byday>-1FR</byday>', "Recurrence by weekday");
$att1 = new Attendee(new ContactReference("*****@*****.**"));
$att1->setPartStat(kolabformat::PartDelegated);
$att2 = new Attendee(new ContactReference("*****@*****.**"));
$att1->setPartStat(kolabformat::PartNeedsAction);
$vdelegatees = new vectorcontactref();
$vdelegatees->push($att2->contact());
$att1->setDelegatedTo($vdelegatees);
$vdelegators = new vectorcontactref();
$vdelegators->push($att1->contact());
$att2->setDelegatedFrom($vdelegators);
$attendees = new vectorattendee();
$attendees->push($att1);
$attendees->push($att2);
$e1->setAttendees($attendees);
$xml = kolabformat::writeEvent($e1);
assertcontains($xml, '<delegated-to><cal-address>mailto:%3Cjane%40kolab.org%3E</cal-address>', "Delegated-To");
assertcontains($xml, '<delegated-from><cal-address>mailto:%3Cjohn%40kolab.org%3E</cal-address>', "Delegated-From");
$e2 = kolabformat::readEvent($xml, false);
$attendees_ = $e2->attendees();
assertequal($attendees_->size(), 2, "Event::attendees()");
$att1_ = $attendees_->get(0);
$att2_ = $attendees_->get(1);