From 2db547b55724463522589e80d618d00cb034eff1 Mon Sep 17 00:00:00 2001 From: Badlop Date: Fri, 17 May 2019 15:24:18 +0200 Subject: [PATCH 1/3] Vcard search doesn't support * in mnesia, fix search form (#633) --- src/mod_vcard.erl | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/mod_vcard.erl b/src/mod_vcard.erl index 5caecae50..6b6f5f7d5 100644 --- a/src/mod_vcard.erl +++ b/src/mod_vcard.erl @@ -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), From 937f07a4cc54e3fbe5c97a5734025067ccb3b06c Mon Sep 17 00:00:00 2001 From: Badlop Date: Fri, 17 May 2019 15:37:34 +0200 Subject: [PATCH 2/3] Fix typo in Change User Password adhoc command (thanks to lovetox)(#2884) --- src/mod_configure.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod_configure.erl b/src/mod_configure.erl index aa431e285..36ea75141 100644 --- a/src/mod_configure.erl +++ b/src/mod_configure.erl @@ -1161,7 +1161,7 @@ get_form(_Host, ?NS_ADMINL(<<"get-user-password">>), get_form(_Host, ?NS_ADMINL(<<"change-user-password">>), Lang) -> {result, - #xdata{title = ?T(Lang, <<"Get User Password">>), + #xdata{title = ?T(Lang, <<"Change User Password">>), type = form, fields = [?HFIELD(), #xdata_field{type = 'jid-single', From 63e9b82a46cd944e0969d5662e0d44190c0df180 Mon Sep 17 00:00:00 2001 From: Alexey Shchepin Date: Sat, 18 May 2019 21:16:33 +0300 Subject: [PATCH 3/3] Fix PostgreSQL compatibility in mod_offline_sql:remove_old_messages (#2695) --- src/mod_offline_sql.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod_offline_sql.erl b/src/mod_offline_sql.erl index cb0efa51e..972316954 100644 --- a/src/mod_offline_sql.erl +++ b/src/mod_offline_sql.erl @@ -94,7 +94,7 @@ remove_old_messages(Days, LServer) -> ejabberd_sql:sql_query_t( ?SQL("DELETE FROM spool" " WHERE created_at <" - " NOW() - INTERVAL '%(Days)d DAY'")); + " NOW() - %(Days)d * INTERVAL '1 DAY'")); (_, _) -> ejabberd_sql:sql_query_t( ?SQL("DELETE FROM spool"