Code modification for a personal implementation or a Plugin?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Code modification for a personal implementation or a Plugin?

Philip Rhoades-2
People,

Years ago I posted on a suggested improvement list somewhere to have an
option to only list folders with unread messages (I have hundreds of
folders and it that option would greatly reduce the necessary scrolling)
but it never got implemented - I guess because it never became a
priority for scarce development resources.  While I would still like
that previously suggested upgrade, I have another upgrade which might be
more amenable to me having a shot it doing the work myself.  I think it
is probably a minor tweak so I could just apply it to new, major
versions of the code as they are released.  However, if what I wanted to
do could be done as a Plugin, I would be interested in trying that route
as well.

What I would like is, since there is already the facility to highlight
newly arrived mails in blue - to modify this facility a little so that
ANY mails that are less than 24 hours old are highlighted in blue.  This
would be useful for when I have had to exit out of RCM and reload it for
some reason - currently all the blue highlighted mails lose the
highlight on re-opening RCM.

If someone could point me to the place in the code where I could do this
myself or how suggest I could do this as a plugin, I would greatly
appreciate it!

Regards,

Phil.
--
Philip Rhoades

PO Box 896
Cowra  NSW  2794
Australia
E-mail:  [hidden email]
_______________________________________________
Roundcube Development discussion mailing list
[hidden email]
http://lists.roundcube.net/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Code modification for a personal implementation or a Plugin?

Philip Rhoades-2
People,


On 2018-03-09 19:29, Philip Rhoades wrote:

> People,
>
> Years ago I posted on a suggested improvement list somewhere to have
> an option to only list folders with unread messages (I have hundreds
> of folders and it that option would greatly reduce the necessary
> scrolling) but it never got implemented - I guess because it never
> became a priority for scarce development resources.  While I would
> still like that previously suggested upgrade, I have another upgrade
> which might be more amenable to me having a shot it doing the work
> myself.  I think it is probably a minor tweak so I could just apply it
> to new, major versions of the code as they are released.  However, if
> what I wanted to do could be done as a Plugin, I would be interested
> in trying that route as well.
>
> What I would like is, since there is already the facility to highlight
> newly arrived mails in blue


That should be: "since there is already the facility to highlight
FOLDERS with newly arrived emails in blue".


> - to modify this facility a little so that
> ANY mails that are less than 24 hours old are highlighted in blue.
> This would be useful for when I have had to exit out of RCM and reload
> it for some reason - currently all the blue highlighted mails lose the
> highlight on re-opening RCM.
>
> If someone could point me to the place in the code where I could do
> this myself or how suggest I could do this as a plugin, I would
> greatly appreciate it!
>
> Regards,
>
> Phil.

--
Philip Rhoades

PO Box 896
Cowra  NSW  2794
Australia
E-mail:  [hidden email]
_______________________________________________
Roundcube Development discussion mailing list
[hidden email]
http://lists.roundcube.net/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Code modification for a personal implementation or a Plugin?

A.L.E.C
On 09.03.2018 09:41, Philip Rhoades wrote:

>> What I would like is, since there is already the facility to highlight
>> newly arrived mails in blue
>
> That should be: "since there is already the facility to highlight
> FOLDERS with newly arrived emails in blue".
>
>> - to modify this facility a little so that
>> ANY mails that are less than 24 hours old are highlighted in blue.
>> This would be useful for when I have had to exit out of RCM and reload
>> it for some reason - currently all the blue highlighted mails lose the
>> highlight on re-opening RCM.

That would be definitely a plugin. It would do an ajax request just
after initial getunread request, where it would go through list of
folders doing an imap search for "unread messages arrived in last 24 hours".

Some hints for PHP code:

$rcmail    = rcmail::get_instance();
$storage   = $rcmail->get_storage();
$a_folders = $storage->list_folders_subscribed('', '*', 'mail');
$unseen_folders = array();

foreach ($a_folders as $mbox) {
    // IMAP SEARCH supports date-only format
    $index = $storage->search_once($mbox, 'UNSEEN SINCE ...');
    if ($index->count()) {
        $unseen_folders[] = $mbox;
    }
    // you may also/instead need to check timestamp of the most recent
message
}

$rcmail->output->command('set_unseen_folders', $unseen_folders);

Of course, you'd need the client-side part that does the request and
updates folders classes.

Also, considering performance you might need to store the list of unseen
folders in some database and update the state when you like and remember
when the user visited such a folder to not mark it unseen again, etc.

--
Aleksander 'A.L.E.C' Machniak
Kolab Groupware Developer         [http://kolab.org]
Roundcube Webmail Developer   [http://roundcube.net]
----------------------------------------------------
PGP: 19359DC1 # Blog: https://kolabian.wordpress.com
_______________________________________________
Roundcube Development discussion mailing list
[hidden email]
http://lists.roundcube.net/mailman/listinfo/dev