Skip to content

Commit

Permalink
It's perfectly fine to not have an attendee.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Mar 5, 2015
1 parent cefc217 commit 83d4582
Showing 1 changed file with 28 additions and 29 deletions.
57 changes: 28 additions & 29 deletions nag/lib/Task.php
Expand Up @@ -1472,38 +1472,37 @@ public function fromiCalendar(Horde_Icalendar_Vtodo $vTodo)
// If an attendee matches our from_addr, add current user as assignee.
try {
$atnames = $vTodo->getAttribute('ATTENDEE');
} catch (Horde_Icalendar_Exception $e) {
throw new Nag_Exception($e->getMessage());
}
if (!is_array($atnames)) {
$atnames = array($atnames);
}
$identity = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Identity')->create();
$all_addrs = $identity->getAll('from_addr');
foreach ($atnames as $index => $attendee) {
if ($vTodo->getAttribute('VERSION') < 2) {
$addr_ob = new Horde_Mail_Rfc822_Address($attendee);
if (!$addr_ob->valid) {
continue;
if (!is_array($atnames)) {
$atnames = array($atnames);
}
$identity = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Identity')->create();
$all_addrs = $identity->getAll('from_addr');
foreach ($atnames as $index => $attendee) {
if ($vTodo->getAttribute('VERSION') < 2) {
$addr_ob = new Horde_Mail_Rfc822_Address($attendee);
if (!$addr_ob->valid) {
continue;
}
$attendee = $addr_ob->bare_address;
$name = $addr_ob->personal;
} else {
$attendee = str_ireplace('mailto:', '', $attendee);
$addr_ob = new Horde_Mail_Rfc822_Address($attendee);
if (!$addr_ob->valid) {
continue;
}
$attendee = $addr_ob->bare_address;
$name = isset($atparms[$index]['CN']) ? $atparms[$index]['CN'] : null;
}
$attendee = $addr_ob->bare_address;
$name = $addr_ob->personal;
} else {
$attendee = str_ireplace('mailto:', '', $attendee);
$addr_ob = new Horde_Mail_Rfc822_Address($attendee);
if (!$addr_ob->valid) {
continue;
if (in_array($attendee, $all_addrs) !== false) {
$this->assignee = $GLOBALS['conf']['assignees']['allow_external'] ? $attendee : $GLOBALS['registry']->getAuth();
$this->status = Nag::RESPONSE_ACCEPTED;
break;
} elseif ($GLOBALS['conf']['assignees']['allow_external']) {
$this->assignee = $attendee;
}
$attendee = $addr_ob->bare_address;
$name = isset($atparms[$index]['CN']) ? $atparms[$index]['CN'] : null;
}
if (in_array($attendee, $all_addrs) !== false) {
$this->assignee = $GLOBALS['conf']['assignees']['allow_external'] ? $attendee : $GLOBALS['registry']->getAuth();
$this->status = Nag::RESPONSE_ACCEPTED;
break;
} elseif ($GLOBALS['conf']['assignees']['allow_external']) {
$this->assignee = $attendee;
}
} catch (Horde_Icalendar_Exception $e) {
}

// Default to current user as organizer
Expand Down

0 comments on commit 83d4582

Please sign in to comment.