MOD mise à jour du protocole : ajout d'un numéro de version pour chaque message,...
authorGreg Burri <greg.burri@gmail.com>
Wed, 25 Jun 2008 13:43:13 +0000 (13:43 +0000)
committerGreg Burri <greg.burri@gmail.com>
Wed, 25 Jun 2008 13:43:13 +0000 (13:43 +0000)
doc/protocole3.txt

index e89b357..0af2cce 100644 (file)
@@ -1,4 +1,4 @@
-Euphorik - Protocole v3
+Euphorik - Protocole v3
 -----------------------
 
 == Introduction ==
 -----------------------
 
 == Introduction ==
@@ -37,6 +37,14 @@ Message ok générique :
 <ok>
    {
       "reply" : "ok"
 <ok>
    {
       "reply" : "ok"
+   }\r
+\r
+Entete des messages clients :\r
+Si la version du protocole n'est pas similaire du coté serveur la requête est refusée\r
+<client_header>\r
+   {\r
+      "action" : <action>,\r
+      "version" : 3\r
    }
 
 
    }
 
 
@@ -47,18 +55,18 @@ Le mot de passe est hashé en md5.
 
 c -> s
    { 
 
 c -> s
    { 
-      "action" : "authentification",
+      "header" : {action : "authentification", version : 3},
       "login" : "paul",
       "password" : "IJKJDHHSAD9081238"
    }
 ou
    {
       "login" : "paul",
       "password" : "IJKJDHHSAD9081238"
    }
 ou
    {
-      "action" : "authentification",
+      "header" : {action : "authentification", version : 3}
       "cookie" : "LKJDLAKSJBFLKASN"
    }
 ou
       "cookie" : "LKJDLAKSJBFLKASN"
    }
 ou
-   {
-      "action" : "register",
+   {\r
+      "header" : {action : "authentification", version : 3},
       "login" : "paul",
       "password" : "IJKJDHHSAD9081238"
    }
       "login" : "paul",
       "password" : "IJKJDHHSAD9081238"
    }
@@ -93,16 +101,16 @@ ou
  
 === Logout ===
 c -> s
  
 === Logout ===
 c -> s
-   {
-      "action" : "logout",
+   {\r
+      "header" : {action : "logout", version : 3},
       "cookie" : "LKJDLAKSJBFLKASN"
    }
  
  
 === Profile ===
 c -> s
       "cookie" : "LKJDLAKSJBFLKASN"
    }
  
  
 === Profile ===
 c -> s
-   {
-      "action" : "set_profile",
+   {\r
+      "header" : {action : "set_profile", version : 3},
       "cookie" : "LKJDLAKSJBFLKASN",
       "login" : "paul49",
       "password" : "IJKJDHHSAD9081238",
       "cookie" : "LKJDLAKSJBFLKASN",
       "login" : "paul49",
       "password" : "IJKJDHHSAD9081238",
@@ -126,10 +134,29 @@ ou
 Si "last_message_id" est absent alors le client ne possède pas de message.
 Si "main_page" est absent alors est vaut 1.
 "cookie" n'est pas obligatoire.
 Si "last_message_id" est absent alors le client ne possède pas de message.
 Si "main_page" est absent alors est vaut 1.
 "cookie" n'est pas obligatoire.
+\r
+<message>\r
+   {\r
+      "id" : 54,\r
+      "user_id" : 344,\r
+      "date" : "Hier 17:26:54",\r
+      "system" : true | false,\r
+      "owner" : true | false,\r
+      "answered" : true | false,\r
+      "is_a_reply" : true | false,\r
+      "nick" : "Paul",\r
+      "login" : "paul_22",\r
+      "content" : "Salut",\r
+      "root" : 453,\r
+      "answer_to" : [\r
+         { "id" : 123, "nick" : "Pierre", "login" : "pierre_45" }\r
+      ]\r
+      "ek_master" : true | false\r
+   }\r
 
 c -> s
 
 c -> s
-   {
-      "action" : "wait_event",
+   {\r
+      "header" : {action : "wait_event", version : 3},
       "page" : "chat"
       "cookie" : "LKJDLAKSJBFLKASN",
       "message_count" : 10,
       "page" : "chat"
       "cookie" : "LKJDLAKSJBFLKASN",
       "message_count" : 10,
@@ -153,28 +180,10 @@ Le format de la date n'est pas formel.
       "reply" : "new_message",
       "conversations" : [
          {
       "reply" : "new_message",
       "conversations" : [
          {
-            "last_page" : true | false,
-            "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",
-                  "root" : 453,
-                  "answer_to" : [
-                     { "id" : 123, "nick" : "Pierre", "login" : "pierre_45" }
-                  ]
-                  "ek_master" : true | false
-               }
-            ]
+            "last_page" : true | false,\r
+            "first" : <message>,
+            "messages" : [ <message>, .. ]
          }
          }
-         ...
       ]
    }
 ou
       ]
    }
 ou
