* Added several hooks
authorfidian <fidian@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 14 May 2001 14:34:07 +0000 (14:34 +0000)
committerfidian <fidian@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 14 May 2001 14:34:07 +0000 (14:34 +0000)
  (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
src/options_identities.php

index 3fde1101c7a1ffc361a49dd0350157caddca1ad2..ccdff59da7bd13b52921e82af73e61b37e7a4246 100644 (file)
@@ -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   <tr<?PHP echo $Info[1]?>>   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
index 5b900cfc708c0bda48b4f06a9da5619bb404f0b2..f1677a1902ba8c17179c447d15cc279a45229c3d 100644 (file)
    
    displayPageHeader($color, 'None');
 
+   $Info = do_hook('options_identities_process', 0);
+   if ($Info[1])
+      SaveUpdateFunction();
+
    if (CheckAndDoDefault() || CheckAndDoPromote()) {
       SaveUpdateFunction();
    }
@@ -38,6 +42,8 @@
 
 <form name=f action="options_identities.php" method=post>
 
+<?PHP do_hook('options_identities_top'); ?>
+
 <center>
 <table width=80% cellpadding=0 cellspacing=0 border=0>
   <tr bgcolor="<?PHP echo $color[9] ?>">
@@ -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<?PHP echo $post ?>"> 
     </td>
   </tr>
+<?PHP do_hook('options_identities_table', $OtherBG, $isEmptySection, $post); ?>
   <tr<?PHP echo $OtherBG ?>>
     <td>&nbsp;</td><td>
       <input type=hidden name="form_for_<?PHP echo $post ?>" value="1">
@@ -312,6 +323,7 @@ function ShowTableInfo($full_name, $email_address, $reply_to, $post)
          echo _("Move Up") ?>">
 <?PHP
    }
+   do_hook('options_identities_buttons', $isEmptySection, $post);
 ?>
     </td>
   </tr>