Index: branches/2.2/jabberit_messenger/jmessenger/js/trophyim.mini.js
===================================================================
--- branches/2.2/jabberit_messenger/jmessenger/js/trophyim.mini.js	(revision 3332)
+++ branches/2.2/jabberit_messenger/jmessenger/js/trophyim.mini.js	(revision 4420)
@@ -1,3 +1,2 @@
-
 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">\
@@ -108,5 +107,13 @@
 TrophyIM.rosterObj.setPresence(msg.getAttribute('from'),priority,show,status);}
 return true;},onPresenceChatRoom:function(msg)
-{var xquery=msg.getElementsByTagName("x");if(xquery.length>0)
+{var xquery=msg.getElementsByTagName("x");var _error=msg.getElementsByTagName("error");if(_error.length>0)
+{for(var i=0;i<_error.length;i++)
+{if(_error[i].getElementsByTagName("text"))
+{var _errorMsg=Strophe.getText(_error[i].getElementsByTagName("text")[0]);if(_errorMsg=="Room creation is denied by service policy")
+{alert(i18n.ROOM_CREATION_IS_DENIED_BY_SERVICE_POLICY);}
+else
+{alert(" Informe ao seu Administrador ERRO : \n"+_errorMsg);}}}}
+else
+{if(xquery.length>0)
 {for(var i=0;i<xquery.length;i++)
 {var xmlns=xquery[i].getAttribute("xmlns");if(xmlns.indexOf("http://jabber.org/protocol/muc#user")==0)
@@ -121,5 +128,5 @@
 {nodeUser.parentNode.removeChild(nodeUser);}
 else if(show)
-{nodeUser.style.backgroundImage='url("'+path_jabberit+'templates/default/images/'+show+'.gif")';}}}}}},onMessage:function(msg)
+{nodeUser.style.backgroundImage='url("'+path_jabberit+'templates/default/images/'+show+'.gif")';}}}}}}},onMessage:function(msg)
 {var checkTime=function(i)
 {if(i<10)i="0"+i;return i;};var messageDate=function(_date)
@@ -396,5 +403,6 @@
 {current=presence}
 else
-{if(presence['priority']>current['priority']&&((presence['show']=="chat"||presence['show']=="available")||(current['show']!="chat"||current['show']!="available")))
+{if(presence['priority']>current['priority']&&((presence['show']=="chat"
+||presence['show']=="available")||(current['show']!="chat"||current['show']!="available")))
 {current=presence}}}}
 return current;}
Index: branches/2.2/jabberit_messenger/jmessenger/js/lang/i18n_pt_Br.js
===================================================================
--- branches/2.2/jabberit_messenger/jmessenger/js/lang/i18n_pt_Br.js	(revision 3260)
+++ branches/2.2/jabberit_messenger/jmessenger/js/lang/i18n_pt_Br.js	(revision 4420)
@@ -31,4 +31,5 @@
 	NONE_RESULT_WAS_FOUND : 'Nenhum resultado encontrado !',
 	PAUSED : ' está parado.',
+        ROOM_CREATION_IS_DENIED_BY_SERVICE_POLICY : 'Não é permitido a criação de salas',
 	SEND : 'Enviar',
 	SEARCH_RESULT : 'Resulta da busca',
