Applied patch #102655. Ha! my first commit !
[squirrelmail.git] / functions / imap_messages.php
index 1f4d57d427c8d517a8c0a963d367d56b4ef67cbf..a28dc43da6ba7af74eedb7da50b0aee947c473d8 100755 (executable)
       $read = sqimap_read_data ($imap_stream, "a001", true, $response, $message);
    }
 
+
+   /******************************************************************************
+    **  Remove specified flag from specified messages
+    ******************************************************************************/
+   function sqimap_messages_remove_flag ($imap_stream, $start, $end, $flag) {
+      fputs ($imap_stream, "a001 STORE $start:$end -FLAGS (\\$flag)\r\n");
+      $read = sqimap_read_data ($imap_stream, "a001", true, $response, $message);
+   }
+
+
    /******************************************************************************
     **  Returns some general header information -- FROM, DATE, and SUBJECT
     ******************************************************************************/
             if (strpos(strtolower(trim($line)), "charset=")) {
                $pos = strpos($line, "charset=") + 8;
                $charset = trim($line);
-               if (strpos($line, " ", $pos) > 0) {
-                  $charset = substr($charset, $pos, strpos($line, " ", $pos));
+               if (strpos($line, ";", $pos) > 0) {
+                  $charset = substr($charset, $pos, strpos($line, ";", $pos)-$pos);
                } else {
                   $charset = substr($charset, $pos);
                }