25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Vcard search doesn't support * in mnesia, fix search form (#633)

This commit is contained in:
Badlop 2019-05-17 15:24:18 +02:00
parent 0ed638c7fb
commit 2db547b557

View File

@ -429,18 +429,26 @@ mk_search_form(JID, ServerHost, Lang) ->
Fs = [mk_tfield(Label, Var, Lang) || {Label, Var} <- SearchFields],
X = #xdata{type = form,
title = Title,
instructions =
[translate:translate(
Lang,
<<"Fill in the form to search for any matching "
"Jabber User (Add * to the end of field "
"to match substring)">>)],
instructions = [make_instructions(Mod, Lang)],
fields = Fs},
#search{instructions =
translate:translate(
Lang, <<"You need an x:data capable client to search">>),
xdata = X}.
make_instructions(Mod, Lang) ->
Fill = translate:translate(
Lang,
<<"Fill in the form to search for any matching "
"Jabber User">>),
Add = translate:translate(
Lang,
<<" (Add * to the end of field to match substring)">>),
case Mod of
mod_vcard_mnesia -> Fill;
_ -> str:concat(Fill, Add)
end.
-spec search_result(binary(), jid(), binary(), [xdata_field()]) -> xdata().
search_result(Lang, JID, ServerHost, XFields) ->
Mod = gen_mod:db_mod(ServerHost, ?MODULE),