| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * newmail.php |
| 5 | * |
| 6 | * Copyright (c) 2000 by Michael Huttinger |
| 7 | * |
| 8 | * Quite a hack -- but my first attempt at a plugin. We were |
| 9 | * looking for a way to play a sound when there was unseen |
| 10 | * messages to look at. Nice for users who keep the squirrel |
| 11 | * mail window up for long periods of time and want to know |
| 12 | * when mail arrives. |
| 13 | * |
| 14 | * Basically, I hacked much of left_main.php into a plugin that |
| 15 | * goes through each mail folder and increments a flag if |
| 16 | * there are unseen messages. If the final count of unseen |
| 17 | * folders is > 0, then we play a sound (using the HTML at the |
| 18 | * far end of this script). |
| 19 | * |
| 20 | * This was tested with IE5.0 - but I hear Netscape works well, |
| 21 | * too (with a plugin). |
| 22 | * |
| 23 | * @copyright © 1999-2007 The SquirrelMail Project Team |
| 24 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
| 25 | * @version $Id$ |
| 26 | * @package plugins |
| 27 | * @subpackage newmail |
| 28 | */ |
| 29 | |
| 30 | |
| 31 | /** |
| 32 | * Init newmail plugin |
| 33 | */ |
| 34 | function squirrelmail_plugin_init_newmail() { |
| 35 | |
| 36 | global $squirrelmail_plugin_hooks; |
| 37 | $totalNewArr=array(); |
| 38 | global $totalNewArr; |
| 39 | |
| 40 | $squirrelmail_plugin_hooks['folder_status']['newmail'] |
| 41 | = 'newmail_folder_status'; |
| 42 | $squirrelmail_plugin_hooks['template_construct_left_main.tpl']['newmail'] |
| 43 | = 'newmail_plugin'; |
| 44 | $squirrelmail_plugin_hooks['optpage_register_block']['newmail'] |
| 45 | = 'newmail_optpage_register_block'; |
| 46 | $squirrelmail_plugin_hooks['options_save']['newmail'] |
| 47 | = 'newmail_sav'; |
| 48 | $squirrelmail_plugin_hooks['loading_prefs']['newmail'] |
| 49 | = 'newmail_pref'; |
| 50 | $squirrelmail_plugin_hooks['optpage_set_loadinfo']['newmail'] |
| 51 | = 'newmail_set_loadinfo'; |
| 52 | |
| 53 | } |
| 54 | |
| 55 | |
| 56 | /** |
| 57 | * Register newmail option block |
| 58 | */ |
| 59 | function newmail_optpage_register_block() { |
| 60 | include_once(SM_PATH . 'plugins/newmail/functions.php'); |
| 61 | newmail_optpage_register_block_function(); |
| 62 | } |
| 63 | |
| 64 | |
| 65 | /** |
| 66 | * Save newmail plugin settings |
| 67 | */ |
| 68 | function newmail_sav() { |
| 69 | include_once(SM_PATH . 'plugins/newmail/functions.php'); |
| 70 | newmail_sav_function(); |
| 71 | } |
| 72 | |
| 73 | |
| 74 | /** |
| 75 | * Load newmail plugin settings |
| 76 | */ |
| 77 | function newmail_pref() { |
| 78 | include_once(SM_PATH . 'plugins/newmail/functions.php'); |
| 79 | newmail_pref_function(); |
| 80 | } |
| 81 | |
| 82 | |
| 83 | /** |
| 84 | * Set loadinfo data |
| 85 | * |
| 86 | * Used by option page when saving settings. |
| 87 | */ |
| 88 | function newmail_set_loadinfo() { |
| 89 | include_once(SM_PATH . 'plugins/newmail/functions.php'); |
| 90 | newmail_set_loadinfo_function(); |
| 91 | } |
| 92 | |
| 93 | |
| 94 | /** |
| 95 | * Insert needed data in left_main |
| 96 | */ |
| 97 | function newmail_plugin() { |
| 98 | include_once(SM_PATH . 'plugins/newmail/functions.php'); |
| 99 | return newmail_plugin_function(); |
| 100 | } |
| 101 | |
| 102 | |
| 103 | /** |
| 104 | * Returns info about this plugin |
| 105 | * |
| 106 | */ |
| 107 | function newmail_info() { |
| 108 | return array( |
| 109 | 'english_name' => 'New Mail', |
| 110 | 'authors' => array( |
| 111 | 'SquirrelMail Team' => array(), |
| 112 | ), |
| 113 | 'version' => 'CORE', |
| 114 | 'required_sm_version' => 'CORE', |
| 115 | 'requires_configuration' => 0, |
| 116 | 'summary' => 'This plugin is used to notify the user when a new mail arrives.', |
| 117 | 'details' => 'This plugin is used to notify the user when a new mail arrives. This is accomplished by playing a sound through the browser or spawning a popup window whenever the user has unseen messages.', |
| 118 | ); |
| 119 | } |
| 120 | |
| 121 | |
| 122 | |
| 123 | /** |
| 124 | * Returns version info about this plugin |
| 125 | * |
| 126 | */ |
| 127 | function newmail_version() { |
| 128 | $info = newmail_info(); |
| 129 | return $info['version']; |
| 130 | } |
| 131 | |
| 132 | |