[geary/mjog/composer-context-loading-fixes: 11/19] Geary.RFC822.MessageIDList: Replace append with concatenate
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/composer-context-loading-fixes: 11/19] Geary.RFC822.MessageIDList: Replace append with concatenate
- Date: Thu, 13 Aug 2020 09:52:25 +0000 (UTC)
commit c41515a2c7dc32bcee68948c3fa2a9b99fb3724f
Author: Michael Gratton <mike vee net>
Date: Wed Aug 12 10:10:20 2020 +1000
Geary.RFC822.MessageIDList: Replace append with concatenate
Add new method for appending a single id, rename to `concatenate` to
disambiguate.
src/engine/rfc822/rfc822-message-data.vala | 27 +++++++++++++++++++++++----
src/engine/rfc822/rfc822-message.vala | 2 +-
2 files changed, 24 insertions(+), 5 deletions(-)
---
diff --git a/src/engine/rfc822/rfc822-message-data.vala b/src/engine/rfc822/rfc822-message-data.vala
index ee06727ae..09aa1d4ed 100644
--- a/src/engine/rfc822/rfc822-message-data.vala
+++ b/src/engine/rfc822/rfc822-message-data.vala
@@ -67,6 +67,7 @@ public class Geary.RFC822.MessageID :
}
+
/**
* A immutable list of RFC822 Message-ID values.
*/
@@ -88,17 +89,26 @@ public class Geary.RFC822.MessageIDList :
private Gee.List<MessageID> list = new Gee.ArrayList<MessageID>();
+ /**
+ * Constructs a new Message-Id list.
+ *
+ * If the optional collection of ids is not given, the list
+ * is created empty. Otherwise the collection's ids are
+ * added to the list by iterating over it in natural order.
+ */
public MessageIDList(Gee.Collection<MessageID>? collection = null) {
if (collection != null) {
this.list.add_all(collection);
}
}
- public MessageIDList.single(MessageID msg_id) {
+ /** Constructs a new Message-Id list containing a single id. */
+ public MessageIDList.single(MessageID msg_id){
this();
list.add(msg_id);
}
+ /** Constructs a new Message-Id list by parsing a RFC822 string. */
public MessageIDList.from_rfc822_string(string rfc822)
throws Error {
this();
@@ -201,10 +211,19 @@ public class Geary.RFC822.MessageIDList :
}
/**
- * Returns a new list with the given messages ids appended to this list's.
+ * Returns a new list with the given list appended to this.
+ */
+ public MessageIDList concatenate_id(MessageID other) {
+ var new_ids = new MessageIDList(this.list);
+ new_ids.list.add(other);
+ return new_ids;
+ }
+
+ /**
+ * Returns a new list with the given list appended to this.
*/
- public MessageIDList append(MessageIDList others) {
- MessageIDList new_ids = new MessageIDList(this.list);
+ public MessageIDList concatenate_list(MessageIDList others) {
+ var new_ids = new MessageIDList(this.list);
new_ids.list.add_all(others.list);
return new_ids;
}
diff --git a/src/engine/rfc822/rfc822-message.vala b/src/engine/rfc822/rfc822-message.vala
index e995f430b..4459180c2 100644
--- a/src/engine/rfc822/rfc822-message.vala
+++ b/src/engine/rfc822/rfc822-message.vala
@@ -960,7 +960,7 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
try {
ids = new MessageIDList.from_rfc822_string(header_value);
if (existing != null) {
- ids = existing.append(ids);
+ ids = existing.concatenate_list(ids);
}
} catch (Error err) {
// Can't simply throw this since we need to be as lax as
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]