[Dovecot] Quota plugin and SQL

Leonardo Rodrigues leolistas at solutti.com.br
Sun Mar 7 13:34:30 EET 2010


Em 06/03/2010 19:12, David escreveu:
>
> Is there any way to modify the queries used to split out username into 
> localpart and domain?  This would enable me to put the current quota 
> information in my main mailbox table and display it to users in my 
> admin interface.
>

     i'm successfully using a PHP script for displaying a graph with 
current quota information in my admin interface. Is this what you're 
looking for ? Quota usage is taken directly from IMAP server, through 
IMAP commands.

http://img707.imageshack.us/img707/9551/quota.jpg

     i'm actually using a script based on the one found here:


http://lists.horde.org/archives/imp/Week-of-Mon-20040816/038902.html

     the original script grabs the current usage from database, and i 
dont have the information there. So i changed it to use imap_open and 
grab quota directly from IMAP server. Something like:

Changes would be something like:

function draw_bar($mailbox, $width, $height) {
     global $imaphost, $usuario, $senha;
     $mbox = @imap_open($imaphost, $usuario, $senha, OP_HALFOPEN);
     $q = @imap_get_quotaroot($mbox, 'INBOX');
     imap_close($mbox);
     if ($q) {
         $taken = $q['usage'];
         $total = $q['limit'];
         quota_bar($taken, $total, $width, $height);
     }
}


     that's pretty straightforward when your passwords are stored in 
clear-text. In my cases password is SSHA256-hashed before storing, so i 
had to configure a masteruse on dovecot to acchieve that.

http://wiki.dovecot.org/Authentication/MasterUsers

     so i have something:

$user = $realuser . "*mymasteruser at local"
$password = "mypasteruserpassword"




-- 


	Atenciosamente / Sincerily,
	Leonardo Rodrigues
	Solutti Tecnologia
	http://www.solutti.com.br

	Minha armadilha de SPAM, NÃO mandem email
	gertrudes at solutti.com.br
	My SPAMTRAP, do not email it






More information about the dovecot mailing list