new mail notification in mailbox.php

Nick Ustinov Nick.Ustinov@videinfra.lv
Thu, 26 Apr 2001 00:50:30 +0300


as req'ed:

in mailbox.php, around line 605, comes one extra line $newmsgcount++:

                $style[] = $conf['mailbox']['unseen_style'];
                $bg = 'unseen';
	    $newmsgcount++;    // increment number of unseen messages
            }
            if ($h->Answered == 'A') {
                $flagbits |= IMP_ANSWERED;

at the bottom of mailbox.php, before $registry->shutdown():

/* Check to see if user wants new mail notification and notify if new mails
arrived */
if ($prefs->getValue('nav_popup')) {
    if (isset($imp['newmsgs'])) {
        $delta = $newmsgcount - $imp['newmsgs'];
        if ($delta > 0) {
            include $conf['paths']['templates'] . '/mailbox/alert.inc';
        }
    }
$imp['newmsgs'] = $newmsgcount;
}


and also in templates/mailbox, create alert.inc, containing:
<script language="JavaScript" type="text/javascript">

<!--

    alert('<?=_("You have ").$delta._(" new message(s)")?>');

// -->

</script> 


Guess this should work :)  Play around and report bugs. Of course, you have
to enable new mail notification in preferences.


Nick