This document was generated from CDN thread
Created by: Liz Wendland on 12-05-2010 05:13:41 PM
Hi,
I have found a problem when I try to re-open a Chat session that has already been created. The problem comes from the ChatController>>openSession method:
openSession: function(jid, thread) {
var chatSession = null;
if (!(jid instanceof jabberwerx.JID)) {
jid = new jabberwerx.JID(jid);
}
if (this._getChatSessionIndex(jid) < 0) {
// Create a new session and trigger event
chatSession = new jabberwerx.ChatSession(this.client, jid, thread);
this._chatSessions.push(chatSession);
this.event('chatSessionOpened').trigger({chatSession: chatSession,
userCreated: true});
}
return chatSession;
},
Please notice that if a chat session exists (_getChatSessionIndex >=0) the value of chatSession will never be set.
Here is how I fixed it.
openSession: function(jid, thread) {
var chatSession = null;
if (!(jid instanceof jabberwerx.JID)) {
jid = new jabberwerx.JID(jid);
}
chatSession = this.getSession(jid);
if (chatSession == null) {
// Create a new session and trigger event
chatSession = new jabberwerx.ChatSession(this.client, jid, thread);
this._chatSessions.push(chatSession);
this.event('chatSessionOpened').trigger({chatSession: chatSession,
userCreated: true});
}
return chatSession;
},
I'm not sure if this is the correct way but it seems to work OK for me. I'm hoping this can get fixed in the latest version of the CiscoXMPP libraries.
Thanks!