[prev in list] [next in list] [prev in thread] [next in thread]
List: squirrelmail-cvs
Subject: [SM-CVS] SF.net SVN: squirrelmail: [12830]
From: pdontthink () users ! sourceforge ! net
Date: 2007-12-19 8:23:47
Message-ID: E1J4uDT-00067L-0d () sc8-pr-svn2 ! sourceforge ! net
[Download RAW message or body]
Revision: 12830
http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=12830&view=rev
Author: pdontthink
Date: 2007-12-19 00:23:46 -0800 (Wed, 19 Dec 2007)
Log Message:
-----------
Refactor how IMAP messages are "sent"
Modified Paths:
--------------
branches/SM-1_4-STABLE/squirrelmail/ChangeLog
branches/SM-1_4-STABLE/squirrelmail/class/deliver/Deliver.class.php
branches/SM-1_4-STABLE/squirrelmail/class/deliver/Deliver_IMAP.class.php
branches/SM-1_4-STABLE/squirrelmail/src/compose.php
Modified: branches/SM-1_4-STABLE/squirrelmail/ChangeLog
===================================================================
--- branches/SM-1_4-STABLE/squirrelmail/ChangeLog 2007-12-17 15:58:12 UTC (rev 12829)
+++ branches/SM-1_4-STABLE/squirrelmail/ChangeLog 2007-12-19 08:23:46 UTC (rev 12830)
@@ -9,6 +9,7 @@
- Fix warning in Printer Friendly due to missing include (#1849101).
- Let configtest.php use optional PEAR dynamic extension loading,
patch by Walter Huijbers (#1833123).
+ - Fix for IMAP servers that were having problems saving sent messages
Version 1.4.13 - 14 December 2007
---------------------------------
Modified: branches/SM-1_4-STABLE/squirrelmail/class/deliver/Deliver.class.php
===================================================================
--- branches/SM-1_4-STABLE/squirrelmail/class/deliver/Deliver.class.php 2007-12-17 \
15:58:12 UTC (rev 12829)
+++ branches/SM-1_4-STABLE/squirrelmail/class/deliver/Deliver.class.php 2007-12-19 \
08:23:46 UTC (rev 12830) @@ -33,6 +33,11 @@
*
* @param Message $message Message object to send
* @param resource $stream Handle to the SMTP stream
+ * (when FALSE, nothing will be
+ * written to the stream; this can
+ * be used to determine the actual
+ * number of bytes that will be
+ * written to the stream)
* @param string $reply_id Identifies message being replied to
* (OPTIONAL; caller should ONLY specify
* a value for this when the message
@@ -42,10 +47,17 @@
* message inside another (OPTIONAL; caller
* should ONLY specify a value for this
* when the message being sent is a reply)
+ * @param mixed $extra Any implementation-specific variables
+ * can be passed in here and used in
+ * an overloaded version of this method
+ * if needed.
*
- * @return integer $raw_length
+ * @return integer $raw_length The number of bytes written (or that would
+ * have been written) to the output stream
*/
- function mail($message, $stream=false, $reply_id=0, $reply_ent_id=0) {
+ function mail($message, $stream=false, $reply_id=0, $reply_ent_id=0,
+ $extra=NULL) {
+
$rfc822_header = $message->rfc822_header;
if (count($message->entities)) {
$boundary = $this->mimeBoundary();
@@ -61,7 +73,8 @@
if ($reply_id) {
global $imapConnection, $username, $key, $imapServerAddress,
$imapPort, $mailbox;
- if (!$imapConnection)
+
+ if (!is_resource($imapConnection))
$imapConnection = sqimap_login($username, $key,
$imapServerAddress, $imapPort, 0);
@@ -89,12 +102,43 @@
? $message->reply_rfc822_header : '');
$header = $this->prepareRFC822_Header($rfc822_header, $reply_rfc822_header, \
$raw_length);
+ $this->send_mail($message, $header, $boundary, $stream, $raw_length, \
$extra); +
+ return $raw_length;
+ }
+
+ /**
+ * function send_mail - send the message parts to the IMAP stream
+ *
+ * @param Message $message Message object to send
+ * @param string $header Headers ready to send
+ * @param string $boundary Message parts boundary
+ * @param resource $stream Handle to the SMTP stream
+ * (when FALSE, nothing will be
+ * written to the stream; this can
+ * be used to determine the actual
+ * number of bytes that will be
+ * written to the stream)
+ * @param int &$raw_length The number of bytes written (or that
+ * would have been written) to the
+ * output stream - NOTE that this is
+ * passed by reference
+ * @param mixed $extra Any implementation-specific variables
+ * can be passed in here and used in
+ * an overloaded version of this method
+ * if needed.
+ *
+ * @return void
+ *
+ */
+ function send_mail($message, $header, $boundary, $stream=false,
+ &$raw_length, $extra=NULL) {
+
if ($stream) {
$this->preWriteToStream($header);
$this->writeToStream($stream, $header);
}
$this->writeBody($message, $stream, $raw_length, $boundary);
- return $raw_length;
}
/**
@@ -105,6 +149,11 @@
*
* @param Message $message Message object to transform
* @param resource $stream SMTP output stream
+ * (when FALSE, nothing will be
+ * written to the stream; this can
+ * be used to determine the actual
+ * number of bytes that will be
+ * written to the stream)
* @param integer &$length_raw raw length of the message (part)
* as returned by mail fn
* @param string $boundary custom boundary to call, usually for subparts
@@ -163,6 +212,11 @@
*
* @param Message $message Message object to transform
* @param resource $stream SMTP output stream
+ * (when FALSE, nothing will be
+ * written to the stream; this can
+ * be used to determine the actual
+ * number of bytes that will be
+ * written to the stream)
* @param integer &$length length of the message part
* as returned by mail fn
*
@@ -853,4 +907,3 @@
}
}
-?>
Modified: branches/SM-1_4-STABLE/squirrelmail/class/deliver/Deliver_IMAP.class.php
===================================================================
--- branches/SM-1_4-STABLE/squirrelmail/class/deliver/Deliver_IMAP.class.php 2007-12-17 \
15:58:12 UTC (rev 12829)
+++ branches/SM-1_4-STABLE/squirrelmail/class/deliver/Deliver_IMAP.class.php 2007-12-19 \
08:23:46 UTC (rev 12830) @@ -25,8 +25,59 @@
return true;
}
+ /**
+ * function send_mail - send the message parts to the IMAP stream
+ *
+ * Overridden from parent class so that we can insert some
+ * IMAP APPEND commands before and after the message is
+ * sent on the IMAP stream.
+ *
+ * @param Message $message Message object to send
+ * @param string $header Headers ready to send
+ * @param string $boundary Message parts boundary
+ * @param resource $stream Handle to the SMTP stream
+ * (when FALSE, nothing will be
+ * written to the stream; this can
+ * be used to determine the actual
+ * number of bytes that will be
+ * written to the stream)
+ * @param int &$raw_length The number of bytes written (or that
+ * would have been written) to the
+ * output stream - NOTE that this is
+ * passed by reference
+ * @param string $folder The IMAP folder to which the
+ * message is being sent
+ *
+ * @return void
+ *
+ */
+ function send_mail($message, $header, $boundary, $stream=false,
+ &$raw_length, $folder) {
+
+ // write the body without providing a stream so we
+ // can calculate the final length - after this call,
+ // $final_length will be our correct final length value
+ //
+ $final_length = $raw_length;
+ $this->writeBody($message, 0, $final_length, $boundary);
+
+
+ // now if we have a real live stream, send the message
+ //
+ if ($stream) {
+ sqimap_append ($stream, $folder, $final_length);
+
+ $this->preWriteToStream($header);
+ $this->writeToStream($stream, $header);
+ $this->writeBody($message, $stream, $raw_length, $boundary);
+
+ sqimap_append_done ($stream, $folder);
+ }
+
+ }
+
+
/* to do: finishing the imap-class so the initStream function can call the
imap-class */
}
-?>
\ No newline at end of file
Modified: branches/SM-1_4-STABLE/squirrelmail/src/compose.php
===================================================================
--- branches/SM-1_4-STABLE/squirrelmail/src/compose.php 2007-12-17 15:58:12 UTC (rev \
12829)
+++ branches/SM-1_4-STABLE/squirrelmail/src/compose.php 2007-12-19 08:23:46 UTC (rev \
12830) @@ -1577,16 +1577,12 @@
$stream = $deliver->initStream($composeMessage,$sendmail_path);
} elseif ($draft) {
global $draft_folder;
- require_once(SM_PATH . 'class/deliver/Deliver_IMAP.class.php');
$imap_stream = sqimap_login($username, $key, $imapServerAddress,
$imapPort, 0);
if (sqimap_mailbox_exists ($imap_stream, $draft_folder)) {
require_once(SM_PATH . 'class/deliver/Deliver_IMAP.class.php');
$imap_deliver = new Deliver_IMAP();
- $length = $imap_deliver->mail($composeMessage, 0, $reply_id, \
$reply_ent_id);
- sqimap_append ($imap_stream, $draft_folder, $length);
- $imap_deliver->mail($composeMessage, $imap_stream, $reply_id, \
$reply_ent_id);
- sqimap_append_done ($imap_stream, $draft_folder);
+ $imap_deliver->mail($composeMessage, $imap_stream, $reply_id, \
$reply_ent_id, $draft_folder); sqimap_logout($imap_stream);
unset ($imap_deliver);
$composeMessage->purgeAttachments();
@@ -1644,11 +1640,9 @@
}
if (($fld_sent && $svr_allow_sent && !$lcl_allow_sent) || ($fld_sent && \
$lcl_allow_sent)) {
- sqimap_append ($imap_stream, $sent_folder, $length);
require_once(SM_PATH . 'class/deliver/Deliver_IMAP.class.php');
$imap_deliver = new Deliver_IMAP();
- $imap_deliver->mail($composeMessage, $imap_stream, $reply_id, \
$reply_ent_id);
- sqimap_append_done ($imap_stream, $sent_folder);
+ $imap_deliver->mail($composeMessage, $imap_stream, $reply_id, \
$reply_ent_id, $sent_folder); unset ($imap_deliver);
}
$composeMessage->purgeAttachments();
This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
-----
squirrelmail-cvs mailing list
List address: squirrelmail-cvs@lists.sourceforge.net
List info (subscribe/unsubscribe/change options): \
https://lists.sourceforge.net/lists/listinfo/squirrelmail-cvs
Repository: http://squirrelmail.org/svn
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic