diff options
author | Hugues Hiegel <hugues@hiegel.fr> | 2013-09-12 11:35:26 +0200 |
---|---|---|
committer | Hugues Hiegel <root@paranoid> | 2013-11-08 17:40:16 +0100 |
commit | 31de4bc5ebf9556817554ae9630ca06e92fd7218 (patch) | |
tree | f98afd42b6f4f818b3f4c489b2e6a7b3912dbb93 /plugins/markasjunk2/drivers/sa_detach.php | |
parent | ef14bd0d8d58ae0f57aa1969e31a5373aa441dba (diff) |
Updates / Plugins
Diffstat (limited to 'plugins/markasjunk2/drivers/sa_detach.php')
-rw-r--r-- | plugins/markasjunk2/drivers/sa_detach.php | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/plugins/markasjunk2/drivers/sa_detach.php b/plugins/markasjunk2/drivers/sa_detach.php new file mode 100644 index 000000000..947b4b8a7 --- /dev/null +++ b/plugins/markasjunk2/drivers/sa_detach.php @@ -0,0 +1,47 @@ +<?php + +/** + * SpamAssassin detach ham driver + * @version 2.0 + * @author Philip Weir + */ + +class markasjunk2_sa_detach +{ + public function spam($uids) + { + // do nothing + } + + public function ham(&$uids) + { + $rcmail = rcube::get_instance(); + $storage = $rcmail->storage; + $mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST); + + $new_uids = array(); + foreach (explode(",", $uids) as $uid) { + $saved = false; + $message = new rcube_message($uid); + + if (sizeof($message->attachments) > 0) { + foreach ($message->attachments as $part) { + if ($part->ctype_primary == 'message' && $part->ctype_secondary == 'rfc822') { + $orig_message_raw = $storage->get_message_part($message->uid, $part->mime_id, $part); + $saved = $storage->save_message($mbox, $orig_message_raw); + + if ($saved !== false) { + $rcmail->output->command('rcmail_markasjunk2_move', null, $uid); + array_push($new_uids, $saved); + } + } + } + } + } + + if (sizeof($new_uids) > 0) + $uids = implode(',', $new_uids); + } +} + +?>
\ No newline at end of file |