if ($rn == "\r\n"){
$tmp = str_replace("\n", "\r\n", $tmp);
}
- /**
- * Check if the last line has newline ($rn) in it
- * and append if it doesn't.
- */
- if ($fp && feof($fp) && !strstr($tmp, "$rn")){
- $tmp .= $rn;
- }
if ($fp) {
fputs($fp, $tmp);
}
$length += strlen($tmp);
}
+ if (substr($tmp, strlen($tmp) - strlen($rn), strlen($rn)) != $rn) {
+ if ($fp) {
+ fputs($fp, $rn);
+ }
+ }
} else {
$header .= "Content-Transfer-Encoding: base64"
. "$rn" . "$rn";
/* Delete files that are uploaded for attaching
*/
function deleteAttachments($session) {
- global $username, $attachments, $attachment_dir;
+ global $username, $attachments, $attachment_dir, $data_dir;
$hashed_attachment_dir = getHashedDir($username, $attachment_dir);
$rem_attachments = array();
}
}
$attachments = $rem_attachments;
+ setPref($data_dir, $username, 'attachments', serialize($attachments));
}
/* Return a nice MIME-boundary
global $useSendmail, $msg_id, $is_reply, $mailbox, $onetimepad,
$data_dir, $username, $domain, $key, $version, $sent_folder,
$imapServerAddress, $imapPort, $default_use_priority, $more_headers,
- $request_mdn, $request_dr;
+ $request_mdn, $request_dr, $uid_support;
$more_headers = Array();
* The References header should really be the old Referenced header
* with the message ID appended, and now it is (jmunro)
*/
- $sid = sqimap_session_id();
+ $sid = sqimap_session_id($uid_support);
$query = "$sid FETCH $reply_id (BODY.PEEK[HEADER.FIELDS (Message-Id In-Reply-To)])\r\n";
fputs ($imap_stream, $query);
$read = sqimap_read_data($imap_stream, $sid, true, $response, $message);