Copyright 2011-2012 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Author: Michael Slusarz (slusarz@horde.org)
Inheritance: implements Serializable
Esempio n. 1
0
 public function testMailboxGet()
 {
     $a = Horde_Imap_Client_Mailbox::get('B');
     $this->assertEquals('B', $a->utf7imap);
     $mailbox = new Horde_Imap_Client_Mailbox('A');
     $b = Horde_Imap_Client_Mailbox::get($mailbox);
     $this->assertEquals($mailbox, $b);
 }
Esempio n. 2
0
 public function testBug13825()
 {
     $mbox = 'INBOX.!  Astrid"';
     $mbox_escape = '"INBOX.!  Astrid\\""';
     $ob = new Horde_Imap_Client_Mailbox($mbox);
     $this->assertEquals($ob, Horde_Imap_Client_Mailbox::get($mbox));
     $this->assertEquals($ob, Horde_Imap_Client_Mailbox::get($ob));
     $format = new Horde_Imap_Client_Data_Format_Mailbox($ob);
     $this->assertEquals($mbox_escape, $format->escape());
     $format2 = new Horde_Imap_Client_Data_Format_Mailbox_Utf8($ob);
     $this->assertEquals($mbox_escape, $format2->escape());
 }
Esempio n. 3
0
 /**
  * @throws Horde_Imap_Client_Exception
  */
 public function binary()
 {
     if (parent::binary()) {
         // Mailbox data can NEVER be sent as binary.
         /* @todo: Disable until Horde_Imap_Client 3.0 */
         // throw new Horde_Imap_Client_Exception(
         //     'Client error: can not send mailbox to IMAP server as binary data.'
         // );
         // Temporary fix: send a blank mailbox string.
         $this->_mailbox = Horde_Imap_Client_Mailbox::get('');
     }
     return false;
 }
Esempio n. 4
0
 /**
  */
 protected function _listMailboxes($pattern, $mode, $options)
 {
     if (empty($options['flat'])) {
         return array('INBOX' => array('attributes' => array(), 'delimiter' => '', 'mailbox' => Horde_Imap_Client_Mailbox::get('INBOX')));
     }
     return array('INBOX' => Horde_Imap_Client_Mailbox::get('INBOX'));
 }
Esempio n. 5
0
 /**
  * Parse a METADATA response (RFC 5464 [4.4]).
  *
  * @param Horde_Imap_Client_Interaction_Pipeline $pipeline  Pipeline
  *                                                          object.
  * @param Horde_Imap_Client_Tokenize $data  The server response.
  *
  * @throws Horde_Imap_Client_Exception
  */
 protected function _parseMetadata(Horde_Imap_Client_Interaction_Pipeline $pipeline, Horde_Imap_Client_Tokenize $data)
 {
     // Mailbox name is in UTF7-IMAP.
     $mbox = Horde_Imap_Client_Mailbox::get($data->next(), true);
     // Ignore unsolicited responses.
     if ($data->next() === true) {
         while (($entry = $data->next()) !== false) {
             $pipeline->data['metadata'][strval($mbox)][$entry] = $data->next();
         }
     }
 }
Esempio n. 6
0
 /**
  * Shortcut to obtaining Horde_Imap_Client_Mailbox object(s).
  *
  * @param mixed $mbox  The full IMAP mailbox name(s).
  *
  * @return mixed  The Horde_Imap_Client_Mailbox object(s).
  */
 public static function getImapMboxOb($mbox)
 {
     if (is_array($mbox)) {
         return array_filter(array_map(array(__CLASS__, 'getImapMboxOb'), $mbox));
     }
     if ($mbox instanceof Horde_Imap_Client_Mailbox) {
         return $mbox;
     }
     // Mailbox names are always UTF-8 within IMP.
     $mbox_ob = new self($mbox);
     return Horde_Imap_Client_Mailbox::get($mbox_ob->imap_mbox);
 }
Esempio n. 7
0
 /**
  * Parse a STATUS response (RFC 3501 [7.2.4], RFC 4551 [3.6])
  *
  * @param Horde_Imap_Client_Tokenize $data  Token data
  */
 protected function _parseStatus(Horde_Imap_Client_Tokenize $data)
 {
     // Mailbox name is in UTF7-IMAP
     $mbox = strval(Horde_Imap_Client_Mailbox::get($data->current(), true));
     $this->_temp['status'][$mbox] = array();
     $s_data = $data->next();
     $k = $s_data->rewind();
     do {
         $this->_temp['status'][$mbox][strtolower($k)] = $s_data->next();
     } while (($k = $s_data->next()) !== false);
 }
Esempio n. 8
0
 /**
  */
 protected function _listMailboxes($pattern, $mode, $options)
 {
     $tmp = array('mailbox' => Horde_Imap_Client_Mailbox::get('INBOX'));
     if (!empty($options['attributes'])) {
         $tmp['attributes'] = array();
     }
     if (!empty($options['delimiter'])) {
         $tmp['delimiter'] = '';
     }
     return array('INBOX' => $tmp);
 }
Esempio n. 9
0
 /**
  */
 protected function _parseUrl(array $data)
 {
     if (isset($data['path']) && strlen($path = ltrim($data['path'], '/'))) {
         $parts = explode('/;', $path);
         $mbox = array_shift($parts);
         if (($pos = stripos($mbox, ';UIDVALIDITY=')) !== false) {
             $this->uidvalidity = intval(substr($mbox, $pos + 13));
             $mbox = substr($mbox, 0, $pos);
         }
         if ($mbox[0] === ';') {
             array_unshift($parts, substr($mbox, 1));
         } elseif (strlen($mbox)) {
             $this->_mailbox = Horde_Imap_Client_Mailbox::get(rawurldecode($mbox), true);
         }
         if (isset($data['query'])) {
             $this->search = rawurldecode($data['query']);
             $parts = array();
         }
     } else {
         $parts = array();
     }
     if (count($parts)) {
         foreach ($parts as $val) {
             list($k, $v) = explode('=', $val);
             $this->{Horde_String::lower($k)} = $v;
         }
     }
 }
Esempio n. 10
0
File: Base.php Progetto: Gomez/horde
 /**
  * Set metadata for a given mailbox/identifier.
  *
  * @param mixed $mailbox  A mailbox. Either a Horde_Imap_Client_Mailbox
  *                        object or a string (UTF-8). If empty, sets a
  *                        server annotation.
  * @param array $data     A set of data values. The metadata values
  *                        corresponding to the keys of the array will
  *                        be set to the values in the array.
  *
  * @throws Horde_Imap_Client_Exception
  */
 public function setMetadata($mailbox, $data)
 {
     $this->login();
     $this->_setMetadata(Horde_Imap_Client_Mailbox::get($mailbox), $data);
 }
Esempio n. 11
0
 /**
  * @param mixed $data  Either a mailbox object or a UTF-8 mailbox name.
  */
 public function __construct($data)
 {
     $this->_mailbox = Horde_Imap_Client_Mailbox::get($data);
     parent::__construct($this->_mailbox->utf7imap);
 }