original_string: public function copy($source, $dest, array $options = array())
      {
          // Open mailbox call will handle the login.
          $this->openMailbox($source, empty($options['move']) ? Horde_Imap_Client::OPEN_AUTO : Horde_Imap_Client::OPEN_READWRITE);
  
          /* SEARCHRES requires server support. */
          if (empty($options['ids'])) {
              $options['ids'] = $this->getIdsOb(Horde_Imap_Client_Ids::ALL);
          } elseif ($options['ids']->isEmpty()) {
              return array();
          } elseif ($options['ids']->search_res &&
                    !$this->_capability('SEARCHRES')) {
              throw new Horde_Imap_Client_Exception_NoSupportExtension('SEARCHRES');
          }
  
          $dest = Horde_Imap_Client_Mailbox::get($dest);
          $res = $this->_copy($dest, $options);
  
          if (($res === true) && !empty($options['force_map'])) {
              /* Need to manually create mapping from Message-ID data. */
              $query = new Horde_Imap_Client_Fetch_Query();
              $query->envelope();
              $fetch = $this->fetch($source, $query, array(
                  'ids' => $options['ids']
              ));
  
              $res = array();
              foreach ($fetch as $val) {
                  if ($uid = $this->_getUidByMessageId($dest, $val->getEnvelope()->message_id)) {
                      $res[$val->getUid()] = $uid;
                  }
              }
          }
  
          return $res;
      }
code: public function copy($source, $dest, array $options = array())
      {
          // Open mailbox call will handle the login.
          $this->openMailbox($source, empty($options['move']) ? Horde_Imap_Client::OPEN_AUTO : Horde_Imap_Client::OPEN_READWRITE);
  
          /* SEARCHRES requires server support. */
          if (empty($options['ids'])) {
              $options['ids'] = $this->getIdsOb(Horde_Imap_Client_Ids::ALL);
          } elseif ($options['ids']->isEmpty()) {
              return array();
          } elseif ($options['ids']->search_res &&
                    !$this->_capability('SEARCHRES')) {
              throw new Horde_Imap_Client_Exception_NoSupportExtension('SEARCHRES');
          }
  
          $dest = Horde_Imap_Client_Mailbox::get($dest);
          $res = $this->_copy($dest, $options);
  
          if (($res === true) && !empty($options['force_map'])) {
              /* Need to manually create mapping from Message-ID data. */
              $query = new Horde_Imap_Client_Fetch_Query();
              $query->envelope();
              $fetch = $this->fetch($source, $query, array(
                  'ids' => $options['ids']
              ));
  
              $res = array();
              foreach ($fetch as $val) {
                  if ($uid = $this->_getUidByMessageId($dest, $val->getEnvelope()->message_id)) {
                      $res[$val->getUid()] = $uid;
                  }
              }
          }
  
          return $res;
      }
code_tokens: public function copy ( $ source , $ dest , array $ options = array ( ) ) { // Open mailbox call will handle the login. $ this -> openMailbox ( $ source , empty ( $ options [ 'move' ] ) ? Horde_Imap_Client :: OPEN_AUTO : Horde_Imap_Client :: OPEN_READWRITE ) ; /* SEARCHRES requires server support. */ if ( empty ( $ options [ 'ids' ] ) ) { $ options [ 'ids' ] = $ this -> getIdsOb ( Horde_Imap_Client_Ids :: ALL ) ; } elseif ( $ options [ 'ids' ] -> isEmpty ( ) ) { return array ( ) ; } elseif ( $ options [ 'ids' ] -> search_res && ! $ this -> _capability ( 'SEARCHRES' ) ) { throw new Horde_Imap_Client_Exception_NoSupportExtension ( 'SEARCHRES' ) ; } $ dest = Horde_Imap_Client_Mailbox :: get ( $ dest ) ; $ res = $ this -> _copy ( $ dest , $ options ) ; if ( ( $ res === true ) && ! empty ( $ options [ 'force_map' ] ) ) { /* Need to manually create mapping from Message-ID data. */ $ query = new Horde_Imap_Client_Fetch_Query ( ) ; $ query -> envelope ( ) ; $ fetch = $ this -> fetch ( $ source , $ query , array ( 'ids' => $ options [ 'ids' ] ) ) ; $ res = array ( ) ; foreach ( $ fetch as $ val ) { if ( $ uid = $ this -> _getUidByMessageId ( $ dest , $ val -> getEnvelope ( ) -> message_id ) ) { $ res [ $ val -> getUid ( ) ] = $ uid ; } } } return $ res ; }
docstring: Copy messages to another mailbox.
  
  @param mixed $source   The source mailbox. Either a
  Horde_Imap_Client_Mailbox object or a string
  (UTF-8).
  @param mixed $dest     The destination mailbox. Either a
  Horde_Imap_Client_Mailbox object or a string
  (UTF-8).
  @param array $options  Additional options:
  - create: (boolean) Try to create $dest if it does not exist?
  DEFAULT: No.
  - force_map: (boolean) Forces the array mapping to always be
  returned. [@since 2.19.0]
  - ids: (Horde_Imap_Client_Ids) The list of messages to copy.
  DEFAULT: All messages in $mailbox will be copied.
  - move: (boolean) If true, delete the original messages.
  DEFAULT: Original messages are not deleted.
  
  @return mixed  An array mapping old UIDs (keys) to new UIDs (values) on
  success (only guaranteed if 'force_map' is true) or
  true.
  
  @throws Horde_Imap_Client_Exception
  @throws Horde_Imap_Client_Exception_NoSupportExtension
docstring_tokens: Copy messages to another mailbox .