From 07f5140771388c9e0c8a99b0dd2e5d950bdb173b Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 14 Oct 2021 15:16:42 +1100 Subject: moving h-source subdir out. --- .../lib/classes/Swift/Events/CommandEvent.php | 67 ++++++++ .../lib/classes/Swift/Events/CommandListener.php | 29 ++++ .../swiftmailer/lib/classes/Swift/Events/Event.php | 39 +++++ .../lib/classes/Swift/Events/EventDispatcher.php | 81 ++++++++++ .../lib/classes/Swift/Events/EventListener.php | 19 +++ .../lib/classes/Swift/Events/EventObject.php | 65 ++++++++ .../lib/classes/Swift/Events/ResponseEvent.php | 65 ++++++++ .../lib/classes/Swift/Events/ResponseListener.php | 29 ++++ .../lib/classes/Swift/Events/SendEvent.php | 127 +++++++++++++++ .../lib/classes/Swift/Events/SendListener.php | 35 +++++ .../classes/Swift/Events/SimpleEventDispatcher.php | 175 +++++++++++++++++++++ .../classes/Swift/Events/TransportChangeEvent.php | 31 ++++ .../Swift/Events/TransportChangeListener.php | 53 +++++++ .../Swift/Events/TransportExceptionEvent.php | 50 ++++++ .../Swift/Events/TransportExceptionListener.php | 30 ++++ 15 files changed, 895 insertions(+) create mode 100755 External/swiftmailer/lib/classes/Swift/Events/CommandEvent.php create mode 100755 External/swiftmailer/lib/classes/Swift/Events/CommandListener.php create mode 100755 External/swiftmailer/lib/classes/Swift/Events/Event.php create mode 100755 External/swiftmailer/lib/classes/Swift/Events/EventDispatcher.php create mode 100755 External/swiftmailer/lib/classes/Swift/Events/EventListener.php create mode 100755 External/swiftmailer/lib/classes/Swift/Events/EventObject.php create mode 100755 External/swiftmailer/lib/classes/Swift/Events/ResponseEvent.php create mode 100755 External/swiftmailer/lib/classes/Swift/Events/ResponseListener.php create mode 100755 External/swiftmailer/lib/classes/Swift/Events/SendEvent.php create mode 100755 External/swiftmailer/lib/classes/Swift/Events/SendListener.php create mode 100755 External/swiftmailer/lib/classes/Swift/Events/SimpleEventDispatcher.php create mode 100755 External/swiftmailer/lib/classes/Swift/Events/TransportChangeEvent.php create mode 100755 External/swiftmailer/lib/classes/Swift/Events/TransportChangeListener.php create mode 100755 External/swiftmailer/lib/classes/Swift/Events/TransportExceptionEvent.php create mode 100755 External/swiftmailer/lib/classes/Swift/Events/TransportExceptionListener.php (limited to 'External/swiftmailer/lib/classes/Swift/Events') diff --git a/External/swiftmailer/lib/classes/Swift/Events/CommandEvent.php b/External/swiftmailer/lib/classes/Swift/Events/CommandEvent.php new file mode 100755 index 0000000..73eb585 --- /dev/null +++ b/External/swiftmailer/lib/classes/Swift/Events/CommandEvent.php @@ -0,0 +1,67 @@ +_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/External/swiftmailer/lib/classes/Swift/Events/CommandListener.php b/External/swiftmailer/lib/classes/Swift/Events/CommandListener.php new file mode 100755 index 0000000..2fd7117 --- /dev/null +++ b/External/swiftmailer/lib/classes/Swift/Events/CommandListener.php @@ -0,0 +1,29 @@ +_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/External/swiftmailer/lib/classes/Swift/Events/ResponseEvent.php b/External/swiftmailer/lib/classes/Swift/Events/ResponseEvent.php new file mode 100755 index 0000000..addf9e7 --- /dev/null +++ b/External/swiftmailer/lib/classes/Swift/Events/ResponseEvent.php @@ -0,0 +1,65 @@ +_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/External/swiftmailer/lib/classes/Swift/Events/ResponseListener.php b/External/swiftmailer/lib/classes/Swift/Events/ResponseListener.php new file mode 100755 index 0000000..092385b --- /dev/null +++ b/External/swiftmailer/lib/classes/Swift/Events/ResponseListener.php @@ -0,0 +1,29 @@ +_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/External/swiftmailer/lib/classes/Swift/Events/SendListener.php b/External/swiftmailer/lib/classes/Swift/Events/SendListener.php new file mode 100755 index 0000000..a8f0cc3 --- /dev/null +++ b/External/swiftmailer/lib/classes/Swift/Events/SendListener.php @@ -0,0 +1,35 @@ +_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/External/swiftmailer/lib/classes/Swift/Events/TransportChangeEvent.php b/External/swiftmailer/lib/classes/Swift/Events/TransportChangeEvent.php new file mode 100755 index 0000000..f069a4c --- /dev/null +++ b/External/swiftmailer/lib/classes/Swift/Events/TransportChangeEvent.php @@ -0,0 +1,31 @@ +getSource(); + } + +} \ No newline at end of file diff --git a/External/swiftmailer/lib/classes/Swift/Events/TransportChangeListener.php b/External/swiftmailer/lib/classes/Swift/Events/TransportChangeListener.php new file mode 100755 index 0000000..ba729d0 --- /dev/null +++ b/External/swiftmailer/lib/classes/Swift/Events/TransportChangeListener.php @@ -0,0 +1,53 @@ +_exception = $ex; + } + + /** + * Get the TransportException thrown. + * @return Swift_TransportException + */ + public function getException() + { + return $this->_exception; + } + +} diff --git a/External/swiftmailer/lib/classes/Swift/Events/TransportExceptionListener.php b/External/swiftmailer/lib/classes/Swift/Events/TransportExceptionListener.php new file mode 100755 index 0000000..d6dce94 --- /dev/null +++ b/External/swiftmailer/lib/classes/Swift/Events/TransportExceptionListener.php @@ -0,0 +1,30 @@ +