From 48dcc5180a87d27a81767682bb0af36824aa74bd Mon Sep 17 00:00:00 2001 From: Badlop Date: Wed, 3 Nov 2010 12:43:23 +0100 Subject: [PATCH] Additional fixes for previous captcha commits related to exmpp --- src/ejabberd_captcha.erl | 4 ++-- src/gen_mod.erl | 1 + src/mod_register.erl | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ejabberd_captcha.erl b/src/ejabberd_captcha.erl index c2f92b800..52d2b3ee2 100644 --- a/src/ejabberd_captcha.erl +++ b/src/ejabberd_captcha.erl @@ -265,7 +265,7 @@ create_captcha_x(SID, To, Lang, HeadEls, TailEls) -> value = <<"text-single">> }, #xmlattr{name = 'label', - value = translate:translate(Lang, "CAPTCHA web page") + value = list_to_binary(translate:translate(Lang, "CAPTCHA web page")) }, #xmlattr{name = 'var', value = <<"url">> @@ -525,7 +525,7 @@ process(_Handlers, #request{method='POST', q=Q, lang=Lang, path=[_, Id]}) -> % }]}, #xmlel{name = 'p', children = [ - #xmlcdata{cdata = translate:translate(Lang, "The captcha is valid.")} + #xmlcdata{cdata = list_to_binary(translate:translate(Lang, "The captcha is valid."))} ] }, ejabberd_web:make_xhtml([Form]); diff --git a/src/gen_mod.erl b/src/gen_mod.erl index 08ae0f88d..e3fa13174 100644 --- a/src/gen_mod.erl +++ b/src/gen_mod.erl @@ -48,6 +48,7 @@ -include("ejabberd.hrl"). -record(ejabberd_module, {module_host, opts}). +%% module_host = {Module::atom(), Host::string()} behaviour_info(callbacks) -> [{start, 2}, diff --git a/src/mod_register.erl b/src/mod_register.erl index 2a1598d78..bfc55ad44 100644 --- a/src/mod_register.erl +++ b/src/mod_register.erl @@ -96,7 +96,7 @@ process_iq(From, To, #iq{type = Type, lang = Lang, payload = SubEl, id = ID} = IQ_Rec, Source) -> IsCaptchaEnabled = case gen_mod:get_module_opt( - exmpp_jid:domain(To), ?MODULE, captcha_protected, false) of + exmpp_jid:domain_as_list(To), ?MODULE, captcha_protected, false) of true -> true; _ -> @@ -504,7 +504,7 @@ write_time({{Y,Mo,D},{H,Mi,S}}) -> [Y, Mo, D, H, Mi, S]). process_xdata_submit(El) -> - case xml:get_subtag(El, "x") of + case exmpp_xml:get_element(El, x) of false -> error; Xdata -> @@ -519,7 +519,7 @@ process_xdata_submit(El) -> end. is_strong_password(Server, Password) -> - LServer = jlib:nameprep(Server), + LServer = exmpp_stringprep:nameprep(Server), case gen_mod:get_module_opt(LServer, ?MODULE, password_strength, 0) of Entropy when is_number(Entropy), Entropy >= 0 -> if Entropy == 0 ->