diff options
Diffstat (limited to 'src/mod_vcard.erl')
-rw-r--r-- | src/mod_vcard.erl | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/mod_vcard.erl b/src/mod_vcard.erl index 70e54cafb..8cf82184b 100644 --- a/src/mod_vcard.erl +++ b/src/mod_vcard.erl @@ -22,6 +22,8 @@ -include("jlib.hrl"). +%-define(JUD_ALLOW_RETURN_ALL, true) + -record(vcard_search, {user, luser, fn, lfn, family, lfamily, @@ -386,6 +388,7 @@ record_to_item(R) -> ] }. +-ifdef(JUD_ALLOW_RETURN_ALL). search(Data) -> MatchSpec = make_matchspec(Data), @@ -397,6 +400,27 @@ search(Data) -> Rs end. +-else. + +search(Data) -> + MatchSpec = make_matchspec(Data), + if + MatchSpec == #vcard_search{_ = '_'} -> + []; + true -> + case catch mnesia:dirty_select(vcard_search, + [{MatchSpec, [], ['$_']}]) of + {'EXIT', Reason} -> + ?ERROR_MSG("~p", [Reason]), + []; + Rs -> + Rs + end + end. + +-endif. + + % TODO: remove % F = fun() -> % mnesia:select(vcard_search, [{MatchSpec, [], ['$_']}]) |