mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-12 15:57:31 +01:00
Work also with some unicode strings in PgSQL (EJAB-1490)
This commit is contained in:
parent
7d623d5eb4
commit
112a18f966
@ -219,17 +219,17 @@ set_vcard(User, LServer, VCARD) ->
|
||||
end,
|
||||
|
||||
LUser = jlib:nodeprep(User),
|
||||
LFN = string:to_lower(FN),
|
||||
LFamily = string:to_lower(Family),
|
||||
LGiven = string:to_lower(Given),
|
||||
LMiddle = string:to_lower(Middle),
|
||||
LNickname = string:to_lower(Nickname),
|
||||
LBDay = string:to_lower(BDay),
|
||||
LCTRY = string:to_lower(CTRY),
|
||||
LLocality = string:to_lower(Locality),
|
||||
LEMail = string:to_lower(EMail),
|
||||
LOrgName = string:to_lower(OrgName),
|
||||
LOrgUnit = string:to_lower(OrgUnit),
|
||||
LFN = string2lower(FN),
|
||||
LFamily = string2lower(Family),
|
||||
LGiven = string2lower(Given),
|
||||
LMiddle = string2lower(Middle),
|
||||
LNickname = string2lower(Nickname),
|
||||
LBDay = string2lower(BDay),
|
||||
LCTRY = string2lower(CTRY),
|
||||
LLocality = string2lower(Locality),
|
||||
LEMail = string2lower(EMail),
|
||||
LOrgName = string2lower(OrgName),
|
||||
LOrgUnit = string2lower(OrgUnit),
|
||||
|
||||
US = {LUser, LServer},
|
||||
|
||||
@ -271,6 +271,12 @@ set_vcard(User, LServer, VCARD) ->
|
||||
ejabberd_hooks:run(vcard_set, LServer, [LUser, LServer, VCARD])
|
||||
end.
|
||||
|
||||
string2lower(String) ->
|
||||
case stringprep:tolower(String) of
|
||||
Lower when is_list(Lower) -> Lower;
|
||||
error -> string:to_lower(String)
|
||||
end.
|
||||
|
||||
-define(TLFIELD(Type, Label, Var),
|
||||
{xmlelement, "field", [{"type", Type},
|
||||
{"label", translate:translate(Lang, Label)},
|
||||
@ -541,7 +547,7 @@ filter_fields([], Match, _LServer) ->
|
||||
Match;
|
||||
filter_fields([{SVar, [Val]} | Ds], Match, LServer)
|
||||
when is_list(Val) and (Val /= "") ->
|
||||
LVal = string:to_lower(Val),
|
||||
LVal = string2lower(Val),
|
||||
NewMatch = case SVar of
|
||||
"user" ->
|
||||
case gen_mod:get_module_opt(LServer, ?MODULE,
|
||||
@ -618,17 +624,17 @@ set_vcard_t(R, _) ->
|
||||
OrgUnit = xml:get_path_s(VCARD, [{elem, "ORG"}, {elem, "ORGUNIT"}, cdata]),
|
||||
|
||||
{LUser, _LServer} = US,
|
||||
LFN = string:to_lower(FN),
|
||||
LFamily = string:to_lower(Family),
|
||||
LGiven = string:to_lower(Given),
|
||||
LMiddle = string:to_lower(Middle),
|
||||
LNickname = string:to_lower(Nickname),
|
||||
LBDay = string:to_lower(BDay),
|
||||
LCTRY = string:to_lower(CTRY),
|
||||
LLocality = string:to_lower(Locality),
|
||||
LEMail = string:to_lower(EMail),
|
||||
LOrgName = string:to_lower(OrgName),
|
||||
LOrgUnit = string:to_lower(OrgUnit),
|
||||
LFN = string2lower(FN),
|
||||
LFamily = string2lower(Family),
|
||||
LGiven = string2lower(Given),
|
||||
LMiddle = string2lower(Middle),
|
||||
LNickname = string2lower(Nickname),
|
||||
LBDay = string2lower(BDay),
|
||||
LCTRY = string2lower(CTRY),
|
||||
LLocality = string2lower(Locality),
|
||||
LEMail = string2lower(EMail),
|
||||
LOrgName = string2lower(OrgName),
|
||||
LOrgUnit = string2lower(OrgUnit),
|
||||
|
||||
if
|
||||
(LUser == error) or
|
||||
|
@ -186,17 +186,17 @@ set_vcard(User, LServer, VCARD) ->
|
||||
end,
|
||||
|
||||
LUser = jlib:nodeprep(User),
|
||||
LFN = string:to_lower(FN),
|
||||
LFamily = string:to_lower(Family),
|
||||
LGiven = string:to_lower(Given),
|
||||
LMiddle = string:to_lower(Middle),
|
||||
LNickname = string:to_lower(Nickname),
|
||||
LBDay = string:to_lower(BDay),
|
||||
LCTRY = string:to_lower(CTRY),
|
||||
LLocality = string:to_lower(Locality),
|
||||
LEMail = string:to_lower(EMail),
|
||||
LOrgName = string:to_lower(OrgName),
|
||||
LOrgUnit = string:to_lower(OrgUnit),
|
||||
LFN = string2lower(FN),
|
||||
LFamily = string2lower(Family),
|
||||
LGiven = string2lower(Given),
|
||||
LMiddle = string2lower(Middle),
|
||||
LNickname = string2lower(Nickname),
|
||||
LBDay = string2lower(BDay),
|
||||
LCTRY = string2lower(CTRY),
|
||||
LLocality = string2lower(Locality),
|
||||
LEMail = string2lower(EMail),
|
||||
LOrgName = string2lower(OrgName),
|
||||
LOrgUnit = string2lower(OrgUnit),
|
||||
|
||||
if
|
||||
(LUser == error) or
|
||||
@ -252,6 +252,12 @@ set_vcard(User, LServer, VCARD) ->
|
||||
ejabberd_hooks:run(vcard_set, LServer, [LUser, LServer, VCARD])
|
||||
end.
|
||||
|
||||
string2lower(String) ->
|
||||
case stringprep:tolower(String) of
|
||||
Lower when is_list(Lower) -> Lower;
|
||||
error -> string:to_lower(String)
|
||||
end.
|
||||
|
||||
-define(TLFIELD(Type, Label, Var),
|
||||
{xmlelement, "field", [{"type", Type},
|
||||
{"label", translate:translate(Lang, Label)},
|
||||
@ -531,7 +537,7 @@ filter_fields([], Match, _LServer) ->
|
||||
end;
|
||||
filter_fields([{SVar, [Val]} | Ds], Match, LServer)
|
||||
when is_list(Val) and (Val /= "") ->
|
||||
LVal = string:to_lower(Val),
|
||||
LVal = string2lower(Val),
|
||||
NewMatch = case SVar of
|
||||
"user" -> make_val(Match, "lusername", LVal);
|
||||
"fn" -> make_val(Match, "lfn", LVal);
|
||||
|
Loading…
Reference in New Issue
Block a user