X-Git-Url: http://git.euphorik.ch/?p=euphorik.git;a=blobdiff_plain;f=js%2Fchat%2Fmessage.js;h=e7439c99974a0c48ba29de4882a8cfbf57e84229;hp=51d84b9cf8898e387790cb6b27cc6a641bbd0753;hb=4a6c575807a90370c0069b688026b10102e1ce10;hpb=5dc140390551c133ac5525725a86854ca69679af diff --git a/js/chat/message.js b/js/chat/message.js index 51d84b9..e7439c9 100644 --- a/js/chat/message.js +++ b/js/chat/message.js @@ -15,7 +15,7 @@ // // You should have received a copy of the GNU General Public License // along with Euphorik. If not, see . - + euphorik.Reponse = function(id, nick, login) { this.id = id; this.nick = nick || ""; @@ -25,10 +25,10 @@ euphorik.Reponse = function(id, nick, login) { /** * Représente un message. */ -euphorik.Message = function(client, formater, element) { +euphorik.Message = function(client, formatter, element) { this.client = client; - this.formater = formater; - + this.formatter = formatter; + this.id = element.id; this.auteurId = element.user_id; this.racineId = element.root; @@ -36,11 +36,11 @@ euphorik.Message = function(client, formater, element) { 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; @@ -63,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); }); @@ -81,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) { @@ -94,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; }; @@ -113,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.completeProcessing(this.nick) : - (this.client.nickFormat === "login" ? this.formater.completeProcessing(this.login) : - this.formater.completeProcessing(this.nick) + "(" + this.formater.completeProcessing(this.login) +")" ); + var identifiant = + this.client.nickFormat === "nick" || this.login === "" ? this.formatter.completeProcessing(this.nick) : + (this.client.nickFormat === "login" ? this.formatter.completeProcessing(this.login) : + this.formatter.completeProcessing(this.nick) + "(" + this.formatter.completeProcessing(this.login) +")" ); var XHTMLrepondA = ""; var debut = true; @@ -128,13 +128,13 @@ euphorik.Message.prototype.XHTML = function(messagePair, pre) { if (!debut) { XHTMLrepondA += ", "; } - XHTMLrepondA += thisMessage.formater.completeProcessing(rep.nick); + XHTMLrepondA += thisMessage.formatter.completeProcessing(rep.nick); debut = false; }); if (XHTMLrepondA) { XHTMLrepondA = "" + XHTMLrepondA + ""; } - + return "
" + "[" + this.date + "]" + "" + this.auteurId + "" + identifiant + "" + - "" + + "" + "" + XHTMLrepondA + - "" + this.formater.completeProcessing(this.contenu, this.nick) + "" + + "" + this.formatter.completeProcessing(this.contenu, this.nick) + "" + "
"; };