Index: branches/2.2/jabberit_messenger/jmessenger/js/trophyim.mini.js
===================================================================
--- branches/2.2/jabberit_messenger/jmessenger/js/trophyim.mini.js	(revision 3308)
+++ branches/2.2/jabberit_messenger/jmessenger/js/trophyim.mini.js	(revision 3314)
@@ -100,5 +100,11 @@
 return true;},onPresence:function(msg)
 {TrophyIM.onPresenceChatRoom(msg);var type=msg.getAttribute('type')?msg.getAttribute('type'):'available';var show=msg.getElementsByTagName('show').length?Strophe.getText(msg.getElementsByTagName('show')[0]):type;var status=msg.getElementsByTagName('status').length?Strophe.getText(msg.getElementsByTagName('status')[0]):'';var priority=msg.getElementsByTagName('priority').length?parseInt(Strophe.getText(msg.getElementsByTagName('priority')[0])):0;if(msg.getAttribute('from').toString().indexOf(TROPHYIM_CHATROOM)<0)
-{TrophyIM.rosterObj.setPresence(msg.getAttribute('from'),priority,show,status);}
+{var _from=Strophe.getBareJidFromJid(msg.getAttribute('from'));var _flag=true;if(TrophyIM.removeResult.idResult.length>0)
+{for(var i=0;i<TrophyIM.removeResult.idResult.length;i++)
+{if(TrophyIM.removeResult.idResult[i]==_from)
+{_flag=false;TrophyIM.removeResult.idResult.splice(i,1);i--;if(show.toLowerCase()==='subscribe')
+_flag=true;}}}
+if(_flag)
+TrophyIM.rosterObj.setPresence(msg.getAttribute('from'),priority,show,status);}
 return true;},onPresenceChatRoom:function(msg)
 {var xquery=msg.getElementsByTagName("x");if(xquery.length>0)
@@ -183,5 +189,10 @@
 {_send_message();}});var winChatRoom={id_window:"window_chat_room_"+arguments[0],barejid:jidChatRoom,width:500,height:450,top:TrophyIM.posWindow.top,left:TrophyIM.posWindow.left,draggable:true,visible:"display",resizable:true,zindex:loadscript.getZIndex(),title:titleWindow,closeAction:"hidden",content:_content}
 _win=_winBuild(winChatRoom);return(_messages=_win.content().firstChild);},addContact:function(jidTo,name,group)
-{var _id=TrophyIM.connection.getUniqueId('add');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('group').t(group).tree();TrophyIM.connection.send(newContact);},addMessage:function(chatBox,jid,msg)
+{var _flag=true;if(TrophyIM.removeResult.idResult.length>0)
+{for(var i=0;i<TrophyIM.removeResult.idResult.length;i++)
+{if(TrophyIM.removeResult.idResult[i]==jidTo)
+{_flag=false;TrophyIM.removeResult.idResult.splice(i,1);i--;}}}
+if(_flag)
+{var _id=TrophyIM.connection.getUniqueId('add');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('group').t(group).tree();TrophyIM.connection.send(newContact);}},addMessage:function(chatBox,jid,msg)
 {msg.msg=loadscript.getSmiles(msg.msg);var messageDiv=document.createElement("div");messageDiv.style.margin="3px 0px 1em 3px";messageDiv.innerHTML=msg.contact+" : "+msg.msg;chatBox.appendChild(messageDiv);chatBox.scrollTop=chatBox.scrollHeight;},renameContact:function(jid)
 {var name=TrophyIM.rosterObj.roster[jid].contact.name;if((name=prompt(i18n.ASK_NEW_NAME_QUESTION+name+"!",name)))
@@ -206,5 +217,5 @@
 {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})
+{var _id=TrophyIM.connection.getUniqueId();TrophyIM.removeResult.idResult[TrophyIM.removeResult.idResult.length]=jidTo;var delContact=$iq({type:'set',id:_id})
 delContact=delContact.c('query').attrs({xmlns:'jabber:iq:roster'});delContact=delContact.c('item').attrs({jid:jidTo,subscription:'remove'}).tree();TrophyIM.connection.send(delContact);loadscript.removeElement(document.getElementById('itenContactNotification_'+jidTo));var spanShow=document.getElementById('span_show_itenContact_'+jidTo)
 spanShow.parentNode.removeChild(spanShow);loadscript.removeGroup(divItenContact.parentNode);divItenContact.parentNode.removeChild(divItenContact);}},renderRoster:function()
Index: branches/2.2/jabberit_messenger/jmessenger/js/trophyim.js
===================================================================
--- branches/2.2/jabberit_messenger/jmessenger/js/trophyim.js	(revision 3308)
+++ branches/2.2/jabberit_messenger/jmessenger/js/trophyim.js	(revision 3314)
@@ -640,5 +640,27 @@
     	if( msg.getAttribute('from').toString().indexOf( TROPHYIM_CHATROOM ) < 0 )
     	{	
-    		TrophyIM.rosterObj.setPresence( msg.getAttribute('from'), priority, show, status );
+			var _from = Strophe.getBareJidFromJid( msg.getAttribute('from') );
+			var _flag = true;
+
+    		if( TrophyIM.removeResult.idResult.length > 0 )
+    		{
+    			for( var i = 0 ; i < TrophyIM.removeResult.idResult.length; i++ )
+    			{
+    				if( TrophyIM.removeResult.idResult[i] == _from )
+    				{
+    					_flag = false;
+    					
+    					TrophyIM.removeResult.idResult.splice(i,1);
+    					
+    					i--;
+    					
+    					if( show.toLowerCase() === 'subscribe' )
+    						_flag = true;
+    				}
+    			}
+    		}
+    		
+    		if( _flag )
+    			TrophyIM.rosterObj.setPresence( msg.getAttribute('from'), priority, show, status );
         }
 
@@ -1151,12 +1173,32 @@
 	addContact : function( jidTo, name, group )
 	{
-		// Add Contact
-    	var _id = TrophyIM.connection.getUniqueId('add'); 
-		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('group').t(group).tree();
-
-		TrophyIM.connection.send(newContact);
+		var _flag = true;
+
+		if( TrophyIM.removeResult.idResult.length > 0 )
+		{
+			for( var i = 0 ; i < TrophyIM.removeResult.idResult.length; i++ )
+			{
+				if( TrophyIM.removeResult.idResult[i] == jidTo )
+				{
+					_flag = false;
+					
+					TrophyIM.removeResult.idResult.splice(i,1);
+					
+					i--;
+				}
+			}
+		}
+		
+		if( _flag )
+		{	
+	    	// Add Contact
+	    	var _id = TrophyIM.connection.getUniqueId('add'); 
+			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('group').t(group).tree();
+	
+			TrophyIM.connection.send(newContact);
+		}
 	},
 
@@ -1336,5 +1378,5 @@
     		
     		// Controller Result
-    		//TrophyIM.removeResult.idResult[ TrophyIM.removeResult.idResult.length ] = jidTo;
+    		TrophyIM.removeResult.idResult[ TrophyIM.removeResult.idResult.length ] = jidTo;
 
     		var delContact	= $iq({type: 'set', id: _id})
