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},
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)},
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,
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
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
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)},
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);