Skip to content

Commit

Permalink
Added PluginAPI hooks for message_move and message_delete (#9501)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Jan-Nicklas Adler <[email protected]>
  • Loading branch information
JE4GLE and Jan-Nicklas Adler authored Jun 19, 2024
1 parent 2e241b1 commit 7a3e91a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- Plugin API: Added message_delete hook (#9499)
- Plugin API: Added message_move hook (#9499)
- Update to jQuery 3.7.1
- Drop dependency on JsTimeZoneDetect (#8965)
- Renamed composer.json.dist to composer.json (#9279)
Expand Down
10 changes: 10 additions & 0 deletions program/lib/Roundcube/rcube_imap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2589,6 +2589,11 @@ public function move_message($uids, $to_mbox, $from_mbox = '')
return false;
}

$plugin = $this->plugins->exec_hook('message_move', ['source_folder' => $from_mbox, 'target_folder' => $to_mbox, 'uids' => $uids]);
if ($plugin['abort']) {
return false;
}

$config = rcube::get_instance()->config;
$to_trash = $to_mbox == $config->get('trash_mbox');

Expand Down Expand Up @@ -2699,6 +2704,11 @@ public function delete_message($uids, $folder = null)
return false;
}

$plugin = $this->plugins->exec_hook('message_delete', ['folder' => $folder, 'uids' => $uids]);
if ($plugin['abort']) {
return false;
}

$deleted = $this->conn->flag($folder, $uids, 'DELETED');

if ($deleted) {
Expand Down

0 comments on commit 7a3e91a

Please sign in to comment.