Commit c10ca2ac authored by mku's avatar mku

ZP-381 #comment Remove unused functions required by previous versions of SendMail #time 30m

git-svn-id: https://z-push.org/svn/z-push/trunk@1654 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent 127def77
...@@ -372,30 +372,6 @@ class MAPIUtils { ...@@ -372,30 +372,6 @@ class MAPIUtils {
} }
/**
* Handles recurring item for meeting request coming from tnef
*
* @param array $mapiprops
* @param array $props
*
* @access public
* @return
*/
public static function handleRecurringItem(&$mapiprops, &$props) {
$mapiprops[$props["isrecurringtag"]] = true;
$mapiprops[$props["sideeffects"]] = 369;
//both goids have the same value
$mapiprops[$props["goid2tag"]] = $mapiprops[$props["goidtag"]];
$mapiprops[$props["type"]] = "IPM.Appointment";
$mapiprops[$props["busystatus"]] = 1; //tentative
$mapiprops[PR_RESPONSE_REQUESTED] = true;
$mapiprops[PR_ICON_INDEX] = 1027;
$mapiprops[$props["meetingstatus"]] = olMeetingReceived; // The recipient is receiving the request
$mapiprops[$props["responsestatus"]] = olResponseNotResponded;
$mapiprops[$props["usetnef"]] = true;
}
/** /**
* Reads data of large properties from a stream * Reads data of large properties from a stream
* *
...@@ -448,60 +424,6 @@ class MAPIUtils { ...@@ -448,60 +424,6 @@ class MAPIUtils {
} }
} }
/**
* Gets attachment from a Mail_mimeDecode parsed email and stores it into MAPI
*
* @param mixed $mapimessage target message
* @param object $part Mail_mimeDecode part to be stored
*
* @access public
* @return boolean
*/
public static function StoreAttachment($mapimessage, $part) {
// attachment
$attach = mapi_message_createattach($mapimessage);
$filename = "";
// Filename is present in both Content-Type: name=.. and in Content-Disposition: filename=
if(isset($part->ctype_parameters["name"]))
$filename = $part->ctype_parameters["name"];
else if(isset($part->d_parameters["name"]))
$filename = $part->d_parameters["filename"];
else if (isset($part->d_parameters["filename"])) // sending appointment with nokia & android only filename is set
$filename = $part->d_parameters["filename"];
// filenames with more than 63 chars as splitted several strings
else if (isset($part->d_parameters["filename*0"])) {
for ($i=0; $i< count($part->d_parameters); $i++)
if (isset($part->d_parameters["filename*".$i]))
$filename .= $part->d_parameters["filename*".$i];
}
else
$filename = "untitled";
// Android just doesn't send content-type, so mimeDecode doesn't performs base64 decoding
// on meeting requests text/calendar somewhere inside content-transfer-encoding
if (isset($part->headers['content-transfer-encoding']) && strpos($part->headers['content-transfer-encoding'], 'base64')) {
if (strpos($part->headers['content-transfer-encoding'], 'text/calendar') !== false) {
$part->ctype_primary = 'text';
$part->ctype_secondary = 'calendar';
}
if (!isset($part->headers['content-type']))
$part->body = base64_decode($part->body);
}
mapi_setprops($attach, array(
// Set filename and attachment type
PR_ATTACH_LONG_FILENAME => u2wi($filename),
PR_ATTACH_METHOD => ATTACH_BY_VALUE,
// Set attachment data
PR_ATTACH_DATA_BIN => $part->body,
// Set MIME type
PR_ATTACH_MIME_TAG => $part->ctype_primary . "/" . $part->ctype_secondary));
ZLog::Write(LOGLEVEL_DEBUG, sprintf("Utils::StoreAttachment: Attachment '%s' with %d bytes saved", $filename, strlen($part->body)));
return mapi_savechanges($attach);
}
/** /**
* Returns the MAPI PR_CONTAINER_CLASS string for an ActiveSync Foldertype * Returns the MAPI PR_CONTAINER_CLASS string for an ActiveSync Foldertype
* *
......
...@@ -1377,73 +1377,6 @@ class BackendZarafa implements IBackend, ISearchProvider { ...@@ -1377,73 +1377,6 @@ class BackendZarafa implements IBackend, ISearchProvider {
$mapiprops[$sendMailProps["priority"]] = $priority; $mapiprops[$sendMailProps["priority"]] = $priority;
} }
/**
* Adds the recipients to an email message from a RFC822 message headers.
*
* @param MIMEMessageHeader $headers
* @param MAPIMessage $mapimessage
*/
private function addRecipients($headers, &$mapimessage) {
$toaddr = $ccaddr = $bccaddr = array();
$Mail_RFC822 = new Mail_RFC822();
if(isset($headers["to"]))
$toaddr = $Mail_RFC822->parseAddressList($headers["to"]);
if(isset($headers["cc"]))
$ccaddr = $Mail_RFC822->parseAddressList($headers["cc"]);
if(isset($headers["bcc"]))
$bccaddr = $Mail_RFC822->parseAddressList($headers["bcc"]);
if(empty($toaddr))
throw new StatusException(sprintf("ZarafaBackend->SendMail(): 'To' address in RFC822 message not found or unparsable. To header: '%s'", ((isset($headers["to"]))?$headers["to"]:'')), SYNC_COMMONSTATUS_MESSHASNORECIP);
// Add recipients
$recips = array();
foreach(array(MAPI_TO => $toaddr, MAPI_CC => $ccaddr, MAPI_BCC => $bccaddr) as $type => $addrlist) {
foreach($addrlist as $addr) {
$mapirecip[PR_ADDRTYPE] = "SMTP";
$mapirecip[PR_EMAIL_ADDRESS] = $addr->mailbox . "@" . $addr->host;
if(isset($addr->personal) && strlen($addr->personal) > 0)
$mapirecip[PR_DISPLAY_NAME] = u2wi($addr->personal);
else
$mapirecip[PR_DISPLAY_NAME] = $mapirecip[PR_EMAIL_ADDRESS];
$mapirecip[PR_RECIPIENT_TYPE] = $type;
$mapirecip[PR_ENTRYID] = mapi_createoneoff($mapirecip[PR_DISPLAY_NAME], $mapirecip[PR_ADDRTYPE], $mapirecip[PR_EMAIL_ADDRESS]);
array_push($recips, $mapirecip);
}
}
mapi_message_modifyrecipients($mapimessage, 0, $recips);
}
/**
* Get headers for the forwarded message
*
* @param MAPIMessage $fwmessage
*
* @return string
*/
private function getForwardHeaders($message) {
$messageprops = mapi_getprops($message, array(PR_SENT_REPRESENTING_NAME, PR_DISPLAY_TO, PR_DISPLAY_CC, PR_SUBJECT, PR_CLIENT_SUBMIT_TIME));
$fwheader = "\r\n\r\n";
$fwheader .= "-----Original Message-----\r\n";
if(isset($messageprops[PR_SENT_REPRESENTING_NAME]))
$fwheader .= "From: " . $messageprops[PR_SENT_REPRESENTING_NAME] . "\r\n";
if(isset($messageprops[PR_DISPLAY_TO]) && strlen($messageprops[PR_DISPLAY_TO]) > 0)
$fwheader .= "To: " . $messageprops[PR_DISPLAY_TO] . "\r\n";
if(isset($messageprops[PR_DISPLAY_CC]) && strlen($messageprops[PR_DISPLAY_CC]) > 0)
$fwheader .= "Cc: " . $messageprops[PR_DISPLAY_CC] . "\r\n";
if(isset($messageprops[PR_CLIENT_SUBMIT_TIME]))
$fwheader .= "Sent: " . strftime("%x %X", $messageprops[PR_CLIENT_SUBMIT_TIME]) . "\r\n";
if(isset($messageprops[PR_SUBJECT]))
$fwheader .= "Subject: " . $messageprops[PR_SUBJECT] . "\r\n";
return $fwheader."\r\n";
}
/** /**
* Copies attachments from one message to another. * Copies attachments from one message to another.
* *
......
...@@ -77,35 +77,6 @@ class Utils { ...@@ -77,35 +77,6 @@ class Utils {
return array($user, $domain); return array($user, $domain);
} }
/**
* iPhone defines standard summer time information for current year only,
* starting with time change in February. Dates from the 1st January until
* the time change are undefined and the server uses GMT or its current time.
* The function parses the ical attachment and replaces DTSTART one year back
* in VTIMEZONE section if the event takes place in this undefined time.
* See also http://developer.berlios.de/mantis/view.php?id=311
*
* @param string $ical iCalendar data
*
* @access public
* @return string
*/
static public function IcalTimezoneFix($ical) {
$eventDate = substr($ical, (strpos($ical, ":", strpos($ical, "DTSTART", strpos($ical, "BEGIN:VEVENT")))+1), 8);
$posStd = strpos($ical, "DTSTART:", strpos($ical, "BEGIN:STANDARD")) + strlen("DTSTART:");
$posDst = strpos($ical, "DTSTART:", strpos($ical, "BEGIN:DAYLIGHT")) + strlen("DTSTART:");
$beginStandard = substr($ical, $posStd , 8);
$beginDaylight = substr($ical, $posDst , 8);
if (($eventDate < $beginStandard) && ($eventDate < $beginDaylight) ) {
ZLog::Write(LOGLEVEL_DEBUG,"icalTimezoneFix for event on $eventDate, standard:$beginStandard, daylight:$beginDaylight");
$year = intval(date("Y")) - 1;
$ical = substr_replace($ical, $year, (($beginStandard < $beginDaylight) ? $posDst : $posStd), strlen($year));
}
return $ical;
}
/** /**
* Build an address string from the components * Build an address string from the components
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment