Roundcube Community Forum

Third Party Contributions => API Based Plugins => Topic started by: deltatech on May 02, 2011, 12:55:27 AM

Title: Summary Plugin question
Post by: deltatech on May 02, 2011, 12:55:27 AM
Does anyone know how to get the summary plugin to display the counts of ALL imap folders?

Mine only shows the special folders and I want to display all folders so the users can easily see how big they are getting.
Title: Summary Plugin question
Post by: rosali on May 02, 2011, 07:58:41 AM
This would need code modifications. Due to performance concerns I won't implement a walk-through all imap folders.
Title: Summary Plugin question
Post by: deltatech on May 02, 2011, 04:18:53 PM
Quote from: rosali;34550This would need code modifications. Due to performance concerns I won't implement a walk-through all imap folders.

Can you give me a clue where to start?  I may develop my own version of the plugin.    

I am thinking of having a cron job get the stats of the other folders and store them in the database.  That way the user won't have to wait for the info from those folders.
Title: Summary Plugin question
Post by: rosali on May 02, 2011, 04:58:28 PM
Did you see the quota indicator? People will see there how big they are getting.

It is not so easy to do this by a cron, because you must access Roundcube index.php to have all built-in classes/methods available.

Basically you get counts by ...
$rcmail->imap->messagecount('INBOX', 'ALL', TRUE);
[INBOX has to be replaced by the folder name]

The list of all folders can be obtained by ...
$rcmail->imap->list_mailboxes(); [returns an array]

Roundcube remembers folder stats in $_SESSION.

I don't know, if this is already available when summary plugin jumps in. You have to test.

A general hint: Look in ./program/include. This folders contain most of the classes used by Roundcube. So you can easily find starting points there.