summaryrefslogtreecommitdiff
path: root/src/ejabberd_captcha.erl
diff options
context:
space:
mode:
authorChristophe Romain <christophe.romain@process-one.net>2015-10-07 00:06:58 +0200
committerChristophe Romain <christophe.romain@process-one.net>2015-10-07 14:18:38 +0200
commit6aeb9dcb38921249cdfe453baeadcd03298d5d6e (patch)
treedf5559ad1f52ec9ed536c8399fd5bde714985059 /src/ejabberd_captcha.erl
parentRemove unused dependency (diff)
cosmetic cleanup
Diffstat (limited to 'src/ejabberd_captcha.erl')
-rw-r--r--src/ejabberd_captcha.erl42
1 files changed, 4 insertions, 38 deletions
diff --git a/src/ejabberd_captcha.erl b/src/ejabberd_captcha.erl
index 8a1de2ed..8815c436 100644
--- a/src/ejabberd_captcha.erl
+++ b/src/ejabberd_captcha.erl
@@ -75,13 +75,6 @@
tref :: reference(),
args :: any()}).
-%%====================================================================
-%% API
-%%====================================================================
-%%--------------------------------------------------------------------
-%% Function: start_link() -> {ok,Pid} | ignore | {error,Error}
-%% Description: Starts the server
-%%--------------------------------------------------------------------
start_link() ->
gen_server:start_link({local, ?MODULE}, ?MODULE, [],
[]).
@@ -276,12 +269,6 @@ create_captcha_x(SID, To, Lang, Limiter, HeadEls,
Err -> Err
end.
-%% @spec (Id::string(), Lang::string()) -> {FormEl, {ImgEl, TextEl, IdEl, KeyEl}} | captcha_not_found
-%% where FormEl = xmlelement()
-%% ImgEl = xmlelement()
-%% TextEl = xmlelement()
-%% IdEl = xmlelement()
-%% KeyEl = xmlelement()
-spec build_captcha_html(binary(), binary()) -> captcha_not_found |
{xmlel(),
{xmlel(), xmlel(),
@@ -330,12 +317,6 @@ build_captcha_html(Id, Lang) ->
_ -> captcha_not_found
end.
-%% @spec (Id::string(), ProvidedKey::string()) -> captcha_valid | captcha_non_valid | captcha_not_found
--spec check_captcha(binary(), binary()) -> captcha_not_found |
- captcha_valid |
- captcha_non_valid.
-
-
-spec process_reply(xmlel()) -> ok | {error, bad_match | not_found | malformed}.
process_reply(#xmlel{} = El) ->
@@ -405,9 +386,6 @@ process(_Handlers,
process(_Handlers, _Request) ->
ejabberd_web:error(not_found).
-%%====================================================================
-%% gen_server callbacks
-%%====================================================================
init([]) ->
mnesia:delete_table(captcha),
ets:new(captcha,
@@ -454,16 +432,6 @@ terminate(_Reason, _State) -> ok.
code_change(_OldVsn, State, _Extra) -> {ok, State}.
-%%--------------------------------------------------------------------
-%%% Internal functions
-%%--------------------------------------------------------------------
-%%--------------------------------------------------------------------
-%% Function: create_image() -> {ok, Type, Key, Image} | {error, Reason}
-%% Type = "image/png" | "image/jpeg" | "image/gif"
-%% Key = string()
-%% Image = binary()
-%% Reason = atom()
-%%--------------------------------------------------------------------
create_image() -> create_image(undefined).
create_image(Limiter) ->
@@ -596,12 +564,6 @@ is_limited(Limiter) ->
end
end.
-%%--------------------------------------------------------------------
-%% Function: cmd(Cmd) -> Data | {error, Reason}
-%% Cmd = string()
-%% Data = binary()
-%% Description: os:cmd/1 replacement
-%%--------------------------------------------------------------------
-define(CMD_TIMEOUT, 5000).
-define(MAX_FILE_SIZE, 64 * 1024).
@@ -663,6 +625,10 @@ lookup_captcha(Id) ->
_ -> {error, enoent}
end.
+-spec check_captcha(binary(), binary()) -> captcha_not_found |
+ captcha_valid |
+ captcha_non_valid.
+
check_captcha(Id, ProvidedKey) ->
case ets:lookup(captcha, Id) of
[#captcha{pid = Pid, args = Args, key = ValidKey,