@@ -72,6 +72,13 @@ pub struct MimeFactory {
72
72
/// Vector of pairs of past group member name and addresses.
73
73
past_members : Vec < ( String , String ) > ,
74
74
75
+ /// Timestamps of the members in the same order as in the `recipients`
76
+ /// followed by `past_members`.
77
+ ///
78
+ /// If this is not empty, its length
79
+ /// should be the sum of `recipients` and `past_members` length.
80
+ member_timestamps : Vec < i64 > ,
81
+
75
82
timestamp : i64 ,
76
83
loaded : Loaded ,
77
84
in_reply_to : String ,
@@ -150,6 +157,7 @@ impl MimeFactory {
150
157
151
158
let mut recipients = Vec :: with_capacity ( 5 ) ;
152
159
let mut past_members = Vec :: new ( ) ;
160
+ let mut member_timestamps = Vec :: new ( ) ;
153
161
let mut recipient_ids = HashSet :: new ( ) ;
154
162
let mut req_mdn = false ;
155
163
@@ -190,20 +198,23 @@ impl MimeFactory {
190
198
if add_timestamp >= remove_timestamp {
191
199
if !recipients_contain_addr ( & recipients, & addr) {
192
200
recipients. push ( ( name, addr) ) ;
201
+ member_timestamps. push ( add_timestamp) ;
193
202
}
194
203
recipient_ids. insert ( id) ;
195
204
} else {
196
205
// Row is a tombstone,
197
206
// member is not actually part of the group.
198
207
if !recipients_contain_addr ( & past_members, & addr) {
199
208
past_members. push ( ( name, addr) ) ;
209
+ member_timestamps. push ( remove_timestamp) ;
200
210
}
201
211
}
202
212
}
203
213
Ok ( ( ) )
204
214
} ,
205
215
)
206
216
. await ?;
217
+
207
218
let recipient_ids: Vec < _ > = recipient_ids. into_iter ( ) . collect ( ) ;
208
219
ContactId :: scaleup_origin ( context, & recipient_ids, Origin :: OutgoingTo ) . await ?;
209
220
@@ -240,13 +251,18 @@ impl MimeFactory {
240
251
} ;
241
252
let attach_selfavatar = Self :: should_attach_selfavatar ( context, & msg) . await ;
242
253
254
+ debug_assert ! (
255
+ member_timestamps. is_empty( )
256
+ || recipients. len( ) + past_members. len( ) == member_timestamps. len( )
257
+ ) ;
243
258
let factory = MimeFactory {
244
259
from_addr,
245
260
from_displayname,
246
261
sender_displayname,
247
262
selfstatus,
248
263
recipients,
249
264
past_members,
265
+ member_timestamps,
250
266
timestamp : msg. timestamp_sort ,
251
267
loaded : Loaded :: Message { msg, chat } ,
252
268
in_reply_to,
@@ -276,6 +292,7 @@ impl MimeFactory {
276
292
selfstatus : "" . to_string ( ) ,
277
293
recipients : vec ! [ ( "" . to_string( ) , contact. get_addr( ) . to_string( ) ) ] ,
278
294
past_members : vec ! [ ] ,
295
+ member_timestamps : vec ! [ ] ,
279
296
timestamp,
280
297
loaded : Loaded :: Mdn {
281
298
rfc724_mid,
@@ -569,6 +586,10 @@ impl MimeFactory {
569
586
) ;
570
587
}
571
588
589
+ if !self . member_timestamps . is_empty ( ) {
590
+ // TODO send `Chat-Member-Timestamps`.
591
+ }
592
+
572
593
let subject_str = self . subject_str ( context) . await ?;
573
594
let encoded_subject = if subject_str
574
595
. chars ( )
0 commit comments