cvs: pear /Net_SMTP SMTP.php package.xml
| From: | Jon Parise | Date: | Fri, 10 Jan 2003 20:28:09 +0000 |
| Subject: | cvs: pear /Net_SMTP SMTP.php package.xml | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-8178@lists.php.net to get a copy of this message | ||
jon Fri Jan 10 15:28:09 2003 EDT
Modified files:
/pear/Net_SMTP SMTP.php package.xml
Log:
Added optional debugging output (enabled via setDebug()).
Inspired by: Damian Alejandro Fernandez Sosa <damlists@cnba.uba.ar>
Index: pear/Net_SMTP/SMTP.php
diff -u pear/Net_SMTP/SMTP.php:1.14 pear/Net_SMTP/SMTP.php:1.15
--- pear/Net_SMTP/SMTP.php:1.14 Fri Jan 10 15:12:53 2003
+++ pear/Net_SMTP/SMTP.php Fri Jan 10 15:28:09 2003
@@ -49,6 +49,12 @@
var $localhost = 'localhost';
/**
+ * Should debugging output be enabled?
+ * @var boolean
+ */
+ var $_debug = false;
+
+ /**
* The socket resource being used to connect to the SMTP server.
* @var resource
*/
@@ -98,6 +104,18 @@
}
/**
+ * Set the value of the debugging flag.
+ *
+ * @param boolean $debug New value for the debugging flag.
+ *
+ * @access public
+ */
+ function setDebug($debug)
+ {
+ $this->_debug = $debug;
+ }
+
+ /**
* Attempt to connect to the SMTP server.
*
* @return mixed Returns a PEAR_Error with an error message on any
@@ -153,6 +171,10 @@
*/
function _send($data)
{
+ if ($this->_debug) {
+ echo "DEBUG: Send: $data\n";
+ }
+
if (PEAR::isError($error = $this->_socket->write($data))) {
echo 'Failed to write to socket: ' . $error->getMessage() .
"\n";
return new PEAR_Error('Failed to write to socket: ' .
@@ -204,6 +226,10 @@
$this->_arguments = array();
while ($line = $this->_socket->readLine()) {
+ if ($this->_debug) {
+ echo "DEBUG: Recv: $line\n";
+ }
+
/* If we receive an empty line, the connection has been closed. */
if (empty($line)) {
$this->disconnect();
Index: pear/Net_SMTP/package.xml
diff -u pear/Net_SMTP/package.xml:1.8 pear/Net_SMTP/package.xml:1.9
--- pear/Net_SMTP/package.xml:1.8 Fri Jan 10 15:13:48 2003
+++ pear/Net_SMTP/package.xml Fri Jan 10 15:28:09 2003
@@ -29,6 +29,7 @@
- The SMTP server's SIZE capability is now honored.
- Improved support for SMTP authentication (LOGIN, PLAIN).
- Overhauled the server response parsing system.
+- Added optional debugging output (enabled via setDebug()).
</notes>
<state>stable</state>
<filelist>