@@ -196,8 +205,8 @@ ou
 
 === Wait event (page = admin) ===
 c -> s
 
 === Wait event (page = admin) ===
 c -> s
-   {
-      "action" : "wait_event",
+   {\r
+      "header" : {action : "wait_event", version : 3},
       "page" : "admin",
       "last_troll" : 5
    }
       "page" : "admin",
       "last_troll" : 5
    }
@@ -238,8 +247,8 @@ s -> c
 
 === Envoie d'un troll ===
 c -> s
 
 === Envoie d'un troll ===
 c -> s
-   {
-      "action" : "put_troll",
+   {\r
+      "header" : {action : "put_troll", version : 3},
       "cookie" : "LKJDLAKSJBFLKASN",
       "content" : "Un bon troll velu !"
    }
       "cookie" : "LKJDLAKSJBFLKASN",
       "content" : "Un bon troll velu !"
    }
@@ -252,8 +261,8 @@ ou
    
 === Modification d'un troll ===
 c -> s
    
 === Modification d'un troll ===
 c -> s
-   {
-      "action" : "mod_troll",
+   {\r
+      "header" : {action : "mod_troll", version : 3},
       "cookie" : "LKJDLAKSJBFLKASN",
       "troll_id" : 3,
       "content" : "Un bon troll velu 2 !"
       "cookie" : "LKJDLAKSJBFLKASN",
       "troll_id" : 3,
       "content" : "Un bon troll velu 2 !"
@@ -267,8 +276,8 @@ ou
    
 === Suppression d'un troll ===
 c -> s
    
 === Suppression d'un troll ===
 c -> s
-   {
-      "action" : "del_troll",
+   {\r
+      "header" : {action : "del_troll", version : 3},
       "cookie" : "LKJDLAKSJBFLKASN",
       "troll_id" : 3
    }
       "cookie" : "LKJDLAKSJBFLKASN",
       "troll_id" : 3
    }
@@ -284,8 +293,8 @@ Le client envoie un message, le message peut répondre à un certain nombre d'au
 "answer_to" n'est pas obligatoire.
 
 c -> s
 "answer_to" n'est pas obligatoire.
 
 c -> s
-   {
-      "action" : "put_message",
+   {\r
+      "header" : {action : "put_message", version : 3},
       "cookie" : "LKJDLAKSJBFLKASN",
       "nick" : "Paul",
       "content" : "Bonjour",
       "cookie" : "LKJDLAKSJBFLKASN",
       "nick" : "Paul",
       "content" : "Bonjour",
@@ -300,8 +309,8 @@ ou
 
 === Slapage ===
 c -> s
 
 === Slapage ===
 c -> s
-   {
-      "action" : "slap",
+   {\r
+      "header" : {action : "slap", version : 3},
       "cookie" :  "LKJDLAKSJBFLKASN",
       "user_id" : 67,
       "reason" : "blablabla"
       "cookie" :  "LKJDLAKSJBFLKASN",
       "user_id" : 67,
       "reason" : "blablabla"
@@ -315,8 +324,8 @@ ou
 
 === Bannissement ===
 c -> s
 
 === Bannissement ===
 c -> s
-   {
-      "action" : "ban",
+   {\r
+      "header" : {action : "ban", version : 3},
       "cookie" : "LKJDLAKSJBFLKASN",
       "duration" : 15, // en minute
       "user_id" : 67,
       "cookie" : "LKJDLAKSJBFLKASN",
       "duration" : 15, // en minute
       "user_id" : 67,
@@ -331,8 +340,8 @@ ou
    
 === Liste des ip bannis ===
 c -> s
    
 === Liste des ip bannis ===
 c -> s
-   {
-      "action" : "list_banned_ips",
+   {\r
+      "header" : {action : "list_banned_ips", version : 3},
       "cookie" : "LKJDLAKSJBFLKASN"
    }
 
       "cookie" : "LKJDLAKSJBFLKASN"
    }
 
@@ -356,8 +365,8 @@ s -> c
 
 === Débannissement ===
 c -> s
 
 === Débannissement ===
 c -> s
-   {
-      "action" : "unban",
+   {\r
+      "header" : {action : "unban", version : 3},
       "cookie" : "LKJDLAKSJBFLKASN"
       "ip" : "192.168.1.2"
    }
       "cookie" : "LKJDLAKSJBFLKASN"
       "ip" : "192.168.1.2"
    }
@@ -374,8 +383,8 @@ Le message est appondu avec un " +++ " devant, par exemple :
 > Gnome c'est mieux que KDE +++ Euh non ok, c'est faux
 
 c -> s
 > Gnome c'est mieux que KDE +++ Euh non ok, c'est faux
 
 c -> s
-   {
-      "action" : "correction",
+   {\r
+      "header" : {action : "correction", version : 3},
       "cookie" : "LKJDLAKSJBFLKASN",
       "content" : "Euh non ok, c'est faux"
    }
       "cookie" : "LKJDLAKSJBFLKASN",
       "content" : "Euh non ok, c'est faux"
    }