Index: branches/2.2/jabberit_messenger/jmessenger/inc/jabberit_acl.inc.php
===================================================================
--- branches/2.2/jabberit_messenger/jmessenger/inc/jabberit_acl.inc.php	(revision 3108)
+++ branches/2.2/jabberit_messenger/jmessenger/inc/jabberit_acl.inc.php	(revision 3127)
@@ -68,15 +68,16 @@
 		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.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/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_constants.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/json2.js'></script>";
-	 	echo "<script type='text/javascript' src='".$webserver_url . "js/SelectEditable.js'></script>";
+	 	echo "<script type='text/javascript' src='".$webserver_url . "js/SelectEditable.mini.js'></script>";
 		echo "<script type='text/javascript'> var loadscript = new LoadIM('".$fullName."','".$preferences."'); </script>";
 		
Index: branches/2.2/jabberit_messenger/jmessenger/js/trophyim.mini.js
===================================================================
--- branches/2.2/jabberit_messenger/jmessenger/js/trophyim.mini.js	(revision 3102)
+++ branches/2.2/jabberit_messenger/jmessenger/js/trophyim.mini.js	(revision 3127)
@@ -1,4 +1,4 @@
 
-var TROPHYIM_BOSH_SERVICE="/proxy/ejabberd";var TROPHYIM_LOG_LINES=200;var TROPHYIM_LOGLEVEL=0;var TROPHYIM_VERSION="0.3";var TROPHYIM_RESOURCE="/JABBERITWEB";var TROPHYIM_CHATROOM="conference.im.pr.gov.br";DOMObjects={xmlParse:function(xmlString){var xmlObj=this.xmlRender(xmlString);if(xmlObj){try{if(this.processor==undefined){this.processor=new XSLTProcessor();this.processor.importStylesheet(this.xmlRender('<xsl:stylesheet version="1.0"\
+DOMObjects={xmlParse:function(xmlString){var xmlObj=this.xmlRender(xmlString);if(xmlObj){try{if(this.processor==undefined){this.processor=new XSLTProcessor();this.processor.importStylesheet(this.xmlRender('<xsl:stylesheet version="1.0"\
                     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\
                     <xsl:output method="html" indent="yes"/><xsl:template\
@@ -13,5 +13,5 @@
 return renderObj;},getHTML:function(page)
 {return this.xmlParse(HTMLSnippets[page]);},getScript:function(script)
-{var newscript=document.createElement('script');newscript.setAttribute('src',script);newscript.setAttribute('type','text/javascript');return newscript;}};TrophyIM={controll:{notificationNewUsers:0},autoConnection:{connect:true},chatHistory:{},constants:{stale_roster:false},posWindow:{left:400,top:100},statusConn:{connected:false},_timeOut:{renderRoster:null},setCookie:function(name,value)
+{var newscript=document.createElement('script');newscript.setAttribute('src',script);newscript.setAttribute('type','text/javascript');return newscript;}};TrophyIM={controll:{notificationNewUsers:0},autoConnection:{connect:true},activeChatRoom:{name:[]},chatHistory:{},constants:{stale_roster:false},posWindow:{left:400,top:100},statusConn:{connected:false},_timeOut:{renderRoster:null},setCookie:function(name,value)
 {var expire=new Date();expire.setDate(expire.getDate()+365);document.cookie=name+"="+value+"; expires="+expire.toGMTString();},delCookie:function(name)
 {var expire=new Date();expire.setDate(expire.getDate()-365);document.cookie=name+"= ; expires="+expire.toGMTString();delete TrophyIM.cookies[name];},getCookies:function()
@@ -104,20 +104,14 @@
 {for(var i=0;i<xquery.length;i++)
 {var xmlns=xquery[i].getAttribute("xmlns");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')?xquery[i].parentNode.getAttribute('type'):'available';var show=(xquery[i].parentNode.firstChild.firstChild!=null)?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 _from=xquery[i].parentNode.getAttribute('from');var _to=xquery[i].parentNode.getAttribute('to');var nameChatRoom=Strophe.getBareJidFromJid(_from);var nickName=Strophe.getResourceFromJid(_from);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;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)
 {nameChatRoom=document.getElementById(nameChatRoom+'__roomChat__participants');nameChatRoom.appendChild(_UserChatRoom);}
 else
-{TrophyIM.makeChatRoom(nameChatRoom,nameChatRoom);nameChatRoom=document.getElementById(nameChatRoom+'__roomChat__participants');nameChatRoom.appendChild(_UserChatRoom);}}
+{TrophyIM.makeChatRoom(nameChatRoom,nameChatRoom.substring(0,nameChatRoom.indexOf('@')));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);}
+{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");}}}}}},onMessage:function(msg)
+{nodeUser.setAttribute("style","padding-left:18px ; margin:3px 0px 0px 2px; background: url('"+path_jabberit+"templates/default/images/"+show+".gif')no-repeat center left");}}}}}},onMessage:function(msg)
 {var checkTime=function(i)
 {if(i<10)i="0"+i;return i;};var messageDate=function(_date)
@@ -178,5 +172,9 @@
 {if(!TrophyIM.sendMessageChatRoom(jidChatRoom,_textarea.value))
 return false;_textarea.value='';_textarea.focus();};loadscript.configEvents(_send,'onclick',_send_message);loadscript.configEvents(_leaveChatRoom,'onclick',function()
-{TrophyIM.leaveChatRoom(jidChatRoom);setTimeout(function()
+{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()
 {_winBuild('window_chat_room_'+jidChatRoom,'remove');},500);});loadscript.configEvents(_textarea,'onkeyup',function(e)
 {if(e.keyCode==13)
@@ -200,6 +198,8 @@
 {var presence=$pres({from:TrophyIM.connection.jid,to:roomName}).c("x",{xmlns:Strophe.NS.MUC});TrophyIM.connection.send(presence);},leaveChatRoom:function(roomName)
 {var room_nick=roomName;var presenceid=TrophyIM.connection.getUniqueId();var presence=$pres({type:"unavailable",id:presenceid,from:TrophyIM.connection.jid,to:room_nick}).c("x",{xmlns:Strophe.NS.MUC});TrophyIM.connection.send(presence);},getListRooms:function()
+{if(TrophyIM.statusConn.connected)
 {var _error_return=function(element)
-{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);},removeContact:function(jidTo)
+{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);},removeContact:function(jidTo)
 {var divItenContact=null;if((divItenContact=document.getElementById('itenContact_'+jidTo)))
 {var _id=TrophyIM.connection.getUniqueId();var delContact=$iq({type:'set',id:_id})
@@ -298,5 +298,5 @@
 {TrophyIM.makeChat(fulljid);},setAutorization:function(jidTo,jidFrom,_typeSubscription)
 {var _id=TrophyIM.connection.getUniqueId();TrophyIM.connection.send($pres().attrs({from:jidFrom,to:jidTo,type:_typeSubscription,id:_id}).tree());},setPresence:function(_type)
-{if(_type!='status')
+{var presence_chatRoom="";if(_type!='status')
 {if(_type=="unavailable"&&TrophyIM.statusConn.connected)
 {var loading_gif=document.getElementById("JabberIMRosterLoadingGif");if(TrophyIM._timeOut.renderRoster!=null)
@@ -314,7 +314,7 @@
 {if(TrophyIM.statusConn.connected)
 {if(loadscript.getStatusMessage()!="")
-{var _presence=$pres();_presence.node.appendChild(Strophe.xmlElement('show')).appendChild(Strophe.xmlTextNode(_type));_presence.node.appendChild(Strophe.xmlElement('status')).appendChild(Strophe.xmlTextNode(loadscript.getStatusMessage()));TrophyIM.connection.send(_presence.tree());}
-else
-{TrophyIM.connection.send($pres().c('show').t(_type).tree());}}}}}
+{var _presence=$pres();_presence.node.appendChild(Strophe.xmlElement('show')).appendChild(Strophe.xmlTextNode(_type));_presence.node.appendChild(Strophe.xmlElement('status')).appendChild(Strophe.xmlTextNode(loadscript.getStatusMessage()));TrophyIM.connection.send(_presence.tree());presence_chatRoom=_type;}
+else
+{TrophyIM.connection.send($pres().c('show').t(_type).tree());presence_chatRoom=_type;}}}}}
 else
 {var _show="available";var _status="";if(arguments.length<2)
@@ -330,5 +330,9 @@
 _show=TrophyIM.rosterObj.roster[Base64.decode(loadscript.getUserCurrent().jid)].presence[resource].show;}
 if(TrophyIM.statusConn.connected)
-{var _presence=$pres();_presence.node.appendChild(Strophe.xmlElement('show')).appendChild(Strophe.xmlTextNode(_show));_presence.node.appendChild(Strophe.xmlElement('status')).appendChild(Strophe.xmlTextNode(_status));TrophyIM.connection.send(_presence.tree());}}},sendMessage:function()
+{var _presence=$pres();_presence.node.appendChild(Strophe.xmlElement('show')).appendChild(Strophe.xmlTextNode(_show));_presence.node.appendChild(Strophe.xmlElement('status')).appendChild(Strophe.xmlTextNode(_status));TrophyIM.connection.send(_presence.tree());presence_chatRoom=_show;}}
+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));}}},sendMessage:function()
 {if(arguments.length>0)
 {var jidTo=arguments[0];var message_input=arguments[1];message_input=message_input.replace(/^\s+|\s+$|^\n|\n$/g,"");if(message_input!=""){var newMessage=$msg({to:jidTo,from:TrophyIM.connection.jid,type:'chat'});newMessage=newMessage.c('body').t(message_input);newMessage.up();newMessage=newMessage.c('active').attrs({xmlns:'http://jabber.org/protocol/chatstates'});TrophyIM.connection.send(newMessage.tree());return true;}}
Index: branches/2.2/jabberit_messenger/jmessenger/js/trophyim_constants.js
===================================================================
--- branches/2.2/jabberit_messenger/jmessenger/js/trophyim_constants.js	(revision 3127)
+++ branches/2.2/jabberit_messenger/jmessenger/js/trophyim_constants.js	(revision 3127)
@@ -0,0 +1,11 @@
+var TROPHYIM_BOSH_SERVICE	= "/proxy/ejabberd";  //Change to suit
+
+var TROPHYIM_LOG_LINES		= 200;
+
+var TROPHYIM_LOGLEVEL		= 0; //0=debug, 1=info, 2=warn, 3=error, 4=fatal 
+
+var TROPHYIM_VERSION 		= "0.3";
+
+var TROPHYIM_RESOURCE		= "/JABBERITWEB";
+
+var TROPHYIM_CHATROOM		= "conference.im.pr.gov.br";
Index: branches/2.2/jabberit_messenger/jmessenger/js/trophyim.js
===================================================================
--- branches/2.2/jabberit_messenger/jmessenger/js/trophyim.js	(revision 3124)
+++ branches/2.2/jabberit_messenger/jmessenger/js/trophyim.js	(revision 3127)
@@ -1,24 +1,2 @@
-/**
- *   This program is distributed under the terms of the MIT license.
- *   Please see the LICENSE file for details.
- *
- *   Copyright 2008 Michael Garvin
- */
-
-var TROPHYIM_BOSH_SERVICE	= "/proxy/ejabberd";  //Change to suit
-
-var TROPHYIM_LOG_LINES		= 200;
-
-var TROPHYIM_LOGLEVEL		= 0; //0=debug, 1=info, 2=warn, 3=error, 4=fatal 
-
-var TROPHYIM_VERSION 		= "0.3";
-
-var TROPHYIM_RESOURCE		= "/JABBERITWEB";
-
-var TROPHYIM_CHATROOM		= "conference.im.pr.gov.br";
-
-//Uncomment to make session reattachment work
-//var TROPHYIM_JSON_STORE = "json_store.php";
-
 /** Object: DOMObjects
  *  This class contains builders for all the DOM objects needed by TrophyIM
Index: branches/2.2/jabberit_messenger/jmessenger/js/jscode/loadIM.mini.js
===================================================================
--- branches/2.2/jabberit_messenger/jmessenger/js/jscode/loadIM.mini.js	(revision 3102)
+++ branches/2.2/jabberit_messenger/jmessenger/js/jscode/loadIM.mini.js	(revision 3127)
@@ -291,10 +291,13 @@
 _listRooms.appendChild(_ROOM);show();};var _get_room_info=function(_room)
 {TrophyIM.connection.sendIQ($iq({"to":_room,"type":"get"}).c("query",{xmlns:Strophe.NS.DISCO_INFO}),_add_room,function(a)
-{_roomsCount++;show();},500);};for(var i=0;i<element.length;i++)
+{_roomsCount++;show();},500);};if(element.length>0)
+{for(var i=0;i<element.length;i++)
 {_get_room_info(element[i].getAttribute('jid'));}}
+else
+{show();}}
 function getListRooms()
 {TrophyIM.getListRooms();}
 function joinRoom(jidRoom,nameRoom)
-{var test_append_nick=function(room,nick)
+{var append_nick=function(room,nick)
 {var room_nick=room;if(nick)
 {room_nick+="/"+nick;}
@@ -304,7 +307,7 @@
 else
 {var nickName=Base64.decode(loadscript.getUserCurrent().jid);nickName=nickName.substring(0,nickName.indexOf('@'));var _prompt=prompt("Deseja informar um Apelido ?",nickName);if(_prompt)
-{_prompt=_prompt.replace(/^\s+|\s+$|^\n|\n$/g,"");var room_nick=test_append_nick(jidRoom,nickName);if(_prompt&&_prompt!="")
-{var room_nick=test_append_nick(jidRoom,_prompt);}
-TrophyIM.makeChatRoom(jidRoom,nameRoom);TrophyIM.joinChatRoom(room_nick);}}}
+{_prompt=_prompt.replace(/^\s+|\s+$|^\n|\n$/g,"");var room_nick=append_nick(jidRoom,nickName);if(_prompt&&_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);}}}
 function loadIM()
 {if(arguments.length>0)
