Diffstat (limited to 'noncore/net/mailit/smtpclient.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mailit/smtpclient.cpp | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/noncore/net/mailit/smtpclient.cpp b/noncore/net/mailit/smtpclient.cpp index 2916f45..5b5ef52 100644 --- a/noncore/net/mailit/smtpclient.cpp +++ b/noncore/net/mailit/smtpclient.cpp | |||
@@ -74,5 +74,10 @@ void SmtpClient::connectionEstablished() | |||
74 | void SmtpClient::errorHandling(int status) | 74 | void SmtpClient::errorHandling(int status) |
75 | { | 75 | { |
76 | emit errorOccurred(status); | 76 | errorHandlingWithMsg( status, QString::null ); |
77 | } | ||
78 | |||
79 | void SmtpClient::errorHandlingWithMsg(int status, const QString & EMsg ) | ||
80 | { | ||
81 | emit errorOccurred(status, EMsg ); | ||
77 | socket->close(); | 82 | socket->close(); |
78 | mailList.clear(); | 83 | mailList.clear(); |
@@ -88,5 +93,4 @@ void SmtpClient::incomingData() | |||
88 | 93 | ||
89 | response = socket->readLine(); | 94 | response = socket->readLine(); |
90 | |||
91 | switch(status) { | 95 | switch(status) { |
92 | case Init: { | 96 | case Init: { |
@@ -95,12 +99,13 @@ void SmtpClient::incomingData() | |||
95 | mailPtr = mailList.first(); | 99 | mailPtr = mailList.first(); |
96 | *stream << "HELO there\r\n"; | 100 | *stream << "HELO there\r\n"; |
97 | } else errorHandling(ErrUnknownResponse); | 101 | } else errorHandlingWithMsg(ErrUnknownResponse,response); |
98 | break; | 102 | break; |
99 | } | 103 | } |
100 | case From: { | 104 | case From: { |
101 | if (response[0] == '2') { | 105 | if (response[0] == '2') { |
102 | *stream << "MAIL FROM: " << mailPtr->from << "\r\n"; | 106 | qDebug(mailPtr->from); |
107 | *stream << "MAIL FROM: <" << mailPtr->from << ">\r\n"; | ||
103 | status = Recv; | 108 | status = Recv; |
104 | } else errorHandling(ErrUnknownResponse); | 109 | } else errorHandlingWithMsg(ErrUnknownResponse, response ); |
105 | break; | 110 | break; |
106 | } | 111 | } |
@@ -108,9 +113,10 @@ void SmtpClient::incomingData() | |||
108 | if (response[0] == '2') { | 113 | if (response[0] == '2') { |
109 | it = mailPtr->to.begin(); | 114 | it = mailPtr->to.begin(); |
110 | if (it == NULL) | 115 | if (it == NULL) { |
111 | errorHandling(ErrUnknownResponse); | 116 | errorHandlingWithMsg(ErrUnknownResponse,response); |
112 | *stream << "RCPT TO: " << *it << ">\r\n"; | 117 | } |
118 | *stream << "RCPT TO: <" << *it << ">\r\n"; | ||
113 | status = MRcv; | 119 | status = MRcv; |
114 | } else errorHandling(ErrUnknownResponse); | 120 | } else errorHandlingWithMsg(ErrUnknownResponse,response); |
115 | break; | 121 | break; |
116 | } | 122 | } |
@@ -124,5 +130,5 @@ void SmtpClient::incomingData() | |||
124 | status = Data; | 130 | status = Data; |
125 | } | 131 | } |
126 | } else errorHandling(ErrUnknownResponse); | 132 | } else errorHandlingWithMsg(ErrUnknownResponse,response); |
127 | } | 133 | } |
128 | case Data: { | 134 | case Data: { |
@@ -131,5 +137,6 @@ void SmtpClient::incomingData() | |||
131 | status = Body; | 137 | status = Body; |
132 | emit updateStatus(tr("Sending: ") + mailPtr->subject); | 138 | emit updateStatus(tr("Sending: ") + mailPtr->subject); |
133 | } else errorHandling(ErrUnknownResponse); | 139 | |
140 | } else errorHandlingWithMsg(ErrUnknownResponse,response); | ||
134 | break; | 141 | break; |
135 | } | 142 | } |
@@ -143,5 +150,5 @@ void SmtpClient::incomingData() | |||
143 | status = Quit; | 150 | status = Quit; |
144 | } | 151 | } |
145 | } else errorHandling(ErrUnknownResponse); | 152 | } else errorHandlingWithMsg(ErrUnknownResponse,response); |
146 | break; | 153 | break; |
147 | } | 154 | } |
@@ -157,5 +164,5 @@ void SmtpClient::incomingData() | |||
157 | sending = FALSE; | 164 | sending = FALSE; |
158 | socket->close(); | 165 | socket->close(); |
159 | } else errorHandling(ErrUnknownResponse); | 166 | } else errorHandlingWithMsg(ErrUnknownResponse,response); |
160 | break; | 167 | break; |
161 | } | 168 | } |