Horde_Imap_Client_Socket::_setMetadata PHP Method

_setMetadata() protected method

protected _setMetadata ( Horde_Imap_Client_Mailbox $mailbox, $data )
$mailbox Horde_Imap_Client_Mailbox
    protected function _setMetadata(Horde_Imap_Client_Mailbox $mailbox, $data)
    {
        if ($this->_capability('METADATA') || strlen($mailbox) && $this->_capability('METADATA-SERVER')) {
            $data_elts = new Horde_Imap_Client_Data_Format_List();
            foreach ($data as $key => $value) {
                $data_elts->add(array(new Horde_Imap_Client_Data_Format_Astring($key), new Horde_Imap_Client_Data_Format_Nstring_Nonascii($value)));
            }
            $cmd = $this->_command('SETMETADATA')->add(array($this->_getMboxFormatOb($mailbox), $data_elts));
        } else {
            if (!$this->_capability('ANNOTATEMORE') && !$this->_capability('ANNOTATEMORE2')) {
                throw new Horde_Imap_Client_Exception_NoSupportExtension('METADATA');
            }
            $cmd = $this->_pipeline();
            foreach ($data as $md_entry => $value) {
                list($entry, $type) = $this->_getAnnotateMoreEntry($md_entry);
                $cmd->add($this->_command('SETANNOTATION')->add(array($this->_getMboxFormatOb($mailbox), new Horde_Imap_Client_Data_Format_String($entry), new Horde_Imap_Client_Data_Format_List(array(new Horde_Imap_Client_Data_Format_String($type), new Horde_Imap_Client_Data_Format_Nstring_Nonascii($value))))));
            }
        }
        $this->_sendCmd($cmd);
    }