198 |
|
} |
199 |
|
else |
200 |
|
{ |
201 |
< |
result += input + "\r\n"; |
201 |
> |
result += input + "\n"; |
202 |
|
} |
203 |
|
} |
204 |
|
|
229 |
|
} |
230 |
|
else |
231 |
|
{ |
232 |
< |
result += input + "\r\n"; |
232 |
> |
result += input + "\n"; |
233 |
|
} |
234 |
|
} |
235 |
|
|
262 |
|
} |
263 |
|
else |
264 |
|
{ |
265 |
< |
result += input + "\r\n"; |
265 |
> |
result += input + "\n"; |
266 |
|
} |
267 |
|
} |
268 |
|
|
271 |
|
|
272 |
|
void IMAPHandler::putline(const string line) |
273 |
|
{ |
274 |
< |
if (debug) cerr << line << "\n"; |
274 |
> |
istringstream lines(line); |
275 |
|
|
276 |
< |
sprintf(buffer, "%s\r\n", line.c_str()); |
277 |
< |
|
278 |
< |
if (tls) |
276 |
> |
while (lines.good()) |
277 |
|
{ |
278 |
< |
if (int code = SSL_write(ssl, buffer, strlen(buffer)) <= 0) |
279 |
< |
{ |
280 |
< |
error(program + ": SSL Write", code); |
281 |
< |
exit(1); |
278 |
> |
string line; |
279 |
> |
|
280 |
> |
std::getline(lines, line); |
281 |
> |
if (debug) cerr << line << "\n"; |
282 |
> |
|
283 |
> |
sprintf(buffer, "%s\r\n", line.c_str()); |
284 |
> |
|
285 |
> |
// for (unsigned index = 0; index < strlen(buffer); index++) |
286 |
> |
// { |
287 |
> |
// cout << "\"" << buffer[index] << "\" = " << int(buffer[index]) |
288 |
> |
// << "\n"; |
289 |
> |
// } |
290 |
> |
|
291 |
> |
if (tls) |
292 |
> |
{ |
293 |
> |
if (int code = SSL_write(ssl, buffer, strlen(buffer)) <= 0) |
294 |
> |
{ |
295 |
> |
error(program + ": SSL Write", code); |
296 |
> |
exit(1); |
297 |
> |
} |
298 |
|
} |
299 |
< |
} |
286 |
< |
else |
287 |
< |
{ |
288 |
< |
if (send(sock, buffer, strlen(buffer), 0) == SOCKET_ERROR) |
299 |
> |
else |
300 |
|
{ |
301 |
< |
error(program + ": Send"); |
302 |
< |
exit(1); |
301 |
> |
if (send(sock, buffer, strlen(buffer), 0) == SOCKET_ERROR) |
302 |
> |
{ |
303 |
> |
error(program + ": Send"); |
304 |
> |
exit(1); |
305 |
> |
} |
306 |
|
} |
307 |
+ |
|
308 |
+ |
lines.peek(); |
309 |
|
} |
310 |
|
} |
311 |
|
|