Index: /branches/2.2/jabberit_messenger/jmessenger/js/trophyim.js
===================================================================
--- /branches/2.2/jabberit_messenger/jmessenger/js/trophyim.js	(revision 3120)
+++ /branches/2.2/jabberit_messenger/jmessenger/js/trophyim.js	(revision 3122)
@@ -142,4 +142,10 @@
 	autoConnection : { connect : true },
 
+	/** Active Chat Room
+	 * 
+	 */
+	
+	activeChatRoom : { name : [] },
+	
 	/** Object: chatHistory
     *
@@ -681,6 +687,7 @@
                 	var nickName		= Strophe.getResourceFromJid( _from );
                 	
+                	// Get Type/Show
                 	var type	= ( xquery[i].parentNode.getAttribute('type') != null ) ? xquery[i].parentNode.getAttribute('type') : 'available' ;
-                	var show	= type;
+                	var show	= ( xquery[i].parentNode.firstChild.nodeName == "show" ) ? xquery[i].parentNode.firstChild.firstChild.nodeValue : type;
                 	
                 	var _idElement = nameChatRoom + "_UserChatRoom__" + nickName;
@@ -689,5 +696,5 @@
 	            		_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) );
+	            		_UserChatRoom.appendChild( document.createTextNode( nickName ) );
 
 	            	var nodeUser = document.getElementById( _idElement );	
@@ -719,64 +726,4 @@
                 	}
                 }
-                
-                /*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 type = ( xquery[i].parentNode.getAttribute('type') != null ) ? xquery[i].parentNode.getAttribute('type') : 'available' ;
-                	
-            		var show = ( xquery[i].parentNode.firstChild.firstChild.nodeName.toLowerCase() == "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') )
-                	{
-                		if( document.getElementById( nameChatRoom + '__roomChat__participants' ) != null )
-                		{
-                			nameChatRoom = document.getElementById( nameChatRoom + '__roomChat__participants' );
-                			nameChatRoom.appendChild( _UserChatRoom );
-                		}
-                		else
-                		{
-                			TrophyIM.makeChatRoom( nameChatRoom, nameChatRoom );
-                			nameChatRoom = document.getElementById( nameChatRoom + '__roomChat__participants' );
-                			nameChatRoom.appendChild( _UserChatRoom );
-                		}
-                	}
-                	else
-                	{
-                		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");	
-                		}
-                	}
-                }*/
             }
         }
@@ -1805,4 +1752,6 @@
 	setPresence : function( _type )
 	{
+		var presence_chatRoom = "";
+		
 		if( _type != 'status')
 		{
@@ -1854,8 +1803,12 @@
 							
 							TrophyIM.connection.send( _presence.tree() );
+							
+							presence_chatRoom = _type;
 						}
 						else
 						{
 							TrophyIM.connection.send($pres( ).c('show').t(_type).tree());
+							
+							presence_chatRoom = _type;
 						}
 					}
@@ -1901,6 +1854,18 @@
 				
 				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 )
+			{
+				TrophyIM.connection.send($pres( { to : TrophyIM.activeChatRoom.name[i] } ).c('show').t( presence_chatRoom ) );
+			}
+		}
+
 	},
 	
Index: /branches/2.2/jabberit_messenger/jmessenger/js/jscode/loadIM.js
===================================================================
--- /branches/2.2/jabberit_messenger/jmessenger/js/jscode/loadIM.js	(revision 3115)
+++ /branches/2.2/jabberit_messenger/jmessenger/js/jscode/loadIM.js	(revision 3122)
@@ -1433,4 +1433,5 @@
 	function joinRoom( jidRoom, nameRoom )
 	{
+		
 		var append_nick = function( room, nick )
 	    {
@@ -1468,4 +1469,6 @@
 			    
 			    TrophyIM.makeChatRoom( jidRoom , nameRoom );
+
+			    TrophyIM.activeChatRoom.name[ TrophyIM.activeChatRoom.name.length ] = room_nick; 
 			    
 			    TrophyIM.joinChatRoom( room_nick);
