+ $("#menu .profile").css("display", displayType).text("login")\r
+ $("#menu .logout").css("display", "none")
+ $("#menu .register").css("display", displayType)
+ }
+}
+
+Client.prototype.slap = function(userId, raison)
+{
+ var thisClient = this
+
+ jQuery.ajax({
+ type: "POST",
+ url: "request",
+ dataType: "json",
+ data: this.util.jsonVersAction(
+ {
+ "action" : "slap",
+ "cookie" : thisClient.cookie,
+ "user_id" : userId,
+ "reason" : raison
+ }),
+ success:
+ function(data)
+ {
+ if (data["reply"] == "error")
+ thisClient.util.messageDialogue(data["error_message"])
+ }
+ })
+}
+
+Client.prototype.ban = function(userId, raison, 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,
+ "reason" : raison
+ }),
+ success:
+ function(data)
+ {
+ if (data["reply"] == "error")
+ thisClient.util.messageDialogue(data["error_message"])
+ }
+ })
+}
+
+Client.prototype.kick = function(userId, raison)
+{
+ this.ban(userId, raison, 15)
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * classe permettant de gérer les événements (push serveur).
+ * @page la page
+ */
+function PageEvent(page, util)
+{
+ this.page = page
+ this.util = util
+
+ // l'objet JSONHttpRequest représentant la connexion d'attente
+ this.attenteCourante = null
+}
+
+/**
+ * Arrête l'attente courante s'il y en a une.
+ */
+PageEvent.prototype.stopAttenteCourante = function()
+{
+ if (this.attenteCourante != null)
+ this.attenteCourante.abort()
+}
+
+/**
+ * Attend un événement lié à la page.
+ * @funSend une fonction renvoyant les données json à envoyer
+ * @funReceive une fonction qui accepte un paramètre correspondant au données reçues
+ */
+PageEvent.prototype.waitEvent = function(funSend, funReceive)
+{
+ var thisPageEvent = this
+
+ this.stopAttenteCourante()
+
+ // on doit conserver l'ordre des valeurs de l'objet JSON (le serveur les veux dans l'ordre définit dans le protocole)
+ // TODO : ya pas mieux ?
+ var dataToSend =
+ {
+ "action" : "wait_event",
+ "page" : this.page