Explorar o código

Fixed bug: Encoding was not set correctly when message was not multipart.

gustavf %!s(int64=25) %!d(string=hai) anos
pai
achega
20118cb5b3
Modificáronse 2 ficheiros con 5 adicións e 4 borrados
  1. 4 3
      functions/imap_messages.php
  2. 1 1
      functions/mime.php

+ 4 - 3
functions/imap_messages.php

@@ -88,7 +88,7 @@
       $message["INFO"]["ID"] = $id;
       $message["INFO"]["MAILBOX"] = $mailbox;
       $message["HEADER"] = sqimap_get_message_header($imap_stream, $id);
-      $message["ENTITIES"] = sqimap_get_message_body($imap_stream, $message["HEADER"]["BOUNDARY"], $id, $message["HEADER"]["TYPE0"], $message["HEADER"]["TYPE1"]);
+      $message["ENTITIES"] = sqimap_get_message_body($imap_stream, $message["HEADER"]["BOUNDARY"], $id, $message["HEADER"]["TYPE0"], $message["HEADER"]["TYPE1"], $message["HEADER"]["ENCODING"]);
       return $message;
    }
 
@@ -271,7 +271,7 @@
    /******************************************************************************
     **  Returns the body of a message.
     ******************************************************************************/
-   function sqimap_get_message_body ($imap_stream, $bound, $id, $type0, $type1) {
+   function sqimap_get_message_body ($imap_stream, $bound, $id, $type0, $type1, $encoding) {
       fputs ($imap_stream, "a001 FETCH $id:$id BODY[TEXT]\n");
       $read = sqimap_read_data ($imap_stream, "a001", true, $response, $message);
        
@@ -285,6 +285,7 @@
          $i++;
       }
       $body = $bodytmp;
-      return decodeMime($body, $bound, $type0, $type1);
+
+      return decodeMime($body, $bound, $type0, $type1, $encoding);
    }
 ?>

+ 1 - 1
functions/mime.php

@@ -11,7 +11,7 @@
    /** This is the first function called.  It decides if this is a multipart
        message or if it should be handled as a single entity
     **/
-   function decodeMime($body, $bound, $type0, $type1, &$entities) {
+   function decodeMime($body, $bound, $type0, $type1, $encoding, &$entities) {
       if ($type0 == "multipart") {
          $bound = trim($bound);
          $i = 0;