mirror of
https://github.com/Mibew/tray.git
synced 2025-01-22 18:10:34 +03:00
fix empty and double messages
git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@97 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
parent
91ab3aee5a
commit
bc06c38ade
@ -58,6 +58,7 @@ Class.inherit( Ajax.ChatThreadUpdater, Ajax.Base, {
|
|||||||
this._options.onComplete = this.requestComplete.bind(this);
|
this._options.onComplete = this.requestComplete.bind(this);
|
||||||
this.updater = {};
|
this.updater = {};
|
||||||
this.frequency = (this._options.frequency || 2);
|
this.frequency = (this._options.frequency || 2);
|
||||||
|
this.cansend = true;
|
||||||
FrameUtils.initFrame(this._options.container);
|
FrameUtils.initFrame(this._options.container);
|
||||||
if( this._options.message ) {
|
if( this._options.message ) {
|
||||||
this._options.message.onkeydown = this.handleKeyDown.bind(this);
|
this._options.message.onkeydown = this.handleKeyDown.bind(this);
|
||||||
@ -96,6 +97,7 @@ Class.inherit( Ajax.ChatThreadUpdater, Ajax.Base, {
|
|||||||
|
|
||||||
requestComplete: function(_response) {
|
requestComplete: function(_response) {
|
||||||
this.enableInput(true);
|
this.enableInput(true);
|
||||||
|
this.cansend = true;
|
||||||
var xmlRoot = Ajax.getXml(_response);
|
var xmlRoot = Ajax.getXml(_response);
|
||||||
if( xmlRoot && xmlRoot.tagName == 'thread' ) {
|
if( xmlRoot && xmlRoot.tagName == 'thread' ) {
|
||||||
this.updateContent( xmlRoot );
|
this.updateContent( xmlRoot );
|
||||||
@ -107,6 +109,10 @@ Class.inherit( Ajax.ChatThreadUpdater, Ajax.Base, {
|
|||||||
},
|
},
|
||||||
|
|
||||||
postMessage: function(msg) {
|
postMessage: function(msg) {
|
||||||
|
if( msg == "" || !this.cansend) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.cansend = false;
|
||||||
this.stopUpdate();
|
this.stopUpdate();
|
||||||
this.updateOptions("post");
|
this.updateOptions("post");
|
||||||
var postOptions = {}.extend(this._options);
|
var postOptions = {}.extend(this._options);
|
||||||
|
Loading…
Reference in New Issue
Block a user