Changeset 2994


Ignore:
Timestamp:
07/05/10 15:52:19 (14 years ago)
Author:
alexandrecorreia
Message:

Ticket #1116 - As vezes a operacao de remover um contato da lista nao funcionava direito.

Location:
trunk/jmessenger/js
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/jmessenger/js/AddUser.js

    r2990 r2994  
    7979                        if( jidFrom != jidTo ) 
    8080                        { 
     81                                TrophyIM.rosterObj.removeContact( jidTo ); 
     82                                 
    8183                                // Remove Element 
    8284                                loadscript.removeElement( getElement('itenContact_' + jidTo ) ); 
    8385                                loadscript.removeElement( getElement('span_show_itenContact_' + jidTo ) ); 
    8486                                loadscript.removeElement( getElement('itenContactNotification_' + jidTo ) ); 
    85          
    86                                 TrophyIM.rosterObj.removeContact( jidTo ); 
    8787 
    8888                                TrophyIM.addContact( jidTo, name, group ); 
  • trunk/jmessenger/js/jscode/loadIM.js

    r2988 r2994  
    878878                switch(subscription) 
    879879                { 
    880                         case 'from': 
     880                                case 'from': 
     881                                case 'subscribe' : 
     882                                         
     883                                        TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid), 'subscribed'); 
     884                                break; 
     885                                 
     886                                case 'none' :                                    
    881887                                 
    882888                                TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid), 'subscribe'); 
     889                                //TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid), 'subscribed'); 
    883890                                break; 
    884  
    885                         case 'none' : 
    886891                                 
    887                                 TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid), 'subscribe'); 
     892                        case 'to' :                              
     893                                 
    888894                                TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid), 'subscribed'); 
    889                                  
     895                                removeElement( getElement('itenContactNotification_' + jidTo ) );                                
    890896                                break; 
    891897 
    892898                        case 'not-in-roster': 
    893899                                         
    894                                 setTimeout(function() 
     900                                /*setTimeout(function() 
    895901                                        { 
    896902                                        var _add = ""; 
     
    901907                                        } 
    902908                                         
    903                                         },100); 
     909                                        },100);*/ 
     910                                 
     911                                        addUser.add( jidTo ); 
    904912                                 
    905913                                        break; 
    906914                                         
    907                         case 'to' : 
    908  
    909                                 TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid), 'subscribed'); 
    910                                  
    911                                 removeElement( getElement('itenContactNotification_' + jidTo ) ); 
     915                                default: 
    912916                                         
    913                         case 'subscribe' : 
    914                                  
    915                                 TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid), 'subscribe'); 
    916                                  
    917                                         break; 
     917                                        alert( "EU NÃO SEI : " + subscription ); 
    918918                } 
    919919        } 
  • trunk/jmessenger/js/trophyim.js

    r2990 r2994  
    594594                                                group_array[group_array.length] = groups[g].firstChild.nodeValue; 
    595595                                } 
    596                                  
    597                                 if( getAttribute('ask') ) 
    598                                         TrophyIM.rosterObj.addContact(getAttribute('jid'), getAttribute('ask'), getAttribute('name'), group_array); 
     596 
     597                                if( getAttribute('ask') && getAttribute('ask').toString() === "subscribe" ) 
     598                                { 
     599                                        if( getAttribute('subscription').toString() === "none" ) 
     600                                        { 
     601                                                TrophyIM.rosterObj.addContact( getAttribute('jid'), getAttribute('ask'), getAttribute('name'), group_array ); 
     602                                        } 
     603                                         
     604                                        if( getAttribute('subscription').toString() === "remove" ) 
     605                                        { 
     606                                                TrophyIM.rosterObj.removeContact(getAttribute('jid')); 
     607                                        } 
     608                                } 
    599609                                else 
    600                                         TrophyIM.rosterObj.addContact(getAttribute('jid'), getAttribute('subscription'), getAttribute('name'), group_array); 
     610                                { 
     611                                        if( getAttribute('subscription').toString() === "remove" ) 
     612                                        { 
     613                                                TrophyIM.rosterObj.removeContact(getAttribute('jid')); 
     614                                        } 
     615                                        else 
     616                                        { 
     617                                                TrophyIM.rosterObj.addContact( getAttribute('jid'), getAttribute('subscription'), getAttribute('name'), group_array ); 
     618                                        } 
     619                                } 
    601620                        } 
    602621        } 
     
    12461265                                                        case "from" : 
    12471266                                                                 
    1248                                                                 status          = " (( " + i18n.AUTH_ASK + " )) "; 
     1267                                                                status          = " (( " + i18n.AUTHORIZED + " )) "; 
    12491268                                                                statusColor = "green"; 
    12501269                                                                break; 
     
    12601279                                                                status          = " (( " + i18n.ASK_FOR_AUTH_QUESTION  + " )) "; 
    12611280                                                                statusColor     = "orange";      
     1281                                                                break; 
     1282                                                                 
     1283                                                        default : 
     1284                                                                 
    12621285                                                                break; 
    12631286                                                } 
     
    13971420                                var _subscription = TrophyIM.rosterObj.roster[users[i]].contact.subscription; 
    13981421                                 
    1399                                 if( _subscription == "to" || _subscription == "not-in-roster") 
     1422                                if( _subscription === "to" ) 
     1423                                { 
     1424                                        flag = true; 
     1425                                } 
     1426                                 
     1427                                if(  _subscription === "not-in-roster") 
    14001428                                { 
    14011429                                        flag = true; 
     
    14581486        var _id = TrophyIM.connection.getUniqueId(); 
    14591487         
    1460         TrophyIM.connection.send($pres( ).attrs( {to: jidTo, from: jidFrom, type: _typeSubscription, id: _id}).tree()); 
     1488        TrophyIM.connection.send($pres( ).attrs({ from: jidFrom, to: jidTo, type: _typeSubscription, id: _id }).tree()); 
    14611489        }, 
    14621490     
     
    16961724        this.addContact = function(jid, subscription, name, groups ) 
    16971725        { 
    1698                 switch( subscription ) 
    1699                 { 
    1700                         case 'remove'   : 
    1701  
    1702                                 this.removeContact(jid); 
    1703                                 break; 
    1704                                  
    1705                         default : 
    1706                                  
    1707                                 var contact             = { jid:jid, subscription:subscription, name:name, groups:groups } 
    1708                         var jid_lower   = jid.toLowerCase(); 
    1709                  
    1710                                 if ( this.roster[jid_lower] ) 
    1711                                 { 
    1712                             this.roster[jid_lower]['contact'] = contact; 
    1713                         } 
    1714                                 else 
    1715                                 { 
    1716                             this.roster[jid_lower] = {contact:contact}; 
    1717                         } 
    1718          
    1719                                 groups = groups ? groups : ['']; 
    1720                          
    1721                                 for ( var g = 0; g < groups.length; g++ ) 
    1722                                 { 
    1723                                         if ( !this.groups[groups[g]] ) 
    1724                                         { 
    1725                                 this.groups[groups[g]] = {}; 
    1726                             } 
    1727                              
    1728                                         this.groups[groups[g]][jid_lower] = jid_lower; 
    1729                         } 
    1730                 } 
    1731                  
    1732                 /*if( subscription.indexOf("remove") >= 0 ) 
     1726                if( subscription === "remove" ) 
    17331727        { 
    17341728                        this.removeContact(jid); 
     
    17591753                                this.groups[groups[g]][jid_lower] = jid_lower; 
    17601754                } 
    1761         }*/ 
     1755        } 
    17621756    } 
    17631757     
Note: See TracChangeset for help on using the changeset viewer.