| 1 | <?php |
| 2 | /** |
| 3 | * newmail.php |
| 4 | * |
| 5 | * Copyright (c) 1999-2005 The SquirrelMail Project Team |
| 6 | * Copyright (c) 2000 by Michael Huttinger |
| 7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| 8 | * |
| 9 | * Quite a hack -- but my first attempt at a plugin. We were |
| 10 | * looking for a way to play a sound when there was unseen |
| 11 | * messages to look at. Nice for users who keep the squirrel |
| 12 | * mail window up for long periods of time and want to know |
| 13 | * when mail arrives. |
| 14 | * |
| 15 | * Basically, I hacked much of left_main.php into a plugin that |
| 16 | * goes through each mail folder and increments a flag if |
| 17 | * there are unseen messages. If the final count of unseen |
| 18 | * folders is > 0, then we play a sound (using the HTML at the |
| 19 | * far end of this script). |
| 20 | * |
| 21 | * This was tested with IE5.0 - but I hear Netscape works well, |
| 22 | * too (with a plugin). |
| 23 | * |
| 24 | * @version $Id$ |
| 25 | * @package plugins |
| 26 | * @subpackage newmail |
| 27 | */ |
| 28 | |
| 29 | /** @ignore */ |
| 30 | if (! defined('SM_PATH')) define('SM_PATH','../../'); |
| 31 | |
| 32 | /** |
| 33 | * Init newmail plugin |
| 34 | */ |
| 35 | function squirrelmail_plugin_init_newmail() { |
| 36 | global $squirrelmail_plugin_hooks; |
| 37 | |
| 38 | $squirrelmail_plugin_hooks['left_main_before']['newmail'] = 'newmail_plugin'; |
| 39 | $squirrelmail_plugin_hooks['optpage_register_block']['newmail'] = 'newmail_optpage_register_block'; |
| 40 | $squirrelmail_plugin_hooks['options_save']['newmail'] = 'newmail_sav'; |
| 41 | $squirrelmail_plugin_hooks['loading_prefs']['newmail'] = 'newmail_pref'; |
| 42 | $squirrelmail_plugin_hooks['optpage_set_loadinfo']['newmail'] = 'newmail_set_loadinfo'; |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * Register newmail option block |
| 47 | */ |
| 48 | function newmail_optpage_register_block() { |
| 49 | include_once(SM_PATH . 'plugins/newmail/functions.php'); |
| 50 | newmail_optpage_register_block_function(); |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Save newmail plugin settings |
| 55 | */ |
| 56 | function newmail_sav() { |
| 57 | include_once(SM_PATH . 'plugins/newmail/functions.php'); |
| 58 | newmail_sav_function(); |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Load newmail plugin settings |
| 63 | */ |
| 64 | function newmail_pref() { |
| 65 | include_once(SM_PATH . 'plugins/newmail/functions.php'); |
| 66 | newmail_pref_function(); |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * Set loadinfo data |
| 71 | * |
| 72 | * Used by option page when saving settings. |
| 73 | */ |
| 74 | function newmail_set_loadinfo() { |
| 75 | include_once(SM_PATH . 'plugins/newmail/functions.php'); |
| 76 | newmail_set_loadinfo_function(); |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Insert needed data in left_main |
| 81 | */ |
| 82 | function newmail_plugin() { |
| 83 | include_once(SM_PATH . 'plugins/newmail/functions.php'); |
| 84 | newmail_plugin_function(); |
| 85 | } |
| 86 | ?> |