Changeset 5217
- Timestamp:
- 11/29/11 15:07:21 (11 years ago)
- Location:
- trunk/jabberit_messenger/jmessenger/js
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/jabberit_messenger/jmessenger/js/trophyim.js
r5041 r5217 622 622 if( getAttribute('ask') && getAttribute('ask').toString() === "subscribe" ) 623 623 { 624 if( getAttribute('subscription').toString() === "none" )625 {626 TrophyIM.rosterObj.addContact( getAttribute('jid'), getAttribute('ask'), getAttribute('name'), group_array );627 }628 629 624 if( getAttribute('subscription').toString() === "remove" ) 630 625 { 631 626 TrophyIM.rosterObj.removeContact( getAttribute('jid').toString() ); 627 } 628 else 629 { 630 TrophyIM.rosterObj.addContact( getAttribute('jid'), getAttribute('ask'), getAttribute('name'), group_array ); 632 631 } 633 632 } … … 643 642 } 644 643 } 645 644 } 646 645 } 647 646 -
trunk/jabberit_messenger/jmessenger/js/trophyim.mini.js
r5041 r5217 28 28 {loadscript.rosterDiv();}},storeData:function() 29 29 {if(TrophyIM.connection&&TrophyIM.connection.connected) 30 {TrophyIM.setCookie('trophyim_bosh_xid',TrophyIM.connection.jid+"|"+ 31 TrophyIM.connection.sid+"|"+TrophyIM.connection.rid);TrophyIM.rosterObj.save();}},showLogin:function() 30 {TrophyIM.setCookie('trophyim_bosh_xid',TrophyIM.connection.jid+"|"+TrophyIM.connection.sid+"|"+TrophyIM.connection.rid);TrophyIM.rosterObj.save();}},showLogin:function() 32 31 {if(typeof(JSON)!=undefined&&typeof(Strophe)!=undefined) 33 32 {TrophyIM.JSONStore=new TrophyIMJSONStore();if(TrophyIM.JSONStore.store_working&&TrophyIM.cookies['trophyim_bosh_xid']) … … 68 67 if(status==Strophe.Status.CONNECTED) 69 68 {loadscript.setStatusJabber(i18n.STATUS_AVAILABLE,'available');TrophyIM.statusConn.connected=true;TrophyIM.showClient();}},showClient:function() 70 {TrophyIM.setCookie('trophyim_bosh_xid',TrophyIM.connection.jid+"|"+ 71 TrophyIM.connection.sid+"|"+TrophyIM.connection.rid);TrophyIM.rosterObj=new TrophyIMRoster();TrophyIM.connection.addHandler(TrophyIM.onVersion,Strophe.NS.VERSION,'iq',null,null,null);TrophyIM.connection.addHandler(TrophyIM.onRoster,Strophe.NS.ROSTER,'iq',null,null,null);TrophyIM.connection.addHandler(TrophyIM.onPresence,null,'presence',null,null,null);TrophyIM.connection.addHandler(TrophyIM.onMessage,null,'message',null,null,null);TrophyIM.connection.send($iq({type:'get',xmlns:Strophe.NS.CLIENT}).c('query',{xmlns:Strophe.NS.ROSTER}).tree());TrophyIM.connection.send($pres().tree());setTimeout(TrophyIM.renderRoster,1000);},clearClient:function() 69 {TrophyIM.setCookie('trophyim_bosh_xid',TrophyIM.connection.jid+"|"+TrophyIM.connection.sid+"|"+TrophyIM.connection.rid);TrophyIM.rosterObj=new TrophyIMRoster();TrophyIM.connection.addHandler(TrophyIM.onVersion,Strophe.NS.VERSION,'iq',null,null,null);TrophyIM.connection.addHandler(TrophyIM.onRoster,Strophe.NS.ROSTER,'iq',null,null,null);TrophyIM.connection.addHandler(TrophyIM.onPresence,null,'presence',null,null,null);TrophyIM.connection.addHandler(TrophyIM.onMessage,null,'message',null,null,null);TrophyIM.connection.send($iq({type:'get',xmlns:Strophe.NS.CLIENT}).c('query',{xmlns:Strophe.NS.ROSTER}).tree());TrophyIM.connection.send($pres().tree());setTimeout(TrophyIM.renderRoster,1000);},clearClient:function() 72 70 {if(TrophyIM.logging_div) 73 71 {var logging_div=TrophyIM.client_div.removeChild(document.getElementById('trophyimlog'));} … … 86 84 group_array[group_array.length]=groups[g].firstChild.nodeValue;} 87 85 if(getAttribute('ask')&&getAttribute('ask').toString()==="subscribe") 88 {if(getAttribute('subscription').toString()===" none")89 {TrophyIM.rosterObj. addContact(getAttribute('jid'),getAttribute('ask'),getAttribute('name'),group_array);}90 if(getAttribute('subscription').toString()==="remove") 91 {TrophyIM.rosterObj. removeContact(getAttribute('jid').toString());}}86 {if(getAttribute('subscription').toString()==="remove") 87 {TrophyIM.rosterObj.removeContact(getAttribute('jid').toString());} 88 else 89 {TrophyIM.rosterObj.addContact(getAttribute('jid'),getAttribute('ask'),getAttribute('name'),group_array);}} 92 90 else 93 91 {if((getAttribute('ask')==null&&getAttribute('subscription').toString()==="remove")||getAttribute('subscription').toString()==="remove") … … 407 405 {current=presence} 408 406 else 409 {if(presence['priority']>current['priority']&&((presence['show']=="chat" 410 ||presence['show']=="available")||(current['show']!="chat"||current['show']!="available"))) 407 {if(presence['priority']>current['priority']&&((presence['show']=="chat"||presence['show']=="available")||(current['show']!="chat"||current['show']!="available"))) 411 408 {current=presence}}}} 412 409 return current;} … … 443 440 return xhr;} 444 441 this.getData=function(vars){if(typeof(TROPHYIM_JSON_STORE)!=undefined){Strophe.debug("Retrieving JSONStore data");var xhr=this._newXHR();var getdata="get="+vars.join(",");try{xhr.open("POST",TROPHYIM_JSON_STORE,false);}catch(e){Strophe.error("JSONStore open failed.");return false;} 445 xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded');xhr.setRequestHeader('Content-length',getdata.length);xhr.send(getdata);if(xhr.readyState==4&&xhr.status==200){try{var dataObj=JSON.parse(xhr.responseText);return this.emptyFix(dataObj);}catch(e){Strophe.error("Could not parse JSONStore response"+ 446 xhr.responseText);return false;}}else{Strophe.error("JSONStore open failed. Status: "+xhr.status);return false;}}} 442 xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded');xhr.setRequestHeader('Content-length',getdata.length);xhr.send(getdata);if(xhr.readyState==4&&xhr.status==200){try{var dataObj=JSON.parse(xhr.responseText);return this.emptyFix(dataObj);}catch(e){Strophe.error("Could not parse JSONStore response"+xhr.responseText);return false;}}else{Strophe.error("JSONStore open failed. Status: "+xhr.status);return false;}}} 447 443 this.emptyFix=function(obj){if(typeof(obj)=="object"){for(var i in obj){if(obj[i].constructor==Function) 448 444 continue;if(i=='_empty_'){obj[""]=this.emptyFix(obj['_empty_']);delete obj['_empty_'];}else{obj[i]=this.emptyFix(obj[i]);}}}
Note: See TracChangeset
for help on using the changeset viewer.