remove extraneous text option in sasl_error

This commit is contained in:
Emmanuel Gil Peyrot 2017-04-01 14:37:43 +01:00
parent f8c76ac1e8
commit 6c15618df7

View file

@ -5,7 +5,7 @@ use util::FromElement;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum Condition { pub enum Condition {
Aborted, Aborted,
AccountDisabled(Option<String>), AccountDisabled,
CredentialsExpired, CredentialsExpired,
EncryptionRequired, EncryptionRequired,
IncorrectEncoding, IncorrectEncoding,
@ -42,9 +42,8 @@ impl FromElement for SaslError {
if element.has_child("aborted", ns::SASL) { if element.has_child("aborted", ns::SASL) {
err.condition = Condition::Aborted; err.condition = Condition::Aborted;
} }
else if let Some(account_disabled) = element.get_child("account-disabled", ns::SASL) { else if element.has_child("account-disabled", ns::SASL) {
let text = account_disabled.text(); err.condition = Condition::AccountDisabled;
err.condition = Condition::AccountDisabled(if text == "" { None } else { Some(text) });
} }
else if element.has_child("credentials-expired", ns::SASL) { else if element.has_child("credentials-expired", ns::SASL) {
err.condition = Condition::CredentialsExpired; err.condition = Condition::CredentialsExpired;