Changeset 3122 for branches


Ignore:
Timestamp:
08/02/10 17:45:44 (14 years ago)
Author:
alexandrecorreia
Message:

Ticket #1091 - Implementado a busca de salas para bate-papo no novo modulo Expresso messenger XEP-0045-MUC.

Location:
branches/2.2/jabberit_messenger/jmessenger/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/jabberit_messenger/jmessenger/js/jscode/loadIM.js

    r3115 r3122  
    14331433        function joinRoom( jidRoom, nameRoom ) 
    14341434        { 
     1435                 
    14351436                var append_nick = function( room, nick ) 
    14361437            { 
     
    14681469                             
    14691470                            TrophyIM.makeChatRoom( jidRoom , nameRoom ); 
     1471 
     1472                            TrophyIM.activeChatRoom.name[ TrophyIM.activeChatRoom.name.length ] = room_nick;  
    14701473                             
    14711474                            TrophyIM.joinChatRoom( room_nick); 
  • branches/2.2/jabberit_messenger/jmessenger/js/trophyim.js

    r3120 r3122  
    142142        autoConnection : { connect : true }, 
    143143 
     144        /** Active Chat Room 
     145         *  
     146         */ 
     147         
     148        activeChatRoom : { name : [] }, 
     149         
    144150        /** Object: chatHistory 
    145151    * 
     
    681687                        var nickName            = Strophe.getResourceFromJid( _from ); 
    682688                         
     689                        // Get Type/Show 
    683690                        var type        = ( xquery[i].parentNode.getAttribute('type') != null ) ? xquery[i].parentNode.getAttribute('type') : 'available' ; 
    684                         var show        = type; 
     691                        var show        = ( xquery[i].parentNode.firstChild.nodeName == "show" ) ? xquery[i].parentNode.firstChild.firstChild.nodeValue : type; 
    685692                         
    686693                        var _idElement = nameChatRoom + "_UserChatRoom__" + nickName; 
     
    689696                                _UserChatRoom.id        = _idElement; 
    690697                                _UserChatRoom.setAttribute("style","padding-left:18px ; margin:3px 0px 0px 2px; background: url('"+path_jabberit+"templates/default/images/" + show + ".gif')no-repeat center left"); 
    691                                 _UserChatRoom.appendChild( document.createTextNode(nickName) ); 
     698                                _UserChatRoom.appendChild( document.createTextNode( nickName ) ); 
    692699 
    693700                        var nodeUser = document.getElementById( _idElement );    
     
    719726                        } 
    720727                } 
    721                  
    722                 /*if( xmlns.indexOf("http://jabber.org/protocol/muc#user") == 0 ) 
    723                 { 
    724                         var nameChatRoom = xquery[i].parentNode.getAttribute('from'); 
    725                                 nameChatRoom = Strophe.getBareJidFromJid(nameChatRoom); 
    726  
    727                         var nickName = xquery[i].parentNode.getAttribute('from'); 
    728                                 nickName = Strophe.getResourceFromJid(nickName); 
    729  
    730                         var type = ( xquery[i].parentNode.getAttribute('type') != null ) ? xquery[i].parentNode.getAttribute('type') : 'available' ; 
    731                          
    732                         var show = ( xquery[i].parentNode.firstChild.firstChild.nodeName.toLowerCase() == "show" ) ? xquery[i].parentNode.firstChild.firstChild.nodeValue : type ; 
    733                          
    734                         if( xquery[i].firstChild.getAttribute('jid') ) 
    735                         { 
    736                                 if ( Strophe.getBareJidFromJid( xquery[i].firstChild.getAttribute('jid') ) == Strophe.getBareJidFromJid( TrophyIM.connection.jid ) ) 
    737                                         show = loadscript.getStatusUserIM(); 
    738                         } 
    739                          
    740                         var _UserChatRoom = document.createElement("div"); 
    741                                 _UserChatRoom.id = nameChatRoom + "_UserChatRoom__" + xquery[i].firstChild.getAttribute('jid'); 
    742                                 _UserChatRoom.setAttribute("style","padding-left:18px ; margin:3px 0px 0px 2px; background: url('"+path_jabberit+"templates/default/images/" + show + ".gif')no-repeat center left"); 
    743                                 _UserChatRoom.appendChild( document.createTextNode(nickName) ); 
    744                  
    745                         var nodeUser = document.getElementById( nameChatRoom + "_UserChatRoom__" + xquery[i].firstChild.getAttribute('jid') );           
    746                                  
    747                         if( nodeUser == null && xquery[i].firstChild.getAttribute('jid') ) 
    748                         { 
    749                                 if( document.getElementById( nameChatRoom + '__roomChat__participants' ) != null ) 
    750                                 { 
    751                                         nameChatRoom = document.getElementById( nameChatRoom + '__roomChat__participants' ); 
    752                                         nameChatRoom.appendChild( _UserChatRoom ); 
    753                                 } 
    754                                 else 
    755                                 { 
    756                                         TrophyIM.makeChatRoom( nameChatRoom, nameChatRoom ); 
    757                                         nameChatRoom = document.getElementById( nameChatRoom + '__roomChat__participants' ); 
    758                                         nameChatRoom.appendChild( _UserChatRoom ); 
    759                                 } 
    760                         } 
    761                         else 
    762                         { 
    763                                 if( type == 'unavailable' ) 
    764                                 { 
    765                                         var nodeUser = ""; 
    766                                          
    767                                         if( xquery[i].firstChild.getAttribute('jid') != null ) 
    768                                                 nodeUser = document.getElementById( nameChatRoom + "_UserChatRoom__" + xquery[i].firstChild.getAttribute('jid') ); 
    769                                         else 
    770                                                 nodeUser = document.getElementById( nameChatRoom + "_UserChatRoom__" + xquery[i].parentNode.getAttribute('to') ); 
    771                                          
    772                                         nodeUser.parentNode.removeChild( nodeUser ); 
    773                                 } 
    774                                 else if( show ) 
    775                                 { 
    776                                         var _UserChatRoom = document.getElementById( nameChatRoom + "_UserChatRoom__" + xquery[i].firstChild.getAttribute('jid') ) 
    777                                                 _UserChatRoom.setAttribute("style","padding-left:18px ; margin:3px 0px 0px 2px; background: url('"+path_jabberit+"templates/default/images/" + show + ".gif')no-repeat center left");    
    778                                 } 
    779                         } 
    780                 }*/ 
    781728            } 
    782729        } 
     
    18051752        setPresence : function( _type ) 
    18061753        { 
     1754                var presence_chatRoom = ""; 
     1755                 
    18071756                if( _type != 'status') 
    18081757                { 
     
    18541803                                                         
    18551804                                                        TrophyIM.connection.send( _presence.tree() ); 
     1805                                                         
     1806                                                        presence_chatRoom = _type; 
    18561807                                                } 
    18571808                                                else 
    18581809                                                { 
    18591810                                                        TrophyIM.connection.send($pres( ).c('show').t(_type).tree()); 
     1811                                                         
     1812                                                        presence_chatRoom = _type; 
    18601813                                                } 
    18611814                                        } 
     
    19011854                                 
    19021855                                TrophyIM.connection.send( _presence.tree() ); 
    1903                         } 
    1904                 } 
     1856                                 
     1857                                presence_chatRoom = _show; 
     1858                        } 
     1859                } 
     1860                 
     1861                // Send Presence Chat Room 
     1862                if( TrophyIM.activeChatRoom.name.length > 0 ) 
     1863                { 
     1864                        for( var i in TrophyIM.activeChatRoom.name ) 
     1865                        { 
     1866                                TrophyIM.connection.send($pres( { to : TrophyIM.activeChatRoom.name[i] } ).c('show').t( presence_chatRoom ) ); 
     1867                        } 
     1868                } 
     1869 
    19051870        }, 
    19061871         
Note: See TracChangeset for help on using the changeset viewer.