Skip to content

Commit 2369161

Browse files
committed
Add MimeFactory.past_members field
1 parent c5af9db commit 2369161

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/mimefactory.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ pub struct MimeFactory {
6969
/// Vector of pairs of recipient name and address
7070
recipients: Vec<(String, String)>,
7171

72+
/// Vector of pairs of past group member name and addresses.
73+
past_members: Vec<(String, String)>,
74+
7275
timestamp: i64,
7376
loaded: Loaded,
7477
in_reply_to: String,
@@ -146,6 +149,7 @@ impl MimeFactory {
146149
};
147150

148151
let mut recipients = Vec::with_capacity(5);
152+
let mut past_members = Vec::new();
149153
let mut recipient_ids = HashSet::new();
150154
let mut req_mdn = false;
151155

@@ -179,18 +183,21 @@ impl MimeFactory {
179183
|rows| {
180184
for row in rows {
181185
let (authname, addr, id, add_timestamp, remove_timestamp) = row?;
186+
let name = match attach_profile_data {
187+
true => authname,
188+
false => "".to_string(),
189+
};
182190
if add_timestamp >= remove_timestamp {
183191
if !recipients_contain_addr(&recipients, &addr) {
184-
let name = match attach_profile_data {
185-
true => authname,
186-
false => "".to_string(),
187-
};
188192
recipients.push((name, addr));
189193
}
190194
recipient_ids.insert(id);
191195
} else {
192196
// Row is a tombstone,
193197
// member is not actually part of the group.
198+
if !recipients_contain_addr(&past_members, &addr) {
199+
past_members.push((name, addr));
200+
}
194201
}
195202
}
196203
Ok(())
@@ -239,6 +246,7 @@ impl MimeFactory {
239246
sender_displayname,
240247
selfstatus,
241248
recipients,
249+
past_members,
242250
timestamp: msg.timestamp_sort,
243251
loaded: Loaded::Message { msg, chat },
244252
in_reply_to,
@@ -267,6 +275,7 @@ impl MimeFactory {
267275
sender_displayname: None,
268276
selfstatus: "".to_string(),
269277
recipients: vec![("".to_string(), contact.get_addr().to_string())],
278+
past_members: vec![],
270279
timestamp,
271280
loaded: Loaded::Mdn {
272281
rfc724_mid,

0 commit comments

Comments
 (0)