Transfer IMAP flags from old server.
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 1 Apr 2009 18:28:05 +0000 (12:28 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 1 Apr 2009 19:12:34 +0000 (13:12 -0600)
imp/lib/Fetchmail.php
imp/lib/Fetchmail/imap.php

index e513235..656816f 100644 (file)
@@ -262,10 +262,11 @@ abstract class IMP_Fetchmail
      *
      * @param string $header  The message header text.
      * @param string $body    The message body text.
+     * @param array $flags    The IMAP flags to add.
      *
      * @return boolean  True on success, false on failure.
      */
-    protected function _addMessage($header, $body)
+    protected function _addMessage($header, $body, $flags)
     {
         $msg = rtrim($header);
 
@@ -281,7 +282,7 @@ abstract class IMP_Fetchmail
         }
 
         try {
-            $GLOBALS['imp_imap']->ob->append($this->_params['lmailbox'], array(array('data' => $msg)));
+            $GLOBALS['imp_imap']->ob->append($this->_params['lmailbox'], array(array('data' => $msg, 'flags' => $flags)));
             return true;
         } catch (Horde_Imap_Client_Exception $e) {
             return false;
index 5f13b36..4244158 100644 (file)
@@ -195,14 +195,15 @@ class IMP_Fetchmail_imap extends IMP_Fetchmail
             try {
                 $res = $this->_ob->fetch($mbox, array(
                     Horde_Imap_Client::FETCH_HEADERTEXT => array(array('peek' => $peek)),
-                    Horde_Imap_Client::FETCH_BODYTEXT => array(array('peek' => true))
+                    Horde_Imap_Client::FETCH_BODYTEXT => array(array('peek' => true)),
+                    Horde_Imap_Client::FETCH_FLAGS => true
                 ), array('ids' => array($id)));
             } catch (Horde_Imap_Client_Exception $e) {
                 continue;
             }
 
             /* Append to the server. */
-            if ($this->_addMessage($res[$id]['headertext'][0], $res[$id]['bodytext'][0])) {
+            if ($this->_addMessage($res[$id]['headertext'][0], $res[$id]['bodytext'][0], $res[$id]['flags'])) {
                 ++$numMsgs;
                 $to_store[] = $id;
             }