tester/0,\r
out/1\r
]).\r
-\r
-include_lib("xmerl/include/xmerl.hrl").\r
-include_lib("yaws/include/yaws_api.hrl").
\r
out(A) ->
- %io:format("~p~n~n", [A]),
+ %io:format("~p~n", [A]), % utilisé parfois pendant le debug
IP = case inet:peername(A#arg.clisock) of
- {ok, {Adresse, _Port}} -> Adresse;
+ {ok, {Adresse, _Port}} -> Adresse;
_ -> inconnue
- end,\r
- %inet:setopts(A#arg.clisock, inet:getopts(A#arg.clisock, [active])),\r
+ end,
+ % passive -> active, permet de recevoir {tcp_closed, _} lorsque le socket se ferme\r
+ inet:setopts(A#arg.clisock, [{active, true}]),\r
{value, {_, Contenu}} = lists:keysearch("action", 1, yaws_api:parse_post(A)),\r
Ret = traiter_donnees(Contenu, IP),
{content, "application/json", Ret}.\r
traiter_action("mod_troll", JSON, _) ->
euphorik_protocole:mod_troll(JSON);
traiter_action("del_troll", JSON, _) ->
- euphorik_protocole:del_troll(JSON).
+ euphorik_protocole:del_troll(JSON);
+traiter_action("list_banned_ips", JSON, _) ->
+ euphorik_protocole:list_banned_ips(JSON);
+traiter_action("unban", JSON, _) ->
+ euphorik_protocole:unban_ip(JSON).
\ No newline at end of file