[imp] INBOX blank after setting quota hook

Joshua E Warchol jwarchol@dsl.net
Wed, 28 Aug 2002 21:51:07 -0400


I've messed up just about everything you can mess up while configuring
Horde/IMP. I've seen problems like this before. Just to check, if you 
comment out all of this it works fine, right? You've tried commenting it
all out, since if you changed anything else there might be a different 
error causing this. 

My biggest caust of errors is simple PHP boo-boos. There is a command
line argument you can give to php to check syntax. I don't recall what
that is, maybe someone else does. 

On Wed, Aug 28, 2002 at 12:55:59AM -0700, Roger Thomas wrote:
> horde 2.1
> imp 3.1
> turba 1.1
> php-4.2.2
> courier 1.5.1
> c-client: How do I check that?
> 
> 
> When I changed IMP's conf.php quota hook, I get nothing below the
> INBOX  Compose Folders Options Search Problem? Help Addressbook Logout menubar.
> 
> CHANGES TO conf.php:
> --------------------
> $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="center" class="' .
>  $class . '">'
>                            . sprintf("%.2fMB / %.2fMB  (%.2f%%)", $taken,
> $total, $percent)
>                            . '</td></tr></table></td></tr></table>';
>          }
>          return $quota_html;
>      }
>  }
>    
> 
> CHECKING COURIER's QUOTA SUPPORT:
> ---------------------------------
> [root@mail config]# telnet localhost 143
> Trying 127.0.0.1...
> Connected to mailhostA.
> Escape character is '^]'.
> * OK Courier-IMAP ready. Copyright 1998-2002 Double Precision, Inc.  See
> COPYING for distribution information.
> . login somebody abc123
> . OK LOGIN Ok.
> . capability
> * CAPABILITY IMAP4rev1 CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT
> THREAD=REFERENCES SORT QUOTA
> . OK CAPABILITY completed
> . getquota root
> . BAD GETQUOTA No such Quota Root.
> . getquota ROOT
> * QUOTA "ROOT" (STORAGE 2 977 MESSAGE 2 1000)
> . OK GETQUOTA Ok.
> . logout
> * BYE Courier-IMAP server shutting down
> . OK LOGOUT completed
> Connection closed by foreign host.
> [root@mail config]#
> 
> 
> Appreciate your advise. Best rgds.
> 
> --
> roger
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Finance - Get real-time stock quotes
> http://finance.yahoo.com
> 
> -- 
> IMP mailing list
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: imp-unsubscribe@lists.horde.org

-- 
Joshua Warchol
UNIX Systems Administrator
DSL.net