Index: trunk/jabberit_messenger/jmessenger/inc/jabberit_acl.inc.php
===================================================================
--- trunk/jabberit_messenger/jmessenger/inc/jabberit_acl.inc.php	(revision 3100)
+++ trunk/jabberit_messenger/jmessenger/inc/jabberit_acl.inc.php	(revision 3126)
@@ -68,15 +68,15 @@
 		echo "<script type='text/javascript'>".$js."</script>";
 		echo "<script type='text/javascript' src='".$webserver_url . "js/strophe.min.js'></script>";
-		echo "<script type='text/javascript' src='".$webserver_url . "js/jscode/loadIM.mini.js'></script>";
-        echo "<script type='text/javascript' src='".$webserver_url . "js/connector.mini.js'></script>";
-	 	echo "<script type='text/javascript' src='".$webserver_url . "js/xtools.mini.js'></script>";
-	 	echo "<script type='text/javascript' src='".$webserver_url . "js/lang/i18n_pt_Br.mini.js'></script>";
-	 	echo "<script type='text/javascript' src='".$webserver_url . "js/dragdrop.mini.js'></script>";
-	 	echo "<script type='text/javascript' src='".$webserver_url . "js/makeW.mini.js'></script>";
-	 	echo "<script type='text/javascript' src='".$webserver_url . "js/show_hidden.mini.js'></script>";
-	 	echo "<script type='text/javascript' src='".$webserver_url . "js/trophyim.mini.js'></script>";
-	 	echo "<script type='text/javascript' src='".$webserver_url . "js/AddUser.mini.js'></script>";			            	 	
+		echo "<script type='text/javascript' src='".$webserver_url . "js/jscode/loadIM.js'></script>";
+        echo "<script type='text/javascript' src='".$webserver_url . "js/connector.js'></script>";
+	 	echo "<script type='text/javascript' src='".$webserver_url . "js/xtools.js'></script>";
+	 	echo "<script type='text/javascript' src='".$webserver_url . "js/lang/i18n_pt_Br.js'></script>";
+	 	echo "<script type='text/javascript' src='".$webserver_url . "js/dragdrop.js'></script>";
+	 	echo "<script type='text/javascript' src='".$webserver_url . "js/makeW.js'></script>";
+	 	echo "<script type='text/javascript' src='".$webserver_url . "js/show_hidden.js'></script>";
+	 	echo "<script type='text/javascript' src='".$webserver_url . "js/trophyim.js'></script>";
+	 	echo "<script type='text/javascript' src='".$webserver_url . "js/AddUser.js'></script>";			            	 	
 	 	echo "<script type='text/javascript' src='".$webserver_url . "js/json2.js'></script>";
-	 	echo "<script type='text/javascript' src='".$webserver_url . "js/SelectEditable.mini.js'></script>";
+	 	echo "<script type='text/javascript' src='".$webserver_url . "js/SelectEditable.js'></script>";
 		echo "<script type='text/javascript'> var loadscript = new LoadIM('".$fullName."','".$preferences."'); </script>";
 		
Index: trunk/jabberit_messenger/jmessenger/inc/class.LdapIM.inc.php
===================================================================
--- trunk/jabberit_messenger/jmessenger/inc/class.LdapIM.inc.php	(revision 3013)
+++ trunk/jabberit_messenger/jmessenger/inc/class.LdapIM.inc.php	(revision 3126)
@@ -411,6 +411,6 @@
 			$filter		= "(&(phpgwaccounttype=u)(|".$uidnumber.")(".$search ."))";
 			$justthese	= array( $this->attribute, "uidNumber", "cn", "mail", "phpgwAccountVisible", "dn", "jpegPhoto" );								
-			$search		= ldap_search( $this->ldap, $searchRoot, $filter, $justthese, 0, $this->max_result + 1);
-			$entry		= ldap_get_entries( $this->ldap, $search );
+			$search		= @ldap_search( $this->ldap, $searchRoot, $filter, $justthese, 0, $this->max_result + 1);
+			$entry		= @ldap_get_entries( $this->ldap, $search );
 			$result		= $this->resultArray( $entry, $this->ldap );
 		}		
