Пример #1
0
 function MeetingResponse1($requestid, $folderid, $response, &$calendarid)
 {
     // Use standard meeting response code to process meeting request
     $entryid = mapi_msgstore_entryidfromsourcekey($this->_defaultstore, hex2bin($folderid), hex2bin($requestid));
     $mapimessage = mapi_msgstore_openentry($this->_defaultstore, $entryid);
     if (!$mapimessage) {
         debugLog("Unable to open request message for response");
         return false;
     }
     $meetingrequest = new Meetingrequest($this->_defaultstore, $mapimessage);
     if (!$meetingrequest->isMeetingRequest()) {
         debugLog("Attempt to respond to non-meeting request");
         return false;
     }
     if ($meetingrequest->isLocalOrganiser()) {
         debugLog("Attempt to response to meeting request that we organized");
         return false;
     }
     // Process the meeting response. We don't have to send the actual meeting response
     // e-mail, because the device will send it itself.
     switch ($response) {
         case '3':
             // decline
             $meetingrequest->doDecline(false);
             break;
         case '2':
             // tentative //
             $newentryid = $meetingrequest->doAccept(true, false, $meetingrequest->isInCalendar());
             break;
         default:
             // dw2412 accept = default = 1 //
             $newentryid = $meetingrequest->doAccept(false, false, $meetingrequest->isInCalendar());
             break;
     }
     // F/B will be updated on logoff
     // We have to return the ID of the new calendar item, so do that here
     // dw2412 Outlook shows quite ugly behaviour since it creates already tentative appointment
     // if message lays some time in inbox. The EntryID that we need to return in this case is
     // the one found by the globalobjid of the original message that we use to find the Source_Key of the
     // appointment created by Outlook - otherwise we have two appointments on mobile device.
     // This is why I do the below things to overcome the problem...
     if ($newentryid === false && $response != 3) {
         debugLog("doAccept EntryID == false {$response}");
         $namedgoid = GetPropIDFromString($this->_defaultstore, "PT_BINARY:{6ED8DA90-450B-101B-98DA-00AA003F1305}:0x3");
         $namedgoid2 = GetPropIDFromString($this->_defaultstore, "PT_BINARY:{6ED8DA90-450B-101B-98DA-00AA003F1305}:0x23");
         $messageprops = mapi_getprops($mapimessage, array($namedgoid, $namedgoid2, PR_OWNER_APPT_ID));
         $goid2 = $messageprops[$namedgoid2];
         if (isset($messageprops[PR_OWNER_APPT_ID])) {
             $apptid = $messageprops[PR_OWNER_APPT_ID];
         } else {
             $apptid = false;
         }
         $basedate = $meetingrequest->getBasedateFromGlobalID($messageprops[$namedgoid]);
         /**
          * If basedate is found in globalID, then there are two possibilities.
          * case 1) User has only this occurrence OR
          * case 2) User has recurring item and has received an update for an occurrence
          */
         if ($basedate) {
             // First try with GlobalID(0x3) (case 1)
             $entryid = $meetingrequest->findCalendarItems($messageprops[$namedgoid], $apptid);
             // If not found then try with CleanGlobalID(0x23) (case 2)
             if (!is_array($entryid)) {
                 $entryid = $meetingrequest->findCalendarItems($goid2, $apptid);
             }
         } else {
             $entryid = $meetingrequest->findCalendarItems($goid2, $apptid);
         }
         $newentryid = $entryid[0];
         debugLog("New EntryID from our try to find it by globalid " . bin2hex($newentryid));
         // Now just update the appointment item since otherwise it remains always tentative...
         $newitem = mapi_msgstore_openentry($this->_defaultstore, $newentryid);
         mapi_setprops($newitem, array(GetPropIDFromString($this->_defaultstore, "PT_LONG:{00062002-0000-0000-C000-000000000046}:0x8205") => $response == 2 ? 1 : 2, GetPropIDFromString($this->_defaultstore, "PT_LONG:{00062002-0000-0000-C000-000000000046}:0x8218") => $response == 2 ? olResponseTentative : olResponseAccepted));
         mapi_savechanges($newitem);
     } else {
         debugLog("New EntryID from doAccept " . bin2hex($newentryid));
     }
     $newitem = mapi_msgstore_openentry($this->_defaultstore, $newentryid);
     $newprops = mapi_getprops($newitem, array(PR_SOURCE_KEY));
     $calendarid = bin2hex($newprops[PR_SOURCE_KEY]);
     return true;
 }
