aboutsummaryrefslogtreecommitdiff
path: root/h-source/External/swiftmailer/lib/classes/Swift/Events
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2010-10-17 13:29:57 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2010-10-17 13:29:57 +0000
commit232aa1924c8c0f10d87b210b46c9f061af5c844c (patch)
tree2351f2aaff7ad244f60358954e4711692fb8aadc /h-source/External/swiftmailer/lib/classes/Swift/Events
parenta17e3e0495bee3705d3c1e5ead2db1a8359e64e9 (diff)
added files
Diffstat (limited to 'h-source/External/swiftmailer/lib/classes/Swift/Events')
-rw-r--r--h-source/External/swiftmailer/lib/classes/Swift/Events/CommandEvent.php67
-rw-r--r--h-source/External/swiftmailer/lib/classes/Swift/Events/CommandListener.php29
-rw-r--r--h-source/External/swiftmailer/lib/classes/Swift/Events/Event.php39
-rw-r--r--h-source/External/swiftmailer/lib/classes/Swift/Events/EventDispatcher.php81
-rw-r--r--h-source/External/swiftmailer/lib/classes/Swift/Events/EventListener.php19
-rw-r--r--h-source/External/swiftmailer/lib/classes/Swift/Events/EventObject.php65
-rw-r--r--h-source/External/swiftmailer/lib/classes/Swift/Events/ResponseEvent.php65
-rw-r--r--h-source/External/swiftmailer/lib/classes/Swift/Events/ResponseListener.php29
-rw-r--r--h-source/External/swiftmailer/lib/classes/Swift/Events/SendEvent.php127
-rw-r--r--h-source/External/swiftmailer/lib/classes/Swift/Events/SendListener.php35
-rw-r--r--h-source/External/swiftmailer/lib/classes/Swift/Events/SimpleEventDispatcher.php175
-rw-r--r--h-source/External/swiftmailer/lib/classes/Swift/Events/TransportChangeEvent.php31
-rw-r--r--h-source/External/swiftmailer/lib/classes/Swift/Events/TransportChangeListener.php53
-rw-r--r--h-source/External/swiftmailer/lib/classes/Swift/Events/TransportExceptionEvent.php50
-rw-r--r--h-source/External/swiftmailer/lib/classes/Swift/Events/TransportExceptionListener.php30
15 files changed, 895 insertions, 0 deletions
diff --git a/h-source/External/swiftmailer/lib/classes/Swift/Events/CommandEvent.php b/h-source/External/swiftmailer/lib/classes/Swift/Events/CommandEvent.php
new file mode 100644
index 0000000..73eb585
--- /dev/null
+++ b/h-source/External/swiftmailer/lib/classes/Swift/Events/CommandEvent.php
@@ -0,0 +1,67 @@
+<?php
+
+/*
+ * This file is part of SwiftMailer.
+ * (c) 2004-2009 Chris Corbyn
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+//@require 'Swift/Events/EventObject.php';
+//@require 'Swift/Transport.php';
+
+/**
+ * Generated when a command is sent over an SMTP connection.
+ * @package Swift
+ * @subpackage Events
+ * @author Chris Corbyn
+ */
+class Swift_Events_CommandEvent extends Swift_Events_EventObject
+{
+
+ /**
+ * The command sent to the server.
+ * @var string
+ */
+ private $_command;
+
+ /**
+ * An array of codes which a successful response will contain.
+ * @var int[]
+ */
+ private $_successCodes = array();
+
+ /**
+ * Create a new CommandEvent for $source with $command.
+ * @param Swift_Transport $source
+ * @param string $command
+ * @param array $successCodes
+ */
+ public function __construct(Swift_Transport $source,
+ $command, $successCodes = array())
+ {
+ parent::__construct($source);
+ $this->_command = $command;
+ $this->_successCodes = $successCodes;
+ }
+
+ /**
+ * Get the command which was sent to the server.
+ * @return string
+ */
+ public function getCommand()
+ {
+ return $this->_command;
+ }
+
+ /**
+ * Get the numeric response codes which indicate success for this command.
+ * @return int[]
+ */
+ public function getSuccessCodes()
+ {
+ return $this->_successCodes;
+ }
+
+} \ No newline at end of file
diff --git a/h-source/External/swiftmailer/lib/classes/Swift/Events/CommandListener.php b/h-source/External/swiftmailer/lib/classes/Swift/Events/CommandListener.php
new file mode 100644
index 0000000..2fd7117
--- /dev/null
+++ b/h-source/External/swiftmailer/lib/classes/Swift/Events/CommandListener.php
@@ -0,0 +1,29 @@
+<?php
+
+/*
+ * This file is part of SwiftMailer.
+ * (c) 2004-2009 Chris Corbyn
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+//@require 'Swift/Events/EventListener.php';
+//@require 'Swift/Events/CommandEvent.php';
+
+/**
+ * Listens for Transports to send commands to the server.
+ * @package Swift
+ * @subpackage Events
+ * @author Chris Corbyn
+ */
+interface Swift_Events_CommandListener extends Swift_Events_EventListener
+{
+
+ /**
+ * Invoked immediately following a command being sent.
+ * @param Swift_Events_ResponseEvent $evt
+ */
+ public function commandSent(Swift_Events_CommandEvent $evt);
+
+}
diff --git a/h-source/External/swiftmailer/lib/classes/Swift/Events/Event.php b/h-source/External/swiftmailer/lib/classes/Swift/Events/Event.php
new file mode 100644
index 0000000..c6726a7
--- /dev/null
+++ b/h-source/External/swiftmailer/lib/classes/Swift/Events/Event.php
@@ -0,0 +1,39 @@
+<?php
+
+/*
+ * This file is part of SwiftMailer.
+ * (c) 2004-2009 Chris Corbyn
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * The minimum interface for an Event.
+ *
+ * @package Swift
+ * @subpackage Events
+ * @author Chris Corbyn
+ */
+interface Swift_Events_Event
+{
+
+ /**
+ * Get the source object of this event.
+ * @return object
+ */
+ public function getSource();
+
+ /**
+ * Prevent this Event from bubbling any further up the stack.
+ * @param boolean $cancel, optional
+ */
+ public function cancelBubble($cancel = true);
+
+ /**
+ * Returns true if this Event will not bubble any further up the stack.
+ * @return boolean
+ */
+ public function bubbleCancelled();
+
+}
diff --git a/h-source/External/swiftmailer/lib/classes/Swift/Events/EventDispatcher.php b/h-source/External/swiftmailer/lib/classes/Swift/Events/EventDispatcher.php
new file mode 100644
index 0000000..aaf1211
--- /dev/null
+++ b/h-source/External/swiftmailer/lib/classes/Swift/Events/EventDispatcher.php
@@ -0,0 +1,81 @@
+<?php
+
+/*
+ * This file is part of SwiftMailer.
+ * (c) 2004-2009 Chris Corbyn
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+//@require 'Swift/Events/EventListener.php';
+//@require 'Swift/Event.php';
+
+/**
+ * Interface for the EventDispatcher which handles the event dispatching layer.
+ * @package Swift
+ * @subpackage Events
+ * @author Chris Corbyn
+ */
+interface Swift_Events_EventDispatcher
+{
+
+ /**
+ * Create a new SendEvent for $source and $message.
+ * @param Swift_Transport $source
+ * @param Swift_Mime_Message
+ * @return Swift_Events_SendEvent
+ */
+ public function createSendEvent(Swift_Transport $source,
+ Swift_Mime_Message $message);
+
+ /**
+ * Create a new CommandEvent for $source and $command.
+ * @param Swift_Transport $source
+ * @param string $command That will be executed
+ * @param array $successCodes That are needed
+ * @return Swift_Events_CommandEvent
+ */
+ public function createCommandEvent(Swift_Transport $source,
+ $command, $successCodes = array());
+
+ /**
+ * Create a new ResponseEvent for $source and $response.
+ * @param Swift_Transport $source
+ * @param string $response
+ * @param boolean $valid If the response is valid
+ * @return Swift_Events_ResponseEvent
+ */
+ public function createResponseEvent(Swift_Transport $source,
+ $response, $valid);
+
+ /**
+ * Create a new TransportChangeEvent for $source.
+ * @param Swift_Transport $source
+ * @return Swift_Events_TransportChangeEvent
+ */
+ public function createTransportChangeEvent(Swift_Transport $source);
+
+ /**
+ * Create a new TransportExceptionEvent for $source.
+ * @param Swift_Transport $source
+ * @param Swift_TransportException $ex
+ * @return Swift_Events_TransportExceptionEvent
+ */
+ public function createTransportExceptionEvent(Swift_Transport $source,
+ Swift_TransportException $ex);
+
+ /**
+ * Bind an event listener to this dispatcher.
+ * @param Swift_Events_EventListener $listener
+ */
+ public function bindEventListener(Swift_Events_EventListener $listener);
+
+ /**
+ * Dispatch the given Event to all suitable listeners.
+ * @param Swift_Events_EventObject $evt
+ * @param string $target method
+ */
+ public function dispatchEvent(Swift_Events_EventObject $evt, $target);
+
+}
diff --git a/h-source/External/swiftmailer/lib/classes/Swift/Events/EventListener.php b/h-source/External/swiftmailer/lib/classes/Swift/Events/EventListener.php
new file mode 100644
index 0000000..00fb799
--- /dev/null
+++ b/h-source/External/swiftmailer/lib/classes/Swift/Events/EventListener.php
@@ -0,0 +1,19 @@
+<?php
+
+/*
+ * This file is part of SwiftMailer.
+ * (c) 2004-2009 Chris Corbyn
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * An identity interface which all EventListeners must extend.
+ * @package Swift
+ * @subpackage Events
+ * @author Chris Corbyn
+ */
+interface Swift_Events_EventListener
+{
+}
diff --git a/h-source/External/swiftmailer/lib/classes/Swift/Events/EventObject.php b/h-source/External/swiftmailer/lib/classes/Swift/Events/EventObject.php
new file mode 100644
index 0000000..5d494fe
--- /dev/null
+++ b/h-source/External/swiftmailer/lib/classes/Swift/Events/EventObject.php
@@ -0,0 +1,65 @@
+<?php
+
+/*
+ * This file is part of SwiftMailer.
+ * (c) 2004-2009 Chris Corbyn
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+//@require 'Swift/Events/Event.php';
+
+/**
+ * A base Event which all Event classes inherit from.
+ *
+ * @package Swift
+ * @subpackage Events
+ * @author Chris Corbyn
+ */
+class Swift_Events_EventObject implements Swift_Events_Event
+{
+
+ /** The source of this Event */
+ private $_source;
+
+ /** The state of this Event (should it bubble up the stack?) */
+ private $_bubbleCancelled = false;
+
+ /**
+ * Create a new EventObject originating at $source.
+ * @param object $source
+ */
+ public function __construct($source)
+ {
+ $this->_source = $source;
+ }
+
+ /**
+ * Get the source object of this event.
+ * @return object
+ */
+ public function getSource()
+ {
+ return $this->_source;
+ }
+
+ /**
+ * Prevent this Event from bubbling any further up the stack.
+ * @param boolean $cancel, optional
+ */
+ public function cancelBubble($cancel = true)
+ {
+ $this->_bubbleCancelled = $cancel;
+ }
+
+ /**
+ * Returns true if this Event will not bubble any further up the stack.
+ * @return boolean
+ */
+ public function bubbleCancelled()
+ {
+ return $this->_bubbleCancelled;
+ }
+
+}
diff --git a/h-source/External/swiftmailer/lib/classes/Swift/Events/ResponseEvent.php b/h-source/External/swiftmailer/lib/classes/Swift/Events/ResponseEvent.php
new file mode 100644
index 0000000..addf9e7
--- /dev/null
+++ b/h-source/External/swiftmailer/lib/classes/Swift/Events/ResponseEvent.php
@@ -0,0 +1,65 @@
+<?php
+
+/*
+ * This file is part of SwiftMailer.
+ * (c) 2004-2009 Chris Corbyn
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+//@require 'Swift/Events/EventObject.php';
+
+/**
+ * Generated when a response is received on a SMTP connection.
+ * @package Swift
+ * @subpackage Events
+ * @author Chris Corbyn
+ */
+class Swift_Events_ResponseEvent extends Swift_Events_EventObject
+{
+
+ /**
+ * The overall result.
+ * @var boolean
+ */
+ private $_valid;
+
+ /**
+ * The response received from the server.
+ * @var string
+ */
+ private $_response;
+
+ /**
+ * Create a new ResponseEvent for $source and $response.
+ * @param Swift_Transport $source
+ * @param string $response
+ * @param boolean $valid
+ */
+ public function __construct(Swift_Transport $source, $response, $valid = false)
+ {
+ parent::__construct($source);
+ $this->_response = $response;
+ $this->_valid = $valid;
+ }
+
+ /**
+ * Get the response which was received from the server.
+ * @return string
+ */
+ public function getResponse()
+ {
+ return $this->_response;
+ }
+
+ /**
+ * Get the success status of this Event.
+ * @return boolean
+ */
+ public function isValid()
+ {
+ return $this->_valid;
+ }
+
+} \ No newline at end of file
diff --git a/h-source/External/swiftmailer/lib/classes/Swift/Events/ResponseListener.php b/h-source/External/swiftmailer/lib/classes/Swift/Events/ResponseListener.php
new file mode 100644
index 0000000..092385b
--- /dev/null
+++ b/h-source/External/swiftmailer/lib/classes/Swift/Events/ResponseListener.php
@@ -0,0 +1,29 @@
+<?php
+
+/*
+ * This file is part of SwiftMailer.
+ * (c) 2004-2009 Chris Corbyn
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+//@require 'Swift/Events/EventListener.php';
+//@require 'Swift/Events/ResponseEvent.php';
+
+/**
+ * Listens for responses from a remote SMTP server.
+ * @package Swift
+ * @subpackage Events
+ * @author Chris Corbyn
+ */
+interface Swift_Events_ResponseListener extends Swift_Events_EventListener
+{
+
+ /**
+ * Invoked immediately following a response coming back.
+ * @param Swift_Events_ResponseEvent $evt
+ */
+ public function responseReceived(Swift_Events_ResponseEvent $evt);
+
+}
diff --git a/h-source/External/swiftmailer/lib/classes/Swift/Events/SendEvent.php b/h-source/External/swiftmailer/lib/classes/Swift/Events/SendEvent.php
new file mode 100644
index 0000000..49a8351
--- /dev/null
+++ b/h-source/External/swiftmailer/lib/classes/Swift/Events/SendEvent.php
@@ -0,0 +1,127 @@
+<?php
+
+/*
+ * This file is part of SwiftMailer.
+ * (c) 2004-2009 Chris Corbyn
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+//@require 'Swift/Events/EventObject.php';
+
+/**
+ * Generated when a message is being sent.
+ * @package Swift
+ * @subpackage Events
+ * @author Chris Corbyn
+ */
+class Swift_Events_SendEvent extends Swift_Events_EventObject
+{
+
+ /** Sending has yet to occur */
+ const RESULT_PENDING = 0x0001;
+
+ /** Sending was successful */
+ const RESULT_SUCCESS = 0x0010;
+
+ /** Sending worked, but there were some failures */
+ const RESULT_TENTATIVE = 0x0100;
+
+ /** Sending failed */
+ const RESULT_FAILED = 0x1000;
+
+ /**
+ * The Message being sent.
+ * @var Swift_Mime_Message
+ */
+ private $_message;
+
+ /**
+ * The Transport used in sending.
+ * @var Swift_Transport
+ */
+ private $_transport;
+
+ /**
+ * Any recipients which failed after sending.
+ * @var string[]
+ */
+ private $failedRecipients = array();
+
+ /**
+ * The overall result as a bitmask from the class constants.
+ * @var int
+ */
+ private $result;
+
+ /**
+ * Create a new SendEvent for $source and $message.
+ * @param Swift_Transport $source
+ * @param Swift_Mime_Message $message
+ */
+ public function __construct(Swift_Transport $source,
+ Swift_Mime_Message $message)
+ {
+ parent::__construct($source);
+ $this->_message = $message;
+ $this->_result = self::RESULT_PENDING;
+ }
+
+ /**
+ * Get the Transport used to send the Message.
+ * @return Swift_Transport
+ */
+ public function getTransport()
+ {
+ return $this->getSource();
+ }
+
+ /**
+ * Get the Message being sent.
+ * @return Swift_Mime_Message
+ */
+ public function getMessage()
+ {
+ return $this->_message;
+ }
+
+ /**
+ * Set the array of addresses that failed in sending.
+ * @param array $recipients
+ */
+ public function setFailedRecipients($recipients)
+ {
+ $this->_failedRecipients = $recipients;
+ }
+
+ /**
+ * Get an recipient addresses which were not accepted for delivery.
+ * @return string[]
+ */
+ public function getFailedRecipients()
+ {
+ return $this->_failedRecipients;
+ }
+
+ /**
+ * Set the result of sending.
+ * @return int
+ */
+ public function setResult($result)
+ {
+ $this->_result = $result;
+ }
+
+ /**
+ * Get the result of this Event.
+ * The return value is a bitmask from
+ * {@link RESULT_PENDING, RESULT_SUCCESS, RESULT_TENTATIVE, RESULT_FAILED}
+ * @return int
+ */
+ public function getResult()
+ {
+ return $this->_result;
+ }
+
+} \ No newline at end of file
diff --git a/h-source/External/swiftmailer/lib/classes/Swift/Events/SendListener.php b/h-source/External/swiftmailer/lib/classes/Swift/Events/SendListener.php
new file mode 100644
index 0000000..a8f0cc3
--- /dev/null
+++ b/h-source/External/swiftmailer/lib/classes/Swift/Events/SendListener.php
@@ -0,0 +1,35 @@
+<?php
+
+/*
+ * This file is part of SwiftMailer.
+ * (c) 2004-2009 Chris Corbyn
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+//@require 'Swift/Events/EventListener.php';
+//@require 'Swift/Events/SendEvent.php';
+
+/**
+ * Listens for Messages being sent from within the Transport system.
+ * @package Swift
+ * @subpackage Events
+ * @author Chris Corbyn
+ */
+interface Swift_Events_SendListener extends Swift_Events_EventListener
+{
+
+ /**
+ * Invoked immediately before the Message is sent.
+ * @param Swift_Events_SendEvent $evt
+ */
+ public function beforeSendPerformed(Swift_Events_SendEvent $evt);
+
+ /**
+ * Invoked immediately after the Message is sent.
+ * @param Swift_Events_SendEvent $evt
+ */
+ public function sendPerformed(Swift_Events_SendEvent $evt);
+
+}
diff --git a/h-source/External/swiftmailer/lib/classes/Swift/Events/SimpleEventDispatcher.php b/h-source/External/swiftmailer/lib/classes/Swift/Events/SimpleEventDispatcher.php
new file mode 100644
index 0000000..3e6c0be
--- /dev/null
+++ b/h-source/External/swiftmailer/lib/classes/Swift/Events/SimpleEventDispatcher.php
@@ -0,0 +1,175 @@
+<?php
+
+/*
+ * This file is part of SwiftMailer.
+ * (c) 2004-2009 Chris Corbyn
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+//@require 'Swift/Events/EventDispatcher.php';
+//@require 'Swift/Events/EventListener.php';
+//@require 'Swift/Events/EventObject.php';
+//@require 'Swift/Events/CommandEvent.php';
+//@require 'Swift/Events/ResponseEvent.php';
+//@require 'Swift/Events/SendEvent.php';
+//@require 'Swift/Events/TransportChangeEvent.php';
+//@require 'Swift/Events/TransportExceptionEvent.php';
+
+/**
+ * The EventDispatcher which handles the event dispatching layer.
+ *
+ * @package Swift
+ * @subpackage Events
+ * @author Chris Corbyn
+ */
+class Swift_Events_SimpleEventDispatcher implements Swift_Events_EventDispatcher
+{
+
+ /** A map of event types to their associated listener types */
+ private $_eventMap = array();
+
+ /** Event listeners bound to this dispatcher */
+ private $_listeners = array();
+
+ /** Listeners queued to have an Event bubbled up the stack to them */
+ private $_bubbleQueue = array();
+
+ /**
+ * Create a new EventDispatcher.
+ */
+ public function __construct()
+ {
+ $this->_eventMap = array(
+ 'Swift_Events_CommandEvent' => 'Swift_Events_CommandListener',
+ 'Swift_Events_ResponseEvent' => 'Swift_Events_ResponseListener',
+ 'Swift_Events_SendEvent' => 'Swift_Events_SendListener',
+ 'Swift_Events_TransportChangeEvent' => 'Swift_Events_TransportChangeListener',
+ 'Swift_Events_TransportExceptionEvent' => 'Swift_Events_TransportExceptionListener'
+ );
+ }
+
+ /**
+ * Create a new SendEvent for $source and $message.
+ *
+ * @param Swift_Transport $source
+ * @param Swift_Mime_Message
+ * @return Swift_Events_SendEvent
+ */
+ public function createSendEvent(Swift_Transport $source,
+ Swift_Mime_Message $message)
+ {
+ return new Swift_Events_SendEvent($source, $message);
+ }
+
+ /**
+ * Create a new CommandEvent for $source and $command.
+ *
+ * @param Swift_Transport $source
+ * @param string $command That will be executed
+ * @param array $successCodes That are needed
+ * @return Swift_Events_CommandEvent
+ */
+ public function createCommandEvent(Swift_Transport $source,
+ $command, $successCodes = array())
+ {
+ return new Swift_Events_CommandEvent($source, $command, $successCodes);
+ }
+
+ /**
+ * Create a new ResponseEvent for $source and $response.
+ *
+ * @param Swift_Transport $source
+ * @param string $response
+ * @param boolean $valid If the response is valid
+ * @return Swift_Events_ResponseEvent
+ */
+ public function createResponseEvent(Swift_Transport $source,
+ $response, $valid)
+ {
+ return new Swift_Events_ResponseEvent($source, $response, $valid);
+ }
+
+ /**
+ * Create a new TransportChangeEvent for $source.
+ *
+ * @param Swift_Transport $source
+ * @return Swift_Events_TransportChangeEvent
+ */
+ public function createTransportChangeEvent(Swift_Transport $source)
+ {
+ return new Swift_Events_TransportChangeEvent($source);
+ }
+
+ /**
+ * Create a new TransportExceptionEvent for $source.
+ *
+ * @param Swift_Transport $source
+ * @param Swift_TransportException $ex
+ * @return Swift_Events_TransportExceptionEvent
+ */
+ public function createTransportExceptionEvent(Swift_Transport $source,
+ Swift_TransportException $ex)
+ {
+ return new Swift_Events_TransportExceptionEvent($source, $ex);
+ }
+
+ /**
+ * Bind an event listener to this dispatcher.
+ *
+ * @param Swift_Events_EventListener $listener
+ */
+ public function bindEventListener(Swift_Events_EventListener $listener)
+ {
+ foreach ($this->_listeners as $l)
+ {
+ //Already loaded
+ if ($l === $listener)
+ {
+ return;
+ }
+ }
+ $this->_listeners[] = $listener;
+ }
+
+ /**
+ * Dispatch the given Event to all suitable listeners.
+ *
+ * @param Swift_Events_EventObject $evt
+ * @param string $target method
+ */
+ public function dispatchEvent(Swift_Events_EventObject $evt, $target)
+ {
+ $this->_prepareBubbleQueue($evt);
+ $this->_bubble($evt, $target);
+ }
+
+ // -- Private methods
+
+ /** Queue listeners on a stack ready for $evt to be bubbled up it */
+ private function _prepareBubbleQueue(Swift_Events_EventObject $evt)
+ {
+ $this->_bubbleQueue = array();
+ $evtClass = get_class($evt);
+ foreach ($this->_listeners as $listener)
+ {
+ if (array_key_exists($evtClass, $this->_eventMap)
+ && ($listener instanceof $this->_eventMap[$evtClass]))
+ {
+ $this->_bubbleQueue[] = $listener;
+ }
+ }
+ }
+
+ /** Bubble $evt up the stack calling $target() on each listener */
+ private function _bubble(Swift_Events_EventObject $evt, $target)
+ {
+ if (!$evt->bubbleCancelled() && $listener = array_shift($this->_bubbleQueue))
+ {
+ $listener->$target($evt);
+ $this->_bubble($evt, $target);
+ }
+ }
+
+}
diff --git a/h-source/External/swiftmailer/lib/classes/Swift/Events/TransportChangeEvent.php b/h-source/External/swiftmailer/lib/classes/Swift/Events/TransportChangeEvent.php
new file mode 100644
index 0000000..f069a4c
--- /dev/null
+++ b/h-source/External/swiftmailer/lib/classes/Swift/Events/TransportChangeEvent.php
@@ -0,0 +1,31 @@
+<?php
+
+/*
+ * This file is part of SwiftMailer.
+ * (c) 2004-2009 Chris Corbyn
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+//@require 'Swift/Events/EventObject.php';
+
+/**
+ * Generated when the state of a Transport is changed (i.e. stopped/started).
+ * @package Swift
+ * @subpackage Events
+ * @author Chris Corbyn
+ */
+class Swift_Events_TransportChangeEvent extends Swift_Events_EventObject
+{
+
+ /**
+ * Get the Transport.
+ * @return Swift_Transport
+ */
+ public function getTransport()
+ {
+ return $this->getSource();
+ }
+
+} \ No newline at end of file
diff --git a/h-source/External/swiftmailer/lib/classes/Swift/Events/TransportChangeListener.php b/h-source/External/swiftmailer/lib/classes/Swift/Events/TransportChangeListener.php
new file mode 100644
index 0000000..ba729d0
--- /dev/null
+++ b/h-source/External/swiftmailer/lib/classes/Swift/Events/TransportChangeListener.php
@@ -0,0 +1,53 @@
+<?php
+
+/*
+ * This file is part of SwiftMailer.
+ * (c) 2004-2009 Chris Corbyn
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+//@require 'Swift/Events/EventListener.php';
+//@require 'Swift/Events/TransportChangeEvent.php';
+
+/**
+ * Listens for changes within the Transport system.
+ *
+ * @package Swift
+ * @subpackage Events
+ *
+ * @author Chris Corbyn
+ */
+interface Swift_Events_TransportChangeListener extends Swift_Events_EventListener
+{
+
+ /**
+ * Invoked just before a Transport is started.
+ *
+ * @param Swift_Events_TransportChangeEvent $evt
+ */
+ public function beforeTransportStarted(Swift_Events_TransportChangeEvent $evt);
+
+ /**
+ * Invoked immediately after the Transport is started.
+ *
+ * @param Swift_Events_TransportChangeEvent $evt
+ */
+ public function transportStarted(Swift_Events_TransportChangeEvent $evt);
+
+ /**
+ * Invoked just before a Transport is stopped.
+ *
+ * @param Swift_Events_TransportChangeEvent $evt
+ */
+ public function beforeTransportStopped(Swift_Events_TransportChangeEvent $evt);
+
+ /**
+ * Invoked immediately after the Transport is stopped.
+ *
+ * @param Swift_Events_TransportChangeEvent $evt
+ */
+ public function transportStopped(Swift_Events_TransportChangeEvent $evt);
+
+}
diff --git a/h-source/External/swiftmailer/lib/classes/Swift/Events/TransportExceptionEvent.php b/h-source/External/swiftmailer/lib/classes/Swift/Events/TransportExceptionEvent.php
new file mode 100644
index 0000000..a1bf7d2
--- /dev/null
+++ b/h-source/External/swiftmailer/lib/classes/Swift/Events/TransportExceptionEvent.php
@@ -0,0 +1,50 @@
+<?php
+
+/*
+ * This file is part of SwiftMailer.
+ * (c) 2004-2009 Chris Corbyn
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+//@require 'Swift/Events/EventObject.php';
+//@require 'Swift/TransportException.php';
+
+/**
+ * Generated when a TransportException is thrown from the Transport system.
+ * @package Swift
+ * @subpackage Events
+ * @author Chris Corbyn
+ */
+class Swift_Events_TransportExceptionEvent extends Swift_Events_EventObject
+{
+
+ /**
+ * The Exception thrown.
+ * @var Swift_TransportException
+ */
+ private $_exception;
+
+ /**
+ * Create a new TransportExceptionEvent for $transport.
+ * @param Swift_Transport $transport
+ * @param Swift_TransportException $ex
+ */
+ public function __construct(Swift_Transport $transport,
+ Swift_TransportException $ex)
+ {
+ parent::__construct($transport);
+ $this->_exception = $ex;
+ }
+
+ /**
+ * Get the TransportException thrown.
+ * @return Swift_TransportException
+ */
+ public function getException()
+ {
+ return $this->_exception;
+ }
+
+}
diff --git a/h-source/External/swiftmailer/lib/classes/Swift/Events/TransportExceptionListener.php b/h-source/External/swiftmailer/lib/classes/Swift/Events/TransportExceptionListener.php
new file mode 100644
index 0000000..d6dce94
--- /dev/null
+++ b/h-source/External/swiftmailer/lib/classes/Swift/Events/TransportExceptionListener.php
@@ -0,0 +1,30 @@
+<?php
+
+/*
+ * This file is part of SwiftMailer.
+ * (c) 2004-2009 Chris Corbyn
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+//@require 'Swift/Events/EventListener.php';
+//@require 'Swift/Events/TransportExceptionEvent.php';
+
+/**
+ * Listens for Exceptions thrown from within the Transport system.
+ * @package Swift
+ * @subpackage Events
+ * @author Chris Corbyn
+ */
+interface Swift_Events_TransportExceptionListener
+ extends Swift_Events_EventListener
+{
+
+ /**
+ * Invoked as a TransportException is thrown in the Transport system.
+ * @param Swift_Events_TransportExceptionEvent $evt
+ */
+ public function exceptionThrown(Swift_Events_TransportExceptionEvent $evt);
+
+}