mirror of
https://github.com/chatmail/core.git
synced 2026-04-02 05:22:14 +03:00
Make Aheader::from_imffields accept &str, not const char *
This commit is contained in:
@@ -7,7 +7,6 @@ use mmime::mailimf_types::*;
|
||||
|
||||
use crate::constants::*;
|
||||
use crate::contact::*;
|
||||
use crate::dc_tools::as_str;
|
||||
use crate::key::*;
|
||||
|
||||
/// Possible values for encryption preference
|
||||
@@ -64,11 +63,8 @@ impl Aheader {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_imffields(
|
||||
wanted_from: *const libc::c_char,
|
||||
header: *const mailimf_fields,
|
||||
) -> Option<Self> {
|
||||
if wanted_from.is_null() || header.is_null() {
|
||||
pub fn from_imffields(wanted_from: &str, header: *const mailimf_fields) -> Option<Self> {
|
||||
if header.is_null() {
|
||||
return None;
|
||||
}
|
||||
|
||||
@@ -94,7 +90,7 @@ impl Aheader {
|
||||
|
||||
match Self::from_str(value) {
|
||||
Ok(test) => {
|
||||
if addr_cmp(&test.addr, as_str(wanted_from)) {
|
||||
if addr_cmp(&test.addr, wanted_from) {
|
||||
if fine_header.is_none() {
|
||||
fine_header = Some(test);
|
||||
} else {
|
||||
|
||||
@@ -408,7 +408,8 @@ impl E2eeHelper {
|
||||
}
|
||||
}
|
||||
let mut peerstate = None;
|
||||
let autocryptheader = Aheader::from_imffields(from, imffields);
|
||||
let autocryptheader =
|
||||
as_opt_str(from).and_then(|from| Aheader::from_imffields(from, imffields));
|
||||
if message_time > 0 && !from.is_null() {
|
||||
peerstate = Peerstate::from_addr(context, &context.sql, as_str(from));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user