Skip to content

Commit 8f9eae4

Browse files
committed
Stop including self into To: in every group message
1 parent e5d062c commit 8f9eae4

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/mimefactory.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,15 @@ impl MimeFactory {
259259
}
260260
}
261261

262+
debug_assert!(member_timestamps.len() >= to.len());
263+
264+
if to.len() > 1 {
265+
if let Some(position) = to.iter().position(|(_, x)| x == &from_addr) {
266+
to.remove(position);
267+
member_timestamps.remove(position);
268+
}
269+
}
270+
262271
member_timestamps.extend(past_member_timestamps);
263272
Ok(())
264273
},

src/receive_imf.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2090,6 +2090,16 @@ async fn create_group(
20902090
)?;
20912091
}
20922092

2093+
if !to_ids.contains(&from_id) {
2094+
transaction.execute(
2095+
"INSERT INTO chats_contacts (chat_id, contact_id, add_timestamp)
2096+
VALUES (?1, ?2, ?3)
2097+
ON CONFLICT (chat_id, contact_id)
2098+
DO UPDATE SET add_timestamp=MAX(add_timestamp, ?3)",
2099+
(chat_id, from_id, tools::time()),
2100+
)?;
2101+
}
2102+
20932103
Ok(())
20942104
})
20952105
.await?;

0 commit comments

Comments
 (0)