[imp] imp quota

Jf jean-francois.senechal at marche.be
Thu May 6 04:24:14 PDT 2004


ok

my IMAP server is  : courier-imap 1.4.3-2.3


What's wrong in my configuration ?


Jan Schneider a écrit :
> Zitat von Jf <jean-francois.senechal at marche.be>:
> 
>> Hello,
>>
>> I try to configure the function imp_show_quota, but nothing is show.
>>
>> I have postfix
> 
> 
> This is your MTA, not your IMAP server.
> 
>> What is missing ?
> 
> 
> The correct configuration? Did you read the comments over the hook below?
> 
>> My configuration:
>>
>>
>> $conf['hooks']['quota'] = 'imp_show_quota';
>>
>> /* Gets the quota usage from the imap server. $imap_admin &
>>   * $imap_passwd must be set to fit your own settings. This works
>>   * with the Cyrus imap server and the Courier imap server > 1.3.12.
>>   * Note the necessary changes for the Courier server in the comments.
>>   */
>>   if (!function_exists('imp_show_quota')) {
>>      function imp_show_quota ($imp) {
>>           $quota_html = '';
>>           //$imap_admin = 'admin';
>>           //$imap_passwd = 'password';
>>           // Use the following two lines instead for Courier.
>>            $imap_admin = $imp['user'];
>>            $imap_passwd = Secret::read(Secret::getKey('imp'), 
>> $imp['pass']);
>>
>>           $stream = @imap_open(IMP::serverString(), $imap_admin,
>> $imap_passwd, OP_HALFOPEN);
>>           $quota = @imap_get_quota($stream, 'user.' . $imp['user']);
>>           // Use the following line instead for Courier.
>>           $quota = @imap_get_quota($stream, 'ROOT');
>>           imap_close($stream);
>>
>>           if (is_array($quota) && $quota['limit'] != 0) {
>>               $taken   = $quota['usage'] / 1024.0;
>>               $total   = $quota['limit'] / 1024.0;
>>               $percent = $taken * 100 / $total;
>>               if ($percent >= 90) {
>>                   $class = 'quotaalert';
>>               } elseif ($percent >= 75) {
>>                   $class = 'quotawarn';
>>               } else {
>>                   $class = 'control';
>>               }
>>
>>               $quota_html = '<table width="100%" border="0"
>> cellpadding="0" cellspacing="0"><tr><td class="item">'
>>                             . '<table border="0" cellspacing="2"
>> cellpadding="2" width="100%"><tr><td align="cente
>>                             . sprintf("%.2fMB / %.2fMB  (%.2f%%)",
>> $taken, $total, $percent)
>>                             . '</td></tr></table></td></tr></table>';
>>           }
>>           return $quota_html;
>>       }
>>   }
>>
>>
>> -- 
>> IMP mailing list - Join the hunt: http://horde.org/bounties/#imp
>> Frequently Asked Questions: http://horde.org/faq/
>> To unsubscribe, mail: imp-unsubscribe at lists.horde.org
> 
> 
> 
> 
> Jan.
> 
> -- 
> http://www.horde.org - The Horde Project
> http://www.ammma.de - Neue Wege des Lernens
> http://www.tip4all.de - Deine private Tippgemeinschaft



More information about the imp mailing list