Index: sandbox/jabberit_messenger/trophy_expresso/js/trophyim.js
===================================================================
--- sandbox/jabberit_messenger/trophy_expresso/js/trophyim.js	(revision 2491)
+++ sandbox/jabberit_messenger/trophy_expresso/js/trophyim.js	(revision 2511)
@@ -656,5 +656,8 @@
 				'path_jabberit' : path_jabberit
     	};
-    	
+
+    	titleWindow = barejid.toLowerCase();
+   		titleWindow = titleWindow.substring(0, titleWindow.indexOf('@'));
+
         if( TrophyIM.rosterObj.roster[barejid] )
         {
@@ -664,9 +667,4 @@
             }
         }
-        else
-        {
-        	titleWindow = barejid.toLowerCase();
-        	titleWindow = titleWindow.substring(0, titleWindow.indexOf('@'));
-        }	
 
     	var winChatBox = 
@@ -687,4 +685,7 @@
     	
     	_winBuild(winChatBox);
+
+    	// Photo User;
+   		loadIM.getPhotoUser(barejid);
 		
 		loadIM.configEvents( document.getElementById( barejid + '__sendBox'),
@@ -999,12 +1000,19 @@
 		for( var i = 0 ; i < users.length; i++ )
 		{
-			if( TrophyIM.rosterObj.roster[users[i]].contact.groups )
-			{
-				var groups = TrophyIM.rosterObj.roster[users[i]].contact.groups;
-				
-				if( groups.length > 0 )
+			if( TrophyIM.rosterObj.roster[users[i]].contact.jid != loadIM.getUserCurrent().jid )
+			{
+				if( TrophyIM.rosterObj.roster[users[i]].contact.groups )
 				{
-					for( var j = 0; j < groups.length; j++ )
-						addItem( TrophyIM.rosterObj.roster[users[i]], groups[j], element, j );
+					var groups = TrophyIM.rosterObj.roster[users[i]].contact.groups;
+					
+					if( groups.length > 0 )
+					{
+						for( var j = 0; j < groups.length; j++ )
+							addItem( TrophyIM.rosterObj.roster[users[i]], groups[j], element, j );
+					}
+					else
+					{
+						addItem( TrophyIM.rosterObj.roster[users[i]], "Geral", element, 0 );
+					}
 				}
 				else
@@ -1013,8 +1021,4 @@
 				}
 			}
-			else
-			{
-				addItem( TrophyIM.rosterObj.roster[users[i]], "Geral", element, 0 );
-			}
 		}	
 	},
@@ -1046,7 +1050,30 @@
      */
 
-	setPresence : function( show )
-	{
-		TrophyIM.connection.send($pres( ).c('show').t(show).tree());
+	setPresence : function( type )
+	{
+		if( type != 'status')
+		{
+			TrophyIM.connection.send($pres( ).c('show').t(type).tree());
+		}
+		else
+		{
+			var _show	= "available";
+			var _status	= "";
+			
+			if (( _status = prompt("Digite sua mensagem !") ))
+			{
+				for(var resource in TrophyIM.rosterObj.roster[loadIM.getUserCurrent().jid].presence )
+				{	
+					if ( TROPHYIM_RESOURCE === ("/" + resource) )
+						_show = TrophyIM.rosterObj.roster[loadIM.getUserCurrent().jid].presence[resource].show;
+				}
+
+				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() );
+			}
+		}
 	},
 	
@@ -1157,36 +1184,33 @@
 	this.addContact = function(jid, subscription, name, groups )
 	{
-    	if( jid != loadIM.getUserCurrent().jid )
-    	{ 
-    	 	if( subscription !== "remove" )
-	        {
-		    	var contact		= { jid:jid, subscription:subscription, name:name, groups:groups }
-		        var jid_lower	= jid.toLowerCase();
-		
-				if ( this.roster[jid_lower] )
+	 	if( subscription !== "remove" )
+        {
+	    	var contact		= { jid:jid, subscription:subscription, name:name, groups:groups }
+	        var jid_lower	= jid.toLowerCase();
+	
+			if ( this.roster[jid_lower] )
+			{
+	            this.roster[jid_lower]['contact'] = contact;
+	        }
+			else
+			{
+	            this.roster[jid_lower] = {contact:contact};
+	        }
+	
+			groups = groups ? groups : [''];
+	        
+			for ( var g = 0; g < groups.length; g++ )
+			{
+				if ( !this.groups[groups[g]] )
 				{
-		            this.roster[jid_lower]['contact'] = contact;
-		        }
-				else
-				{
-		            this.roster[jid_lower] = {contact:contact};
-		        }
-		
-				groups = groups ? groups : [''];
-		        
-				for ( var g = 0; g < groups.length; g++ )
-				{
-					if ( !this.groups[groups[g]] )
-					{
-		                this.groups[groups[g]] = {};
-		            }
-		            
-					this.groups[groups[g]][jid_lower] = jid_lower;
-		        }
+	                this.groups[groups[g]] = {};
+	            }
+	            
+				this.groups[groups[g]][jid_lower] = jid_lower;
 	        }
-        	else
-        	{
-        		this.removeContact(jid);
-        	}
+        }
+    	else
+    	{
+    		this.removeContact(jid);
     	}
     }
@@ -1314,35 +1338,27 @@
         var jid_lower = barejid.toLowerCase();
         
-        if( barejid != loadIM.getUserCurrent().jid )
-        {
-			if( show != 'unavailable')
-			{
-	            if (!this.roster[jid_lower])
-				{
-	                this.addContact(barejid, 'not-in-roster');
-	            }
-	            var presence =
-				{
-	                resource:resource, priority:priority, show:show, status:status
-	            }
-	            
-				if (!this.roster[jid_lower]['presence'])
-				{
-	                this.roster[jid_lower]['presence'] = {}
-	            }
-	            this.roster[jid_lower]['presence'][resource] = presence
-	        }
-			else if (this.roster[jid_lower] && this.roster[jid_lower]['presence'] && this.roster[jid_lower]['presence'][resource])
-			{
-	            delete this.roster[jid_lower]['presence'][resource];
-	        }
-	        
-			this.addChange(jid_lower);
-	        
-			if (TrophyIM.activeChats['divs'][jid_lower])
-			{
-	            TrophyIM.setTabPresence(jid_lower, TrophyIM.activeChats['divs'][jid_lower]['tab']);
-	        }
-        }
+		if( show != 'unavailable')
+		{
+            if (!this.roster[jid_lower])
+			{
+                this.addContact(barejid, 'not-in-roster');
+            }
+            var presence =
+			{
+                resource:resource, priority:priority, show:show, status:status
+            }
+            
+			if (!this.roster[jid_lower]['presence'])
+			{
+                this.roster[jid_lower]['presence'] = {}
+            }
+            this.roster[jid_lower]['presence'][resource] = presence
+        }
+		else if (this.roster[jid_lower] && this.roster[jid_lower]['presence'] && this.roster[jid_lower]['presence'][resource])
+		{
+            delete this.roster[jid_lower]['presence'][resource];
+        }
+        
+		this.addChange(jid_lower);
     }
 