Index: branches/2.2/jabberit_messenger/jmessenger/js/lang/i18n_pt_Br.mini.js
===================================================================
--- branches/2.2/jabberit_messenger/jmessenger/js/lang/i18n_pt_Br.mini.js	(revision 3260)
+++ branches/2.2/jabberit_messenger/jmessenger/js/lang/i18n_pt_Br.mini.js	(revision 4420)
@@ -1,2 +1,1 @@
-
-i18n={ADD:'Adicionar',ADD_CONTACT:'Adicionar Contatos',ADD_CONTACTS:'Adicionar Contatos',ASK_NEW_NAME_QUESTION:'Informe um novo nome para ',ASK_NEW_GROUP_QUESTION:'Informe um novo grupo ou deixe em branco',ASK_FOR_AUTH:'PEDIR AUTORIZAÇÃO !',AUTHORIZED:'AUTORIZADO !',AUTH_SENT:'AUTORIZAÇÃO ENVIADA !',ASK_FOR_AUTH_QUESTION:'QUERO ADICIONÁ-LO(A) ! POSSO ?',CLOSE:'Fechar',COMPOSING:' está digitando...',CONTACT_ASK_FOR_AUTH:'CONTATO PEDE AUTORIZAÇÃO !',GONE:' saiu da conversa.',GROUP:'Grupo',INACTIVE:' está inativo.',LEAVE_CHATROOM:'Sair da Sala',LOAD:'Carregando',MANY_RESULTS_PLEASE_TRY_TO_REFINE_YOUR_SEARCH:'Muitos Resultados ! Por favor tente refinar sua busca !',ME:'Eu',NAME_CONTACT:'Nome do Contato',NEW_USER:'Novo Usuário',NONE_RESULT_WAS_FOUND:'Nenhum resultado encontrado !',PAUSED:' está parado.',SEND:'Enviar',SEARCH_RESULT:'Resulta da busca',SEARCH_USERS:'Procurar contatos',STATUS_ANAVAILABLE:'Desconectado',STATUS_AVAILABLE:'Disponível',STATUS_ANAVAILABLE:'Desconectado',TRY_AGAIN:'Tente Novamente!',TYPE_YOUR_MESSAGE_HERE_STATUS:'Digite aqui sua mensagem de Status',TYPE_YOUR_MSG:'Digite sua mensagem !!!',YOUR_SEARCH_ARGUMENT_MUST_BE_LONGER_THAN_3_CHARACTERS:'Sua busca precisa ter mais que 3 dígitos'};
+i18n={ADD:'Adicionar',ADD_CONTACT:'Adicionar Contatos',ADD_CONTACTS:'Adicionar Contatos',ASK_NEW_NAME_QUESTION:'Informe um novo nome para ',ASK_NEW_GROUP_QUESTION:'Informe um novo grupo ou deixe em branco',ASK_FOR_AUTH:'PEDIR AUTORIZAÇÃO !',AUTHORIZED:'AUTORIZADO !',AUTH_SENT:'AUTORIZAÇÃO ENVIADA !',ASK_FOR_AUTH_QUESTION:'QUERO ADICIONÁ-LO(A) ! POSSO ?',CLOSE:'Fechar',COMPOSING:' está digitando...',CONTACT_ASK_FOR_AUTH:'CONTATO PEDE AUTORIZAÇÃO !',GONE:' saiu da conversa.',GROUP:'Grupo',INACTIVE:' está inativo.',LEAVE_CHATROOM:'Sair da Sala',LOAD:'Carregando',MANY_RESULTS_PLEASE_TRY_TO_REFINE_YOUR_SEARCH:'Muitos Resultados ! Por favor tente refinar sua busca !',ME:'Eu',NAME_CONTACT:'Nome do Contato',NEW_USER:'Novo Usuário',NONE_RESULT_WAS_FOUND:'Nenhum resultado encontrado !',PAUSED:' está parado.',ROOM_CREATION_IS_DENIED_BY_SERVICE_POLICY:'Não é permitido a criação de salas',SEND:'Enviar',SEARCH_RESULT:'Resulta da busca',SEARCH_USERS:'Procurar contatos',STATUS_ANAVAILABLE:'Desconectado',STATUS_AVAILABLE:'Disponível',STATUS_ANAVAILABLE:'Desconectado',TRY_AGAIN:'Tente Novamente!',TYPE_YOUR_MESSAGE_HERE_STATUS:'Digite aqui sua mensagem de Status',TYPE_YOUR_MSG:'Digite sua mensagem !!!',YOUR_SEARCH_ARGUMENT_MUST_BE_LONGER_THAN_3_CHARACTERS:'Sua busca precisa ter mais que 3 dígitos'};
Index: branches/2.2/jabberit_messenger/jmessenger/js/trophyim.js
===================================================================
--- branches/2.2/jabberit_messenger/jmessenger/js/trophyim.js	(revision 3332)
+++ branches/2.2/jabberit_messenger/jmessenger/js/trophyim.js	(revision 4420)
@@ -112,5 +112,5 @@
 		
 
-	controll : { notificationNewUsers : 0 },	
+	controll : {notificationNewUsers : 0},	
     
 	/** AutoConnection
@@ -118,5 +118,5 @@
 	*/	
 		
-	autoConnection : { connect : true },
+	autoConnection : {connect : true},
 
 	/** Active Chat Room
@@ -124,5 +124,5 @@
 	 */
 	
-	activeChatRoom : { name : [] },
+	activeChatRoom : {name : []},
 	
 	/** Object: chatHistory
@@ -144,5 +144,5 @@
 	 * 
 	 */	
-	posWindow : { left : 400, top : 100 },	
+	posWindow : {left : 400, top : 100},	
 		
 	/** StatusConnection
@@ -150,5 +150,5 @@
 	 */
 
