[geary/wip/721441-originator] Some debug and error-checking toward fixing problems
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/721441-originator] Some debug and error-checking toward fixing problems
- Date: Tue, 7 Jan 2014 02:02:02 +0000 (UTC)
commit 902fbfb0d7f314074c4f95a0e8a94f096e326ca0
Author: Jim Nelson <jim yorba org>
Date: Mon Jan 6 18:01:41 2014 -0800
Some debug and error-checking toward fixing problems
.../imap/response/imap-fetch-data-decoder.vala | 13 ++++++++++---
src/engine/rfc822/rfc822-mailbox-address.vala | 10 +++++++++-
src/engine/rfc822/rfc822-mailbox-addresses.vala | 5 +++++
3 files changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/src/engine/imap/response/imap-fetch-data-decoder.vala
b/src/engine/imap/response/imap-fetch-data-decoder.vala
index 5dc1a6f..46650d7 100644
--- a/src/engine/imap/response/imap-fetch-data-decoder.vala
+++ b/src/engine/imap/response/imap-fetch-data-decoder.vala
@@ -155,12 +155,19 @@ public class Geary.Imap.EnvelopeDecoder : Geary.Imap.FetchDataDecoder {
(message_id != null) ? new Geary.RFC822.MessageID(message_id.value) : null);
}
- // TODO: This doesn't handle group lists (see Johnson, p.268) -- this will throw an
- // ImapError.TYPE_ERROR if this occurs.
- private Geary.RFC822.MailboxAddresses? parse_addresses(ListParameter listp) throws ImapError {
+ // TODO: This doesn't handle group lists (see Johnson, p.268 and
+ // http://tools.ietf.org/html/rfc3501#section-7.4.2
+ private Geary.RFC822.MailboxAddresses parse_addresses(ListParameter listp) throws ImapError {
Gee.List<Geary.RFC822.MailboxAddress> list = new Gee.ArrayList<Geary.RFC822.MailboxAddress>();
for (int ctr = 0; ctr < listp.size; ctr++) {
ListParameter fields = listp.get_as_empty_list(ctr);
+
+ // watch for group lists, which are not currently supported
+ if (fields.get_as_nullable_string(3) == null) {
+ debug("Dropping group list \"%s\"", fields.to_string());
+ continue;
+ }
+
StringParameter? name = fields.get_as_nullable_string(0);
StringParameter? source_route = fields.get_as_nullable_string(1);
StringParameter mailbox = fields.get_as_empty_string(2);
diff --git a/src/engine/rfc822/rfc822-mailbox-address.vala b/src/engine/rfc822/rfc822-mailbox-address.vala
index eda4a94..bb411b9 100644
--- a/src/engine/rfc822/rfc822-mailbox-address.vala
+++ b/src/engine/rfc822/rfc822-mailbox-address.vala
@@ -23,6 +23,11 @@ public class Geary.RFC822.MailboxAddress : Geary.MessageData.SearchableMessageDa
if (atsign > 0) {
mailbox = address.slice(0, atsign);
domain = address.slice(atsign + 1, address.length);
+ } else {
+ debug("Bogus name \"%s\" address \"%s\"", name, address);
+ //breakpoint();
+ mailbox = "";
+ domain = "";
}
}
@@ -32,7 +37,10 @@ public class Geary.RFC822.MailboxAddress : Geary.MessageData.SearchableMessageDa
this.mailbox = mailbox;
this.domain = domain;
- address = "%s %s".printf(mailbox, domain);
+ if (!String.is_empty(mailbox) && !String.is_empty(domain))
+ address = "%s %s".printf(mailbox, domain);
+ else
+ debug("Bogus IMAP name mailbox %s domain %s", mailbox, domain);
}
// Borrowed liberally from GMime's internal _internet_address_decode_name() function.
diff --git a/src/engine/rfc822/rfc822-mailbox-addresses.vala b/src/engine/rfc822/rfc822-mailbox-addresses.vala
index 5321ce6..2c04c8a 100644
--- a/src/engine/rfc822/rfc822-mailbox-addresses.vala
+++ b/src/engine/rfc822/rfc822-mailbox-addresses.vala
@@ -33,6 +33,11 @@ public class Geary.RFC822.MailboxAddresses : Geary.MessageData.AbstractMessageDa
if (mbox_addr == null)
continue;
+ if (!mbox_addr.get_addr().contains("@")) {
+ debug("Dropping invalid address \"%s\"", mbox_addr.to_string(false));
+ continue;
+ }
+
addrs.add(new MailboxAddress(mbox_addr.get_name(), mbox_addr.get_addr()));
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]