Add introducer add command

- Create a command to add an introducer (with domains).
- Add a module for escaping regular expressions used in certifications
- Add some helper functions.
This commit is contained in:
Malte Meiboom
2026-05-04 22:55:02 +02:00
parent 5f50624478
commit bf53af50ec
9 changed files with 213 additions and 8 deletions
+16
View File
@@ -20,3 +20,19 @@ pub fn to_email(rcpt: &CString) -> Option<String> {
else { None }
} else { None }
}
/// Checks if the parameter has a valid email format.
pub fn is_email(email: &str) -> bool {
let uid = UserID::from(email);
if let Ok(Some(e)) = uid.email() {
e == email
} else {
false
}
}
/// Checks if the parameter has a valid domain format.
pub fn is_domain(domain: &str) -> bool {
is_email(format!("test@{}", domain).as_str())
}