ADD nouveaux smiles
[euphorik.git] / js / pageMinichat.js
index 637ff21..8d914b4 100755 (executable)
@@ -413,7 +413,7 @@ Conversation.prototype.viderMessages = function()
   * d'afficher les messages non-affichés.
   * @param funClickExtract fonction (fun(numMess)) appellée lors du clic sur un bouton "extraire"
   */
-Conversation.prototype.flush = function(funClickExtract, funClickLienConv)
+Conversation.prototype.flush = function(funClickOuvrirConv)
 {
    var thisConversation = this
 
@@ -431,8 +431,9 @@ Conversation.prototype.flush = function(funClickExtract, funClickLienConv)
          
          // construit l'identifiant de la personne
          var identifiant = 
-            this.client.nickFormat == "nick" ? message.pseudo : 
-            (this.client.nickFormat == "login" ? message.login : message.pseudo + "(" + message.login +")" )
+            this.client.nickFormat == "nick" ? this.formateur.traitementComplet(message.pseudo) : 
+            (this.client.nickFormat == "login" ? this.formateur.traitementComplet(message.login) : 
+            this.formateur.traitementComplet(message.pseudo) + "<span class=\"login\">(" + this.formateur.traitementComplet(message.login) +")</span>" )
          
          var XHTMLrepondA = ""
          for (var id in message.repondA)
@@ -448,7 +449,7 @@ Conversation.prototype.flush = function(funClickExtract, funClickLienConv)
             "\">" +
                "<div class=\"extraire\">&gt;</div>" +
                "[<span class=\"date\">" + message.date + "</span>]" +
-               "<span class=\"pseudo\">" + this.formateur.traitementComplet(identifiant) + "</span>:" +
+               "<span class=\"pseudo\">" + identifiant + "</span>:" +
                XHTMLrepondA +
                "<span class=\"contenu\">" + (message.systeme ? this.formateur.remplacerBalisesHTML(message.contenu) : this.formateur.traitementComplet(message.contenu, message.pseudo)) + "</span>" +
             "</div>"
@@ -477,7 +478,7 @@ Conversation.prototype.flush = function(funClickExtract, funClickLienConv)
             {          
                // FIXME : ya pas mieux ?
                var racine = jQuery(event.target).text()
-               funClickLienConv(parseInt(racine.substring(1, racine.length - 1), 36))
+               funClickOuvrirConv(parseInt(racine.substring(1, racine.length - 1), 36))
                return false
             }
          )
@@ -493,7 +494,7 @@ Conversation.prototype.flush = function(funClickExtract, funClickLienConv)
                // extraction d'une conversation
                if (jQuery(event.target).is(".extraire"))
                {
-                  funClickExtract(parseInt(idMess, 36))
+                  funClickOuvrirConv(parseInt(idMess, 36))
                   return
                }
             
@@ -757,20 +758,21 @@ Messages.prototype.flush = function(numConv)
    var thisMessages = this
    
    this.conversations[numConv].flush(
-      // fonction appelée lors de la demande d'extraction d'une conversation
-      function(idMess)
-      {
-         if (thisMessages.client.ajouterConversation(idMess))
-            thisMessages.rafraichirMessages(true)
-      },
       function(racine) // appelé lorsqu'un utilisateur click sur un lien vers une conversation
       {
-         if (thisMessages.client.ajouterConversation(racine))
-            thisMessages.rafraichirMessages(true)
+         thisMessages.ouvrirConversation(racine)
       }
    )
 }
 
+Messages.prototype.ouvrirConversation = function(racine)
+{
+   if (this.client.ajouterConversation(racine))
+      this.rafraichirMessages(true)
+   else
+      this.util.messageDialogue("Cette conversation est déjà ouverte")
+}
+
 Messages.prototype.viderMessages = function()
 {
    // Obsolète