[geary/mjog/composer-context-loading-fixes: 7/14] Geary.RFC822.MessageIDList: Update append methods.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/composer-context-loading-fixes: 7/14] Geary.RFC822.MessageIDList: Update append methods.
- Date: Thu, 13 Aug 2020 01:42:21 +0000 (UTC)
commit e35decb9e6e6455cc8941d784b74cd9f7efe66a6
Author: Michael Gratton <mike vee net>
Date: Wed Aug 12 15:51:32 2020 +1000
Geary.RFC822.MessageIDList: Update append methods.
Add new method for appending a single id, rename existing to
disambiguate. Increase doc comment coverage.
src/engine/rfc822/rfc822-message-data.vala | 16 +++++++++++++---
src/engine/rfc822/rfc822-message.vala | 2 +-
2 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/src/engine/rfc822/rfc822-message-data.vala b/src/engine/rfc822/rfc822-message-data.vala
index 0c13ef5fd..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();
@@ -203,7 +213,7 @@ public class Geary.RFC822.MessageIDList :
/**
* Returns a new list with the given list appended to this.
*/
- public MessageIDList append_id(MessageID other) {
+ public MessageIDList concatenate_id(MessageID other) {
var new_ids = new MessageIDList(this.list);
new_ids.list.add(other);
return new_ids;
@@ -212,7 +222,7 @@ public class Geary.RFC822.MessageIDList :
/**
* Returns a new list with the given list appended to this.
*/
- public MessageIDList append_list(MessageIDList others) {
+ 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 de33bafe5..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_list(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]