ADD Bannissement (sans le slap)
[euphorik.git] / js / euphorik.js
index 2d64fe2..6ed1963 100755 (executable)
@@ -673,10 +673,10 @@ Client.prototype.connexion = function(messageJson)
 \r
 Client.prototype.deconnexion = function()\r
 {
-   this.flush()\r
+   this.flush()
+   this.delCookie()\r
    this.setStatut(statutType.deconnected) // deconnexion\r
    this.resetDonneesPersonnelles()\r
-   this.delCookie ()\r
 }
 
 Client.prototype.chargerDonnees = function(data)
@@ -771,6 +771,39 @@ Client.prototype.majMenu = function()
    }
 }
 
+Client.prototype.ban = function(userId, minutes)
+{
+   var thisClient = this
+
+   // par défaut un ban correspond à 3 jours
+   if (typeof(minutes) == "undefined")
+      minutes = 60 * 24 * 3
+      
+   jQuery.ajax({
+      type: "POST",
+      url: "request",
+      dataType: "json",
+      data: this.util.jsonVersAction(
+         {
+            "action" : "ban",
+            "cookie" : thisClient.cookie,
+            "duration" : minutes,
+            "user_id" : userId
+         }),
+      success: 
+         function(data)
+         {
+            if (data["reply"] == "error")
+               thisClient.util.messageDialogue(data["error_message"])
+         }
+   })
+}
+
+Client.prototype.kick = function(userId)
+{
+   this.ban(userId, 15)
+}
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 function initialiserListeStyles(client)