24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-07-14 23:44:18 +02:00

Fix try/catch branch

This commit is contained in:
Evgeniy Khramtsov 2011-07-28 16:04:02 +10:00
parent cb41c8ef80
commit a06b627631

View File

@ -717,23 +717,25 @@ attrs_to_body_attrs(Attrs) ->
fun(_, {error, Reason}) -> fun(_, {error, Reason}) ->
{error, Reason}; {error, Reason};
({Attr, Val}, Acc) -> ({Attr, Val}, Acc) ->
try Attr of try
"ver" -> [{ver, Val}|Acc]; case Attr of
"xmpp:version" -> [{'xmpp:version', Val}|Acc]; "ver" -> [{ver, Val}|Acc];
"type" -> [{type, Val}|Acc]; "xmpp:version" -> [{'xmpp:version', Val}|Acc];
"key" -> [{key, Val}|Acc]; "type" -> [{type, Val}|Acc];
"newkey" -> [{newkey, Val}|Acc]; "key" -> [{key, Val}|Acc];
"xmlns" -> Val = ?NS_HTTP_BIND, Acc; "newkey" -> [{newkey, Val}|Acc];
"secure" -> [{secure, to_bool(Val)}|Acc]; "xmlns" -> Val = ?NS_HTTP_BIND, Acc;
"xmpp:restart" -> [{'xmpp:restart', to_bool(Val)}|Acc]; "secure" -> [{secure, to_bool(Val)}|Acc];
"to" -> [{to, [_|_] = jlib:nameprep(Val)}|Acc]; "xmpp:restart" -> [{'xmpp:restart', to_bool(Val)}|Acc];
"wait" -> [{wait, to_int(Val, 0)}|Acc]; "to" -> [{to, [_|_] = jlib:nameprep(Val)}|Acc];
"ack" -> [{ack, to_int(Val, 0)}|Acc]; "wait" -> [{wait, to_int(Val, 0)}|Acc];
"sid" -> [{sid, Val}|Acc]; "ack" -> [{ack, to_int(Val, 0)}|Acc];
"hold" -> [{hold, to_int(Val, 0)}|Acc]; "sid" -> [{sid, Val}|Acc];
"rid" -> [{rid, to_int(Val, 0)}|Acc]; "hold" -> [{hold, to_int(Val, 0)}|Acc];
"pause" -> [{pause, to_int(Val, 0)}|Acc]; "rid" -> [{rid, to_int(Val, 0)}|Acc];
_ -> [{Attr, Val}|Acc] "pause" -> [{pause, to_int(Val, 0)}|Acc];
_ -> [{Attr, Val}|Acc]
end
catch _:_ -> catch _:_ ->
{error, "Invalid \"" ++ Attr ++ "\" attribute"} {error, "Invalid \"" ++ Attr ++ "\" attribute"}
end end