From ed763b2859c3d8143043b31363193d2f19c3f5dd Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sat, 19 Apr 2014 10:55:59 -0400
Subject: [PATCH] Plugin API: Added message_saved hook (#1489752)

---
 CHANGELOG                            |    1 +
 program/lib/Roundcube/rcube_imap.php |   11 +++++++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 6482ca2..af678db 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+- Plugin API: Added message_saved hook (#1489752)
 - Support messages import from zip archives
 - Zipdownload: Added mbox format support (#1486069)
 - Drop support for IE6, move IE7/IE8 support to legacy_browser plugin
diff --git a/program/lib/Roundcube/rcube_imap.php b/program/lib/Roundcube/rcube_imap.php
index b3ae960..f2ade95 100644
--- a/program/lib/Roundcube/rcube_imap.php
+++ b/program/lib/Roundcube/rcube_imap.php
@@ -2457,6 +2457,17 @@
         if ($saved) {
             // increase messagecount of the target folder
             $this->set_messagecount($folder, 'ALL', 1);
+
+            rcube::get_instance()->plugins->exec_hook('message_saved', array(
+                    'folder'  => $folder,
+                    'message' => $message,
+                    'headers' => $headers,
+                    'is_file' => $is_file,
+                    'flags'   => $flags,
+                    'date'    => $date,
+                    'binary'  => $binary,
+                    'result'  => $saved,
+            ));
         }
 
         return $saved;

--
Gitblit v1.9.1