Ignore:
Timestamp:
07/22/10 17:08:40 (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
Files:
1 added
3 edited

Legend:

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

    r3076 r3082  
    13941394         
    13951395         
    1396         function joinRoom( roomName ) 
     1396        function joinRoom( jidRoom, nameRoom ) 
    13971397        { 
    13981398            var test_append_nick = function( room, nick ) 
     
    14071407                return room_nick; 
    14081408            } 
    1409  
    1410                  
    1411             var room_nick = test_append_nick( roomName, "CORREIA" ); 
     1409                 
     1410            var room_nick = test_append_nick( jidRoom, "USUARIO_DE_TESTE" ); 
    14121411             
    1413             TrophyIM.joinRoom( room_nick, loadscript.teste1, loadscript.teste2 ); 
    1414         } 
    1415          
    1416         function teste1() 
    1417         { 
    1418                 alert( arguments[0] ); 
    1419         } 
    1420          
    1421  
    1422         function teste2() 
    1423         { 
    1424                 alert( arguments[0] ); 
     1412            TrophyIM.makeChatRoom( jidRoom , nameRoom ); 
     1413             
     1414            TrophyIM.joinRoom( room_nick ); 
    14251415        } 
    14261416         
    14271417        loadIM.prototype.joinRoom       = joinRoom; 
    1428         loadIM.prototype.teste1         = teste1; 
    1429         loadIM.prototype.teste2         = teste2; 
    1430          
    14311418         
    14321419        function loadIM() 
  • trunk/jabberit_messenger/jmessenger/js/trophyim.js

    r3076 r3082  
    635635    onPresence : function(msg) 
    636636        { 
    637                 Strophe.debug("Presence handler"); 
    638         var type                = msg.getAttribute('type') ? msg.getAttribute('type') : 'available'; 
     637        var type                = msg.getAttribute('type') ? msg.getAttribute('type') : 'available'; 
    639638        var show                = msg.getElementsByTagName('show').length ? Strophe.getText(msg.getElementsByTagName('show')[0]) : type; 
    640639        var status              = msg.getElementsByTagName('status').length ? Strophe.getText(msg.getElementsByTagName('status')[0]) : ''; 
    641640        var priority    = msg.getElementsByTagName('priority').length ? parseInt(Strophe.getText(msg.getElementsByTagName('priority')[0])) : 0; 
    642641 
    643         TrophyIM.rosterObj.setPresence(msg.getAttribute('from'), priority, show, status); 
     642        TrophyIM.rosterObj.setPresence( msg.getAttribute('from'), priority, show, status ); 
    644643                 
    645644        return true; 
     
    748747                                msg             : "</br>" + _message.innerHTML 
    749748                        }; 
    750                                          
    751                                         TrophyIM.addMessage( TrophyIM.makeChat( from ), jid_lower, message ); 
     749 
     750                                        TrophyIM.addMessage( TrophyIM.makeChatRoom( barejid ), jid_lower, message ); 
    752751                                } 
    753752                        } 
     
    826825        }, 
    827826 
    828      
    829     /** Function: makeChat 
     827        /** Function: makeChat 
    830828     * 
    831829     *  Make sure chat window to given fulljid exists, switching chat context to 
     
    871869        _content = _content.firstChild; 
    872870         
    873         var _messages = _content.firstChild.firstChild; 
    874         var _textarea = _content.getElementsByTagName( 'textarea' ).item( 0 ); 
    875         var _send = _content.getElementsByTagName( 'input' ).item( 0 ); 
    876                 var _chatStateOnOff = _content.getElementsByTagName( 'input' ).item( 1 ); 
     871        var _messages           = _content.firstChild.firstChild; 
     872        var _textarea           = _content.getElementsByTagName( 'textarea' ).item( 0 ); 
     873        var _send                       = _content.getElementsByTagName( 'input' ).item( 0 ); 
     874                var _chatStateOnOff     = _content.getElementsByTagName( 'input' ).item( 1 ); 
    877875 
    878876        function _send_message( ) 
     
    962960    }, 
    963961 
     962        /** Function: makeChatRoom 
     963    * 
     964    * 
     965    * 
     966    */ 
     967     
     968    makeChatRoom : function() 
     969    { 
     970        var jidChatRoom = arguments[0]; 
     971        var titleWindow = "ChatRoom - " + arguments[1]; 
     972         
     973         
     974        var paramsChatRoom = 
     975        { 
     976                        'idChatRoom'    : jidChatRoom + "__roomChat", 
     977                        'jidTo'                 : jidChatRoom, 
     978                                'path_jabberit' : path_jabberit 
     979        }; 
     980 
     981        // Position Top 
     982        TrophyIM.posWindow.top  = TrophyIM.posWindow.top + 10;  
     983        if( TrophyIM.posWindow.top > 200 ) 
     984                TrophyIM.posWindow.top  = 100; 
     985         
     986        // Position Left 
     987        TrophyIM.posWindow.left = TrophyIM.posWindow.left + 5; 
     988        if( TrophyIM.posWindow.left > 455 ) 
     989                TrophyIM.posWindow.left = 400; 
     990 
     991        var _content = document.createElement( 'div' ); 
     992        _content.innerHTML = loadscript.parse( "chat_room", "chatRoom.xsl", paramsChatRoom ); 
     993        _content = _content.firstChild; 
     994         
     995        var _messages           = _content.firstChild.firstChild; 
     996         
     997        var winChatRoom =  
     998        { 
     999                         id_window              : "window_chat_room_" + arguments[0], 
     1000                         barejid                : jidChatRoom, 
     1001                         width                  : 500, 
     1002                         height                 : 450, 
     1003                         top                    : TrophyIM.posWindow.top, 
     1004                         left                   : TrophyIM.posWindow.left, 
     1005                         draggable              : true, 
     1006                         visible                : "display", 
     1007                         resizable              : true, 
     1008                         zindex                 : loadscript.getZIndex(), 
     1009                         title                  : titleWindow, 
     1010                         closeAction    : "hidden", 
     1011                         content                : _content       
     1012        } 
     1013         
     1014        _win = _winBuild(winChatRoom); 
     1015         
     1016        return ( _messages = _win.content( ).firstChild ); 
     1017         
     1018    }, 
     1019     
    9641020        /** Function addContacts 
    9651021         *  
     
    9831039        }, 
    9841040 
    985     /** Function: addMessage 
     1041    /** Function: add 
    9861042     * 
    9871043     *  Parameters: 
     
    10781134     */ 
    10791135     
    1080     joinRoom : function(roomName , msg_handler_cb, pres_handler_cb ) 
     1136    joinRoom : function( roomName ) 
    10811137    { 
    10821138        var msg = $pres({from: TrophyIM.connection.jid, to: roomName}).c("x",{xmlns: Strophe.NS.MUC}); 
    10831139         
    10841140                TrophyIM.connection.send(msg); 
    1085                  
    1086                  
    1087                 /*if (password ) 
    1088                 { 
    1089                         var password_elem = Strophe.xmlElement("password",  
    1090                                                       [], 
    1091                                                       password); 
    1092                         msg.cnode(password_elem); 
    1093                 }*/ 
    1094                  
    1095                 /* 
    1096                 if ( msg_handler_cb ) 
    1097                 { 
    1098                    TrophyIM.connection.addHandler( msg_handler_cb , null, "message", null, null, null); 
    1099                 } 
    1100                  
    1101                 if ( pres_handler_cb ) 
    1102                 { 
    1103                         TrophyIM.connection.addHandler( pres_handler_cb , null, "presence", null, null, null); 
    1104                 } 
    1105                 */ 
    1106                  
    11071141    }, 
    11081142     
  • trunk/jabberit_messenger/jmessenger/xsl/listRooms.xsl

    r3076 r3082  
    1111                        <xsl:for-each select="room"> 
    1212                                <xsl:sort select="@nameRoom"/> 
    13                                 <div onclick="loadscript.joinRoom('{jidRoom}');" style="cursor:pointer;padding :5px 0px 5px 45px; background:url({$path_jabberit}templates/default/images/conference.png) no-repeat center left; border-bottom:1px dashed #cecece; margin:6px 1px;"> 
     13                                <div onclick="loadscript.joinRoom('{jidRoom}','{@nameRoom}');" style="cursor:pointer;padding :5px 0px 5px 45px; background:url({$path_jabberit}templates/default/images/conference.png) no-repeat center left; border-bottom:1px dashed #cecece; margin:6px 1px;"> 
    1414                                        Nome da Sala : <xsl:value-of select="@nameRoom"/> <br/> 
    1515                                        <xsl:choose> 
Note: See TracChangeset for help on using the changeset viewer.