From 7214aad0b6b108e45a68a010cd2dbcc2f0f6fa14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ernst=20Pl=C3=BCss?= Date: Mon, 6 Jun 2011 10:19:33 +0200 Subject: [PATCH] integration with mailwire --- includes/mimemail.mail.inc | 35 +----------------------- mimemail.install | 62 +++----------------------------------------- mimemail.module | 9 ++++++ 3 files changed, 15 insertions(+), 91 deletions(-) mode change 100644 => 100755 includes/mimemail.mail.inc mode change 100644 => 100755 mimemail.install mode change 100644 => 100755 mimemail.module diff --git a/includes/mimemail.mail.inc b/includes/mimemail.mail.inc old mode 100644 new mode 100755 index 95813cc..7558e48 --- a/includes/mimemail.mail.inc +++ b/includes/mimemail.mail.inc @@ -8,7 +8,7 @@ /** * Modify the Drupal mail system to send HTML emails. */ -class MimeMailSystem implements MailSystemInterface { +class MimeMailFormatter implements MailFormatter { /** * Concatenate and wrap the e-mail body for HTML mails. * @@ -28,37 +28,6 @@ class MimeMailSystem implements MailSystemInterface { $message['body'] = check_markup($message['body'], variable_get('mimemail_format')); } - $engine = variable_get('mimemail_engine', 'mimemail'); - $mailengine = $engine . '_mailengine'; - $engine_prepare_message = $engine . '_prepare_message'; - - if (function_exists($engine_prepare_message)) { - $message = $engine_prepare_message($message); - } - else { - $message = mimemail_prepare_message($message); - } - - return $message; - } - /** - * Send an HTML e-mail message, using Drupal variables and default settings. - * - * @param $message - * A message array, as described in hook_mail_alter() with optional parameters - * described in mimemail_prepare_message(). - * - * @return - * TRUE if the mail was successfully accepted, otherwise FALSE. - */ - public function mail(array $message) { - $engine = variable_get('mimemail_engine', 'mimemail'); - $mailengine = $engine . '_mailengine'; - - if (!$engine || !function_exists($mailengine)) { - return FALSE; - } - - return $mailengine('send', $message); + return mimemail_prepare_message($message); } } diff --git a/mimemail.install b/mimemail.install old mode 100644 new mode 100755 index 47afa5a..3fb2f67 --- a/mimemail.install +++ b/mimemail.install @@ -6,24 +6,17 @@ */ /** - * Implements hook_enable(). + * Implements hook_install(). */ -function mimemail_enable() { - module_load_include('module', 'mailsystem'); - mailsystem_set( - array( - mailsystem_default_id() => 'MimeMailSystem', - 'mimemail' => 'MimeMailSystem', - ) - ); +function mimemail_install() { + mailwire_set_clear_cash(); } /** * Implements hook_disable(). */ function mimemail_disable() { - mailsystem_clear(array('mimemail' => 'MimeMailSystem')); - variable_set('mimemail_alter', FALSE); + mailwire_set_clear_cash(); } /** @@ -47,50 +40,3 @@ function mimemail_uninstall() { variable_del($variable); } } - -/** - * Implements hook_requirements(). - * - * Ensures that the newly-required Mail System module is available, or else - * disables the Mime Mail module and returns an informative error message. - */ -function mimemail_requirements($phase) { - if ($phase === 'install' || module_exists('mailsystem')) { - return array(); - } - $args = array( - '!mailsystem' => url('http://drupal.org/project/mailsystem'), - '%mailsystem' => 'Mail System', - '!mimemail' => url('http://drupal.org/project/mimemail'), - '%mimemail' => 'Mime Mail', - ); - if ( module_enable(array('mailsystem')) - && module_load_include('module', 'mailsystem') - ) { - drupal_set_message( - t('The %mailsystem module has been enabled because the %mimemail module now requires it.', $args) - ); - return array(); - } - return array( - 'mimemail_mailsystem' => array( - 'title' => t('%mailsystem module', $args), - 'value' => t('Not installed'), - 'description' => t( - 'The %mimemail module dependencies have changed. Please download and install the required %mailsystem module, then re-enable the %mimemail module.', $args - ), - 'severity' => REQUIREMENT_ERROR, - ), - ); -} - -/** - * Implements hook_update_N(). - * - * @see mimemail_requirements(). - */ -function mimemail_update_7000() { - if ($requirements = mimemail_requirements('runtime')) { - throw new DrupalUpdateException($requirements['mimemail_mailsystem']['description']); - } -} diff --git a/mimemail.module b/mimemail.module old mode 100644 new mode 100755 index 1f6bea1..c881df2 --- a/mimemail.module +++ b/mimemail.module @@ -5,6 +5,15 @@ * Component module for sending Mime-encoded emails. */ +function mimemail_mailwire_formatter() { + return array( + array( + 'class_name' => 'MimeMailFormatter', + 'weight' => 0, + ), + ); +} + /** * Implements hook_menu(). */ -- 1.7.0.4