-	statusConn : { connected : false },
+	statusConn : {connected : false},
 	
 	/** TimeOut Render Roster
@@ -157,5 +157,5 @@
 	 */
 	
-	_timeOut : { renderRoster : null },
+	_timeOut : {renderRoster : null},
 	
 	
@@ -165,5 +165,5 @@
 	 */
 	
-	removeResult : { idResult : [] },
+	removeResult : {idResult : []},
 	
      /** Function: setCookie
@@ -675,66 +675,99 @@
     onPresenceChatRoom : function(msg)
     {
-    	var xquery = msg.getElementsByTagName("x");
-
-    	if ( xquery.length > 0 )
+        var xquery      = msg.getElementsByTagName("x");
+        var _error      = msg.getElementsByTagName("error");
+       
+       
+        if( _error.length > 0 )
+        {    
+            /* Room creation is denied by service policy;
+             *
+             *  <error code='403' type='auth'>
+             *      <forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
+             *      <text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>Room creation is denied by service policy</text>
+             *  </error>       
+             */
+            
+            for ( var i = 0; i < _error.length; i++ )
+            {
+                if ( _error[i].getElementsByTagName("text") )
+                {    
+                    var _errorMsg = Strophe.getText( _error[i].getElementsByTagName("text")[0] );
+                    
+                    if( _errorMsg == "Room creation is denied by service policy" )
+                    {
+                        alert( i18n.ROOM_CREATION_IS_DENIED_BY_SERVICE_POLICY );
+                    }
+                    else
+                    {
+                        alert( " Informe ao seu Administrador ERRO : \n" + _errorMsg );
+                    }    
+                        
+                }
+            }
+        }
+        else
         {
-        	for ( var i = 0; i < xquery.length; i++ )
+            if ( xquery.length > 0 )
             {
-                var xmlns = xquery[i].getAttribute("xmlns");
-                
-                if( xmlns.indexOf("http://jabber.org/protocol/muc#user") == 0 )
+                for ( var i = 0; i < xquery.length; i++ )
                 {
-                	var _from	= xquery[i].parentNode.getAttribute('from');
-                	var _to		= xquery[i].parentNode.getAttribute('to');
-
-                	// Get NameChatRoom
-                	var nameChatRoom	= Strophe.getBareJidFromJid( _from );
-                	
-                	// Get nickName
-                	var nickName		= Strophe.getResourceFromJid( _from );
-                	
-                	// 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;
-                	
-                	var _idElement = nameChatRoom + "_UserChatRoom__" + nickName;
-                	  
-                	var _UserChatRoom					= document.createElement("div");
-	            		_UserChatRoom.id				= _idElement;
-	            		_UserChatRoom.style.paddingLeft = '18px';
-	            		_UserChatRoom.style.margin 		= '3px 0px 0px 2px';
-	            		_UserChatRoom.style.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
-                		{
-                			if( type != 'unavailable' )
-                			{
-	                			TrophyIM.makeChatRoom( nameChatRoom, nameChatRoom.substring(0, nameChatRoom.indexOf('@')));
-	                			nameChatRoom = document.getElementById( nameChatRoom + '__roomChat__participants' );
-	                			nameChatRoom.appendChild( _UserChatRoom );
-                			}
-                		}
-                	}
-                	else
-                	{
-                		if( type == 'unavailable' )
-                		{
-                			nodeUser.parentNode.removeChild( nodeUser );
-                		}
-                		else if( show )
-                		{
-                			nodeUser.style.backgroundImage =  'url("'+path_jabberit+'templates/default/images/' + show + '.gif")';
-	            		}
-                	}
+                    var xmlns = xquery[i].getAttribute("xmlns");
+
+                    if( xmlns.indexOf("http://jabber.org/protocol/muc#user") == 0 )
+                    {
+                            var _from	= xquery[i].parentNode.getAttribute('from');
+                            var _to		= xquery[i].parentNode.getAttribute('to');
+
+                            // Get NameChatRoom
+                            var nameChatRoom	= Strophe.getBareJidFromJid( _from );
+
+                            // Get nickName
+                            var nickName		= Strophe.getResourceFromJid( _from );
+
+                            // 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;
+
+                            var _idElement = nameChatRoom + "_UserChatRoom__" + nickName;
+
+                            var _UserChatRoom					= document.createElement("div");
+                                    _UserChatRoom.id				= _idElement;
+                                    _UserChatRoom.style.paddingLeft = '18px';
+                                    _UserChatRoom.style.margin 		= '3px 0px 0px 2px';
+                                    _UserChatRoom.style.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
+                                    {
+                                            if( type != 'unavailable' )
+                                            {
+                                                    TrophyIM.makeChatRoom( nameChatRoom, nameChatRoom.substring(0, nameChatRoom.indexOf('@')));
+                                                    nameChatRoom = document.getElementById( nameChatRoom + '__roomChat__participants' );
+                                                    nameChatRoom.appendChild( _UserChatRoom );
+                                            }
+                                    }
+                            }
+                            else
+                            {
+                                    if( type == 'unavailable' )
+                                    {
+                                            nodeUser.parentNode.removeChild( nodeUser );
+                                    }
+                                    else if( show )
+                                    {
+                                            nodeUser.style.backgroundImage =  'url("'+path_jabberit+'templates/default/images/' + show + '.gif")';
+                                    }
+                            }
+                    }
                 }
             }
