Account for the nested-pair variety of context spec.

This commit is contained in:
Michael Bridgen 2011-05-13 16:23:36 +01:00
parent 8dfc5c4a99
commit e1c34fefc7
1 changed files with 12 additions and 7 deletions

View File

@ -35,14 +35,19 @@ check_contexts(Listeners, Contexts) when
undefined ->
{error, no_default_listener};
_ ->
HasListener = fun(Listener, Acc) ->
case proplists:get_value(Listener, Listeners) of
undefined ->
[Listener | Acc];
_ ->
Acc
end
end,
Checks = lists:foldl(
fun ({_Name, Listener}, Acc) ->
case proplists:get_value(Listener, Listeners) of
undefined ->
[Listener | Acc];
_ ->
Acc
end
fun ({_Name, {Listener, _Path}}, Acc) ->
HasListener(Listener, Acc);
({_Name, Listener}, Acc) ->
HasListener(Listener, Acc)
end, [], Contexts),
case Checks of
[] ->