Since: 2.24.0
Author: Michael Slusarz (slusarz@horde.org)
Inheritance: implements Serializable, implements SplSubject
Exemple #1
0
 /**
  */
 public function query($capability, $parameter = null)
 {
     if (parent::query($capability, $parameter)) {
         return true;
     }
     switch (Horde_String::upper($capability)) {
         case 'CONDSTORE':
         case 'ENABLE':
             /* RFC 7162 [3.2.3] - QRESYNC implies CONDSTORE and ENABLE. */
             return is_null($parameter) && $this->query('QRESYNC');
         case 'UTF8':
             /* RFC 6855 [3] - UTF8=ONLY implies UTF8=ACCEPT. */
             return Horde_String::upper($parameter) === 'ACCEPT' && $this->query('UTF8', 'ONLY');
     }
     return false;
 }
Exemple #2
0
 /**
  */
 protected function _initCapability()
 {
     $this->_connect();
     $c = new Horde_Imap_Client_Data_Capability();
     try {
         $res = $this->_sendLine('CAPA', array('multiline' => 'array'));
         foreach ($res['data'] as $val) {
             $prefix = explode(' ', $val);
             $c->add($prefix[0], array_slice($prefix, 1));
         }
     } catch (Horde_Imap_Client_Exception $e) {
         $this->_temp['no_capa'] = true;
         /* Need to probe for capabilities if CAPA command is not
          * available. */
         $c->add('USER');
         /* Capability sniffing only guaranteed after authentication is
          * completed (if any). */
         if (!empty($this->_init['authmethod'])) {
             $this->_pop3Cache('uidl');
             if (empty($this->_temp['no_uidl'])) {
                 $c->add('UIDL');
             }
             $this->_pop3Cache('top', 1);
             if (empty($this->_temp['no_top'])) {
                 $c->add('TOP');
             }
         }
     }
     $this->_setInit('capability', $c);
 }
Exemple #3
0
 public function testSerialize()
 {
     $c = new Horde_Imap_Client_Data_Capability();
     $c->add('FOO', 'A');
     $c->add('FOO', 'B');
     $c->add('BAR');
     $c_copy = unserialize(serialize($c));
     $this->assertTrue($c_copy->query('FOO', 'A'));
     $this->assertTrue($c_copy->query('FOO', 'B'));
     $this->assertTrue($c_copy->query('BAR'));
 }