alecpl
2010-05-26 874ff4d4be5a8744052f9bcd810f62ac1da1193b
program/include/rcube_imap.php
@@ -2512,7 +2512,7 @@
     * --------------------------------*/
    /**
     * Public method for mailbox listing.
     * Public method for listing subscribed folders
     *
     * Converts mailbox name with root dir first
     *
@@ -2552,16 +2552,16 @@
     */
    private function _list_mailboxes($root='', $filter='*')
    {
        $a_defaults = $a_out = array();
        // get cached folder list
        $a_mboxes = $this->get_cache('mailboxes');
        if (is_array($a_mboxes))
            return $a_mboxes;
        $a_defaults = $a_out = array();
        // Give plugins a chance to provide a list of mailboxes
        $data = rcmail::get_instance()->plugins->exec_hook('list_mailboxes',
            array('root'=>$root,'filter'=>$filter));
            array('root' => $root, 'filter' => $filter, 'mode' => 'LSUB'));
        if (isset($data['folders'])) {
            $a_folders = $data['folders'];
@@ -2585,17 +2585,26 @@
     * Get a list of all folders available on the IMAP server
     *
     * @param string IMAP root dir
     * @param string Optional filter for mailbox listing
     * @return array Indexed array with folder names
     */
    function list_unsubscribed($root='')
    function list_unsubscribed($root='', $filter='*')
    {
        static $a_folders;
        // Give plugins a chance to provide a list of mailboxes
        $data = rcmail::get_instance()->plugins->exec_hook('list_mailboxes',
            array('root' => $root, 'filter' => $filter, 'mode' => 'LIST'));
        if (is_array($a_folders))
            return $a_folders;
        // retrieve list of folders from IMAP server
        $a_mboxes = $this->conn->listMailboxes($this->mod_mailbox($root), '*');
        if (isset($data['folders'])) {
            $a_mboxes = $data['folders'];
        }
        else {
            // retrieve list of folders from IMAP server
            $a_mboxes = $this->conn->listMailboxes($this->mod_mailbox($root), $filter);
        }
        $a_folders = array();
        if (!is_array($a_mboxes))
            $a_mboxes = array();
        // modify names with root dir
        foreach ($a_mboxes as $idx => $mbox_name) {
@@ -3393,13 +3402,13 @@
        foreach ($tnef_arr as $winatt) {
            $tpart = new rcube_message_part;
            $tpart->filename = $winatt["name"];
            $tpart->filename = trim($winatt['name']);
            $tpart->encoding = 'stream';
            $tpart->ctype_primary = $winatt["type0"];
            $tpart->ctype_secondary = $winatt["type1"];
            $tpart->mimetype = strtolower($winatt["type0"] . "/" . $winatt["type1"]);
            $tpart->ctype_primary = trim(strtolower($winatt['type0']));
            $tpart->ctype_secondary = trim(strtolower($winatt['type1']));
            $tpart->mimetype = $tpart->ctype_primary . '/' . $tpart->ctype_secondary;
            $tpart->mime_id = "winmail." . $part->mime_id . ".$pid";
            $tpart->size = $winatt["size"];
            $tpart->size = $winatt['size'];
            $tpart->body = $winatt['stream'];
            $tnef_parts[] = $tpart;