X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;f=modules%2Ferl%2Feuphorik_requests.erl;h=f8dad51627cee769d088348c29c1ac137a317296;hb=221a44d7aeaf467ef9854fe21af93bc964e92ef1;hp=4af2f7ecde9a24fc9ceed7d90832f31fa7df04a7;hpb=13bf850da2316cde3ad2ff8d5c26fb32928bf7b4;p=euphorik.git diff --git a/modules/erl/euphorik_requests.erl b/modules/erl/euphorik_requests.erl index 4af2f7e..f8dad51 100755 --- a/modules/erl/euphorik_requests.erl +++ b/modules/erl/euphorik_requests.erl @@ -9,7 +9,6 @@ tester/0, out/1 ]). - -include_lib("xmerl/include/xmerl.hrl"). -include_lib("yaws/include/yaws_api.hrl"). @@ -20,12 +19,13 @@ tester() -> 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, - %inet:setopts(A#arg.clisock, inet:getopts(A#arg.clisock, [active])), + end, + % passive -> active, permet de recevoir {tcp_closed, _} lorsque le socket se ferme + inet:setopts(A#arg.clisock, [{active, true}]), {value, {_, Contenu}} = lists:keysearch("action", 1, yaws_api:parse_post(A)), Ret = traiter_donnees(Contenu, IP), {content, "application/json", Ret}. @@ -56,5 +56,13 @@ traiter_action("wait_event", JSON, _) -> traiter_action("put_message", JSON, _) -> euphorik_protocole:put_message(JSON); traiter_action("ban", JSON, _) -> - euphorik_protocole:ban(JSON). + euphorik_protocole:ban(JSON); +traiter_action("slap", JSON, _) -> + euphorik_protocole:slap(JSON); +traiter_action("put_troll", JSON, _) -> + euphorik_protocole:put_troll(JSON); +traiter_action("mod_troll", JSON, _) -> + euphorik_protocole:mod_troll(JSON); +traiter_action("del_troll", JSON, _) -> + euphorik_protocole:del_troll(JSON). \ No newline at end of file