X-Git-Url: http://git.euphorik.ch/?p=euphorik.git;a=blobdiff_plain;f=js%2Fchat%2Fmessage.js;h=b3e5f122b241842f73e14baf5ba42f427e64114c;hp=51d84b9cf8898e387790cb6b27cc6a641bbd0753;hb=81393a74d648e4830dc8c7c562fa203f50a105f6;hpb=828daf607fdce322ea17c1786dff84f712aa1632 diff --git a/js/chat/message.js b/js/chat/message.js index 51d84b9..b3e5f12 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 || ""; @@ -28,7 +28,7 @@ euphorik.Reponse = function(id, nick, 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; @@ -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,13 +113,13 @@ 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) : + 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 = ""; @@ -134,7 +134,7 @@ euphorik.Message.prototype.XHTML = function(messagePair, pre) { if (XHTMLrepondA) { XHTMLrepondA = "" + XHTMLrepondA + ""; } - + return "
" + "[" + this.date + "]" + "" + this.auteurId + "" + identifiant + "" + - "" + + "" + "" + XHTMLrepondA + "" + this.formater.completeProcessing(this.contenu, this.nick) + "" +