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:
+16
@@ -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())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user