| 4420 | | stop_gmsgstore (CamelImapFolder *imap_folder, gboolean ctchecker) |
|---|
| 4421 | | { |
|---|
| 4422 | | if (ctchecker) { |
|---|
| 4423 | | camel_object_ref (imap_folder); |
|---|
| 4424 | | imap_folder->gmsgstore_signal = g_timeout_add (1000, |
|---|
| 4425 | | check_gmsgstore_die, imap_folder); |
|---|
| 4426 | | } |
|---|
| 4427 | | g_static_mutex_unlock (&gmsgstore_lock); |
|---|
| | 4421 | stop_gmsgstore (CamelImapFolder *imap_folder, gboolean ctchecker, gboolean quick) |
|---|
| | 4422 | { |
|---|
| | 4423 | if (quick) { |
|---|
| | 4424 | if (ctchecker) { |
|---|
| | 4425 | camel_object_ref (imap_folder); |
|---|
| | 4426 | imap_folder->gmsgstore_signal = g_timeout_add (1000, |
|---|
| | 4427 | check_gmsgstore_die, imap_folder); |
|---|
| | 4428 | } |
|---|
| | 4429 | } else { |
|---|
| | 4430 | imap_folder->gmsgstore->clean_exit = FALSE; |
|---|
| | 4431 | imap_folder->gmsgstore_ticks = 0; |
|---|
| | 4432 | if (ctchecker) { |
|---|
| | 4433 | camel_object_ref (imap_folder); |
|---|
| | 4434 | imap_folder->gmsgstore_signal = g_timeout_add (1, |
|---|
| | 4435 | check_gmsgstore_die, imap_folder); |
|---|
| | 4436 | } |
|---|
| | 4437 | } |
|---|
| | 4438 | |
|---|
| | 4439 | g_static_mutex_unlock (&gmsgstore_lock); /* A */ |
|---|
| 4496 | | nread = camel_stream_read (store->ostream, two_bytes, 1); |
|---|
| 4497 | | line [f] = two_bytes [0]; |
|---|
| 4498 | | f++; |
|---|
| 4499 | | } |
|---|
| 4500 | | line[f] = '\0'; |
|---|
| 4501 | | |
|---|
| 4502 | | /* The first line is very unlikely going to consume 1023 bytes */ |
|---|
| 4503 | | if (f > 1023 || nread <= 0) { |
|---|
| 4504 | | //err = TRUE; |
|---|
| 4505 | | //ex_id = CAMEL_EXCEPTION_SERVICE_UNAVAILABLE; |
|---|
| 4506 | | //errmessage = g_strdup_printf ("Read from service failed: Long " |
|---|
| 4507 | | // " first line during binary fetch for uid=%s", uid); |
|---|
| 4508 | | //goto berrorhander; |
|---|
| 4509 | | } |
|---|
| 4510 | | |
|---|
| 4511 | | /* If the line doesn't start with "* " */ |
|---|
| 4512 | | |
|---|
| 4513 | | if (camel_strstrcase (line, "BAD")) { |
|---|
| 4514 | | g_warning ("Read from service failed: Server does not like how " |
|---|
| 4515 | | " we use BINARY (%s)\n", line); |
|---|
| 4516 | | store->capabilities &= ~IMAP_CAPABILITY_BINARY; |
|---|
| 4517 | | //retry = TRUE; |
|---|
| 4518 | | CAMEL_SERVICE_REC_UNLOCK (store, connect_lock); |
|---|
| 4519 | | //goto myretry; |
|---|
| 4520 | | } |
|---|
| 4521 | | |
|---|
| 4522 | | if (*line != '*' || *(line + 1) != ' ') |
|---|
| 4523 | | { |
|---|
| 4524 | | //err = TRUE; |
|---|
| 4525 | | //ex_id = CAMEL_EXCEPTION_SERVICE_UNAVAILABLE; |
|---|
| 4526 | | //errmessage = g_strdup_printf ("Read from service failed: Line doesn't start " |
|---|
| 4527 | | // " with \"* \" for uid=%s (in stead it started with %s)", uid, line); |
|---|
| 4528 | | //goto berrorhander; |
|---|
| 4529 | | } |
|---|
| 4530 | | |
|---|
| 4531 | | pos = strchr (line, '{'); |
|---|
| 4532 | | |
|---|
| 4533 | | /* If we don't find a '{' character */ |
|---|
| 4534 | | if (!pos) { |
|---|
| 4535 | | imap_debug ("unsolicited in BINARY: %s\n", line); |
|---|
| 4536 | | continue; |
|---|
| 4537 | | } |
|---|
| 4538 | | |
|---|
| 4539 | | /* Set the '}' character to \0 */ |
|---|
| 4540 | | ppos = strchr (pos, '}'); |
|---|
| 4541 | | if (ppos) { |
|---|
| 4542 | | *ppos = '\0'; |
|---|
| 4543 | | unsolicited = FALSE; |
|---|
| 4544 | | } |
|---|
| 4545 | | } |
|---|
| 4546 | | |
|---|
| 4547 | | length = strtol (pos + 1, NULL, 10); |
|---|
| 4548 | | |
|---|
| 4549 | | /* If strtol failed (it's important enough to check this) */ |
|---|
| 4550 | | if (errno == ERANGE) |
|---|
| 4551 | | { |
|---|
| 4552 | | //err = TRUE; |
|---|
| 4553 | | //ex_id = CAMEL_EXCEPTION_SERVICE_UNAVAILABLE; |
|---|
| 4554 | | //errmessage = g_strdup_printf ("Read from service failed: " |
|---|
| 4555 | | // "strtol failed for uid=%s (the line was: %s)", uid, line); |
|---|
| 4556 | | //goto berrorhander; |
|---|
| 4557 | | } |
|---|
| 4558 | | |
|---|
| 4559 | | /* Until we have reached the length, read 1024 at the time */ |
|---|
| 4560 | | while (hread > 0 && rec < length) |
|---|
| 4561 | | { |
|---|
| 4562 | | int wread = (length - rec); |
|---|
| 4563 | | if (wread < 1 || wread > 1024) |
|---|
| 4564 | | wread = 1024; |
|---|
| 4565 | | hread = camel_stream_read (store->ostream, t_str, wread); |
|---|
| 4566 | | if (hread > 0) |
|---|
| 4567 | | { |
|---|
| 4568 | | int hu = write (fd, t_str, hread); |
|---|
| 4569 | | /* And write them too */ |
|---|
| 4570 | | if (hu != hread) |
|---|
| | 4509 | two_bytes [0] = ' '; |
|---|
| | 4510 | f = 0; |
|---|
| | 4511 | nread = 1; |
|---|
| | 4512 | |
|---|
| | 4513 | /* a01 uid fetch 1 BINARY.PEEK[] |
|---|
| | 4514 | * * Bla bla |
|---|
| | 4515 | * * 1 FETCH (UID 1 BINARY[] {24693}\r\n |
|---|
| | 4516 | * Subject: Testing.... |
|---|
| | 4517 | * )\r\n |
|---|
| | 4518 | * a01 OK .... \r\n */ |
|---|
| | 4519 | |
|---|
| | 4520 | /* Read the length in the "\*.*[~|]{<LENGTH>}" */ |
|---|
| | 4521 | while (two_bytes[0] != '\n' && f < 1023 && nread > 0) { |
|---|
| | 4522 | nread = camel_stream_read (store->ostream, two_bytes, 1); |
|---|
| | 4523 | line [f] = two_bytes [0]; |
|---|
| | 4524 | f++; |
|---|
| | 4525 | } |
|---|
| | 4526 | |
|---|
| | 4527 | line[f] = '\0'; |
|---|
| | 4528 | |
|---|
| | 4529 | /* The first line is very unlikely going to consume 1023 bytes */ |
|---|
| | 4530 | if (f > 1023 || nread <= 0) { |
|---|
| | 4531 | err = TRUE; |
|---|
| | 4532 | ex_id = CAMEL_EXCEPTION_SERVICE_UNAVAILABLE; |
|---|
| | 4533 | err_message = g_strdup_printf ("Read from service failed: Long " |
|---|
| | 4534 | " first line during binary fetch for uid=%s", uid); |
|---|
| | 4535 | goto fetch_berrorhander; |
|---|
| | 4536 | } |
|---|
| | 4537 | |
|---|
| | 4538 | /* If the line doesn't start with "* " */ |
|---|
| | 4539 | if (camel_strstrcase (line, "BAD")) { |
|---|
| | 4540 | g_warning ("Read from service failed: Server does not like how " |
|---|
| | 4541 | " we use BINARY (%s)\n", line); |
|---|
| | 4542 | store->capabilities &= ~IMAP_CAPABILITY_BINARY; |
|---|
| | 4543 | retry = TRUE; |
|---|
| | 4544 | CAMEL_SERVICE_REC_UNLOCK (store, connect_lock); |
|---|
| | 4545 | goto fetch_retry; |
|---|
| | 4546 | } |
|---|
| | 4547 | |
|---|
| | 4548 | if (*line != '*' || *(line + 1) != ' ') |
|---|
| 4579 | | printf("wrote: %s (%d)\n", t_str, errno); |
|---|
| 4580 | | rec += hread; |
|---|
| 4581 | | camel_operation_progress (NULL, rec, length); |
|---|
| 4582 | | } else { |
|---|
| 4583 | | if (hread != 0) { |
|---|
| 4584 | | //ex_id = CAMEL_EXCEPTION_SERVICE_UNAVAILABLE; |
|---|
| 4585 | | //errmessage = g_strdup_printf ("Read from service failed, UID=%s", uid); |
|---|
| 4586 | | //err = TRUE; |
|---|
| 4587 | | //goto berrorhander; |
|---|
| | 4556 | |
|---|
| | 4557 | pos = strchr (line, '{'); |
|---|
| | 4558 | |
|---|
| | 4559 | /* If we don't find a '{' character */ |
|---|
| | 4560 | if (!pos) { |
|---|
| | 4561 | imap_debug ("unsolicited in BINARY: %s\n", line); |
|---|
| | 4562 | continue; |
|---|
| | 4563 | } |
|---|
| | 4564 | |
|---|
| | 4565 | /* Set the '}' character to \0 */ |
|---|
| | 4566 | ppos = strchr (pos, '}'); |
|---|
| | 4567 | if (ppos) { |
|---|
| | 4568 | *ppos = '\0'; |
|---|
| | 4569 | unsolicited = FALSE; |
|---|
| 4590 | | } |
|---|
| 4591 | | |
|---|
| 4592 | | |
|---|
| 4593 | | /* Read away the last two lines */ |
|---|
| 4594 | | for (f = 0; f < 2; f++) { |
|---|
| 4595 | | nread = 1; two_bytes[0] = 'x'; |
|---|
| 4596 | | while (two_bytes[0] != '\n' && nread > 0) { |
|---|
| 4597 | | nread = camel_stream_read (store->ostream, two_bytes, 1); |
|---|
| 4598 | | printf ("%c", two_bytes[0]); |
|---|
| | 4572 | |
|---|
| | 4573 | length = strtol (pos + 1, NULL, 10); |
|---|
| | 4574 | |
|---|
| | 4575 | /* If strtol failed (it's important enough to check this) */ |
|---|
| | 4576 | if (errno == ERANGE) |
|---|
| | 4577 | { |
|---|
| | 4578 | err = TRUE; |
|---|
| | 4579 | ex_id = CAMEL_EXCEPTION_SERVICE_UNAVAILABLE; |
|---|
| | 4580 | err_message = g_strdup_printf ("Read from service failed: " |
|---|
| | 4581 | "strtol failed for uid=%s (the line was: %s)", uid, line); |
|---|
| | 4582 | goto fetch_berrorhander; |
|---|
| 4600 | | printf("\n"); |
|---|
| 4601 | | } |
|---|
| 4602 | | //berrorhander: |
|---|
| 4603 | | CAMEL_SERVICE_REC_UNLOCK (store, connect_lock); |
|---|
| 4604 | | |
|---|
| 4605 | | //if (err) |
|---|
| 4606 | | //goto errorhander; |
|---|
| 4607 | | } else |
|---|
| 4608 | | { |
|---|
| 4609 | | gboolean err=FALSE; |
|---|
| 4610 | | gchar line [MAX_LINE_LEN]; |
|---|
| 4611 | | guint linenum = 0; |
|---|
| 4612 | | CamelStreamBuffer *server_stream; |
|---|
| 4613 | | gchar *tag; |
|---|
| 4614 | | guint taglen; |
|---|
| 4615 | | gboolean isnextdone = FALSE, hadr = FALSE; |
|---|
| 4616 | | guint tread = 0, exread = 0; |
|---|
| 4617 | | |
|---|
| 4618 | | nread = 0; |
|---|
| 4619 | | |
|---|
| 4620 | | /* |
|---|
| 4621 | | a01 UID FETCH 1:10 BODY.PEEK[0] |
|---|
| 4622 | | * Bla bla |
|---|
| 4623 | | * 1 FETCH (UID 6 BODY[0] {908} |
|---|
| 4624 | | Received: from nic.funet.fi |
|---|
| 4625 | | */ |
|---|
| 4626 | | |
|---|
| 4627 | | /* Stops idle */ |
|---|
| 4628 | | camel_imap_command_start (store, folder, ex, |
|---|
| 4629 | | "UID FETCH %s BODY.PEEK[%s]", uid, spec); |
|---|
| 4630 | | |
|---|
| 4631 | | tag = g_strdup_printf ("%c%.5u", store->tag_prefix, store->command-1); |
|---|
| 4632 | | taglen = strlen (tag); |
|---|
| 4633 | | |
|---|
| 4634 | | server_stream = (CamelStreamBuffer*) store->istream; |
|---|
| 4635 | | |
|---|
| 4636 | | if (!server_stream) { |
|---|
| 4637 | | //err = TRUE; |
|---|
| 4638 | | //ex_id = CAMEL_EXCEPTION_SERVICE_UNAVAILABLE; |
|---|
| 4639 | | //errmessage = g_strdup ("Read from service failed: Service unavailable"); |
|---|
| 4640 | | } else |
|---|
| 4641 | | store->command++; |
|---|
| 4642 | | |
|---|
| 4643 | | if (server_stream) |
|---|
| 4644 | | while ((nread = camel_stream_buffer_gets (server_stream, line, MAX_LINE_LEN) > 0)) |
|---|
| 4645 | | { |
|---|
| 4646 | | gint llen = 0; |
|---|
| 4647 | | |
|---|
| 4648 | | /* It might be the line before the last line |
|---|
| 4649 | | * TNY TODO: why no check for (linenum != 0) then ? */ |
|---|
| 4650 | | |
|---|
| 4651 | | if (line[0] == ')' && (line[1] == '\n' || (line[1] == '\r' && line[2] == '\n'))) |
|---|
| | 4584 | |
|---|
| | 4585 | /* Until we have reached the length, read 1024 at the time */ |
|---|
| | 4586 | while (hread > 0 && rec < length) |
|---|
| 4653 | | if (line[1] == '\r') |
|---|
| 4654 | | hadr = TRUE; |
|---|
| 4655 | | isnextdone = TRUE; |
|---|
| 4656 | | continue; |
|---|
| 4657 | | } |
|---|
| 4658 | | |
|---|
| 4659 | | /* It's the first line (or an unsolicited one) */ |
|---|
| 4660 | | if (linenum == 0 && (line [0] != '*' || line[1] != ' ')) |
|---|
| 4661 | | { |
|---|
| 4662 | | //ex_id = CAMEL_EXCEPTION_SERVICE_UNAVAILABLE; |
|---|
| 4663 | | //errmessage = g_strdup ("Read from service failed: Unexpected result from service"); |
|---|
| 4664 | | //err=TRUE; |
|---|
| 4665 | | break; |
|---|
| 4666 | | } else if (linenum == 0) |
|---|
| 4667 | | { |
|---|
| 4668 | | char *pos, *ppos; |
|---|
| 4669 | | pos = strchr (line, '{'); |
|---|
| 4670 | | if (pos) { |
|---|
| 4671 | | ppos = strchr (pos, '}'); |
|---|
| 4672 | | if (ppos) { |
|---|
| 4673 | | *ppos = '\0'; |
|---|
| 4674 | | exread = strtol (pos + 1, NULL, 10); |
|---|
| | 4588 | int wread = (length - rec); |
|---|
| | 4589 | if (wread < 1 || wread > 1024) |
|---|
| | 4590 | wread = 1024; |
|---|
| | 4591 | hread = camel_stream_read (store->ostream, t_str, wread); |
|---|
| | 4592 | if (hread > 0) |
|---|
| | 4593 | { |
|---|
| | 4594 | /* And write them too */ |
|---|
| | 4595 | if (write (fd, t_str, hread) != hread) |
|---|
| | 4596 | { |
|---|
| | 4597 | err = TRUE; |
|---|
| | 4598 | err_message = g_strdup_printf ("Write to cache failed: %s", g_strerror (errno)); |
|---|
| | 4599 | goto fetch_berrorhander; |
|---|
| 4678 | | imap_debug ("Unsolicited in FETCH: %s\n", line); |
|---|
| 4679 | | } |
|---|
| 4680 | | continue; |
|---|
| 4681 | | } |
|---|
| 4682 | | |
|---|
| 4683 | | /* It's the last line (isnextdone will be ignored if that is the case) */ |
|---|
| 4684 | | if (!strncmp (line, tag, taglen)) |
|---|
| 4685 | | break; |
|---|
| 4686 | | |
|---|
| 4687 | | if (isnextdone) |
|---|
| 4688 | | { |
|---|
| 4689 | | if (hadr) { |
|---|
| 4690 | | if (write (fd, ")\n", 2) != 2) |
|---|
| 4691 | | { |
|---|
| 4692 | | //err = TRUE; |
|---|
| 4693 | | //errmessage = g_strdup_printf ("Write to cache failed: %s", g_strerror (errno)); |
|---|
| 4694 | | break; |
|---|
| 4695 | | } |
|---|
| 4696 | | } else { |
|---|
| 4697 | | if (write (fd, ")\r\n", 3) != 3) |
|---|
| 4698 | | { |
|---|
| 4699 | | //err = TRUE; |
|---|
| 4700 | | //errmessage = g_strdup_printf ("Write to cache failed: %s", g_strerror (errno)); |
|---|
| 4701 | | break; |
|---|
| | 4604 | if (hread != 0) { |
|---|
| | 4605 | err = TRUE; |
|---|
| | 4606 | ex_id = CAMEL_EXCEPTION_SERVICE_UNAVAILABLE; |
|---|
| | 4607 | err_message = g_strdup_printf ("Read from service failed, UID=%s", uid); |
|---|
| | 4608 | goto fetch_berrorhander; |
|---|
| 4709 | | llen = strlen (line); |
|---|
| 4710 | | if (write (fd, line, llen) != llen) |
|---|
| | 4613 | /* Read away the last two lines */ |
|---|
| | 4614 | for (f = 0; f < 2; f++) { |
|---|
| | 4615 | nread = 1; two_bytes[0] = 'x'; |
|---|
| | 4616 | while (two_bytes[0] != '\n' && nread > 0) { |
|---|
| | 4617 | nread = camel_stream_read (store->ostream, two_bytes, 1); |
|---|
| | 4618 | printf ("%c", two_bytes[0]); |
|---|
| | 4619 | } |
|---|
| | 4620 | } |
|---|
| | 4621 | fetch_berrorhander: |
|---|
| | 4622 | CAMEL_SERVICE_REC_UNLOCK (store, connect_lock); |
|---|
| | 4623 | |
|---|
| | 4624 | if (err) |
|---|
| | 4625 | goto fetch_errorhandler; |
|---|
| | 4626 | } else |
|---|
| | 4627 | { |
|---|
| | 4628 | gboolean err=FALSE; |
|---|
| | 4629 | gchar line [MAX_LINE_LEN]; |
|---|
| | 4630 | guint linenum = 0; |
|---|
| | 4631 | CamelStreamBuffer *server_stream; |
|---|
| | 4632 | gchar *tag; |
|---|
| | 4633 | guint taglen; |
|---|
| | 4634 | gboolean isnextdone = FALSE, hadr = FALSE; |
|---|
| | 4635 | guint tread = 0, exread = 0; |
|---|
| | 4636 | |
|---|
| | 4637 | nread = 0; |
|---|
| | 4638 | |
|---|
| | 4639 | /* |
|---|
| | 4640 | a01 UID FETCH 1:10 BODY.PEEK[0] |
|---|
| | 4641 | * Bla bla |
|---|
| | 4642 | * 1 FETCH (UID 6 BODY[0] {908} |
|---|
| | 4643 | Received: from nic.funet.fi |
|---|
| | 4644 | */ |
|---|
| | 4645 | |
|---|
| | 4646 | /* Stops idle */ |
|---|
| | 4647 | camel_imap_command_start (store, folder, ex, |
|---|
| | 4648 | "UID FETCH %s BODY.PEEK[%s]", uid, spec); |
|---|
| | 4649 | |
|---|
| | 4650 | tag = g_strdup_printf ("%c%.5u", store->tag_prefix, store->command-1); |
|---|
| | 4651 | taglen = strlen (tag); |
|---|
| | 4652 | |
|---|
| | 4653 | server_stream = (CamelStreamBuffer*) store->istream; |
|---|
| | 4654 | |
|---|
| | 4655 | if (!server_stream) { |
|---|
| | 4656 | err = TRUE; |
|---|
| | 4657 | ex_id = CAMEL_EXCEPTION_SERVICE_UNAVAILABLE; |
|---|
| | 4658 | err_message = g_strdup ("Read from service failed: Service unavailable"); |
|---|
| | 4659 | } else |
|---|
| | 4660 | store->command++; |
|---|
| | 4661 | |
|---|
| | 4662 | if (server_stream) |
|---|
| 4712 | | //err = TRUE; |
|---|
| 4713 | | //errmessage = g_strdup_printf ("Write to cache failed: %s", g_strerror (errno)); |
|---|
| 4714 | | break; |
|---|
| | 4664 | while ((nread = camel_stream_buffer_gets (server_stream, line, MAX_LINE_LEN) > 0)) |
|---|
| | 4665 | { |
|---|
| | 4666 | gint llen = 0; |
|---|
| | 4667 | |
|---|
| | 4668 | /* It might be the line before the last line |
|---|
| | 4669 | * TNY TODO: why no check for (linenum != 0) then ? */ |
|---|
| | 4670 | |
|---|
| | 4671 | if (line[0] == ')' && (line[1] == '\n' || (line[1] == '\r' && line[2] == '\n'))) |
|---|
| | 4672 | { |
|---|
| | 4673 | if (line[1] == '\r') |
|---|
| | 4674 | hadr = TRUE; |
|---|
| | 4675 | isnextdone = TRUE; |
|---|
| | 4676 | continue; |
|---|
| | 4677 | } |
|---|
| | 4678 | |
|---|
| | 4679 | /* It's the first line (or an unsolicited one) */ |
|---|
| | 4680 | if (linenum == 0 && (line [0] != '*' || line[1] != ' ')) |
|---|
| | 4681 | { |
|---|
| | 4682 | ex_id = CAMEL_EXCEPTION_SERVICE_UNAVAILABLE; |
|---|
| | 4683 | err_message = g_strdup ("Read from service failed: Unexpected result from service"); |
|---|
| | 4684 | err=TRUE; |
|---|
| | 4685 | break; |
|---|
| | 4686 | } else if (linenum == 0) |
|---|
| | 4687 | { |
|---|
| | 4688 | char *pos, *ppos; |
|---|
| | 4689 | pos = strchr (line, '{'); |
|---|
| | 4690 | if (pos) { |
|---|
| | 4691 | ppos = strchr (pos, '}'); |
|---|
| | 4692 | if (ppos) { |
|---|
| | 4693 | *ppos = '\0'; |
|---|
| | 4694 | exread = strtol (pos + 1, NULL, 10); |
|---|
| | 4695 | } |
|---|
| | 4696 | linenum++; |
|---|
| | 4697 | } else { |
|---|
| | 4698 | imap_debug ("Unsolicited in FETCH: %s\n", line); |
|---|
| | 4699 | } |
|---|
| | 4700 | continue; |
|---|
| | 4701 | } |
|---|
| | 4702 | |
|---|
| | 4703 | /* It's the last line (isnextdone will be ignored if that is the case) */ |
|---|
| | 4704 | if (!strncmp (line, tag, taglen)) |
|---|
| | 4705 | break; |
|---|
| | 4706 | |
|---|
| | 4707 | if (isnextdone) |
|---|
| | 4708 | { |
|---|
| | 4709 | if (hadr) { |
|---|
| | 4710 | if (write (fd, ")\n", 2) != 2) |
|---|
| | 4711 | { |
|---|
| | 4712 | err = TRUE; |
|---|
| | 4713 | err_message = g_strdup_printf ("Write to cache failed: %s", g_strerror (errno)); |
|---|
| | 4714 | break; |
|---|
| | 4715 | } |
|---|
| | 4716 | } else { |
|---|
| | 4717 | if (write (fd, ")\r\n", 3) != 3) |
|---|
| | 4718 | { |
|---|
| | 4719 | err = TRUE; |
|---|
| | 4720 | err_message = g_strdup_printf ("Write to cache failed: %s", g_strerror (errno)); |
|---|
| | 4721 | break; |
|---|
| | 4722 | } |
|---|
| | 4723 | } |
|---|
| | 4724 | |
|---|
| | 4725 | hadr = FALSE; |
|---|
| | 4726 | isnextdone = FALSE; |
|---|
| | 4727 | } |
|---|
| | 4728 | |
|---|
| | 4729 | llen = strlen (line); |
|---|
| | 4730 | if (write (fd, line, llen) != llen) { |
|---|
| | 4731 | err = TRUE; |
|---|
| | 4732 | err_message = g_strdup_printf ("Write to cache failed: %s", g_strerror (errno)); |
|---|
| | 4733 | break; |
|---|
| | 4734 | } |
|---|
| | 4735 | |
|---|
| | 4736 | linenum++; |
|---|
| | 4737 | tread += llen; |
|---|
| | 4738 | |
|---|
| | 4739 | camel_operation_progress (NULL, tread, exread); |
|---|
| | 4740 | |
|---|
| | 4741 | memset (line, 0, MAX_LINE_LEN); |
|---|
| | 4742 | } |
|---|