Revision: 1733
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1733&view=rev
Author:   cimorrison
Date:     2011-01-05 09:37:09 +0000 (Wed, 05 Jan 2011)

Log Message:
-----------
Fixed problem whereby attendees could be included as both REQ-PARTICIPANT and 
NON-PARTICIPANT

Modified Paths:
--------------
    mrbs/branches/ics_attachments/web/functions_ical.inc

Modified: mrbs/branches/ics_attachments/web/functions_ical.inc
===================================================================
--- mrbs/branches/ics_attachments/web/functions_ical.inc        2010-12-23 
09:07:13 UTC (rev 1732)
+++ mrbs/branches/ics_attachments/web/functions_ical.inc        2011-01-05 
09:37:09 UTC (rev 1733)
@@ -219,14 +219,17 @@
   // time of writing (Dec 2010) there don't seem to be any that do so!
   if (!empty($addresses))
   {
+    $attendees = $addresses;  // take a copy of $addresses as we're going to 
alter it
     $keys = array('to', 'cc');  // We won't do 'bcc' as they need to stay blind
     foreach ($keys as $key)
     {
-      if (!empty($addresses[$key]))
+      $attendees[$key] = explode(',', $attendees[$key]);  // convert the list 
into an array
+    }
+    foreach ($keys as $key)
+    {
+      foreach ($attendees[$key] as $attendee)
       {
-        $address_list = $addresses[$key];
-        $address_array = explode(',', $address_list);
-        foreach ($address_array as $address)
+        if (!empty($attendee))
         {
           switch ($key)
           {
@@ -234,10 +237,19 @@
               $role = "REQ-PARTICIPANT";
               break;
             default:
+              if (in_array($attendee, $attendees['to']))
+              {
+                // It's possible that an address could appear on more than one
+                // line, in which case we only want to have one ATTENDEE 
property
+                // for that address and we'll chose the REQ-PARTICIPANT.   
(Apart
+                // from two conflicting ATTENDEES not making sense, it also 
breaks
+                // some applications, eg Apple Mail/iCal)
+                continue 2;  // Move on to the next attendeee
+              }
               $role = "NON-PARTICIPANT";
               break;
           }
-          $results[] = "ATTENDEE;ROLE=$role:mailto:"; . trim($address);
+          $results[] = "ATTENDEE;ROLE=$role:mailto:"; . trim($attendee);
         }
       }
     }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to