Changeset 3092 for trunk


Ignore:
Timestamp:
07/27/10 14:26:14 (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:
trunk/jabberit_messenger/jmessenger/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/jabberit_messenger/jmessenger/js/jscode/loadIM.js

    r3091 r3092  
    14131413            } 
    14141414                 
     1415             
     1416             
    14151417            var room_nick = test_append_nick( jidRoom, "USUARIO_DE_TESTE" ); 
    14161418             
  • trunk/jabberit_messenger/jmessenger/js/trophyim.js

    r3091 r3092  
    670670                                nameChatRoom = Strophe.getBareJidFromJid(nameChatRoom); 
    671671 
    672                         var nickName = xquery[i].firstChild.getAttribute('jid'); 
    673                                 nickName = Strophe.getBareJidFromJid( nickName ); 
    674                                 nickName = nickName.substring(0, nickName.indexOf('@')); 
     672                        var nickName = xquery[i].parentNode.getAttribute('from'); 
     673                                nickName = Strophe.getResourceFromJid(nickName); 
    675674                         
    676675                        var type = xquery[i].parentNode.getAttribute('type') ? xquery[i].parentNode.getAttribute('type') : 'available' ; 
     
    678677                        var show = ( xquery[i].parentNode.firstChild.firstChild != null ) ? xquery[i].parentNode.firstChild.firstChild.nodeValue : type ; 
    679678                         
    680                         if ( Strophe.getBareJidFromJid( xquery[i].firstChild.getAttribute('jid') ) == Strophe.getBareJidFromJid( TrophyIM.connection.jid ) ) 
    681                                 show = loadscript.getStatusUserIM(); 
     679                        if( xquery[i].firstChild.getAttribute('jid') ) 
     680                        { 
     681                                if ( Strophe.getBareJidFromJid( xquery[i].firstChild.getAttribute('jid') ) == Strophe.getBareJidFromJid( TrophyIM.connection.jid ) ) 
     682                                        show = loadscript.getStatusUserIM(); 
     683                        } 
    682684                         
    683685                        var _UserChatRoom = document.createElement("div"); 
     
    688690                        var nodeUser = document.getElementById( nameChatRoom + "_UserChatRoom__" + xquery[i].firstChild.getAttribute('jid'));            
    689691                                 
    690                         if( nodeUser == null ) 
     692                        if( nodeUser == null && xquery[i].firstChild.getAttribute('jid') ) 
    691693                        { 
    692694                                nameChatRoom = document.getElementById(nameChatRoom + '__roomChat__participants'); 
     
    697699                                if( type == 'unavailable' ) 
    698700                                { 
    699                                         nodeUser.parentNode.removeChild( nodeUser ); 
     701                                        var nodeUser = document.getElementById( nameChatRoom + "_UserChatRoom__" + xquery[i].parentNode.getAttribute('to')); 
     702                                                nodeUser.parentNode.removeChild( nodeUser ); 
    700703                                } 
    701704                                else if( show ) 
    702705                                { 
    703706                                        var _UserChatRoom = document.getElementById( nameChatRoom + "_UserChatRoom__" + xquery[i].firstChild.getAttribute('jid') ) 
    704                                          
    705                                         _UserChatRoom.setAttribute("style","padding-left:18px ; margin:3px 0px 0px 2px; background: url('"+path_jabberit+"templates/default/images/" + show + ".gif')no-repeat center left");    
     707                                                _UserChatRoom.setAttribute("style","padding-left:18px ; margin:3px 0px 0px 2px; background: url('"+path_jabberit+"templates/default/images/" + show + ".gif')no-repeat center left");    
    706708                                } 
    707709                        } 
     
    12331235    joinChatRoom : function( roomName ) 
    12341236    { 
    1235         var presence = $pres({from: TrophyIM.connection.jid, to: roomName}).c("x",{xmlns: Strophe.NS.MUC}); 
    1236          
     1237        var presence = $pres({from: TrophyIM.connection.jid, to: roomName}).c("x",{xmlns: Strophe.NS.MUC}); 
     1238         
    12371239                TrophyIM.connection.send( presence ); 
    12381240    }, 
     
    12431245     */ 
    12441246     
    1245     leaveChatRoom : function( roomName) 
     1247    leaveChatRoom : function( roomName ) 
    12461248    { 
    1247         var room_nick = roomName;         
    1248         var presenceid = TrophyIM.connection.getUniqueId(); 
    1249         //var presence = $pres( {type: "unavailable", id: presenceid, to: room_nick} ).c("x",{ xmlns: Strophe.NS.MUC } ); 
    1250         //TrophyIM.connection.send( presence ); 
     1249        var room_nick   = roomName + "/USUARIO_DE_TESTE";  
     1250         
     1251        var presenceid  = TrophyIM.connection.getUniqueId(); 
     1252         
     1253        var presence    = $pres( {type: "unavailable", id: presenceid, from: TrophyIM.connection.jid, to: room_nick} ).c("x",{xmlns: Strophe.NS.MUC}); 
     1254         
     1255        TrophyIM.connection.send( presence );         
    12511256    }, 
    12521257     
Note: See TracChangeset for help on using the changeset viewer.