comparison src/pop3/client.c @ 6940:414c9d631a81 HEAD

Replaced t_push/t_pop calls with T_FRAME*() macros.
author Timo Sirainen <tss@iki.fi>
date Wed, 05 Dec 2007 17:47:44 +0200
parents c62f30cc1153
children 7ed926ed7aa4
comparison
equal deleted inserted replaced
6939:c7b42fea5fcc 6940:414c9d631a81
293 } 293 }
294 294
295 int client_send_line(struct client *client, const char *fmt, ...) 295 int client_send_line(struct client *client, const char *fmt, ...)
296 { 296 {
297 va_list va; 297 va_list va;
298 string_t *str;
299 ssize_t ret; 298 ssize_t ret;
300 299
301 if (client->output->closed) 300 if (client->output->closed)
302 return -1; 301 return -1;
303 302
304 t_push();
305 va_start(va, fmt); 303 va_start(va, fmt);
306 304
307 str = t_str_new(256); 305 T_FRAME(
308 str_vprintfa(str, fmt, va); 306 string_t *str;
309 str_append(str, "\r\n"); 307
310 308 str = t_str_new(256);
311 ret = o_stream_send(client->output, str_data(str), str_len(str)); 309 str_vprintfa(str, fmt, va);
310 str_append(str, "\r\n");
311
312 ret = o_stream_send(client->output,
313 str_data(str), str_len(str));
314 i_assert(ret < 0 || (size_t)ret == str_len(str));
315 );
312 if (ret >= 0) { 316 if (ret >= 0) {
313 i_assert((size_t)ret == str_len(str));
314
315 if (o_stream_get_buffer_used_size(client->output) < 317 if (o_stream_get_buffer_used_size(client->output) <
316 OUTBUF_THROTTLE_SIZE) { 318 OUTBUF_THROTTLE_SIZE) {
317 ret = 1; 319 ret = 1;
318 client->last_output = ioloop_time; 320 client->last_output = ioloop_time;
319 } else { 321 } else {
331 } 333 }
332 } 334 }
333 } 335 }
334 336
335 va_end(va); 337 va_end(va);
336 t_pop();
337 return (int)ret; 338 return (int)ret;
338 } 339 }
339 340
340 void client_send_storage_error(struct client *client) 341 void client_send_storage_error(struct client *client)
341 { 342 {
386 (line = i_stream_next_line(client->input)) != NULL) { 387 (line = i_stream_next_line(client->input)) != NULL) {
387 args = strchr(line, ' '); 388 args = strchr(line, ' ');
388 if (args != NULL) 389 if (args != NULL)
389 *args++ = '\0'; 390 *args++ = '\0';
390 391
391 t_push(); 392 T_FRAME(
392 ret = client_command_execute(client, line, 393 ret = client_command_execute(client, line,
393 args != NULL ? args : ""); 394 args != NULL ? args : "");
394 t_pop(); 395 );
395 if (ret >= 0) { 396 if (ret >= 0) {
396 client->bad_counter = 0; 397 client->bad_counter = 0;
397 if (client->cmd != NULL) { 398 if (client->cmd != NULL) {
398 o_stream_set_flush_pending(client->output, 399 o_stream_set_flush_pending(client->output,
399 TRUE); 400 TRUE);