original_string: public function openMailbox($mailbox, $mode = Horde_Imap_Client::OPEN_AUTO)
      {
          $this->login();
  
          $change = false;
          $mailbox = Horde_Imap_Client_Mailbox::get($mailbox);
  
          if ($mode == Horde_Imap_Client::OPEN_AUTO) {
              if (is_null($this->_selected) ||
                  !$mailbox->equals($this->_selected)) {
                  $mode = Horde_Imap_Client::OPEN_READONLY;
                  $change = true;
              }
          } else {
              $change = (is_null($this->_selected) ||
                         !$mailbox->equals($this->_selected) ||
                         ($mode != $this->_mode));
          }
  
          if ($change) {
              $this->_openMailbox($mailbox, $mode);
              $this->_mailboxOb()->open = true;
              if ($this->_initCache(true)) {
                  $this->_condstoreSync();
              }
          }
      }
code: public function openMailbox($mailbox, $mode = Horde_Imap_Client::OPEN_AUTO)
      {
          $this->login();
  
          $change = false;
          $mailbox = Horde_Imap_Client_Mailbox::get($mailbox);
  
          if ($mode == Horde_Imap_Client::OPEN_AUTO) {
              if (is_null($this->_selected) ||
                  !$mailbox->equals($this->_selected)) {
                  $mode = Horde_Imap_Client::OPEN_READONLY;
                  $change = true;
              }
          } else {
              $change = (is_null($this->_selected) ||
                         !$mailbox->equals($this->_selected) ||
                         ($mode != $this->_mode));
          }
  
          if ($change) {
              $this->_openMailbox($mailbox, $mode);
              $this->_mailboxOb()->open = true;
              if ($this->_initCache(true)) {
                  $this->_condstoreSync();
              }
          }
      }
code_tokens: public function openMailbox ( $ mailbox , $ mode = Horde_Imap_Client :: OPEN_AUTO ) { $ this -> login ( ) ; $ change = false ; $ mailbox = Horde_Imap_Client_Mailbox :: get ( $ mailbox ) ; if ( $ mode == Horde_Imap_Client :: OPEN_AUTO ) { if ( is_null ( $ this -> _selected ) || ! $ mailbox -> equals ( $ this -> _selected ) ) { $ mode = Horde_Imap_Client :: OPEN_READONLY ; $ change = true ; } } else { $ change = ( is_null ( $ this -> _selected ) || ! $ mailbox -> equals ( $ this -> _selected ) || ( $ mode != $ this -> _mode ) ) ; } if ( $ change ) { $ this -> _openMailbox ( $ mailbox , $ mode ) ; $ this -> _mailboxOb ( ) -> open = true ; if ( $ this -> _initCache ( true ) ) { $ this -> _condstoreSync ( ) ; } } }
docstring: Open a mailbox.
  
  @param mixed $mailbox  The mailbox to open. Either a
  Horde_Imap_Client_Mailbox object or a string
  (UTF-8).
  @param integer $mode   The access mode. Either
  - Horde_Imap_Client::OPEN_READONLY
  - Horde_Imap_Client::OPEN_READWRITE
  - Horde_Imap_Client::OPEN_AUTO
  
  @throws Horde_Imap_Client_Exception
docstring_tokens: Open a mailbox .