(no commit message)
[euphorik.git] / doc / protocole3.txt
index e89b357..2eb81a6 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,19 @@ Le mot de passe est hashé en md5.
 
 c -> s
    { 
-      "action" : "authentification",
+      "header" : {action : "register", version : 3},
       "login" : "paul",
-      "password" : "IJKJDHHSAD9081238"
+      "password" : "IJKJDHHSAD9081238",
+      "profile" : { .. } // voir <profile>
    }
 ou
    {
-      "action" : "authentification",
+      "header" : {action : "authentification", version : 3}
       "cookie" : "LKJDLAKSJBFLKASN"
    }
 ou
    {
-      "action" : "register",
+      "header" : {action : "authentification", version : 3},
       "login" : "paul",
       "password" : "IJKJDHHSAD9081238"
    }
@@ -66,54 +75,44 @@ ou
 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",
+      "status" : "auth_registered" | "auth_not_registered",
       "cookie" : "LKJDLAKSJBFLKASN",
       "id" : 193,
-      "nick" : "Paul",
       "login" : "paul49",
-      "email" : "paul@pierre.com",
-      "css" : "css/3/euphorik.css",
-      "nick_format" : "nick" | "login" | "nick_login",
-      "view_times" : true | false,
-      "view_tooltips" : true | false,
-      // "main_page" : 1,
-      "conversations" : [3, 8],
-      "ek_master" : true | false
+      "ek_master" : true | false,
+      "profile" : <profile>
    }
  
  
 === Logout ===
 c -> s
    {
-      "action" : "logout",
+      "header" : {action : "logout", version : 3},
       "cookie" : "LKJDLAKSJBFLKASN"
    }
  
  
 === Profile ===
-c -> s
+<profile>
    {
-      "action" : "set_profile",
-      "cookie" : "LKJDLAKSJBFLKASN",
-      "login" : "paul49",
-      "password" : "IJKJDHHSAD9081238",
       "nick" : "Paul",
       "email" : "paul@pierre.com",
       "css" : "css/3/euphorik.css",
+      "chat_order" : "chrono" | "reverse",
       "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"
+   }
+
+c -> s
+   {
+      "header" : {action : "set_profile", version : 3},
+      "cookie" : "LKJDLAKSJBFLKASN",
+      "login" : "paul49",
+      "password" : "IJKJDHHSAD9081238",
+      "profile" : <profile>
    }
       
 s -> c
@@ -127,9 +126,30 @@ 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",
+      "last_modification" : "Hier 17:26:54"
+   }
+
 c -> s
    {
-      "action" : "wait_event",
+      "header" : {action : "wait_event", version : 3},
       "page" : "chat"
       "cookie" : "LKJDLAKSJBFLKASN",
       "message_count" : 10,
@@ -149,39 +169,23 @@ 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
    {
       "reply" : "message_updated",
       "message_id" : 123,
-      "content" : "Salut +++ poulpe"
+      "content" : "Salut poulpe",
+      "last_modification" : "Hier 17:26:54"
    }
 ou
    {
@@ -197,7 +201,7 @@ ou
 === Wait event (page = admin) ===
 c -> s
    {
-      "action" : "wait_event",
+      "header" : {action : "wait_event", version : 3},
       "page" : "admin",
       "last_troll" : 5
    }
@@ -239,7 +243,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 +257,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 +272,7 @@ ou
 === Suppression d'un troll ===
 c -> s
    {
-      "action" : "del_troll",
+      "header" : {action : "del_troll", version : 3},
       "cookie" : "LKJDLAKSJBFLKASN",
       "troll_id" : 3
    }
@@ -285,7 +289,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 +305,7 @@ ou
 === Slapage ===
 c -> s
    {
-      "action" : "slap",
+      "header" : {action : "slap", version : 3},
       "cookie" :  "LKJDLAKSJBFLKASN",
       "user_id" : 67,
       "reason" : "blablabla"
@@ -316,7 +320,7 @@ ou
 === Bannissement ===
 c -> s
    {
-      "action" : "ban",
+      "header" : {action : "ban", version : 3},
       "cookie" : "LKJDLAKSJBFLKASN",
       "duration" : 15, // en minute
       "user_id" : 67,
@@ -332,7 +336,7 @@ ou
 === Liste des ip bannis ===
 c -> s
    {
-      "action" : "list_banned_ips",
+      "header" : {action : "list_banned_ips", version : 3},
       "cookie" : "LKJDLAKSJBFLKASN"
    }
 
@@ -357,7 +361,7 @@ s -> c
 === Débannissement ===
 c -> s
    {
-      "action" : "unban",
+      "header" : {action : "unban", version : 3},
       "cookie" : "LKJDLAKSJBFLKASN"
       "ip" : "192.168.1.2"
    }
@@ -375,7 +379,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"
    }