From bc06c38ade193d5c6cf705071d5e05d42ddc1dd1 Mon Sep 17 00:00:00 2001 From: Evgeny Gryaznov Date: Wed, 4 Jun 2008 23:20:02 +0000 Subject: [PATCH] fix empty and double messages git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@97 c66351dc-e62f-0410-b875-e3a5c0b9693f --- src/obfuscator/src/page_chat2.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/obfuscator/src/page_chat2.js b/src/obfuscator/src/page_chat2.js index 85803fd6..25f9bd40 100644 --- a/src/obfuscator/src/page_chat2.js +++ b/src/obfuscator/src/page_chat2.js @@ -58,6 +58,7 @@ Class.inherit( Ajax.ChatThreadUpdater, Ajax.Base, { this._options.onComplete = this.requestComplete.bind(this); this.updater = {}; this.frequency = (this._options.frequency || 2); + this.cansend = true; FrameUtils.initFrame(this._options.container); if( this._options.message ) { this._options.message.onkeydown = this.handleKeyDown.bind(this); @@ -96,6 +97,7 @@ Class.inherit( Ajax.ChatThreadUpdater, Ajax.Base, { requestComplete: function(_response) { this.enableInput(true); + this.cansend = true; var xmlRoot = Ajax.getXml(_response); if( xmlRoot && xmlRoot.tagName == 'thread' ) { this.updateContent( xmlRoot ); @@ -107,6 +109,10 @@ Class.inherit( Ajax.ChatThreadUpdater, Ajax.Base, { }, postMessage: function(msg) { + if( msg == "" || !this.cansend) { + return; + } + this.cansend = false; this.stopUpdate(); this.updateOptions("post"); var postOptions = {}.extend(this._options);