Fixed a bug causing failure when user strings are empty.
This commit is contained in:
parent
e48aca279d
commit
f185106e08
1 changed files with 9 additions and 7 deletions
16
src/data.rs
16
src/data.rs
|
@ -39,13 +39,15 @@ pub enum AccessLevel {
|
||||||
|
|
||||||
impl AccessLevel {
|
impl AccessLevel {
|
||||||
pub fn from_str(s: &str) -> AccessLevel {
|
pub fn from_str(s: &str) -> AccessLevel {
|
||||||
match s.char_at(0) {
|
if s.len() == 0 { Member } else {
|
||||||
'~' => Owner,
|
match s.char_at(0) {
|
||||||
'&' => Admin,
|
'~' => Owner,
|
||||||
'@' => Oper,
|
'&' => Admin,
|
||||||
'%' => HalfOp,
|
'@' => Oper,
|
||||||
'+' => Voice,
|
'%' => HalfOp,
|
||||||
_ => Member,
|
'+' => Voice,
|
||||||
|
_ => Member,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue