Split off functional contact tools into its own crate (#5444)

I would like to implement
https://github.com/deltachat/deltachat-core-rust/issues/5422 in its own
crate, but it will depend on some functions that are in the `deltachat`
crate.

So, this PR extracts these functions into its own crate so that I can
add https://github.com/deltachat/deltachat-core-rust/issues/5422 into
the new crate.
This commit is contained in:
Hocuri
2024-04-16 19:01:25 +02:00
committed by GitHub
parent 6ca6a439bd
commit 5d34b225b7
28 changed files with 381 additions and 290 deletions

View File

@@ -1,13 +1,15 @@
use std::collections::HashMap;
use anyhow::{bail, Context as _, Result};
use deltachat_contact_tools::may_be_valid_addr;
use num_traits::cast::ToPrimitive;
use super::{Qr, DCLOGIN_SCHEME};
use crate::config::Config;
use crate::context::Context;
use crate::login_param::CertificateChecks;
use crate::provider::Socket;
use crate::{contact, login_param::CertificateChecks};
/// Options for `dclogin:` scheme.
#[derive(Debug, Clone, PartialEq, Eq)]
@@ -88,7 +90,7 @@ pub(super) fn decode_login(qr: &str) -> Result<Qr> {
.collect();
// check if username is there
if !contact::may_be_valid_addr(addr) {
if !may_be_valid_addr(addr) {
bail!("invalid DCLOGIN payload: invalid username E5");
}