inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.4"
- inkscape:cx="334.11639"
- inkscape:cy="851.68479"
+ inkscape:cx="306.37446"
+ inkscape:cy="563.19133"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1">
+ <rect
+ style="opacity:1;fill:#d2e8fa;fill-opacity:1;stroke:#7a7a7a;stroke-width:1.3789773;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect3455"
+ width="135.98148"
+ height="36.986515"
+ x="236.06519"
+ y="304.53879"
+ ry="6.8493543" />
+ <path
+ style="opacity:1;fill:#fbfacd;fill-opacity:1;stroke:#7a7a7a;stroke-width:1.82790184;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 50.101451,434.9092 L 50.101451,638.61269 L 644.21104,638.61269 L 644.21104,434.9092 L 50.101451,434.9092 z"
+ id="rect2641" />
<text
xml:space="preserve"
- style="font-size:28px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
- x="173.66833"
- y="55.341621"
+ style="font-size:14.65501022px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ x="-665.67365"
+ y="42.102493"
id="text3444"
- sodipodi:linespacing="125%"><tspan
+ sodipodi:linespacing="125%"
+ transform="matrix(0,-0.95659,1.0453799,0,0,0)"><tspan
sodipodi:role="line"
id="tspan3446"
- x="173.66833"
- y="55.341621">Dépendances inter-modules</tspan></text>
+ x="-665.67365"
+ y="42.102493">Dépendances inter-modules</tspan></text>
+ <path
+ style="fill:#cac3f8;fill-opacity:1;stroke:#7a7a7a;stroke-width:1.02962685;stroke-miterlimit:4;stroke-opacity:1"
+ d="M 353.20925,623.42812 L 367.50523,623.42812 L 367.50523,644.53984 L 378.34262,644.53984 L 359.66549,659.78717 L 342.37195,644.53984 L 353.20925,644.53984 L 353.20925,623.42812 z"
+ id="rect3442"
+ sodipodi:nodetypes="cccccccc" />
<g
id="g3551"
- transform="matrix(0.621787,0,0,0.621787,278.22386,181.10016)">
+ transform="matrix(0.621787,0,0,0.621787,269.65243,535.38587)">
<rect
ry="0"
y="112.90382"
</g>
<g
id="g3546"
- transform="matrix(0.621787,0,0,0.621787,442.51445,8.0632701)">
+ transform="matrix(0.621787,0,0,0.621787,433.94302,362.34898)">
<rect
ry="0"
y="152.88066"
</g>
<g
id="g3472"
- transform="matrix(0.621787,0,0,0.621787,349.74055,141.12082)">
+ transform="matrix(0.621787,0,0,0.621787,341.16912,495.40653)">
<g
id="g3477">
<g
</g>
<g
id="g3541"
- transform="matrix(0.621787,0,0,0.621787,312.79634,-20.869345)">
+ transform="matrix(0.621787,0,0,0.621787,304.22491,333.41637)">
<rect
ry="0"
y="199.39748"
</g>
<g
id="g3536"
- transform="matrix(0.621787,0,0,0.621787,33.562539,98.935449)">
+ transform="matrix(0.621787,0,0,0.621787,24.99111,426.07831)">
<rect
ry="0"
y="245.24152"
</g>
<g
id="g3531"
- transform="matrix(0.621787,0,0,0.621787,75.136293,-18.261854)">
+ transform="matrix(0.621787,0,0,0.621787,66.564864,336.02386)">
<rect
ry="0"
y="286.55777"
</g>
<g
id="g3526"
- transform="matrix(0.621787,0,0,0.621787,77.801089,-107.91954)">
+ transform="matrix(0.621787,0,0,0.621787,69.22966,246.36617)">
<rect
ry="0"
y="339.40631"
</g>
<g
id="g3521"
- transform="matrix(0.621787,0,0,0.621787,205.41324,-137.23236)">
+ transform="matrix(0.621787,0,0,0.621787,196.84181,217.05335)">
<rect
ry="0"
y="386.49799"
</g>
<path
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#7a7a7a;stroke-width:0.62199998;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow1Lend);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="M 307.83923,122.15313 L 364.94873,251.09041"
+ d="M 299.2678,476.43884 L 356.3773,605.37612"
id="path4358"
inkscape:connector-type="polyline"
inkscape:connection-start="#g3521"
inkscape:connection-end="#g3551" />
<path
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#7a7a7a;stroke-width:0.62199998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="M 416.12377,122.15313 L 372.48582,251.09041"
+ d="M 407.55234,476.43884 L 363.91439,605.37612"
id="path5406"
inkscape:connector-type="polyline"
inkscape:connection-start="#g3541"
inkscape:connection-end="#g3551" />
<path
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#7a7a7a;stroke-width:0.62199998;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow1Lend);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="M 289.88826,260.73645 L 327.05872,260.73644"
+ d="M 241.61865,597.52534 L 318.48729,608.82454"
id="path5410"
inkscape:connector-type="polyline"
inkscape:connection-start="#g3536"
inkscape:connection-end="#g3551" />
<path
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#7a7a7a;stroke-width:0.62199998;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow1Lend);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="M 184.39315,122.15313 L 184.39315,159.65286"
+ d="M 175.82172,476.43884 L 175.82172,513.93857"
id="path5412"
inkscape:connector-type="polyline"
inkscape:connection-start="#g3526"
inkscape:connection-end="#g3531" />
<path
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#7a7a7a;stroke-width:0.62199998;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow1Lend);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="M 203.89123,178.94492 L 349.72311,251.09041"
+ d="M 195.3198,533.23063 L 341.15168,605.37612"
id="path5935"
inkscape:connector-type="polyline"
sodipodi:nodetypes="ccc"
inkscape:connection-start="#g3531" />
<path
style="fill:none;fill-rule:evenodd;stroke:#7a7a7a;stroke-width:0.62178701px;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow1Lend);stroke-opacity:1"
- d="M 553.53181,122.15313 L 554.97138,210.16652"
+ d="M 544.96038,476.43884 L 546.39995,564.45223"
id="path6979"
inkscape:connector-type="polyline"
inkscape:connection-end="#g3472"
inkscape:connection-start="#g3546" />
<path
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#7a7a7a;stroke-width:0.62199998;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow1Lend);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="M 249.74143,178.20275 L 493.18154,211.37204"
+ d="M 241.17,532.48846 L 484.61011,565.65776"
id="path7502"
inkscape:connector-type="polyline"
inkscape:connection-end="#g3472"
sodipodi:nodetypes="cc" />
<path
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#7a7a7a;stroke-width:0.62199998;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow1Lend);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="M 541.39029,122.15313 L 381.20495,251.09041"
+ d="M 532.81886,476.43884 L 372.63352,605.37612"
id="path8027"
inkscape:connector-type="polyline"
inkscape:connection-end="#g3551"
inkscape:connection-start="#g3546" />
<path
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#7a7a7a;stroke-width:0.62199998;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow1Lend);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="M 184.41159,178.94492 L 184.54951,251.09042"
+ d="M 175.84794,533.23063 L 175.9703,578.23328"
id="path8550"
inkscape:connector-type="polyline"
inkscape:connection-end="#g3536"
inkscape:connection-start="#g3531" />
+ <text
+ xml:space="preserve"
+ style="font-size:22px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ x="273.48901"
+ y="331.2337"
+ id="text2643"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan2645"
+ x="273.48901"
+ y="331.2337">client</tspan></text>
+ <rect
+ style="opacity:1;fill:#fbfacd;fill-opacity:1;stroke:#7a7a7a;stroke-width:1.53152299;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect3430"
+ width="594.40643"
+ height="37.838478"
+ x="49.953262"
+ y="382.07291" />
+ <rect
+ style="opacity:1;fill:#fbfacd;fill-opacity:1;stroke:#7a7a7a;stroke-width:1.53517783;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect3432"
+ width="594.40283"
+ height="37.834652"
+ x="49.95509"
+ y="660.56885" />
+ <text
+ xml:space="preserve"
+ style="font-size:22px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ x="69.163155"
+ y="408.85544"
+ id="text3434"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan3436"
+ x="69.163155"
+ y="408.85544">Yaws</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:22px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
+ x="66.961006"
+ y="687.68781"
+ id="text3438"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan3440"
+ x="66.961006"
+ y="687.68781">Mnesia</tspan></text>
+ <path
+ style="fill:#cac3f8;fill-opacity:1;stroke:#7a7a7a;stroke-width:1.02962685;stroke-miterlimit:4;stroke-opacity:1"
+ d="M 168.61851,420.00991 L 182.91449,420.00991 L 182.91449,441.12163 L 193.75188,441.12163 L 175.07475,456.36896 L 157.78121,441.12163 L 168.61851,441.12163 L 168.61851,420.00991 z"
+ id="path3445"
+ sodipodi:nodetypes="cccccccc" />
+ <path
+ style="fill:#cac3f8;fill-opacity:1;stroke:#7a7a7a;stroke-width:1.29042327;stroke-miterlimit:4;stroke-opacity:1"
+ d="M 293.34646,342.35856 L 314.76524,342.35856 L 314.76524,364.49193 L 331.00223,364.49193 L 303.01945,380.47712 L 277.10961,364.49193 L 293.34646,364.49193 L 293.34646,342.35856 z"
+ id="path3447"
+ sodipodi:nodetypes="cccccccc" />
+ <text
+ xml:space="preserve"
+ style="font-size:16.41790962px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="202.80997"
+ y="360.05765"
+ id="text3449"><tspan
+ sodipodi:role="line"
+ id="tspan3451"
+ x="202.80997"
+ y="360.05765">JSON/HTTP</tspan></text>
</g>
</svg>
% You should have received a copy of the GNU General Public License\r
% along with Euphorik. If not, see <http://www.gnu.org/licenses/>.\r
% \r
-% Ce module est fait pour répondre à des requêtes 'AJAX'.\r
-% Il est définit comme 'appmods' pour l'url "request" dans yaws.\r
+% Ce module est fait pour répondre à des requêtes JSON via 'AJAX'.\r
+% Il est définit comme 'appmods' pour l'url "request" dans Yaws.\r
% Par exemple http://www.euphorik.ch/request abouti sur la fonction out/1 de ce module.\r
% @author G.Burri\r
\r
\r
-module(euphorik_requests).\r
--export([out/1, traiter_donnees/2]).\r
+-export([out/1]).\r
-include_lib("yaws/include/yaws_api.hrl").\r
-include("../include/euphorik_defines.hrl").\r
\r
% keepalive -> true, evite que des firewalls coupe la connexion TCP sans prévenir\r
inet:setopts(A#arg.clisock, [{active, true}, {keepalive, true}]),\r
{value, {_, Contenu}} = lists:keysearch("action", 1, yaws_api:parse_post(A)),\r
- Ret = traiter_donnees(Contenu, IP),\r
+ Ret = traiter_message(Contenu, IP),\r
{content, "application/json", Ret}.\r
\r
\r
-% Décode les données JSON.\r
-traiter_donnees(Contenu, IP) ->\r
+% Décode le message JSON.\r
+traiter_message(Contenu, IP) ->\r
+ % extrait l'entête obligatoire des messages JSON\r
{ok, {struct, [{header, {struct, [{action, Action}, {version, Version_client}]}} | Reste]}} = json:decode_string(Contenu),\r
json:encode(\r
if Version_client =:= ?VERSION_PROTOCOLE ->\r
).\r
\r
\r
-% authentification d'un client\r
+% Authentification d'un client.\r
traiter_action("authentification", JSON, IP) ->\r
euphorik_protocole:login(JSON, IP);\r
-% un client s'enregistre : (pseudo + password) ou de manière anonyme\r
+% Un client s'enregistre : (pseudo + password) ou de manière anonyme.\r
traiter_action("register", JSON, IP) ->\r
euphorik_protocole:register(JSON, IP);\r
-% modification du profile\r
+% Modification du profile.\r
traiter_action("set_profile", JSON, _) ->\r
euphorik_protocole:profile(JSON);\r
-% un utilisateur attend un événement (par exemple l'arrivé d'un nouveau message)\r
+% Un utilisateur attend un événement (par exemple l'arrivée d'un nouveau message).\r
traiter_action("wait_event", JSON, _) ->\r
euphorik_protocole:wait_event(JSON);\r
-% un utilisateur envoie un message\r
+% Un utilisateur envoie un message.\r
traiter_action("put_message", JSON, _) ->\r
euphorik_protocole:put_message(JSON);\r
-% un ekMaster bannie un utilisateur (ip)\r
+% Un ekMaster bannie un utilisateur (ip).\r
traiter_action("ban", JSON, _) ->\r
euphorik_protocole:ban(JSON);\r
-% un ekMaster slap un utilisateur\r
+% Un ekMaster slap un utilisateur.\r
traiter_action("slap", JSON, _) ->\r
euphorik_protocole:slap(JSON);\r
-% un ekMaster envoie un nouveau troll\r
+% Un ekMaster envoie un nouveau troll.\r
traiter_action("put_troll", JSON, _) ->\r
euphorik_protocole:put_troll(JSON);\r
-% un ekMaster modifie un troll\r
+% Un ekMaster modifie un troll.\r
traiter_action("mod_troll", JSON, _) ->\r
euphorik_protocole:mod_troll(JSON);\r
-% un ekMaster supprime un troll\r
+% Un ekMaster supprime un troll.\r
traiter_action("del_troll", JSON, _) ->\r
euphorik_protocole:del_troll(JSON);\r
-% un ekMaster demande la liste des ips bannies\r
+% Un ekMaster demande la liste des ips bannies.\r
traiter_action("list_banned_ips", JSON, _) ->\r
euphorik_protocole:list_banned_ips(JSON);\r
-% un ekMaster débannie une ip\r
+% Un ekMaster débannie une ip.\r
traiter_action("unban", JSON, _) ->\r
euphorik_protocole:unban_ip(JSON).\r
\ No newline at end of file