/** */ 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); }
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')); }