summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoruckelman <uckelman@nomic.net>2010-10-31 22:11:51 +0000
committeruckelman <uckelman@nomic.net>2010-10-31 22:11:51 +0000
commit7daafdc2d562b77acec611762abe8823040894ff (patch)
tree1d08d6b216b7b85be77d29901bb53575a1f73420 /src
parent0db2c84dbbe9a1db9b5fd8b684eb71d9c8a26397 (diff)
Pass Mail in as dependency.
git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@7434 67b53d14-2c14-4ace-a08f-0dab2b34000c
Diffstat (limited to 'src')
-rw-r--r--src/PhpBB3ToMailman.php9
-rw-r--r--src/forum_post_send.php6
2 files changed, 10 insertions, 5 deletions
diff --git a/src/PhpBB3ToMailman.php b/src/PhpBB3ToMailman.php
index fccd2b4..411853f 100644
--- a/src/PhpBB3ToMailman.php
+++ b/src/PhpBB3ToMailman.php
@@ -33,11 +33,14 @@ class PhpBB3ToMailman {
protected $bridge;
protected $phpbb;
+ protected $mailer;
protected $logger;
- public function __construct(Bridge $bridge, PhpBB3 $phpbb, Log $logger) {
+ public function __construct(Bridge $bridge, PhpBB3 $phpbb,
+ Mail $mailer, Log $logger) {
$this->bridge = $bridge;
$this->phpbb = $phpbb;
+ $this->mailer = $mailer;
$this->logger = $logger;
}
@@ -147,8 +150,6 @@ class PhpBB3ToMailman {
# Build the message body
$body = build_body($headers, $text, $attachments, $footer);
- $mailer = Mail::factory('sendmail');
-
# Register the message
$seen = !$this->bridge->registerByEditId($editId, $messageId, $inReplyTo);
if ($seen) {
@@ -157,7 +158,7 @@ class PhpBB3ToMailman {
try {
# Send the message
- $err = $mailer->send($to, $headers, $body);
+ $err = $this->mailer->send($to, $headers, $body);
if (PEAR::isError($err)) {
throw new Exception('Mail::send error: ' . $err->toString());
}
diff --git a/src/forum_post_send.php b/src/forum_post_send.php
index c2b23bd..723ed66 100644
--- a/src/forum_post_send.php
+++ b/src/forum_post_send.php
@@ -44,6 +44,8 @@ function send_post_to_lists($config, $user, $mode, $data, $post_data) {
print '</p>';
*/
+ require_once('Mail.php');
+
require_once(__DIR__ . '/BridgeConf.php');
require_once(__DIR__ . '/BridgeImpl.php');
require_once(__DIR__ . '/PhpBB3Conf.php');
@@ -55,7 +57,9 @@ function send_post_to_lists($config, $user, $mode, $data, $post_data) {
$phpbb = new PhpBB3Impl();
- $conduit = new PhpBB3ToMailman($bridge, $phpbb, $logger);
+ $mailer = Mail::factory('sendmail');
+
+ $conduit = new PhpBB3ToMailman($bridge, $phpbb, $mailer, $logger);
$conduit->process($config, $user, $mode, $data, $post_data);
}