-
-
Notifications
You must be signed in to change notification settings - Fork 110
feat(backwards-compat): For now, send Chat-Verified header (instead of _verified) again #7349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,9 +61,11 @@ impl fmt::Display for Aheader { | |
| if self.prefer_encrypt == EncryptPreference::Mutual { | ||
| write!(fmt, " prefer-encrypt=mutual;")?; | ||
| } | ||
| if self.verified { | ||
| write!(fmt, " _verified=1;")?; | ||
| } | ||
| // TODO After we reset all existing verifications, | ||
| // we want to start sending the _verified attribute | ||
| // if self.verified { | ||
| // write!(fmt, " _verified=1;")?; | ||
| // } | ||
|
|
||
| // adds a whitespace every 78 characters, this allows | ||
| // email crate to wrap the lines according to RFC 5322 | ||
|
|
@@ -282,8 +284,9 @@ mod tests { | |
| .contains("[email protected]") | ||
| ); | ||
|
|
||
| // We don't send the _verified header yet: | ||
| assert!( | ||
| format!( | ||
| !format!( | ||
| "{}", | ||
| Aheader { | ||
| addr: "[email protected]".to_string(), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1352,6 +1352,43 @@ impl MimeFactory { | |
| let command = msg.param.get_cmd(); | ||
| let mut placeholdertext = None; | ||
|
|
||
| let send_verified_headers = match chat.typ { | ||
| Chattype::Single => true, | ||
| Chattype::Group => true, | ||
| // Mailinglists and broadcast channels can actually never be verified: | ||
| Chattype::Mailinglist => false, | ||
| Chattype::OutBroadcast | Chattype::InBroadcast => false, | ||
| }; | ||
|
|
||
| if send_verified_headers { | ||
| let was_protected: bool = context | ||
| .sql | ||
| .query_get_value("SELECT protected FROM chats WHERE id=?", (chat.id,)) | ||
| .await? | ||
| .unwrap_or_default(); | ||
|
Comment on lines
+1365
to
+1368
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code was also copied from version 2.20.0 |
||
|
|
||
| if was_protected { | ||
| let unverified_member_exists = context | ||
| .sql | ||
| .exists( | ||
| "SELECT COUNT(*) | ||
| FROM contacts, chats_contacts | ||
| WHERE chats_contacts.contact_id=contacts.id AND chats_contacts.chat_id=? | ||
| AND contacts.id>9 | ||
| AND contacts.verifier=0", | ||
|
Comment on lines
+1374
to
+1378
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This SQL statement was largely copied from a SQL statement in stats.rs |
||
| (chat.id,), | ||
| ) | ||
| .await?; | ||
|
|
||
| if !unverified_member_exists { | ||
| headers.push(( | ||
| "Chat-Verified", | ||
| mail_builder::headers::raw::Raw::new("1").into(), | ||
| )); | ||
| } | ||
|
Comment on lines
+1383
to
+1388
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code was also copied from version 2.20.0 |
||
| } | ||
| } | ||
|
|
||
| if chat.typ == Chattype::Group { | ||
| // Send group ID unless it is an ad hoc group that has no ID. | ||
| if !chat.grpid.is_empty() { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code was copied from version 2.20.0