Changeset 3115 for branches/2.2


Ignore:
Timestamp:
08/02/10 13:43:20 (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

    r3102 r3115  
    14331433        function joinRoom( jidRoom, nameRoom ) 
    14341434        { 
    1435                 var test_append_nick = function( room, nick ) 
     1435                var append_nick = function( room, nick ) 
    14361436            { 
    14371437                var room_nick = room; 
     
    14601460                                _prompt = _prompt.replace(/^\s+|\s+$|^\n|\n$/g,""); 
    14611461                             
    1462                             var room_nick = test_append_nick( jidRoom, nickName );       
     1462                            var room_nick = append_nick( jidRoom, nickName );    
    14631463                                 
    14641464                            if( _prompt && _prompt != "" ) 
    14651465                            { 
    1466                                 var room_nick = test_append_nick( jidRoom, _prompt ); 
     1466                                var room_nick = append_nick( jidRoom, _prompt ); 
    14671467                            } 
    14681468                             
  • branches/2.2/jabberit_messenger/jmessenger/js/trophyim.js

    r3107 r3115  
    671671                 
    672672                if( xmlns.indexOf("http://jabber.org/protocol/muc#user") == 0 ) 
     673                { 
     674                        var _from       = xquery[i].parentNode.getAttribute('from'); 
     675                        var _to         = xquery[i].parentNode.getAttribute('to'); 
     676 
     677                        // Get NameChatRoom 
     678                        var nameChatRoom        = Strophe.getBareJidFromJid( _from ); 
     679                         
     680                        // Get nickName 
     681                        var nickName            = Strophe.getResourceFromJid( _from ); 
     682                         
     683                        var type        = ( xquery[i].parentNode.getAttribute('type') != null ) ? xquery[i].parentNode.getAttribute('type') : 'available' ; 
     684                        var show        = type; 
     685                         
     686                        var _UserChatRoom = document.createElement("div"); 
     687                                _UserChatRoom.id = nameChatRoom + "_UserChatRoom__" + xquery[i].firstChild.getAttribute('jid'); 
     688                                _UserChatRoom.setAttribute("style","padding-left:18px ; margin:3px 0px 0px 2px; background: url('"+path_jabberit+"templates/default/images/" + show + ".gif')no-repeat center left"); 
     689                                _UserChatRoom.appendChild( document.createTextNode(nickName) ); 
     690 
     691                        var nodeUser = document.getElementById( nameChatRoom + "_UserChatRoom__" + xquery[i].firstChild.getAttribute('jid') );           
     692                         
     693                        if( nodeUser == null && xquery[i].firstChild.getAttribute('jid') ) 
     694                        { 
     695                                if( document.getElementById( nameChatRoom + '__roomChat__participants' ) != null ) 
     696                                { 
     697                                        nameChatRoom = document.getElementById( nameChatRoom + '__roomChat__participants' ); 
     698                                        nameChatRoom.appendChild( _UserChatRoom ); 
     699                                } 
     700                                else 
     701                                { 
     702                                        TrophyIM.makeChatRoom( nameChatRoom, nameChatRoom.substring(0, nameChatRoom.indexOf('@')) ); 
     703                                        nameChatRoom = document.getElementById( nameChatRoom + '__roomChat__participants' ); 
     704                                        nameChatRoom.appendChild( _UserChatRoom ); 
     705                                } 
     706                        } 
     707                        else 
     708                        { 
     709                                if( type == 'unavailable' ) 
     710                                { 
     711                                        var nodeUser = ""; 
     712                                         
     713                                        if( xquery[i].firstChild.getAttribute('jid') != null ) 
     714                                                nodeUser = document.getElementById( nameChatRoom + "_UserChatRoom__" + xquery[i].firstChild.getAttribute('jid') ); 
     715                                        else 
     716                                                nodeUser = document.getElementById( nameChatRoom + "_UserChatRoom__" + xquery[i].parentNode.getAttribute('to') ); 
     717                                         
     718                                        nodeUser.parentNode.removeChild( nodeUser ); 
     719                                } 
     720                                else if( show ) 
     721                                { 
     722                                        var _UserChatRoom = document.getElementById( nameChatRoom + "_UserChatRoom__" + xquery[i].firstChild.getAttribute('jid') ) 
     723                                                _UserChatRoom.setAttribute("style","padding-left:18px ; margin:3px 0px 0px 2px; background: url('"+path_jabberit+"templates/default/images/" + show + ".gif')no-repeat center left");    
     724                                } 
     725                        } 
     726                } 
     727                 
     728                /*if( xmlns.indexOf("http://jabber.org/protocol/muc#user") == 0 ) 
    673729                { 
    674730                        var nameChatRoom = xquery[i].parentNode.getAttribute('from'); 
     
    728784                                } 
    729785                        } 
    730                 } 
     786                }*/ 
    731787            } 
    732788        } 
     
    12751331    joinChatRoom : function( roomName ) 
    12761332    { 
    1277         var presence = $pres({from: TrophyIM.connection.jid, to: roomName}).c("x",{xmlns: Strophe.NS.MUC}); 
     1333        var presence = $pres( {from: TrophyIM.connection.jid, to: roomName} ).c("x",{xmlns: Strophe.NS.MUC}); 
    12781334         
    12791335                TrophyIM.connection.send( presence ); 
     
    17481804        TrophyIM.connection.send($pres( ).attrs({ from: jidFrom, to: jidTo, type: _typeSubscription, id: _id }).tree()); 
    17491805        }, 
    1750      
     1806 
    17511807        /** Function: setPresence 
    17521808     * 
Note: See TracChangeset for help on using the changeset viewer.