ADD avancement sur la possibilité de réduire une conversation (pas fini)
[euphorik.git] / doc / protocole3.txt
index e89b357..dc3ff4b 100644 (file)
@@ -1,4 +1,4 @@
-Euphorik - Protocole v3
+Euphorik - Protocole v3
 -----------------------
 
 == Introduction ==
@@ -39,6 +39,14 @@ Message ok générique :
       "reply" : "ok"
    }
 
+Entete des messages clients :
+Si la version du protocole n'est pas similaire du coté serveur la requête est refusée
+<client_header>
+   {
+      "action" : <action>,
+      "version" : 3
+   }
+
 
 === Enregistrement et authentification ===
 Permet de créer un nouvel utilisateur.
@@ -47,18 +55,18 @@ Le mot de passe est hashé en md5.
 
 c -> s
    { 
-      "action" : "authentification",
+      "header" : {action : "authentification", version : 3},
       "login" : "paul",
       "password" : "IJKJDHHSAD9081238"
    }
 ou
    {
-      "action" : "authentification",
+      "header" : {action : "authentification", version : 3}
       "cookie" : "LKJDLAKSJBFLKASN"
    }
 ou
    {
-      "action" : "register",
+      "header" : {action : "authentification", version : 3},
       "login" : "paul",
       "password" : "IJKJDHHSAD9081238"
    }
@@ -85,16 +93,16 @@ ou
       "nick_format" : "nick" | "login" | "nick_login",
       "view_times" : true | false,
       "view_tooltips" : true | false,
-      // "main_page" : 1,
-      "conversations" : [3, 8],
-      "ek_master" : true | false
+      "conversations" : [{"root" : 3, "minimized" : true},
+      "ek_master" : true | false,
+      "ostentatious_master" : "invisible" | "light" | "heavy"
    }
  
  
 === Logout ===
 c -> s
    {
-      "action" : "logout",
+      "header" : {action : "logout", version : 3},
       "cookie" : "LKJDLAKSJBFLKASN"
    }
  
@@ -102,7 +110,7 @@ c -> s
 === Profile ===
 c -> s
    {
-      "action" : "set_profile",
+      "header" : {action : "set_profile", version : 3},
       "cookie" : "LKJDLAKSJBFLKASN",
       "login" : "paul49",
       "password" : "IJKJDHHSAD9081238",
@@ -112,8 +120,8 @@ c -> s
       "nick_format" : "nick" | "login" | "nick_login",
       "view_times" : true | false,
       "view_tooltips" : true | false,
-      "main_page" : 1,
-      "conversations" : [3, 8]
+      "conversations" : [{"root" : 3, "minimized" : true},
+      "ostentatious_master" : "invisible" | "light" | "heavy"
    }
       
 s -> c
@@ -127,9 +135,29 @@ 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.
 
+<message>
+   {
+      "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,
+      "ostentatious_master" : "invisible" | "light" | "heavy"
+   }
+
 c -> s
    {
-      "action" : "wait_event",
+      "header" : {action : "wait_event", version : 3},
       "page" : "chat"
       "cookie" : "LKJDLAKSJBFLKASN",
       "message_count" : 10,
@@ -149,32 +177,15 @@ s -> c
 La première conversation est la principale (main).
 L'ordre des conversation est le même que celui des données de l'utilisateur.
 Le format de la date n'est pas formel.
+first correpond au premier message de la conversation, vaut 'null' pour la conversation principale ainsi que pour les conversations vides.
    {
       "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
-               }
-            ]
+            "first" : <message> | null,
+            "messages" : [ <message>, .. ]
          }
-         ...
       ]
    }
 ou
@@ -197,7 +208,7 @@ ou
 === Wait event (page = admin) ===
 c -> s
    {
-      "action" : "wait_event",
+      "header" : {action : "wait_event", version : 3},
       "page" : "admin",
       "last_troll" : 5
    }
@@ -239,7 +250,7 @@ s -> c
 === Envoie d'un troll ===
 c -> s
    {
-      "action" : "put_troll",
+      "header" : {action : "put_troll", version : 3},
       "cookie" : "LKJDLAKSJBFLKASN",
       "content" : "Un bon troll velu !"
    }
@@ -253,7 +264,7 @@ ou
 === Modification d'un troll ===
 c -> s
    {
-      "action" : "mod_troll",
+      "header" : {action : "mod_troll", version : 3},
       "cookie" : "LKJDLAKSJBFLKASN",
       "troll_id" : 3,
       "content" : "Un bon troll velu 2 !"
@@ -268,7 +279,7 @@ ou
 === Suppression d'un troll ===
 c -> s
    {
-      "action" : "del_troll",
+      "header" : {action : "del_troll", version : 3},
       "cookie" : "LKJDLAKSJBFLKASN",
       "troll_id" : 3
    }
@@ -285,7 +296,7 @@ Le client envoie un message, le message peut répondre à un certain nombre d'au
 
 c -> s
    {
-      "action" : "put_message",
+      "header" : {action : "put_message", version : 3},
       "cookie" : "LKJDLAKSJBFLKASN",
       "nick" : "Paul",
       "content" : "Bonjour",
@@ -301,7 +312,7 @@ ou
 === Slapage ===
 c -> s
    {
-      "action" : "slap",
+      "header" : {action : "slap", version : 3},
       "cookie" :  "LKJDLAKSJBFLKASN",
       "user_id" : 67,
       "reason" : "blablabla"
@@ -316,7 +327,7 @@ ou
 === Bannissement ===
 c -> s
    {
-      "action" : "ban",
+      "header" : {action : "ban", version : 3},
       "cookie" : "LKJDLAKSJBFLKASN",
       "duration" : 15, // en minute
       "user_id" : 67,
@@ -332,7 +343,7 @@ ou
 === Liste des ip bannis ===
 c -> s
    {
-      "action" : "list_banned_ips",
+      "header" : {action : "list_banned_ips", version : 3},
       "cookie" : "LKJDLAKSJBFLKASN"
    }
 
@@ -357,7 +368,7 @@ s -> c
 === Débannissement ===
 c -> s
    {
-      "action" : "unban",
+      "header" : {action : "unban", version : 3},
       "cookie" : "LKJDLAKSJBFLKASN"
       "ip" : "192.168.1.2"
    }
@@ -375,7 +386,7 @@ Le message est appondu avec un " +++ " devant, par exemple :
 
 c -> s
    {
-      "action" : "correction",
+      "header" : {action : "correction", version : 3},
       "cookie" : "LKJDLAKSJBFLKASN",
       "content" : "Euh non ok, c'est faux"
    }