X-Git-Url: http://git.euphorik.ch/?p=euphorik.git;a=blobdiff_plain;f=js%2Fchat%2Fmessage.js;h=b3e5f122b241842f73e14baf5ba42f427e64114c;hp=c24be1dd1aa12c83510d2dfa4bf13493c53a7b8b;hb=81393a74d648e4830dc8c7c562fa203f50a105f6;hpb=e49a1c483f1751f129c0766d1061b3da44b60581 diff --git a/js/chat/message.js b/js/chat/message.js index c24be1d..b3e5f12 100644 --- a/js/chat/message.js +++ b/js/chat/message.js @@ -15,12 +15,10 @@ // // You should have received a copy of the GNU General Public License // along with Euphorik. If not, see . - -euphorik.Reponse = function(id, pseudo, login) { + +euphorik.Reponse = function(id, nick, login) { this.id = id; - this.pseudo = pseudo; - this.login = login; - this.pseudo = pseudo || ""; + this.nick = nick || ""; this.login = login || ""; }; @@ -30,19 +28,19 @@ euphorik.Reponse = function(id, pseudo, login) { euphorik.Message = function(client, formater, element) { this.client = client; this.formater = formater; - + this.id = element.id; this.auteurId = element.user_id; this.racineId = element.root; this.date = element.date; - this.pseudo = element.nick; + this.nick = element.nick; this.login = element.login; this.contenu = element.content; - + // l'ensemble des id des messages qui reponde à ce message, exemple : {45:true, 32:true} (le 'true' ne sert à rien ^_^) // mis à jour au fur à mesure que des messages sont ajoutés aux conversations this.estReponduPar = {}; - + this.appartientAuClient = element.owner; this.clientARepondu = element.answered; this.estUneReponse = element.is_a_reply; @@ -65,7 +63,7 @@ euphorik.Message.prototype.getId = function(pre) { euphorik.Message.prototype.setRepondA = function(repondAJSON) { var thisMessage = this; this.repondA = {}; - + repondAJSON.each(function(i, reponse) { thisMessage.repondA[reponse.id] = new euphorik.Reponse(reponse.id, reponse.nick, reponse.login); }); @@ -83,7 +81,7 @@ euphorik.Message.prototype.getConversation = function(messages) { // les messages faisant partie de la conversation var messagesEnEvidence = {}; messagesEnEvidence[this.id] = 1; - + // parcours en profondeur var f = function(ids, premierNiveau, ensemble, evidence) { objectEach(ids, function(id) { @@ -96,13 +94,13 @@ euphorik.Message.prototype.getConversation = function(messages) { } }); }; - + // remonte le temps f(this.estReponduPar, true, "estReponduPar", 2); - + // descent le temps - f(this.repondA, true, "repondA", 3); - + f(this.repondA, true, "repondA", 3); + return messagesEnEvidence; }; @@ -115,14 +113,14 @@ euphorik.Message.prototype.XHTML = function(messagePair, pre) { messagePair = true; } pre = pre || ""; - + thisMessage = this; - + // construit l'identifiant de la personne - var identifiant = - this.client.nickFormat === "nick" || this.login === "" ? this.formater.traitementComplet(this.pseudo) : - (this.client.nickFormat === "login" ? this.formater.traitementComplet(this.login) : - this.formater.traitementComplet(this.pseudo) + "(" + this.formater.traitementComplet(this.login) +")" ); + var identifiant = + this.client.nickFormat === "nick" || this.login === "" ? this.formater.completeProcessing(this.nick) : + (this.client.nickFormat === "login" ? this.formater.completeProcessing(this.login) : + this.formater.completeProcessing(this.nick) + "(" + this.formater.completeProcessing(this.login) +")" ); var XHTMLrepondA = ""; var debut = true; @@ -130,13 +128,13 @@ euphorik.Message.prototype.XHTML = function(messagePair, pre) { if (!debut) { XHTMLrepondA += ", "; } - XHTMLrepondA += thisMessage.formater.traitementComplet(rep.pseudo); + XHTMLrepondA += thisMessage.formater.completeProcessing(rep.nick); debut = false; }); if (XHTMLrepondA) { XHTMLrepondA = "" + XHTMLrepondA + ""; } - + return "
" + "" + "[" + this.date + "]" + - "" + this.auteurId + "" + identifiant + "" + - "" + + "" + this.auteurId + "" + identifiant + "" + + "" + "" + XHTMLrepondA + - "" + this.formater.traitementComplet(this.contenu, this.pseudo) + "" + + "" + this.formater.completeProcessing(this.contenu, this.nick) + "" + "
"; };