From 0f101579c15a7143c6e4997603b0e19df77eec62 Mon Sep 17 00:00:00 2001 From: fidian Date: Mon, 14 May 2001 14:34:07 +0000 Subject: [PATCH] * Added several hooks (Already documented in Wiki -- SpamCop will be taking advantage of them) git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1360 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- doc/plugin.txt | 32 ++++++++++++++++++++++++++++++++ src/options_identities.php | 16 ++++++++++++++-- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/doc/plugin.txt b/doc/plugin.txt index 3fde1101..ccdff59d 100644 --- a/doc/plugin.txt +++ b/doc/plugin.txt @@ -107,6 +107,11 @@ List of hooks * options_folders_bottom src/options_folders.php * options_folders_inside src/options_folders.php * options_folders_save src/options_folders.php + & options_identities_process src/options_identities.php + & options_identities_top src/options_identities.php + & options_identities_renumber src/options_identities.php (multiple places) + & options_identities_table src/options_identities.php + & options_identities_buttons src/options_identities.php logout src/signout.php login_before src/webmail.php login_verified src/webmail.php @@ -213,6 +218,33 @@ three hooks you will need to use. src/load_prefs.php +(&) Identity Hooks +------------------ +Some hooks are passed special information in the array of arguments. See +the SpamCop plugin for how to use them. + +options_identities_process + [0] = Hook's name + [1] = Should I run the SaveUpdateFunction() (alterable) + +options_identities_renumber + [0] = Hook's name + [1] = Renumber it from ('default' or 1 through # idents - 1) + [2] = Renumber it to (same thing) + +options_identities_table + [0] = Hook's name + [1] = Color of table (use it like > in your + plugin) + [2] = Is this an empty section? + [3] = What is the 'post' value? + +options_identities_buttons + [0] = Hook's name + [1] = Is this an empty section (the one at the end of the list)? + [2] = What is the 'post' value? + + (^) Attachment Hooks -------------------- When a message has attachments, this hook is called with the MIME types. For diff --git a/src/options_identities.php b/src/options_identities.php index 5b900cfc..f1677a19 100644 --- a/src/options_identities.php +++ b/src/options_identities.php @@ -18,6 +18,10 @@ displayPageHeader($color, 'None'); + $Info = do_hook('options_identities_process', 0); + if ($Info[1]) + SaveUpdateFunction(); + if (CheckAndDoDefault() || CheckAndDoPromote()) { SaveUpdateFunction(); } @@ -38,6 +42,8 @@
+ +
@@ -89,6 +95,7 @@ function SaveUpdateFunction() if (isset($$name)) { $fakeI --; } else { + do_hook('options_identities_renumber', $i, $fakeI); $filled = 0; $name = 'full_name' . $i; @@ -146,6 +153,7 @@ function CheckAndDoDefault() $name = 'make_default_' . $i; global $$name; if (isset($$name)) { + do_hook('options_identities_renumber', $i, 'default'); global $full_name, $email_address, $reply_to; $name = 'full_name' . $i; @@ -210,6 +218,8 @@ function CheckAndDoPromote() $name = 'promote_' . $i; global $$name; if (isset($$name) && $i > 1) { + do_hook('options_identities_renumber', $i, $i - 1); + $nameA = 'full_name' . $i; $nameB = 'full_name' . ($i - 1); global $$nameA, $$nameB; @@ -224,8 +234,8 @@ function CheckAndDoPromote() $$nameA = $$nameB; $$nameB = $temp; - $nameA = 'email_address' . $i; - $nameB = 'email_address' . ($i - 1); + $nameA = 'reply_to' . $i; + $nameB = 'reply_to' . ($i - 1); global $$nameA, $$nameB; $temp = $$nameA; $$nameA = $$nameB; @@ -294,6 +304,7 @@ function ShowTableInfo($full_name, $email_address, $reply_to, $post) ?>" name="reply_to"> +> -- 2.25.1
  @@ -312,6 +323,7 @@ function ShowTableInfo($full_name, $email_address, $reply_to, $post) echo _("Move Up") ?>">