ADD Bannissement (sans le slap)
[euphorik.git] / js / euphorik.js
index 6685b16..6ed1963 100755 (executable)
@@ -21,19 +21,27 @@ var conf = {
       "bigsmile" : [/:D/g, /:-D/g],\r
       "clin" : [/;\)/g, /;-\)/g],\r
       "cool" : [/8\)/g, /8-\)/g],\r
-      "eheheh" : [/:P/g, /:-P/g],\r
-      "oh" : [/:o/g, /:O/g],\r
+      "eheheh" : [/:P/g, /:-P/g],
+      "lol" : [/\[-lol\]/g],
+      "spliff" : [/\[-spliff\]/g],\r
+      "oh" : [/:o/g, /:O/g],
+      "heink" : [/\[-heink\]/g],
+      "hum" : [/\[-hum\]/g],
+      "boh" : [/\[-boh\]/g],
+      "sniff" : [/:\(/g, /:-\(/g],
+      "triste" : [/\[-triste\]/g],\r
       "pascontent" : [/>\(/g, />\(/g],\r
-      "sniff" : [/:\(/g, /:-\(/g],\r
-      "argn" : [/\[:argn\]/g],\r
-      "bunny" : [/\[:lapin\]/g],\r
-      "chat" : [/\[:chat\]/g],\r
-      "renne" : [/\[:renne\]/g],\r
-      "lol" : [/\[:lol\]/g],\r
-      "spliff" : [/\[:spliff\]/g],\r
-      "star" : [/\[:star\]/g],\r
-      "triste" : [/\[:triste\]/g],\r
-      "kirby" : [/\[:kirby\]/g]\r
+      "argn" : [/\[-argn\]/g],
+      "redface" : [/\[-redface\]/g],\r
+      "bunny" : [/\[-lapin\]/g],\r
+      "chat" : [/\[-chat\]/g],\r
+      "renne" : [/\[-renne\]/g],\r
+      "star" : [/\[-star\]/g],\r
+      "kirby" : [/\[-kirby\]/g],
+      "slurp" : [/\[-slurp\]/g],
+      "agreed" : [/\[-agreed\]/g],
+      "dodo" : [/\[-dodo\]/g],
+      "bn" : [/\[-bn\]/g]\r
    }\r
 }\r
 
@@ -297,7 +305,8 @@ Formateur.prototype.traiterLiensConv = function(M)
 }
 \r
 /**\r
-  * FIXME : Cette méthode est attrocement lourde ! A optimiser.\r
+  * FIXME : Cette méthode est attrocement lourde ! A optimiser.
+  * moyenne su échantillon : 234ms\r
   */
 Formateur.prototype.traiterSmiles = function(M)
 {  
@@ -418,6 +427,7 @@ Client.prototype.resetDonneesPersonnelles = function()
    this.nickFormat = "nick"
    
    this.pagePrincipale = 1
+   this.ekMaster = false
    
    // les conversations, une conversation est un objet possédant les attributs suivants :
    // - racine (entier)
@@ -663,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)
@@ -698,6 +708,7 @@ Client.prototype.chargerDonnees = function(data)
       // les conversations
       thisClient.conversations = data["conversations"]
       
+      thisClient.ekMaster = data["ek_master"]
    }
    this.dernierMessageErreur = data["error_message"]
 }
@@ -760,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)
@@ -792,12 +836,7 @@ jQuery(document).ready(
       initialiserListeStyles(client)
 
       // TODO : pourquoi jQuery(document).unload ne fonctionne pas ?
-      jQuery(window).unload(
-         function()
-         {
-            client.flush(false)
-         }
-      )
+      jQuery(window).unload(function(){client.flush(false)})
       
       jQuery("#menu .minichat").click(function(){ pages.afficherPage("minichat") })
       jQuery("#menu .profile").click(function(){ pages.afficherPage("profile") })\r