courier-imap-1.4.4+vpopmail+imp+quotas

Michael Bellears michael.bellears@staff.datafx.com.au
Wed, 10 Apr 2002 16:22:55 +1000


---------------------- multipart/alternative attachment
Firstly, let me apologise if this has already been discussed.

I am having trouble displaying users quotas within imp.

I'm under the impression Imp is using the php4-imap library
(imap_get_quota()), which doesn't seem to be supported by courier-imap ? 

acnt:~# telnet localhost 143
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
* OK Courier-IMAP ready. Copyright 1998-2002 Double Precision, Inc.  See
COPYING for distribution information.
. login <username> <password>
. OK LOGIN Ok.
. getquota
. BAD GETQUOTA No such Quota Root.
. getquotaroot INBOX
* QUOTAROOT "INBOX" "ROOT"
* QUOTA "ROOT" (STORAGE 41 10)
. OK GETQUOTAROOT Ok.

I am using the following code in /horde/imp/config/conf.php

$conf['hooks']['quota'] = 'imp_show_quota';
if (!function_exists('imp_show_quota')) {
   function imp_show_quota ($imp) {
        $imap_admin = $imp['user'];
        $imap_passwd = Secret::read(Secret::getKey('imp'), $imp['pass']);
 //       echo "$imap_admin $imap_passwd<p>";
        $stream = @imap_open(IMP::serverString(), $imap_admin, $imap_passwd,
OP_HALFOPEN);
        $quota = @imap_get_quota($stream, 'ROOT');
//        $quota = @imap_get_quotaroot($stream, 'ROOT');
//      echo "stream $stream";
        echo "quota $quota";
        imap_close($stream);

        if (!empty($quota)) {
            $taken = $quota['usage'] / 1024.0;
            $total = $quota['limit'] / 1024.0;
            $percent = $taken * 100 / $total;
            echo '<table width="30%" border="0" cellpadding="0"
cellspacing="0"><tr><td><table border="0" cellspacing="2" cellpaddin
g="2" width="100%"><tr><td align="left"><font color=white>';
            echo sprintf("Mailbox Size: %.2fMB / %.2fMB (%.2f%% Full)",
$taken, $total, $percent);
            echo '</font></td></tr></table></td></tr></table>';
        }
        echo "No quota<p>";
    }
}

Which results in the 'No quota' being displayed.

Any suggestions are greatly appreciated.

courier-imap-1.4.4
Vpopmail 5.2
qmail-1.03
horde-2.1-RC2
imp-3.1-RC2
Debian 2.2

Regards,
Michael

---------------------- multipart/alternative attachment--