- Fixed ANNOTATEMORE support

release-0.6
alecpl 13 years ago
parent 0d277ef01b
commit e22740508c

@ -3617,7 +3617,7 @@ class rcube_imap
return $this->conn->setMetadata($mailbox, $entries); return $this->conn->setMetadata($mailbox, $entries);
} }
else if ($this->get_capability('ANNOTATEMORE') || $this->get_capability('ANNOTATEMORE2')) { else if ($this->get_capability('ANNOTATEMORE') || $this->get_capability('ANNOTATEMORE2')) {
foreach ($entries as $entry => $value) { foreach ((array)$entries as $entry => $value) {
list($ent, $attr) = $this->md2annotate($entry); list($ent, $attr) = $this->md2annotate($entry);
$entries[$entry] = array($ent, $attr, $value); $entries[$entry] = array($ent, $attr, $value);
} }
@ -3647,7 +3647,7 @@ class rcube_imap
return $this->conn->deleteMetadata($mailbox, $entries); return $this->conn->deleteMetadata($mailbox, $entries);
} }
else if ($this->get_capability('ANNOTATEMORE') || $this->get_capability('ANNOTATEMORE2')) { else if ($this->get_capability('ANNOTATEMORE') || $this->get_capability('ANNOTATEMORE2')) {
foreach ($entries as $idx => $entry) { foreach ((array)$entries as $idx => $entry) {
list($ent, $attr) = $this->md2annotate($entry); list($ent, $attr) = $this->md2annotate($entry);
$entries[$idx] = array($ent, $attr, NULL); $entries[$idx] = array($ent, $attr, NULL);
} }
@ -3673,7 +3673,7 @@ class rcube_imap
function get_metadata($mailbox, $entries, $options=array()) function get_metadata($mailbox, $entries, $options=array())
{ {
if ($this->get_capability('METADATA') || if ($this->get_capability('METADATA') ||
!strlen(($mailbox) && $this->get_capability('METADATA-SERVER')) (!strlen($mailbox) && $this->get_capability('METADATA-SERVER'))
) { ) {
return $this->conn->getMetadata($mailbox, $entries, $options); return $this->conn->getMetadata($mailbox, $entries, $options);
} }
@ -3682,7 +3682,7 @@ class rcube_imap
$res = array(); $res = array();
// Convert entry names // Convert entry names
foreach ($entries as $entry) { foreach ((array)$entries as $entry) {
list($ent, $attr) = $this->md2annotate($entry); list($ent, $attr) = $this->md2annotate($entry);
$queries[$attr][] = $ent; $queries[$attr][] = $ent;
} }
@ -3703,11 +3703,11 @@ class rcube_imap
* Converts the METADATA extension entry name into the correct * Converts the METADATA extension entry name into the correct
* entry-attrib names for older ANNOTATEMORE version. * entry-attrib names for older ANNOTATEMORE version.
* *
* @param string Entry name * @param string $entry Entry name
* *
* @return array Entry-attribute list, NULL if not supported (?) * @return array Entry-attribute list, NULL if not supported (?)
*/ */
private function md2annotate($name) private function md2annotate($entry)
{ {
if (substr($entry, 0, 7) == '/shared') { if (substr($entry, 0, 7) == '/shared') {
return array(substr($entry, 7), 'value.shared'); return array(substr($entry, 7), 'value.shared');

Loading…
Cancel
Save