示例#1
0
 /**
  * Gets the count of messages with speciefied attribute
  * or all messages when no attribute was specified
  *
  * @param   peer.mail.Mailfolder f
  * @param   int attr default 0xFFFF
  * @return  int count
  */
 public function getMessageCount($f, $attr = 0xffff)
 {
     $this->openFolder($f);
     $f = new Folder($f->name . DIRECTORY_SEPARATOR . 'cur');
     if (!$f->exists()) {
         return 0;
     }
     $cnt = 0;
     $f->open();
     while ($e = $f->getEntry()) {
         if ($attr & $this->_getMailFlags($e)) {
             $cnt++;
         }
     }
     $f->close();
     return $cnt;
 }