Ignore:
Timestamp:
06/25/10 17:59:42 (14 years ago)
Author:
alexandrecorreia
Message:

Ticket #1116 - Melhorar a visualizacao/avisos de novos contatos e pedidos de autorizacao no modulo.

File:
1 edited

Legend:

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

    r2966 r2971  
    345345    log : function(level, msg) 
    346346    { 
    347         if (TrophyIM.logging_div && level >= TROPHYIM_LOGLEVEL) { 
    348             while(TrophyIM.logging_div.childNodes.length > TROPHYIM_LOG_LINES) { 
    349                 TrophyIM.logging_div.removeChild( 
    350                 TrophyIM.logging_div.firstChild); 
     347        if (TrophyIM.logging_div && level >= TROPHYIM_LOGLEVEL) 
     348        { 
     349            while(TrophyIM.logging_div.childNodes.length > TROPHYIM_LOG_LINES) 
     350            { 
     351                TrophyIM.logging_div.removeChild( TrophyIM.logging_div.firstChild ); 
    351352            } 
     353             
    352354            var msg_div = document.createElement('div'); 
    353355            msg_div.className = 'trophyimlogitem'; 
    354356            msg_div.appendChild(document.createTextNode(msg)); 
     357             
    355358            TrophyIM.logging_div.appendChild(msg_div); 
    356359            TrophyIM.logging_div.scrollTop = TrophyIM.logging_div.scrollHeight; 
     
    589592                                                group_array[group_array.length] = groups[g].firstChild.nodeValue; 
    590593                                } 
    591  
     594                                 
    592595                                if( getAttribute('ask') ) 
    593596                                        TrophyIM.rosterObj.addContact(getAttribute('jid'), getAttribute('ask'), getAttribute('name'), group_array); 
     
    966969     */ 
    967970     
    968     renameContact : function( jid, index ) 
     971    renameContact : function( jid ) 
    969972    { 
    970973        // Name 
     
    984987        TrophyIM.addContact( jidTo, name, group ); 
    985988         
    986         document.getElementById('itenContact_' + jid + '_' + index).innerHTML = name; 
     989        document.getElementById('itenContact_' + jid ).innerHTML = name; 
    987990    }, 
    988991     
     
    992995     */ 
    993996 
    994     renameGroup : function( jid, index) 
     997    renameGroup : function( jid ) 
    995998    { 
    996999        var group               = TrophyIM.rosterObj.roster[jid].contact.groups[0]; 
     
    10351038     */ 
    10361039     
    1037     removeContact : function(jidTo, indexTo) 
     1040    removeContact : function( jidTo ) 
    10381041    { 
    10391042        var divItenContact       = null; 
    10401043        var spanShow             = null; 
    10411044         
    1042         if( ( divItenContact = document.getElementById('itenContact_' + jidTo + '_' + indexTo ))) 
     1045        if( ( divItenContact = document.getElementById('itenContact_' + jidTo ))) 
    10431046        {        
    1044                 spanShow = document.getElementById('span_show_itenContact_' + jidTo + '_' + indexTo ) 
     1047                spanShow = document.getElementById('span_show_itenContact_' + jidTo ) 
    10451048                 
    10461049                spanShow.parentNode.removeChild(spanShow); 
     
    11851188                                var group               = arguments[1]; 
    11861189                                var element             = arguments[2]; 
    1187                                 var index               = arguments[3]; 
    11881190                                var showOffline = loadscript.getShowContactsOffline(); 
    11891191                                 
     
    11931195                                var statusColor         = "black"; 
    11941196                                var statusDisplay       = "none"; 
     1197                                 
     1198                                var _resource   = ""; 
    11951199                                 
    11961200                                // Set Presence  
     
    12371241                                                                statusColor     = "orange"; 
    12381242                                                                 
    1239                                                                 if ( TrophyIM.controll.notificationNewUsers == 0 )  
     1243                                                                if ( TrophyIM.controll.notificationNewUsers == 0 ) 
    12401244                                                                { 
    1241                                                                         loadscript.teste_new(); 
     1245                                                                        loadscript.enabledNotificationNewUsers(); 
    12421246                                                                        TrophyIM.controll.notificationNewUsers++; 
    12431247                                                                } 
     
    12621266                                                                statusColor     = "orange";      
    12631267                                                                 
    1264                                                                 if ( TrophyIM.controll.notificationNewUsers == 0 )  
     1268                                                                if ( TrophyIM.controll.notificationNewUsers == 0 ) 
    12651269                                                                { 
    1266                                                                         loadscript.teste_new(); 
     1270                                                                        loadscript.enabledNotificationNewUsers(); 
    12671271                                                                        TrophyIM.controll.notificationNewUsers++; 
    12681272                                                                } 
     
    12781282                                }; 
    12791283 
    1280                                 var itensJid    = document.getElementById( "itenContact_" + objContact.contact.jid + "_" + index ); 
     1284                                var itensJid    = document.getElementById( "itenContact_" + objContact.contact.jid ); 
    12811285 
    12821286                                if( itensJid == null ) 
     
    12991303                                        { 
    13001304                                                divDisplay              : "block",  
    1301                                                 id                              : 'itenContact_' + objContact.contact.jid + '_' + index , 
    1302                                                 index                   : ((index == 0 ) ? "0" : index), 
     1305                                                id                              : 'itenContact_' + objContact.contact.jid , 
    13031306                                                jid                             : objContact.contact.jid, 
    13041307                                                nameContact     : nameContact, 
     
    13081311                                                status                  : status, 
    13091312                                                statusColor             : "black", 
    1310                                                 subscription    : objContact.contact.subscription 
     1313                                                subscription    : objContact.contact.subscription, 
     1314                                                resource                : _resource 
    13111315                                        } 
    13121316                                         
     
    13431347                                        _subscription( objContact ); 
    13441348                                         
    1345                                         with ( document.getElementById('span_show_' + 'itenContact_' + objContact.contact.jid + '_' + index ) ) 
     1349                                        // Set subscription 
     1350                                        itensJid.setAttribute('subscription', objContact.contact.subscription ); 
     1351                                         
     1352                                        with ( document.getElementById('span_show_' + 'itenContact_' + objContact.contact.jid ) ) 
    13461353                                        { 
    13471354                                                if( presence == "unavailable" && !showOffline ) 
     
    13611368                                         
    13621369                                        if( presence == "unavailable" && !showOffline ) 
     1370                                        { 
    13631371                                                itensJid.style.display = "none"; 
     1372                                        } 
    13641373                                        else 
    13651374                                        { 
     
    13761385                                if( !objContact.presence && !showOffline ) 
    13771386                                { 
    1378                                         with ( document.getElementById('span_show_' + 'itenContact_' + objContact.contact.jid + '_' + index )) 
     1387                                        with ( document.getElementById('span_show_' + 'itenContact_' + objContact.contact.jid )) 
    13791388                                        { 
    13801389                                                style.display   = "none"; 
    13811390                                        } 
    13821391 
    1383                                         with ( document.getElementById('itenContact_' + objContact.contact.jid + '_' + index ) ) 
     1392                                        with ( document.getElementById('itenContact_' + objContact.contact.jid ) ) 
    13841393                                        { 
    13851394                                                style.display   = "none"; 
     
    14011410                                                for( var j = 0; j < groups.length; j++ ) 
    14021411                                                { 
    1403                                                         addItem( TrophyIM.rosterObj.roster[users[i]], groups[j], element, j ); 
     1412                                                        addItem( TrophyIM.rosterObj.roster[users[i]], groups[j], element ); 
    14041413                                                } 
    14051414                                        } 
    14061415                                        else 
    14071416                                        { 
    1408                                                 addItem( TrophyIM.rosterObj.roster[users[i]], "Geral", element, 0 ); 
     1417                                                addItem( TrophyIM.rosterObj.roster[users[i]], "Geral", element ); 
    14091418                                        } 
    14101419                                } 
    14111420                                else 
    14121421                                { 
    1413                                         addItem( TrophyIM.rosterObj.roster[users[i]], "Geral", element, 0 ); 
     1422                                        addItem( TrophyIM.rosterObj.roster[users[i]], "Geral", element ); 
    14141423                                } 
    14151424                        } 
     
    18431852                this.addContact(barejid, 'not-in-roster'); 
    18441853            } 
     1854             
    18451855            var presence = 
    18461856                        { 
    1847                 resource:resource, priority:priority, show:show, status:status 
     1857                resource        : resource, 
     1858                priority        : priority, 
     1859                show            : show, 
     1860                status          : status 
    18481861            } 
    18491862             
     
    18521865                this.roster[jid_lower]['presence'] = {}; 
    18531866            } 
     1867             
    18541868            this.roster[jid_lower]['presence'][resource] = presence; 
    18551869        } 
Note: See TracChangeset for help on using the changeset viewer.