X-Git-Url: http://git.euphorik.ch/?p=euphorik.git;a=blobdiff_plain;f=doc%2Fprotocole3.txt;h=99776a48b3c6d3ebafe66655aef7dc792e197832;hp=fdb68df11f4cb4ae038def96a7e32dd31f03819b;hb=eae50232e73fca26d6f631c8177cbea649e5036e;hpb=b5878679d51e91e8a86dd042251c91290bf8caf2 diff --git a/doc/protocole3.txt b/doc/protocole3.txt index fdb68df..99776a4 100644 --- a/doc/protocole3.txt +++ b/doc/protocole3.txt @@ -1,15 +1,13 @@ Euphorik - Protocole v3 ----------------------- -A. Introduction ---------------- +== Introduction == Ce document a pour but de décrire la communication client-serveur du site euphorik. Les messages échangés sont basés sur le format JSON. Ce document remplace 'protocole2.txt'. -B. Principes ------------- +== Principes == Enregistrement: * Permet de créer un compte, un cookie est donné en retour. Ce cookie doit être stocké par le client pour pouvoir s'authentifier par la suite. @@ -23,8 +21,7 @@ Rafraichissement: * Dès qu'un nouveau message arrive, le serveur débloque la connexion et envoie le ou les messages manquants. -C. Protocole ------------- +== Protocole == c : client s : server Les messages client vers serveur sont envoyés par HTTP-POST. @@ -43,50 +40,61 @@ Message ok g } -C.1. Login ----------- -Le mot de passe est hashé en md5. +=== Enregistrement et authentification === +Permet de créer un nouvel utilisateur. +"login" et "password" peuvent ne pas être fournis avec un message de type "register", dans ce cas l'utilisateur ne pourra s'authentifier qu'a l'aide de son cookie. +Le mot de passe est hashé en md5. -c -> s - { - "action" : "authentification", - "login" : "Paul", - "password" : "IJKJDHHSAD9081238" +c -> s + { + "action" : "authentification", + "login" : "paul", + "password" : "IJKJDHHSAD9081238" } -ou - { - "action" : "authentification", - "cookie" : "LKJDLAKSJBFLKASN" +ou + { + "action" : "authentification", + "cookie" : "LKJDLAKSJBFLKASN" } -ou - { - "action" : "register", - "login" : "Paul", - "password" : "IJKJDHHSAD9081238" +ou + { + "action" : "register", + "login" : "paul", + "password" : "IJKJDHHSAD9081238" } -s -> c - { - "reply" : "login", - "status" : "registration_ok" | "authentification_ok", +s -> c + { + "reply" : "register" | "authentification", + "status" : "auth_not_registered", + "cookie" : "LKJDLAKSJBFLKASN", + "id" : 193, + "css" : "css/1/euphorik.css", + "main_page" : 1 + } +ou + { + "reply" : "register" | "authentification", + "status" : "auth_registered", "cookie" : "LKJDLAKSJBFLKASN", "id" : 193, - "pseudo" : "Paul", + "nick" : "Paul", "login" : "paul49", "email" : "paul@pierre.com", - "css" : "css/3/euphorik.css", - "main_page" : 1, - "conversations" : [ - { - "root" : 123, - "page" : 1 - } - ] + "css" : "css/3/euphorik.css", + "nick_format" : "nick" | "login" | "nick_login", + "main_page" : 1, + "conversations" : [ + { + "racine" : 123, + "page" : 1 + } + ], + "ek_master" : true | false } -C.2. Logout ------------ +=== Logout === c -> s { "action" : "logout", @@ -94,24 +102,23 @@ c -> s } -C.3. Profile ------------- - +=== Profile === c -> s { "action" : "set_profile", "cookie" : "LKJDLAKSJBFLKASN", "login" : "paul49", "password" : "IJKJDHHSAD9081238", - "pseudo" : "Paul", + "nick" : "Paul", "email" : "paul@pierre.com", - "css" : "css/3/euphorik.css", - "main_page" : 1, - "conversations" : [ - { - "root" : 123, - "page" : 1 - } + "css" : "css/3/euphorik.css", + "nick_format" : "nick" | "login" | "nick_login", + "main_page" : 1, + "conversations" : [ + { + "root" : 123, + "page" : 1 + } ] } @@ -121,22 +128,24 @@ ou -C.4. Wait event ---------------------- +=== Wait event === Si "last_message_id" est absent alors le client ne possède pas de message. -Les conversations données sont définies dans le profile. +Si "main_page" est absent alors est vaut 1. +"cookie" n'est pas obligatoire. c -> s { - "action" : "wait_event", + "action" : "wait_event", + "page" : "chat" "cookie" : "LKJDLAKSJBFLKASN", - "message_count" : 10, + "message_count" : 10, "last_message_id" : 163, - "main_page" : 1, + "main_page" : 1 "conversations" : [ { - "root" : 123, - "page" : 1 + "racine" : 123, + "page" : 1, + "last_message_id" : 4 (pas obligatoire) } ] } @@ -150,21 +159,25 @@ Le format de la date n'est pas formel. "conversations" : [ { "last_page" : true | false, - "messages" : [ - "id" : 54, - "date" : "Hier 17:26:54", - "system" : true | false, - "owner" : true | false, - "answered" : true | false, - "is_a_reply" : true | false, - "nick" : "Paul", - "login" : "paul_22", - "content" : "Salut", - "answer_to" : [ - { "id" : 123, "pseudo" : "Pierre", "login" : "pierre_45" } - ] + "messages" : [ + { + "id" : 54, + "user_id" : 344, + "date" : "Hier 17:26:54", + "system" : true | false, + "owner" : true | false, + "answered" : true | false, + "is_a_reply" : true | false, + "nick" : "Paul", + "login" : "paul_22", + "content" : "Salut", + "answer_to" : [ + { "id" : 123, "nick" : "Pierre", "login" : "pierre_45" } + ] + "ek_master" : true | false + } ] - } + } ... ] } @@ -174,32 +187,26 @@ ou "message_id" : 123, "contenu" : "Salut +++ poulpe" } -ou - { - "reply" : "error", - "error_message" : "blabla" - } - +ou + -C.5. Envoie troll -------------------- +=== Envoie d'un troll === +TODO c -> s { "action" : "put_troll", "cookie" : "LKJDLAKSJBFLKASN", "content" : "Un bon troll velu !" } - -s -> c - { - "reply" : "ok" | "error", - "error_message" : "blabla" - } - +=== Modification d'un troll === +TODO +=== Suppression d'un troll === +TODO +=== Noter un troll === +TODO -C.6. Envoie message -------------------- +=== Envoie message === Le client envoie un message, le message peut répondre à un certain nombre d'autres messages. "answer_to" n'est pas obligatoire. @@ -209,19 +216,46 @@ c -> s "cookie" : "LKJDLAKSJBFLKASN", "nick" : "Paul", "content" : "Bonjour", - "Troll" : 45, "answer_to" : [ 345, 532, ... ] } -s -> c - { - "reply" : "ok" | "error", - "error_message" : "blabla" +s -> c + +ou + + + +=== Slapage === + +c -> s + { + "action" : "slap", + "cookie" : "LKJDLAKSJBFLKASN", + "user_id" : 67 } + +s -> c + +ou + + + +=== Bannissement === + +c -> s + { + "action" : "ban", + "cookie" : "LKJDLAKSJBFLKASN", + "duration" : 15, // en minute + "user_id" : 67 + } + +s -> c + +ou + - -C.7. Ajout d'une correction d'un messages ----------------------------------------- +=== Ajout d'une correction d'un messages === Le client envoie un correctif sous la forme de texte supplémentaire à appondre au dernier messages. Le message est appondu avec un " +++ " devant, par exemple : > Gnome c'est mieux que KDE +++ Euh non ok, c'est faux