25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-28 16:34:13 +01:00

Fix some case clauses

This commit is contained in:
Evgeniy Khramtsov 2011-09-05 15:35:46 +10:00
parent 1994c8a174
commit 0da2107974

View File

@ -55,6 +55,8 @@ mech_step(#state{step = 2} = State, ClientIn) ->
case string:tokens(ClientIn, ",") of case string:tokens(ClientIn, ",") of
[CBind, UserNameAttribute, ClientNonceAttribute] when (CBind == "y") or (CBind == "n") -> [CBind, UserNameAttribute, ClientNonceAttribute] when (CBind == "y") or (CBind == "n") ->
case parse_attribute(UserNameAttribute) of case parse_attribute(UserNameAttribute) of
{error, Reason} ->
{error, Reason};
{_, EscapedUserName} -> {_, EscapedUserName} ->
case unescape_username(EscapedUserName) of case unescape_username(EscapedUserName) of
error -> error ->
@ -89,11 +91,7 @@ mech_step(#state{step = 2} = State, ClientIn) ->
_Else -> _Else ->
{error, "not-supported"} {error, "not-supported"}
end end
end; end
{error, Reason} ->
{error, Reason};
_Else ->
{error, "bad-protocol"}
end; end;
_Else -> _Else ->
{error, "bad-protocol"} {error, "bad-protocol"}
@ -145,12 +143,8 @@ parse_attribute(Attribute) ->
true -> true ->
if if
SecondChar == $= -> SecondChar == $= ->
case string:substr(Attribute, 3) of String = string:substr(Attribute, 3),
String when is_list(String) -> {lists:nth(1, Attribute), String};
{lists:nth(1, Attribute), String};
_Else ->
{error, "bad-format failed"}
end;
true -> true ->
{error, "bad-format second char not equal sign"} {error, "bad-format second char not equal sign"}
end; end;