Index: trunk/jabberit_messenger/jmessenger/js/trophyim.js
===================================================================
--- trunk/jabberit_messenger/jmessenger/js/trophyim.js	(revision 3099)
+++ trunk/jabberit_messenger/jmessenger/js/trophyim.js	(revision 3126)
@@ -142,4 +142,10 @@
 	autoConnection : { connect : true },
 
+	/** Active Chat Room
+	 * 
+	 */
+	
+	activeChatRoom : { name : [] },
+	
 	/** Object: chatHistory
     *
@@ -663,5 +669,5 @@
     {
     	var xquery = msg.getElementsByTagName("x");
-        
+    	
         if ( xquery.length > 0 )
         {
@@ -672,28 +678,27 @@
                 if( xmlns.indexOf("http://jabber.org/protocol/muc#user") == 0 )
                 {
-                	var nameChatRoom = xquery[i].parentNode.getAttribute('from');
-                		nameChatRoom = Strophe.getBareJidFromJid(nameChatRoom);
-
-            		var nickName = xquery[i].parentNode.getAttribute('from');
-            			nickName = Strophe.getResourceFromJid(nickName);
+                	var _from	= xquery[i].parentNode.getAttribute('from');
+                	var _to		= xquery[i].parentNode.getAttribute('to');
+
+                	// Get NameChatRoom
+                	var nameChatRoom	= Strophe.getBareJidFromJid( _from );
                 	
-                	var type = xquery[i].parentNode.getAttribute('type') ? xquery[i].parentNode.getAttribute('type') : 'available' ;
+                	// Get nickName
+                	var nickName		= Strophe.getResourceFromJid( _from );
                 	
-                	var show = ( xquery[i].parentNode.firstChild.firstChild != null ) ? xquery[i].parentNode.firstChild.firstChild.nodeValue : type ;
+                	// Get Type/Show
+                	var type	= ( xquery[i].parentNode.getAttribute('type') != null ) ? xquery[i].parentNode.getAttribute('type') : 'available' ;
+                	var show	= ( xquery[i].parentNode.firstChild.nodeName == "show" ) ? xquery[i].parentNode.firstChild.firstChild.nodeValue : type;
                 	
-                	if( xquery[i].firstChild.getAttribute('jid') )
-                	{
-	                	if ( Strophe.getBareJidFromJid( xquery[i].firstChild.getAttribute('jid') ) == Strophe.getBareJidFromJid( TrophyIM.connection.jid ) )
-	                		show = loadscript.getStatusUserIM();
-                	}
-                	
-                	var _UserChatRoom = document.createElement("div");
-                		_UserChatRoom.id = nameChatRoom + "_UserChatRoom__" + xquery[i].firstChild.getAttribute('jid');
-                		_UserChatRoom.setAttribute("style","padding-left:18px ; margin:3px 0px 0px 2px; background: url('"+path_jabberit+"templates/default/images/" + show + ".gif')no-repeat center left");
-                		_UserChatRoom.appendChild( document.createTextNode(nickName) );
-                
-                	var nodeUser = document.getElementById(nameChatRoom + "_UserChatRoom__" + xquery[i].firstChild.getAttribute('jid') );		
-                		
-                	if( nodeUser == null && xquery[i].firstChild.getAttribute('jid') )
+                	var _idElement = nameChatRoom + "_UserChatRoom__" + nickName;
+                	  
+                	var _UserChatRoom		= document.createElement("div");
+	            		_UserChatRoom.id	= _idElement;
+	            		_UserChatRoom.setAttribute("style","padding-left:18px ; margin:3px 0px 0px 2px; background: url('"+path_jabberit+"templates/default/images/" + show + ".gif')no-repeat center left");
+	            		_UserChatRoom.appendChild( document.createTextNode( nickName ) );
+
+	            	var nodeUser = document.getElementById( _idElement );	
+	            		
+                	if( nodeUser == null )
                 	{
                 		if( document.getElementById( nameChatRoom + '__roomChat__participants' ) != null )
@@ -704,5 +709,5 @@
                 		else
                 		{
-                			TrophyIM.makeChatRoom( nameChatRoom, nameChatRoom );
+                			TrophyIM.makeChatRoom( nameChatRoom, nameChatRoom.substring(0, nameChatRoom.indexOf('@')));
                 			nameChatRoom = document.getElementById( nameChatRoom + '__roomChat__participants' );
                 			nameChatRoom.appendChild( _UserChatRoom );
@@ -713,17 +718,9 @@
                 		if( type == 'unavailable' )
                 		{
-                			var nodeUser = "";
-                			
-                			if( xquery[i].firstChild.getAttribute('jid') != null )
-                				nodeUser = document.getElementById( nameChatRoom + "_UserChatRoom__" + xquery[i].firstChild.getAttribute('jid') );
-                			else
-                				nodeUser = document.getElementById( nameChatRoom + "_UserChatRoom__" + xquery[i].parentNode.getAttribute('to') );
-                			
                 			nodeUser.parentNode.removeChild( nodeUser );
                 		}
                 		else if( show )
                 		{
-                			var _UserChatRoom = document.getElementById( nameChatRoom + "_UserChatRoom__" + xquery[i].firstChild.getAttribute('jid') )
-                				_UserChatRoom.setAttribute("style","padding-left:18px ; margin:3px 0px 0px 2px; background: url('"+path_jabberit+"templates/default/images/" + show + ".gif')no-repeat center left");	
+                			nodeUser.setAttribute("style","padding-left:18px ; margin:3px 0px 0px 2px; background: url('"+path_jabberit+"templates/default/images/" + show + ".gif')no-repeat center left");	
                 		}
                 	}
@@ -1102,4 +1099,15 @@
         {
         	TrophyIM.leaveChatRoom( jidChatRoom );
+        	
+        	if( TrophyIM.activeChatRoom.name.length > 0 )
+        	{
+        		for( var i = 0;  i < TrophyIM.activeChatRoom.name.length ; i++ )
+        		{
+        			if( TrophyIM.activeChatRoom.name[i].indexOf( jidChatRoom ) >= 0 )
+        			{
+        				TrophyIM.activeChatRoom.name[i] = "";
+        			}
+        		}
+        	}
 
         	setTimeout( function()
@@ -1275,5 +1283,5 @@
     joinChatRoom : function( roomName )
     {
-        var presence = $pres({from: TrophyIM.connection.jid, to: roomName}).c("x",{xmlns: Strophe.NS.MUC});
+        var presence = $pres( {from: TrophyIM.connection.jid, to: roomName} ).c("x",{xmlns: Strophe.NS.MUC});
         
 		TrophyIM.connection.send( presence );
@@ -1303,12 +1311,17 @@
     getListRooms : function()
     {
-    	var _error_return = function(element)
+    	if( TrophyIM.statusConn.connected )
     	{
-    		alert( " ERROR : " + element );
-    	};
-    	
-   		var iq = $iq({to: "conference.im.pr.gov.br", type: "get"}).c("query",{xmlns: Strophe.NS.DISCO_ITEMS});    		
-    		
-    	TrophyIM.connection.sendIQ( iq, loadscript.listRooms, _error_return, 500 );   		
+	    	var _error_return = function(element)
+	    	{
+	    		alert("ERRO : Tente novamente !");
+	    	};
+	    	
+	   		var iq = $iq({ to: TROPHYIM_CHATROOM, type: "get" }).c("query",{xmlns: Strophe.NS.DISCO_ITEMS });    		
+	    		
+	    	TrophyIM.connection.sendIQ( iq, loadscript.listRooms, _error_return, 500 );
+    	}else
+    		alert( "ERRO : Sem conexão com o servidor " + TROPHYIM_CHATROOM );
+                    
     },
     
@@ -1748,5 +1761,5 @@
     	TrophyIM.connection.send($pres( ).attrs({ from: jidFrom, to: jidTo, type: _typeSubscription, id: _id }).tree());
 	},
-    
+
 	/** Function: setPresence
      *
@@ -1755,4 +1768,6 @@
 	setPresence : function( _type )
 	{
+		var presence_chatRoom = "";
+		
 		if( _type != 'status')
 		{
@@ -1804,8 +1819,12 @@
 							
 							TrophyIM.connection.send( _presence.tree() );
+							
+							presence_chatRoom = _type;
 						}
 						else
 						{
 							TrophyIM.connection.send($pres( ).c('show').t(_type).tree());
+							
+							presence_chatRoom = _type;
 						}
 					}
@@ -1851,6 +1870,19 @@
 				
 				TrophyIM.connection.send( _presence.tree() );
-			}
-		}
+				
+				presence_chatRoom = _show;
+			}
+		}
+		
+		// Send Presence Chat Room
+		if( TrophyIM.activeChatRoom.name.length > 0 )
+		{
+			for( var i in TrophyIM.activeChatRoom.name )
+			{
+				if( TrophyIM.activeChatRoom.name[i] != "" )
+					TrophyIM.connection.send($pres( { to : TrophyIM.activeChatRoom.name[i] } ).c('show').t( presence_chatRoom ) );
+			}
+		}
+
 	},
 	
Index: trunk/jabberit_messenger/jmessenger/js/jscode/loadIM.js
===================================================================
--- trunk/jabberit_messenger/jmessenger/js/jscode/loadIM.js	(revision 3099)
+++ trunk/jabberit_messenger/jmessenger/js/jscode/loadIM.js	(revision 3126)
@@ -1414,14 +1414,19 @@
 		        	
 		        		show( );
-		        	},
-		        	500
-		        );
+		        		
+		        	}, 500 );
 		};
 
-		for ( var i = 0; i < element.length; i++ )
-		{
-			_get_room_info( element[ i ].getAttribute( 'jid' ) );
-		}
-		
+		if( element.length > 0 )
+		{
+			for ( var i = 0; i < element.length; i++ )
+			{
+				_get_room_info( element[ i ].getAttribute( 'jid' ) );
+			}
+		}
+		else
+		{
+			show();
+		}
 	}
 	
@@ -1433,5 +1438,6 @@
 	function joinRoom( jidRoom, nameRoom )
 	{
-		var test_append_nick = function( room, nick )
+		
+		var append_nick = function( room, nick )
 	    {
 	        var room_nick = room;
@@ -1460,12 +1466,14 @@
 			   	_prompt = _prompt.replace(/^\s+|\s+$|^\n|\n$/g,"");
 			    
-			    var room_nick = test_append_nick( jidRoom, nickName );	
+			    var room_nick = append_nick( jidRoom, nickName );	
 			    	
 			    if( _prompt && _prompt != "" )
 			    {
-			    	var room_nick = test_append_nick( jidRoom, _prompt );
+			    	var room_nick = append_nick( jidRoom, _prompt );
 			    }
 			    
 			    TrophyIM.makeChatRoom( jidRoom , nameRoom );
+
+			    TrophyIM.activeChatRoom.name[ TrophyIM.activeChatRoom.name.length ] = room_nick; 
 			    
 			    TrophyIM.joinChatRoom( room_nick);
Index: trunk/jabberit_messenger/js/setup.js
===================================================================
--- trunk/jabberit_messenger/js/setup.js	(revision 2121)
+++ trunk/jabberit_messenger/js/setup.js	(revision 3126)
@@ -257,5 +257,5 @@
 			}	
 		}
-		
+
 		_conn.go("$this.db_im.setHostJabber",
 				 function(data)
