Skip to content

Commit

Permalink
melib: add get_tags to support subaddressing
Browse files Browse the repository at this point in the history
  • Loading branch information
epilys committed Sep 20, 2019
1 parent bee1502 commit f066f35
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions melib/src/email/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@ impl Address {
Address::Group(_) => None,
}
}

pub fn get_tags(&self, separator: char) -> Vec<String> {
let mut ret = Vec::new();
if let email = self.get_email() {
let at_pos = email.as_bytes().iter().position(|&b| b == b'@').unwrap();
let email: &str = email[..at_pos].into();
ret.extend(email.split(separator).skip(1).map(str::to_string));
}
ret
}
}

impl Eq for Address {}
Expand Down

0 comments on commit f066f35

Please sign in to comment.