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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.