private function getCount()
{
$options = array();
+ if (@filesize($this->getFileName()) == Banana::$spool->storage['size']) {
+ return max(Banana::$spool->ids);
+ }
$this->getMBoxPosition($options);
$val =& $this->callHelper('-c', $options);
if (!$val) {
break;
}
$hval = array_shift($lines);
- if ($hval === '') {
- break;
- }
if ($hname == 'date') {
$headers[$id][$hname] = @strtotime($hval);
} else {
$headers[$id][$hname] = $hval;
}
}
- if (!isset($headers[$id]['date'])) {
- print_r($id);
- print_r($offset);
- print_r($headers[$id]);
- }
}
array_walk_recursive($headers, array('BananaMimePart', 'decodeHeader'));
return $headers;
Banana::$spool->overview[$id]->storage['offset'] = $data['beginning'];
}
}
+ Banana::$spool->storage['size'] = @filesize($this->getFileName());
}
/** Return the indexes of the new messages since the give date
/** Add the '-p' optioin for callHelper
*/
- private function getMBoxPosition(array &$option, $id = null)
+ private function getMBoxPosition(array &$options, $id = null)
{
if (Banana::$spool->overview) {
- if (!is_null($id) && Banana::$spool->overview[$id]) {
+ if (!is_null($id) && isset(Banana::$spool->overview[$id])) {
$key = $id;
} else {
- $key = max(array_keys(Banana::$spool->overview));
+ $key = max(Banana::$spool->ids);
if (!is_null($id) && $key >= $id) {
return;
}
require_once dirname(__FILE__) . '/banana.inc.php';
-define('BANANA_SPOOL_VERSION', '0.4');
+define('BANANA_SPOOL_VERSION', '0.5');
/** Class spoolhead
* class used in thread overviews
public $ids;
/** thread starts */
public $roots;
+ /** protocole specific data */
+ public $storage = array();
private $unreadnb = 0;
mbox = openMBox(filename);
if (!mbox) {
- fprintf(stderr, "can't open file '%s'", filename);
+ fprintf(stderr, "can't open file '%s'\n", filename);
return 1;
}
if ((fmid >= pmid || fmid == -1) && pos) {
switch (action) {
case 'b':
if (fmid == -1) {
- fprintf(stderr, "you have to define a message number");
+ fprintf(stderr, "you have to define a message number\n");
break;
}
goToMessage(mbox, fmid);
break;
case 'd':
if (fmid == -1) {
- fprintf(stderr, "you have to define a message number");
+ fprintf(stderr, "you have to define a message number\n");
break;
}
for (i = fmid ; i <= lmid ; i++) {