1.) Search the source (or follow the request) through using the "checkmail" as the command. If you go to /skins/default/templates/mail.html you can see on line 102 the following:
So starting from the top:
- We see in the template mail.html we have an "checkmail" action.
- We then look in the JS to see if there's somethign going on with that and we see it's an "enabled_command"
- The enabled_command means it's useable, so we continue scrolling to see what command it executes: check_for_recent()
- check_for_recent() then sends a request to index.php using "check-recent" as the action.
- Index.php receives this request and sees the task as being "mail" and the action as "check-recent" so it includes /program/steps/mail/check_recent.inc
So there you have it. You can impact it by looking in that include file.
2.) According to the javascript there is an "unread" array key which is either true for unread, or false for read. So I guess you could put in your code:
if($rcmail_message[$message_id]['unread'])
{
// The message is "new" or marked as unread
}
else
{
// The message is "old" or marked as read
}Now, that's not to take into account that it may in fact be marked for deletion.
Just to double-check me, try using var_dump() on the roundcube message object in /program/steps/mail/func.inc to see what's in it. Here's an example:
object(iilBasicHeader)#17 (29) {
["id]=>
string(1) "2"
["uid"]=>
string(2) "74"
["subject"]=>
string(20) "Re: Some Website"
["from"]=>
string(38) ""Some Name." <prof@school.edu>"
["to"]=>
string(21) "user@domain.com"
["cc"]=>
NULL
["replyto"]=>
string(13) "user@prof.edu"
["in_reply_to"]=>
string(32) "487A2A34.1040305@domain.com"
["date"]=>
string(37) "Mon, 14 Jul 2008 18:56:19 -0400 (EDT)"
["messageID"]=>
string(57) "<1111.11.111.11.222.1234567890.squirrel@webmail.school.edu>"
["size"]=>
string(4) "2523"
["encoding"]=>
string(4) "8bit"
["charset"]=>
string(10) "iso-8859-1"
["ctype"]=>
string(10) "text/plain"
["flags"]=>
array(1) {
[0]=>
string(4) "Seen"
}
["timestamp"]=>
int(1216076179)
["f"]=>
NULL
["internaldate"]=>
string(20) "14-Jul-2008 15:49:13"
["references"]=>
string(34) "<487A2A34.1040305@domain.com>"
["priority"]=>
int(3)
["mdn_to"]=>
NULL
["mdn_sent"]=>
bool(false)
["is_reply"]=>
bool(false)
["seen"]=>
bool(true)
["deleted"]=>
bool(false)
["recent"]=>
bool(false)
["answered"]=>
bool(false)
["junk"]=>
bool(false)
["structure"]=>
NULL
}
Now, in your code you could do something like:
// $message is our "message" object
if($message->headers->flags['Seen'])
{
// Message is "old" or read
}
else
{
// Message is "new" or unread
}Hope that helps.