@@ -867,29 +900,29 @@
 			// Delete Tags <SCRIPT>
 			var scripts = _message.getElementsByTagName('script_deny');
-			for (var i = 0; i < scripts.length; i++){ _message.removeChild(scripts[i--]); }
+			for (var i = 0; i < scripts.length; i++){_message.removeChild(scripts[i--]);}
 			////////////////////////////////////////////////////
 			
 			// Delete Tags <IMG>
 			var _imgSrc = _message.getElementsByTagName('img_deny');
-			for (var i = 0; i < _imgSrc.length; i++){ _imgSrc[i].parentNode.removeChild( _imgSrc[i--] ); }
+			for (var i = 0; i < _imgSrc.length; i++){_imgSrc[i].parentNode.removeChild( _imgSrc[i--] );}
 			////////////////////////////////////////////////////
 			
 			// Delete Tags <DIV>
 			var _Div = _message.getElementsByTagName('div_deny');
-			for (var i = 0; i < _Div.length; i++){ _Div[i].parentNode.removeChild( _Div[i--] ); }
+			for (var i = 0; i < _Div.length; i++){_Div[i].parentNode.removeChild( _Div[i--] );}
 			////////////////////////////////////////////////////
 			
 			// Delete Tags <SPAN>
 			var _Span = _message.getElementsByTagName('span_deny');
-			for (var i = 0; i < _Span.length; i++){ _Span[i].parentNode.removeChild( _Span[i--] ); }
+			for (var i = 0; i < _Span.length; i++){_Span[i].parentNode.removeChild( _Span[i--] );}
 			////////////////////////////////////////////////////
 
 			// Delete Tags <IFRAME>
 			var _Iframe = _message.getElementsByTagName('iframe_deny');
-			for (var i = 0; i < _Iframe.length; i++){ _Iframe[i].parentNode.removeChild( _Iframe[i--] ); }
+			for (var i = 0; i < _Iframe.length; i++){_Iframe[i].parentNode.removeChild( _Iframe[i--] );}
 
 			// Delete Tags <A HREF>
 			var _aHref = _message.getElementsByTagName('a');
-			for (var i = 0; i < _aHref.length; i++){ _aHref[i].parentNode.removeChild( _aHref[i--] ); }
+			for (var i = 0; i < _aHref.length; i++){_aHref[i].parentNode.removeChild( _aHref[i--] );}
 			
 			_message.innerHTML = _message.innerHTML.replace(/^\s+|\s+$|^\n|\n$/g, "");
@@ -918,9 +951,9 @@
 					var message = 
 					{
-		            	contact : "[" + stamp + "] <font style='font-weight:bold; color:black;'>" + jidChatRoom + "</font>",
-		            	msg		: "</br>" + _message.innerHTML
-	    	        };
-
-					TrophyIM.addMessage( TrophyIM.makeChatRoom( barejid ), jid_lower, message );
+                                                contact : "[" + stamp + "] <font style='font-weight:bold; color:black;'>" + jidChatRoom + "</font>",
+                                                msg     : "</br>" + _message.innerHTML
+                                        };
+
+                                        TrophyIM.addMessage( TrophyIM.makeChatRoom( barejid ), jid_lower, message );
 				}
 			}
@@ -1270,7 +1303,7 @@
 	    	// Add Contact
 	    	var _id = TrophyIM.connection.getUniqueId('add'); 
-			var newContact = $iq({type: 'set', id: _id });
+			var newContact = $iq({type: 'set', id: _id});
 				newContact = newContact.c('query').attrs({xmlns : 'jabber:iq:roster'});
