Fixed bad/malformed request error when Sent was over quota. This was checked
authorkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 30 Mar 2005 18:35:50 +0000 (18:35 +0000)
committerkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 30 Mar 2005 18:35:50 +0000 (18:35 +0000)
at the second stage when appending to Sent but not the first stage (the
response was simply thrown away). I've abstracted the checking to a
separate function that is called at the two relevant points. Closes: #1172694

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@9166 7612ce4b-ef26-0410-bec9-ea0150e637f0

ChangeLog
functions/imap_general.php

index af4c086fcc15e8637fc26ccf7fb27db6d573666c..eabfe0ef0934d4b25389d99fc3cbc84964a32f0c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -289,6 +289,7 @@ Version 1.5.1 -- CVS
     (#1043576).
   - mbstring internal encoding is switched to ASCII, if mbstring.func_overload
     is enabled (#929644).
+  - Fixed checking for quota when appending to Sent folder (#1172694).
   
 Version 1.5.0
 --------------------
index 56e551fe073d108f1788348f6dbe298c1f5f3bd0..9d1fa6dc18fb293f1d89771bb4d0d492854bcaae 100755 (executable)
@@ -966,15 +966,22 @@ function sqimap_status_messages ($imap_stream, $mailbox,
 function sqimap_append ($imap_stream, $sent_folder, $length) {
     fputs ($imap_stream, sqimap_session_id() . ' APPEND ' . sqimap_encode_mailbox_name($sent_folder) . " (\\Seen) \{$length}\r\n");
     $tmp = fgets ($imap_stream, 1024);
+    sqimap_append_checkresponse($tmp, $sent_folder);
 }
 
 function sqimap_append_done ($imap_stream, $folder='') {
-    global $squirrelmail_language, $color;
     fputs ($imap_stream, "\r\n");
     $tmp = fgets ($imap_stream, 1024);
-    if (preg_match("/(.*)(BAD|NO)(.*)$/", $tmp, $regs)) {
+    sqimap_append_checkresponse($tmp, $folder);
+}
+
+function sqimap_append_checkresponse($response, $folder) {
+    
+    if (preg_match("/(.*)(BAD|NO)(.*)$/", $response, $regs)) {
+        global $squirrelmail_language, $color;
         set_up_language($squirrelmail_language);
         require_once(SM_PATH . 'functions/display_messages.php');
+
         $reason = $regs[3];
         if ($regs[2] == 'NO') {
            $string = "<b><font color=\"$color[2]\">\n" .
@@ -994,7 +1001,7 @@ function sqimap_append_done ($imap_stream, $folder='') {
                   _("ERROR : Bad or malformed request.") .
                   "</b><br />\n" .
                   _("Server responded: ") .
-                  $tmp . "</font><br />\n";
+                  $reason . "</font><br />\n";
            error_box($string,$color);
            exit;
         }
@@ -1020,4 +1027,4 @@ function map_yp_alias($username) {
    return chop(substr($yp, strlen($username)+1));
 }
 
-?>
\ No newline at end of file
+?>