// Copyright (c) 2001, Thomas Thurman
// Licensed under the GNU GPL-- see License.txt
// No warranties, express or implied, are attached to this code.
//
// This plugin gives each user the ability to add small icons,
// known as "picons", to identify the senders of email messages.
function squirrelmail_plugin_init_picons() {
global $squirrelmail_plugin_hooks;
$squirrelmail_plugin_hooks["message_icon"]["picons"] = "show_picon";
$squirrelmail_plugin_hooks["options_display_inside"]["picons"] = "picon_options_show";
$squirrelmail_plugin_hooks["options_display_save"]["picons"] = "picon_options_save";
$squirrelmail_plugin_hooks["loading_prefs"]["picons"] = "picon_options_load";
}
// Called from the "message_icon" hook to do the displaying of an icon.
// Args[1] is the From line of the email.
// Args[2] is 0 if we're in a mailbox listing, 1 if we're displaying a whole email.
function show_picon(&$Args) {
global $picons_mailbox, $picons_from, $picons_decay;
// It's possible they'll give us some weird funky addresses.
if (preg_match("/.*\<(.*)\>.*/", $Args[1], $memories))
$email = $memories[1];
else if (preg_match("/.*<(.*)>.*/", $Args[1], $memories))
// icky HTML escaping-- but we shall survive!
$email = $memories[1];
else if (preg_match("/(.*)\(.*\)/", $Args[1], $memories))
$email = $memories[1];
else if (preg_match("/\(.*\).*/", $Args[1], $memories))
$email = $memories[1];
else
$email = $Args[1];
if ($Args[2]==0) {
$size = $picons_mailbox;
$hspace = 1;
$vspace = 1;
} else {
$size = $picons_from;
$hspace = 5;
$vspace = 24;
}
if ($size!=0) {
echo '';
}
}
function picon_options_show() {
global $picons_mailbox, $picons_from, $picons_decay;
echo '