Selaa lähdekoodia

Added 4 hooks (internal_link, mailbox_display_buttons, move_messages_button_action, create_collapse_link)
These are very useful for several plugins (Msg Flags, Archive Mail, Link Buttons to name a few) and allow for a more pretty/graphical display

Jimmy Conner 22 vuotta sitten
vanhempi
commit
7e8409022a
4 muutettua tiedostoa jossa 18 lisäystä ja 11 poistoa
  1. 4 7
      functions/mailbox_display.php
  2. 3 0
      functions/page_header.php
  3. 4 0
      src/left_main.php
  4. 7 4
      src/move_messages.php

+ 4 - 7
functions/mailbox_display.php

@@ -295,8 +295,7 @@ function getServerMessages($imapConnection, $start_msg, $show_num, $num_msgs, $i
             $end_loop = $num_msgs - $start_msg + 1;
         } else {
             $end_loop = $show_num;
-        }
-        return fillMessageArray($imapConnection,$id,$end_loop,$show_num);
+        }        return fillMessageArray($imapConnection,$id,$end_loop,$show_num);
     } else {
         return false;
     }
@@ -346,8 +345,7 @@ function getSelfSortMessages($imapConnection, $start_msg, $show_num,
             } else {
                 $end_loop = $show_num;
             }
-        }
-        $msgs = fillMessageArray($imapConnection,$id,$end_loop, $show_num);
+        }        $msgs = fillMessageArray($imapConnection,$id,$end_loop, $show_num);
     }
     return $msgs;
 }
@@ -420,8 +418,7 @@ function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs,
 	    sqgetGlobalVar('msort', $msort, SQ_SESSION);
 	} else {
     	    sqsession_unregister('msort');
-    	    sqsession_unregister('msgs');
-	}
+    	    sqsession_unregister('msgs');	}
         switch ($mode) {
             case 'thread':
                 $id   = get_thread_sort($imapConnection);
@@ -720,7 +717,7 @@ function mail_message_listing_beginning ($imapConnection,
         echo getButton('SUBMIT', 'expungeButton',_("Expunge"))
              .' ' . _("mailbox") . "\n";
     }
-
+    do_hook('mailbox_display_buttons');
     echo getButton('SUBMIT', 'markRead',_("Read"));
     echo getButton('SUBMIT', 'markUnread',_("Unread"));
     echo getButton('SUBMIT', 'delete',_("Delete")) ." \n";

+ 3 - 0
functions/page_header.php

@@ -74,6 +74,9 @@ function makeInternalLink($path, $text, $target='') {
     if ($target != '') {
         $target = " target=\"$target\"";
     }
+    $hooktext = do_hook_function('internal_link',$text);
+    if ($hooktext != '')
+        $text = $hooktext;
     return '<a href="'.$base_uri.$path.'"'.$target.'>'.$text.'</a>';
 }
 

+ 4 - 0
src/left_main.php

@@ -178,6 +178,10 @@ function create_collapse_link($boxnum) {
     }
     $link .= '</a>';
 
+    $hooklink = do_hook_function('create_collapse_link',$link);
+    if ($hooklink != '')
+        $link = $hooklink;
+
     /* Return the finished product. */
     return ($link);
 }

+ 7 - 4
src/move_messages.php

@@ -69,7 +69,7 @@ function attachSelectedMessages($msg, $imapConnection) {
             $body_a = sqimap_run_command($imapConnection, "FETCH $id RFC822",true, $response, $readmessage, $uid_support);
             if ($response == 'OK') {
             $k = $i + $start_index;
-        $subject = $msgs[$k]['SUBJECT'];
+            $subject = $msgs[$k]['SUBJECT'];
 
             array_shift($body_a);
             $body = implode('', $body_a);
@@ -177,14 +177,17 @@ if(isset($expungeButton)) {
     if (count($id)) {
         $cnt = count($id);
         if (!isset($attache)) {
+            $button_action = concat_hook_function('move_messages_button_action');
             if (isset($markRead)) {
                 sqimap_toggle_flag($imapConnection, $id, '\\Seen',true,true);
             } else if (isset($markUnread)) {
                 sqimap_toggle_flag($imapConnection, $id, '\\Seen',false,true);
             } else  {
-                sqimap_msgs_list_delete($imapConnection, $mailbox, $id);
-                if ($auto_expunge) {
-                    $cnt = sqimap_mailbox_expunge($imapConnection, $mailbox, true);
+                if (!$button_action) {
+                    sqimap_msgs_list_delete($imapConnection, $mailbox, $id);
+                    if ($auto_expunge) {
+                        $cnt = sqimap_mailbox_expunge($imapConnection, $mailbox, true);
+                    }
                 }
             }
         }