Пример #2
0
 function MeetingResponse($requestid, $folderid, $response, &$calendarid)
 {
     // Use standard meeting response code to process meeting request
     $entryid = mapi_msgstore_entryidfromsourcekey($this->_defaultstore, hex2bin($folderid), hex2bin($requestid));
     $mapimessage = mapi_msgstore_openentry($this->_defaultstore, $entryid);
     if (!$mapimessage) {
         debugLog("Unable to open request message for response");
         return false;
     }
     $meetingrequest = new Meetingrequest($this->_defaultstore, $mapimessage);
     if (!$meetingrequest->isMeetingRequest()) {
         debugLog("Attempt to respond to non-meeting request");
         return false;
     }
     if ($meetingrequest->isLocalOrganiser()) {
         debugLog("Attempt to response to meeting request that we organized");
         return false;
     }
     // Process the meeting response. We don't have to send the actual meeting response
     // e-mail, because the device will send it itself.
     switch ($response) {
         case 1:
             // accept
         // accept
         default:
             $entryid = $meetingrequest->doAccept(false, false, $meetingrequest->isInCalendar());
             break;
         case 2:
             // tentative
             $meetingrequest->doAccept(true, false, $meetingrequest->isInCalendar());
             break;
         case 3:
             // decline
             $meetingrequest->doDecline(false);
             break;
     }
     // Update F/B
     $root = mapi_msgstore_openentry($this->_defaultstore);
     $rootprops = mapi_getprops($root, array(PR_IPM_APPOINTMENT_ENTRYID));
     $calendar = mapi_msgstore_openentry($this->_defaultstore, $rootprops[PR_IPM_APPOINTMENT_ENTRYID]);
     $storeprops = mapi_getprops($this->_defaultstore, array(PR_USER_ENTRYID));
     $pub = new FreeBusyPublish($this->_session, $this->_defaultstore, $calendar, $storeprops[PR_USER_ENTRYID]);
     $pub->publishFB(time() - 7 * 24 * 60 * 60, 6 * 30 * 24 * 60 * 60);
     // publish from one week ago, 6 months ahead
     // We have to return the ID of the new calendar item, so do that here
     $newitem = mapi_msgstore_openentry($this->_defaultstore, $entryid);
     $newprops = mapi_getprops($newitem, array(PR_SOURCE_KEY));
     $calendarid = bin2hex($newprops[PR_SOURCE_KEY]);
     return true;
 }
Пример #3
0
 function MeetingResponse($requestid, $folderid, $response, &$calendarid)
 {
     // Use standard meeting response code to process meeting request
     $entryid = mapi_msgstore_entryidfromsourcekey($this->_defaultstore, hex2bin($folderid), hex2bin($requestid));
     $mapimessage = mapi_msgstore_openentry($this->_defaultstore, $entryid);
     if (!$mapimessage) {
         debugLog("Unable to open request message for response");
         return false;
     }
     $meetingrequest = new Meetingrequest($this->_defaultstore, $mapimessage);
     if (!$meetingrequest->isMeetingRequest()) {
         debugLog("Attempt to respond to non-meeting request");
         return false;
     }
     if ($meetingrequest->isLocalOrganiser()) {
         debugLog("Attempt to response to meeting request that we organized");
         return false;
     }
     // Process the meeting response. We don't have to send the actual meeting response
     // e-mail, because the device will send it itself.
     switch ($response) {
         case 1:
             // accept
         // accept
         default:
             $entryid = $meetingrequest->doAccept(false, false, $meetingrequest->isInCalendar());
             break;
         case 2:
             // tentative
             $meetingrequest->doAccept(true, false, $meetingrequest->isInCalendar());
             break;
         case 3:
             // decline
             $meetingrequest->doDecline(false);
             break;
     }
     // F/B will be updated on logoff
     // We have to return the ID of the new calendar item, so do that here
     $newitem = mapi_msgstore_openentry($this->_defaultstore, $entryid);
     $newprops = mapi_getprops($newitem, array(PR_SOURCE_KEY));
     $calendarid = bin2hex($newprops[PR_SOURCE_KEY]);
     return true;
 }