From d3714d3a064ce9964655504f694a5226bb357992 Mon Sep 17 00:00:00 2001 From: cigamit Date: Fri, 18 Jul 2003 02:53:37 +0000 Subject: [PATCH] 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 git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@5330 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/mailbox_display.php | 11 ++++------- functions/page_header.php | 3 +++ src/left_main.php | 4 ++++ src/move_messages.php | 11 +++++++---- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index 12480fb2..546e0b66 100644 --- a/functions/mailbox_display.php +++ b/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"; diff --git a/functions/page_header.php b/functions/page_header.php index 53c5d003..8d567d8d 100644 --- a/functions/page_header.php +++ b/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 ''.$text.''; } diff --git a/src/left_main.php b/src/left_main.php index e716ecc8..b986093c 100644 --- a/src/left_main.php +++ b/src/left_main.php @@ -178,6 +178,10 @@ function create_collapse_link($boxnum) { } $link .= ''; + $hooklink = do_hook_function('create_collapse_link',$link); + if ($hooklink != '') + $link = $hooklink; + /* Return the finished product. */ return ($link); } diff --git a/src/move_messages.php b/src/move_messages.php index bc1cd4eb..43b89e56 100644 --- a/src/move_messages.php +++ b/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); + } } } } -- 2.25.1