Ignore:
Timestamp:
05/06/10 17:02:01 (14 years ago)
Author:
alexandrecorreia
Message:

Ticket #986 - [ Criado por Emmanuel Ferro - SERPRO ] - Implementacao da XEP-0085 - notificacao de status do chat

Location:
sandbox/jabberit_messenger/trophy_expresso
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sandbox/jabberit_messenger/trophy_expresso/js/trophyim.js

    r2724 r2725  
    612612        return true; 
    613613    }, 
     614     
    614615    /** Function: onMessage 
    615616     * 
     
    647648                var jid_lower   = barejid.toLowerCase(); 
    648649                var contact             = ""; 
    649                 var state = ''; 
    650  
    651                 var chatBox     = document.getElementById(jid_lower + "__chatState"); 
    652  
    653                 contact                 = barejid.toLowerCase(); 
    654                 contact                 = contact.substring(0, contact.indexOf('@')); 
     650                var state               = ""; 
     651 
     652                var chatBox     = null; 
     653                 
     654                if( document.getElementById(jid_lower + "__chatState") != null ) 
     655                { 
     656                        chatBox = document.getElementById(jid_lower + "__chatState"); 
     657                } 
     658                                 
     659                contact = barejid.toLowerCase(); 
     660                contact = contact.substring(0, contact.indexOf('@')); 
    655661             
    656662                if( TrophyIM.rosterObj.roster[barejid] ) 
     
    663669 
    664670                // Message with body are "content message", this mean state active 
    665                 if (elems.length > 0) 
     671                if ( elems.length > 0 ) 
    666672                { 
    667673                        state = contact + ' está ativo.'; 
    668674 
    669                         if (type == 'chat' || type == 'normal') { 
    670                          
     675                        if (type == 'chat' || type == 'normal') 
     676                        { 
    671677                                var _message = document.createElement("div"); 
    672678                                _message.innerHTML = Strophe.getText(elems[0]); 
     
    679685                                _message.innerHTML = _message.innerHTML.replace(/^\s+|\s+$|^\n|\n$/g, ""); 
    680686 
    681                                 if (_message.hasChildNodes() ) 
     687                                if ( _message.hasChildNodes() ) 
    682688                                { 
    683689                                        var message =  
     
    688694                                         
    689695                                        TrophyIM.makeChat(from); //Make sure we have a chat window 
    690                                         TrophyIM.addMessage(message, jid_lower); 
     696                                        TrophyIM.addMessage( message, jid_lower ); 
    691697                                } 
    692698                        } 
     
    695701                else 
    696702                { 
    697                         state = contact + TrophyIM.getChatState(msg);                    
    698                 } 
    699                 chatBox.innerHTML = "<font style='font-weight:bold; color:grey;'>" + state + "</font>";  
     703                        if( chatBox != null ) 
     704                                state = contact + TrophyIM.getChatState(msg);                    
     705                } 
     706                 
     707                if( chatBox != null ) 
     708                        chatBox.innerHTML = '<font style="font-weight:bold; color:grey; margin-left: 5px; float:right;">' + state + '</font>';   
     709                 
    700710                return true; 
    701711        }, 
     
    711721                var     state =  msg.getElementsByTagName('inactive'); 
    712722                 
    713                 if ( state.length > 0 ) { 
     723                if ( state.length > 0 ) 
     724                { 
    714725                return' está inativo...'; 
    715                 } else { 
     726                } 
     727                else 
     728                { 
    716729                state = msg.getElementsByTagName('gone'); 
    717             if ( state.length > 0 ){ 
     730            if ( state.length > 0 ) 
     731            { 
    718732                return ' saiu da conversa.'; 
    719                         } else { 
     733                        } 
     734            else 
     735            { 
    720736                state = msg.getElementsByTagName('composing');  
    721                 if ( state.length > 0 ){ 
     737                if ( state.length > 0 ) 
     738                { 
    722739                        return ' está compondo...'; 
    723                                 } else { 
     740                                } 
     741                else 
     742                { 
    724743                        state =  msg.getElementsByTagName('paused'); 
    725                         if ( state.length > 0 ){ 
     744                        if ( state.length > 0 ) 
     745                        { 
    726746                                return ' está parado...'; 
    727747                                        } 
     
    729749                        } 
    730750                } 
     751                 
    731752                return ''; 
    732753        }, 
  • sandbox/jabberit_messenger/trophy_expresso/xsl/chatBox.xsl

    r2721 r2725  
    1111                        <div> 
    1212                                <div id="{$idChatBox}" style="height:190px; width:370px; overflow-y:scroll;"></div> 
    13                                 <div id="{$jidTo}__chatState" style="height:15px; width:370px;"></div> 
     13                                <div id="{$jidTo}__chatState" style="height:15px; width:365px;"></div> 
    1414                                <div style="margin:2px;"> 
    1515                                        <textarea id="{$jidTo}__sendBox" class="trophyimchatinput" style="padding-left: 78px; height:130px; width:360px;"></textarea> 
Note: See TracChangeset for help on using the changeset viewer.