-				newContact = newContact.c('item').attrs({jid: jidTo, name:name });
+				newContact = newContact.c('item').attrs({jid: jidTo, name:name});
 				newContact = newContact.c('group').t(group).tree();
 	
@@ -1335,11 +1368,11 @@
     	var presence	= TrophyIM.rosterObj.roster[jid].presence;
     	
-		// Group
-		if(( group = prompt( i18n.ASK_NEW_GROUP_QUESTION, group )))
-			if(( group = group.replace(/^\s+|\s+$|^\n|\n$/g,"")) == "" )
-				group = "";
-
-		if( group == null || group == "")
-			group = "";
+        // Group
+        if(( group = prompt( i18n.ASK_NEW_GROUP_QUESTION, group )))
+                if(( group = group.replace(/^\s+|\s+$|^\n|\n$/g,"")) == "" )
+                        group = "";
+
+        if( group == null || group == "")
+                group = "";
 
     	var jidTo = TrophyIM.rosterObj.roster[jid].contact.jid;
@@ -1377,11 +1410,11 @@
     	var nameChatRoom = document.getElementById('name_ChatRoom_jabberit').value; 
     	
-    	var _from		= Base64.decode( loadscript.getUserCurrent().jid ) + TROPHYIM_RESOURCE; 
-		var _to			= escape( nameChatRoom ) + "@" + TROPHYIM_CHATROOM + "/" + nickName ;
-		var new_room	= $pres( {from: _from, to: _to } ).c( "x", { xmlns: Strophe.NS.MUC } );
-
-		TrophyIM.activeChatRoom.name[ TrophyIM.activeChatRoom.name.length ] = _to; 
-		
-		TrophyIM.connection.send( new_room.tree() );
+    	var _from	= Base64.decode( loadscript.getUserCurrent().jid ) + TROPHYIM_RESOURCE; 
+        var _to		= escape( nameChatRoom ) + "@" + TROPHYIM_CHATROOM + "/" + nickName ;
+        var new_room	= $pres( {from: _from, to: _to} ).c( "x", {xmlns: Strophe.NS.MUC} );
+
+	TrophyIM.activeChatRoom.name[ TrophyIM.activeChatRoom.name.length ] = _to; 
+		
+	TrophyIM.connection.send( new_room.tree() );
     },
     
@@ -1395,5 +1428,5 @@
     	var presence = $pres( {from: TrophyIM.connection.jid, to: roomName} ).c("x",{xmlns: Strophe.NS.MUC});
         
-		TrophyIM.connection.send( presence );
+	TrophyIM.connection.send( presence );
     },
     
@@ -1428,5 +1461,5 @@
 	    	};
 	    	
-	   		var iq = $iq({ to: TROPHYIM_CHATROOM, type: "get" }).c("query",{xmlns: Strophe.NS.DISCO_ITEMS });    		
+	   	var iq = $iq({to: TROPHYIM_CHATROOM, type: "get"}).c("query",{xmlns: Strophe.NS.DISCO_ITEMS});    		
 	    		
 	    	TrophyIM.connection.sendIQ( iq, loadscript.listRooms, _error_return, 500 );
@@ -1658,5 +1691,5 @@
 								break;
 								
-							case "subscribe" : 
+							case "subscribe" :
 								
 								status		= " (( " + i18n.AUTH_SENT  + " )) ";
@@ -1875,5 +1908,5 @@
     	var _id	= TrophyIM.connection.getUniqueId();
     	
-    	TrophyIM.connection.send($pres( ).attrs({ from: jidFrom, to: jidTo, type: _typeSubscription, id: _id }).tree());
+    	TrophyIM.connection.send($pres( ).attrs({from: jidFrom, to: jidTo, type: _typeSubscription, id: _id}).tree());
 	},
 
@@ -1997,5 +2030,5 @@
 			{
 				if( TrophyIM.activeChatRoom.name[i] != "" )
-					TrophyIM.connection.send($pres( { to : TrophyIM.activeChatRoom.name[i] } ).c('show').t( presence_chatRoom ) );
+					TrophyIM.connection.send($pres( {to : TrophyIM.activeChatRoom.name[i]} ).c('show').t( presence_chatRoom ) );
 			}
 		}
@@ -2161,5 +2194,5 @@
      	else
     	{
-   			var contact		= { jid:jid, subscription:subscription, name:name, groups:groups }
+   			var contact		= {jid:jid, subscription:subscription, name:name, groups:groups}
 	        var jid_lower	= jid.toLowerCase();
 	
