Changeset 93272ea in github


Ignore:
Timestamp:
Oct 29, 2010 8:41:11 AM (3 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
9ae29c9
Parents:
c309cd8
Message:
  • Use consistent results from some functions, code cleanup
Location:
program/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • program/include/rcube_imap.php

    rc309cd8 r93272ea  
    24752475 
    24762476        // move messages 
    2477         $move = $this->conn->move($uids, $from_mbox, $to_mbox); 
    2478         $moved = !($move === false || $move < 0); 
     2477        $moved = $this->conn->move($uids, $from_mbox, $to_mbox); 
    24792478 
    24802479        // send expunge command in order to have the moved message 
     
    25372536 
    25382537        // exit if no message uids are specified 
    2539         if (empty($uids)) 
     2538        if (empty($uids)) { 
    25402539            return false; 
     2540        } 
    25412541 
    25422542        // make sure mailbox exists 
     
    25492549 
    25502550        // copy messages 
    2551         $copy = $this->conn->copy($uids, $from_mbox, $to_mbox); 
    2552         $copied = !($copy === false || $copy < 0); 
     2551        $copied = $this->conn->copy($uids, $from_mbox, $to_mbox); 
    25532552 
    25542553        if ($copied) { 
     
    36513650            return $cache_count ? -2 : 1; 
    36523651 
    3653         if ($cache_count==$msg_count) { 
     3652        if ($cache_count == $msg_count) { 
    36543653            if ($this->skip_deleted) { 
    36553654                    $h_index = $this->conn->fetchHeaderIndex($mailbox, "1:*", 'UID', $this->skip_deleted); 
  • program/include/rcube_imap_generic.php

    rc309cd8 r93272ea  
    12001200    } 
    12011201 
    1202     function UID2ID($folder, $uid) 
     1202    /** 
     1203     * Returns message sequence identifier 
     1204     * 
     1205     * @param string $mailbox Mailbox name 
     1206     * @param int    $uid     Message unique identifier (UID) 
     1207     * 
     1208     * @return int Message sequence identifier 
     1209     * @access public 
     1210     */ 
     1211    function UID2ID($mailbox, $uid) 
    12031212    { 
    12041213            if ($uid > 0) { 
    1205                 $id_a = $this->search($folder, "UID $uid"); 
     1214                $id_a = $this->search($mailbox, "UID $uid"); 
    12061215                if (is_array($id_a) && count($id_a) == 1) { 
    1207                         return $id_a[0]; 
     1216                        return (int) $id_a[0]; 
    12081217                    } 
    12091218            } 
    1210             return false; 
    1211     } 
    1212  
    1213     function ID2UID($folder, $id) 
    1214     { 
    1215             if (empty($id)) { 
    1216                 return  -1; 
     1219            return null; 
     1220    } 
     1221 
     1222    /** 
     1223     * Returns message unique identifier (UID) 
     1224     * 
     1225     * @param string $mailbox Mailbox name 
     1226     * @param int    $uid     Message sequence identifier 
     1227     * 
     1228     * @return int Message unique identifier 
     1229     * @access public 
     1230     */ 
     1231    function ID2UID($mailbox, $id) 
     1232    { 
     1233            if (empty($id) || $id < 0) { 
     1234                return  null; 
    12171235            } 
    12181236 
    12191237        if (!$this->select($folder)) { 
    1220             return -1; 
    1221         } 
    1222  
    1223             $result  = -1; 
     1238            return null; 
     1239        } 
     1240 
    12241241        list($code, $response) = $this->execute('FETCH', array($id, '(UID)')); 
    12251242 
    12261243        if ($code == self::ERROR_OK && preg_match("/^\* $id FETCH \(UID (.*)\)/i", $response, $m)) { 
    1227                         $result = $m[1]; 
    1228         } 
    1229  
    1230         return $result; 
     1244                        return (int) $m[1]; 
     1245        } 
     1246 
     1247        return null; 
    12311248    } 
    12321249 
     
    16161633    { 
    16171634            if (empty($from) || empty($to)) { 
    1618                 return -1; 
     1635                return false; 
    16191636            } 
    16201637 
    16211638            if (!$this->select($from)) { 
    1622             return -1; 
     1639                return false; 
    16231640            } 
    16241641 
     
    16271644            self::COMMAND_NORESPONSE); 
    16281645 
    1629             return $result; 
     1646            return ($result == self::ERROR_OK); 
     1647    } 
     1648 
     1649    function move($messages, $from, $to) 
     1650    { 
     1651        if (!$from || !$to) { 
     1652            return false; 
     1653        } 
     1654 
     1655        $r = $this->copy($messages, $from, $to); 
     1656 
     1657        if ($r) { 
     1658            return $this->delete($from, $messages); 
     1659        } 
     1660        return $r; 
    16301661    } 
    16311662 
     
    18071838    } 
    18081839 
    1809     function move($messages, $from, $to) 
    1810     { 
    1811         if (!$from || !$to) { 
    1812             return -1; 
    1813         } 
    1814  
    1815         $r = $this->copy($messages, $from, $to); 
    1816  
    1817         if ($r==0) { 
    1818             return $this->delete($from, $messages); 
    1819         } 
    1820         return $r; 
    1821     } 
    1822  
    18231840    /** 
    18241841     * Returns list of mailboxes 
Note: See TracChangeset for help on using the changeset viewer.