Re: [sqwebmail] Get Quota size in Bytes not in percent

2004-10-15 Thread Juan Enciso Condeña
Thanks you James
It work

I modify the function folder_showquota() and it works now.
In this moment all my users are using quota in MB, and not TB or KB, For me
your solution is good.

Another question, Is posible use tha function folder_showquota() in other
page, for example in newmsg, folder, address_book? Or I need create another
function, if it is correct, please writte me a example?
 I would like show the quota in all pages.

Very very Thanks friend.

- Original Message -
From: James A Baker [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, October 12, 2004 11:41 PM
Subject: Re: [sqwebmail] Get Quota size in Bytes not in percent


On Oct 11, 2004, at 10:57, Juan Enciso Condeña wrote:

 Hello list.
 I am customing sqwebmail design, In this moment I need get the quota in
 bytes.
 For example:
 You are using 30% of 25MB quota.

 I need get capture the size quota (in bytes) of each users, because My
 users
 heven't the same quota. For example 3MB, 10MB, 100MB, And I can't put
 static
 string 25MB.

 I read the code source but for me (newbie programmer in language C) it
 isn't
 easy understand where is the function quota size.
 I found this functions:
 folder_showquota in folder.c
 but it not help me .

 Please somebody could check the source code and help me with this
 customize.
 Thanks.
 Sorry for my english


I don't use quota's on my system (my small, well-known user base makes
it unnecessary -- at least until/unless someone begins abusing the
privilege, I suppose) so I don't know for sure what is there currently
in sqwebmail actually, and what it is you're wanting to change...

But from my quick look at a slightly older copy of the source, is your
problem that you are trying to *add* the size of the quota into the
string, and make it unique to each user? -- I.e. insert a new variable
into the string, which sqwebmail doesn't currently display?

If that's all, I think what you'd need to do (though I haven't tested
it myself, so no promises) is first to simply change the QUOTAUSAGE
string definition in folders.html to read like this:

[#$QUOTAUSAGE=div align=centerYou are using %d%% of your %d
quota./div#]

... and then, since I believe the quotainfo struct is built on a per
user basis, I think all you need to do after that is change the
folder_showquota() function (which you actually mentioned already) to
read something like this for instance:

if (quotainfo.quota.nmessages != 0 ||
quotainfo.quota.nbytes != 0)
printf(quotamsg, maildir_readquota(quotainfo),
(quotainfo.quota.nbytes / 1024 / 1024));

Now, of course, as I said, I haven't tested that... so I may have
mistyped or not thought something through about that. -- And it would
*only* work as above for byte quotas. That example code modification
doesn't take into account message count quotas, which would necessitate
a bit more logic being added to handle them properly. (I.e. You'll
probably see 22% of your 0 MB quota for any message count-based
quotas.) -- Not to mention that it assumes all quota sizes will be in
MB (instead of KB, GB, TB, etc.) which could be a problem I suppose.
(And if you use 1000 as your multiplier instead of 1024 when assigning
quotas, then you should alter each 1024 above to respect that
difference too.) ...

... But that should get you started at least, I believe.

Good luck!

-jab


P.S. If that actually by some miracle works (without me ever having
compiled it for testing prior to sending this out) and you want to
submit this as a feature addition to Sam... then let me know, and I'll
try to find time to help you clean it up so that it supports other
possibilities such as message count quotas, and quota sizes measured in
units other than MB. -- Unless of course, someone else wants to tackle
that project. =)



Re: [sqwebmail] Get Quota size in Bytes not in percent

2004-10-12 Thread James A Baker
On Oct 11, 2004, at 10:57, Juan Enciso Condeña wrote:
Hello list.
I am customing sqwebmail design, In this moment I need get the quota in
bytes.
For example:
You are using 30% of 25MB quota.
I need get capture the size quota (in bytes) of each users, because My 
users
heven't the same quota. For example 3MB, 10MB, 100MB, And I can't put 
static
string 25MB.

I read the code source but for me (newbie programmer in language C) it 
isn't
easy understand where is the function quota size.
I found this functions:
folder_showquota in folder.c
but it not help me .

Please somebody could check the source code and help me with this 
customize.
Thanks.
Sorry for my english

I don't use quota's on my system (my small, well-known user base makes 
it unnecessary -- at least until/unless someone begins abusing the 
privilege, I suppose) so I don't know for sure what is there currently 
in sqwebmail actually, and what it is you're wanting to change...

But from my quick look at a slightly older copy of the source, is your 
problem that you are trying to *add* the size of the quota into the 
string, and make it unique to each user? -- I.e. insert a new variable 
into the string, which sqwebmail doesn't currently display?

If that's all, I think what you'd need to do (though I haven't tested 
it myself, so no promises) is first to simply change the QUOTAUSAGE 
string definition in folders.html to read like this:

[#$QUOTAUSAGE=div align=centerYou are using %d%% of your %d 
quota./div#]

... and then, since I believe the quotainfo struct is built on a per 
user basis, I think all you need to do after that is change the 
folder_showquota() function (which you actually mentioned already) to 
read something like this for instance:

if (quotainfo.quota.nmessages != 0 ||
quotainfo.quota.nbytes != 0)
printf(quotamsg, maildir_readquota(quotainfo),
(quotainfo.quota.nbytes / 1024 / 1024));
Now, of course, as I said, I haven't tested that... so I may have 
mistyped or not thought something through about that. -- And it would 
*only* work as above for byte quotas. That example code modification 
doesn't take into account message count quotas, which would necessitate 
a bit more logic being added to handle them properly. (I.e. You'll 
probably see 22% of your 0 MB quota for any message count-based 
quotas.) -- Not to mention that it assumes all quota sizes will be in 
MB (instead of KB, GB, TB, etc.) which could be a problem I suppose. 
(And if you use 1000 as your multiplier instead of 1024 when assigning 
quotas, then you should alter each 1024 above to respect that 
difference too.) ...

... But that should get you started at least, I believe.
Good luck!
-jab
P.S. If that actually by some miracle works (without me ever having 
compiled it for testing prior to sending this out) and you want to 
submit this as a feature addition to Sam... then let me know, and I'll 
try to find time to help you clean it up so that it supports other 
possibilities such as message count quotas, and quota sizes measured in 
units other than MB. -- Unless of course, someone else wants to tackle 
that project. =)


smime.p7s
Description: S/MIME cryptographic signature