Changeset 5217 for trunk


Ignore:
Timestamp:
11/29/11 15:07:21 (12 years ago)
Author:
alexandrecorreia
Message:

Ticket #2356 - Erro corrigido, para mostrar o novo contato adicionado.

Location:
trunk/jabberit_messenger/jmessenger/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/jabberit_messenger/jmessenger/js/trophyim.js

    r5041 r5217  
    622622                if( getAttribute('ask') && getAttribute('ask').toString() === "subscribe" )  
    623623                { 
    624                     if( getAttribute('subscription').toString() === "none" ) 
    625                     { 
    626                         TrophyIM.rosterObj.addContact( getAttribute('jid'), getAttribute('ask'), getAttribute('name'), group_array ); 
    627                     } 
    628                                          
    629624                    if( getAttribute('subscription').toString() === "remove" ) 
    630625                    { 
    631626                        TrophyIM.rosterObj.removeContact( getAttribute('jid').toString() ); 
     627                    } 
     628                    else 
     629                    { 
     630                        TrophyIM.rosterObj.addContact( getAttribute('jid'), getAttribute('ask'), getAttribute('name'), group_array ); 
    632631                    } 
    633632                } 
     
    643642                    } 
    644643                } 
    645                 } 
     644            } 
    646645        } 
    647646 
  • trunk/jabberit_messenger/jmessenger/js/trophyim.mini.js

    r5041 r5217  
    2828{loadscript.rosterDiv();}},storeData:function() 
    2929{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() 
    3231{if(typeof(JSON)!=undefined&&typeof(Strophe)!=undefined) 
    3332{TrophyIM.JSONStore=new TrophyIMJSONStore();if(TrophyIM.JSONStore.store_working&&TrophyIM.cookies['trophyim_bosh_xid']) 
     
    6867if(status==Strophe.Status.CONNECTED) 
    6968{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() 
    7270{if(TrophyIM.logging_div) 
    7371{var logging_div=TrophyIM.client_div.removeChild(document.getElementById('trophyimlog'));} 
     
    8684group_array[group_array.length]=groups[g].firstChild.nodeValue;} 
    8785if(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());} 
     88else 
     89{TrophyIM.rosterObj.addContact(getAttribute('jid'),getAttribute('ask'),getAttribute('name'),group_array);}} 
    9290else 
    9391{if((getAttribute('ask')==null&&getAttribute('subscription').toString()==="remove")||getAttribute('subscription').toString()==="remove") 
     
    407405{current=presence} 
    408406else 
    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"))) 
    411408{current=presence}}}} 
    412409return current;} 
     
    443440return xhr;} 
    444441this.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;}}} 
     442xhr.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;}}} 
    447443this.emptyFix=function(obj){if(typeof(obj)=="object"){for(var i in obj){if(obj[i].constructor==Function) 
    448444continue;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.