Index: /trunk/instant_messenger/inc/im_acl.inc.php
===================================================================
--- /trunk/instant_messenger/inc/im_acl.inc.php	(revision 216)
+++ /trunk/instant_messenger/inc/im_acl.inc.php	(revision 227)
@@ -2,60 +2,52 @@
 $size_of_ACL = sizeof($GLOBALS['phpgw_info']['user']['acl']);
 
-for ( $i = 0; $i < $size_of_ACL; $i++ )
-	if ( $GLOBALS['phpgw_info']['user']['acl'][$i]['appname'] == 'instant_messenger' )
-	{
-		$webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url'];
-		$webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/';
+for ( $i = 0; $i < $size_of_ACL && $GLOBALS['phpgw_info']['user']['acl'][$i]['appname'] == 'instant_messenger'; $i++ );
 
-		if ( strrpos($webserver_url, '/') === false || strrpos($webserver_url, '/') != (strlen($webserver_url)-1) )
-			$webserver_url .= '/';
+$webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url'];
+$webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/';
 
-		$webserver_url = $webserver_url . 'instant_messenger/';
+if ( strrpos($webserver_url, '/') === false || strrpos($webserver_url, '/') != (strlen($webserver_url)-1) )
+	$webserver_url .= '/';
 
-		session_start();
-		require_once PHPGW_SERVER_ROOT . '/instant_messenger/inc/im_sessions.inc.php';
-		require_once PHPGW_SERVER_ROOT . '/instant_messenger/inc/load_lang.php';
-		$_user     = $_SESSION['phpgw_info']['instant_messenger']['user'];
-		$_pass     = $_SESSION['phpgw_info']['instant_messenger']['passwd'];
-		$_server   = $_SESSION['phpgw_info']['instant_messenger']['name_jabber'];
-		$_port     = $_SESSION['phpgw_info']['instant_messenger']['port_jabber'];
-		$_resource = $_SESSION['phpgw_info']['instant_messenger']['resource_jabber'];
-		session_write_close();
+$webserver_url = $webserver_url . 'instant_messenger/';
 
-		$DOCUMENT_ROOT = PHPGW_SERVER_ROOT .'/instant_messenger/';
+session_start();
+require_once PHPGW_SERVER_ROOT . '/instant_messenger/inc/im_sessions.inc.php';
+require_once PHPGW_SERVER_ROOT . '/instant_messenger/inc/load_lang.php';
+$_user     = $_SESSION['phpgw_info']['instant_messenger']['user'];
+$_pass     = $_SESSION['phpgw_info']['instant_messenger']['passwd'];
+$_server   = $_SESSION['phpgw_info']['instant_messenger']['name_jabber'];
+$_port     = $_SESSION['phpgw_info']['instant_messenger']['port_jabber'];
+$_resource = $_SESSION['phpgw_info']['instant_messenger']['resource_jabber'];
+session_write_close();
 
-		$js = array(
-			'js/connector.js',
-			'js/xtools.js',
-			'js/jabber.js',
-			'js/client.js',
-			'js/images.js',
-			'js/dragdrop.js',
-			'js/build_win.js',
-			'js/templates.js',
-			'js/fcommon.js',
-			'js/menu_action.js',
-			'js/functions.js',
-			'js/images.js',
-			'js/cookies_im.js',
-			'js/load.js',
-		);
+$DOCUMENT_ROOT = PHPGW_SERVER_ROOT .'/instant_messenger/';
 
-		print '<script type="text/javascript">var path_im = "'.$webserver_url.'";</script>';
+$js = array(
+	'js/connector.js',
+	'js/xtools.js',
+	'js/jabber.js',
+	'js/client.js',
+	'js/images.js',
+	'js/dragdrop.js',
+	'js/build_win.js',
+	'js/templates.js',
+	'js/fcommon.js',
+	'js/menu_action.js',
+	'js/functions.js',
+	'js/images.js',
+	'js/cookies_im.js',
+	'js/load.js',
+);
 
-		foreach ( $js as $key => $val )
-			print '<script src="' . $webserver_url . $val . '?' . filemtime($DOCUMENT_ROOT . $val) . '"></script>';
+print '<script type="text/javascript">var path_im = "'.$webserver_url.'";</script>';
 
-		print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'templates/default/css/window.css">';
-		print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'templates/default/css/chat.css">';
-		print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'templates/default/css/common.css">';
+foreach ( $js as $key => $val )
+	print '<script src="' . $webserver_url . $val . '?' . filemtime($DOCUMENT_ROOT . $val) . '"></script>';
 
-		require_once  $DOCUMENT_ROOT . 'inc/class.Ujabber.inc.php';
+print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'templates/default/css/window.css">';
+print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'templates/default/css/chat.css">';
+print '<link rel="stylesheet" type="text/css" href="' . $webserver_url . 'templates/default/css/common.css">';
 
-		$jabber = new Ujabber;
-		$jabber->connect($_user . '@' . $_server . '/' . $_resource . ':' . $_port, $_pass, 'read/write');
-
-		print '<script type="text/javascript">setTimeout("client()",2000);</script>';
-		$i = $size_of_ACL;
-	}
+print '<script type="text/javascript">setTimeout("client()",2000);</script>';
 ?>
Index: /trunk/instant_messenger/inc/Jabberd2.abstract.php
===================================================================
--- /trunk/instant_messenger/inc/Jabberd2.abstract.php	(revision 216)
+++ /trunk/instant_messenger/inc/Jabberd2.abstract.php	(revision 227)
@@ -71,4 +71,5 @@
 			if ( $this->writeSocket($this->iq('set', $addid, NULL, NULL, "jabber:iq:roster", $newcontact)) )
 				$this->getContacts();
+				echo "OK";
 		}
 	}
@@ -87,9 +88,14 @@
 		{
 			$jid = ( trim($pJid['jid']) == "this" ) ? $this->_user . '@' . $this->_server : $pJid['jid'];
-
+			$vcard = (trim($pJid['jid']) == "this") ? 'vCard_user' : 'vCard';
+			
 			if ( !$this->connected )
+			{
 				echo "disconnected";
+			}
 			else
-				$this->writeSocket($this->iq('get', 'vCard', $jid, NULL, "vcard-temp", "<vCard xmlns='vcard-temp'/>"));
+			{
+				$this->writeSocket($this->iq('get', $vcard, $jid, NULL, "vcard-temp", "<vCard xmlns='vcard-temp'/>"));
+			}
 		}
 		else
@@ -106,5 +112,8 @@
 			echo "disconnected";
 		else
+		{
 			$this->writeSocket($this->iq('set', $id, NULL, NULL, "vcard-temp", "<vCard xmlns='vcard-temp'>".$NewVcard['vcard']."</vCard>"));
+			echo "OK";
+		}
 	}
 
@@ -151,4 +160,10 @@
 	}
 
+	final function setStatus()
+	{
+		$this->setPresence(array("type" => "unavailable"));
+		$this->setPresence(array("type" => "available"));	
+	}
+
 	final function updateContact($pContact)
 	{
Index: /trunk/instant_messenger/inc/class.Ujabber.inc.php
===================================================================
--- /trunk/instant_messenger/inc/class.Ujabber.inc.php	(revision 216)
+++ /trunk/instant_messenger/inc/class.Ujabber.inc.php	(revision 227)
@@ -117,10 +117,10 @@
 			}
 
-			//Linha abaixo dentro do padrÃ£o xmpp, entretanto clientes como
-			//o PSI nÃ£o seguem o padrÃ£o assim ocorre problemas de comunicaÃ§Ã£o
+			//Linha abaixo dentro do padrão xmpp, entretanto clientes como
+			//o PSI não seguem o padrão assim ocorre problemas de comunicação
 			//descomentar e retirar a seguinte para voltar ao padrÃ£o assim
-			//que possÃ­vel
-			//24/10/2007 - problema verificado por usuÃ¡rios do SERPRO na
-			//plataforma Windows ocorrendo tambÃ©m no cliente Linux
+			//que possí­vel
+			//24/10/2007 - problema verificado por usuários do SERPRO na
+			//plataforma Windows ocorrendo também no cliente Linux
 			//por Alexandre e Rodrigo
 
Index: /trunk/instant_messenger/inc/Jabber.abstract.php
===================================================================
--- /trunk/instant_messenger/inc/Jabber.abstract.php	(revision 216)
+++ /trunk/instant_messenger/inc/Jabber.abstract.php	(revision 227)
@@ -61,5 +61,5 @@
 
 				if ( $this->write($xml) === false )
-					throw new Exception('[connect] #4 it isn\'t possible connect in the server becase exists a client connected with same user. File: ' . __FILE__ . '  ::  ' . __LINE__);
+					throw new Exception('[connect] #4 it isn\'t possible connect in the server because exists a client connected with same user. File: ' . __FILE__ . '  ::  ' . __LINE__);
 			}
 
@@ -91,4 +91,5 @@
 				if ( ($xml = $this->read()) === false )
 					throw new Exception('[connect] #1 it isn\'t possible read the socket. File: ' . __FILE__ . '  ::  ' . __LINE__);
+
 
 				if ( preg_match('/(<starttls .*<required\/><\/starttls>)/', $xml, $matches) )
Index: /trunk/instant_messenger/js/jabber.js
===================================================================
--- /trunk/instant_messenger/js/jabber.js	(revision 171)
+++ /trunk/instant_messenger/js/jabber.js	(revision 227)
@@ -42,5 +42,5 @@
 
 		function readContacts(pContacts)
-		{
+		{ 
 			var XmlDoc = "<layer>" +
 							"<lang1>" + im.get_lang("Nickname") + "</lang1>" +
@@ -51,8 +51,8 @@
 						 "</layer>";
 
-			im_window.load('_contacts_im_','instant_messenger_content','<title>.::Expresso Messenger::.</title>','window.xsl','',true,true,false);
+			im_window.load('_contacts_im_','instant_messenger_content','<title>.::Expresso Messenger::.</title>','window.xsl','',true,true,false );
 			im_window.elementC('_contacts_im_').innerHTML  = _this.xtools.parse(XmlDoc,'layer.xsl');
 			im_window.elementC('_contacts_im_').innerHTML += _this.xtools.parse(pContacts, 'contacts.xsl');
-						
+			
 			var element = func.byId('im_contact_list').firstChild;
 
@@ -73,4 +73,24 @@
 				im.ldap_photo('im_avatar');
 			}
+			
+			function handler(Xmldata)
+			{
+			};
+			con.go('$this.Ujabber.setStatus', {'request':handler});
+
+			var status = "";
+			if( status = cookies_im.checkCookie('status'))
+			{
+				status = status.substr(status.indexOf("=") + 1,status.length);
+				im.status = status;
+			}
+			else
+			{
+				im.status = 'type=available';
+				im.statusFlag = 'available';
+				func.byId('im_status_src').src = im_available.src;
+			}
+	
+			im.presence(im.status);
 		}
 
Index: /trunk/instant_messenger/js/client.js
===================================================================
--- /trunk/instant_messenger/js/client.js	(revision 164)
+++ /trunk/instant_messenger/js/client.js	(revision 227)
@@ -78,23 +78,4 @@
 	function contacts(data)
 	{
-		function handler(Xmldata)
-		{
-		};
-		con.go('$this.Ujabber.setPresence', {'request':handler},'type=unavailable');
-
-		var status = "";
-		if( status = cookies_im.checkCookie('status'))
-		{
-			status = status.substr(status.indexOf("=") + 1,status.length);
-			im.status = status;
-		}
-		else
-		{
-			im.status = 'type=available';
-			im.statusFlag = 'available';
-			func.byId('im_status_src').src = im_available.src;
-		}
-
-		im.presence(im.status);
 	}
 	request();
Index: /trunk/instant_messenger/js/load.js
===================================================================
--- /trunk/instant_messenger/js/load.js	(revision 171)
+++ /trunk/instant_messenger/js/load.js	(revision 227)
@@ -25,5 +25,5 @@
 	function load_im_contacts()
 	{
-		im_window.load('_contacts_im_','instant_messenger_content', '<title>Expresso Messenger</title>', 'window.xsl','',true,true,true);
+		im_window.load('_contacts_im_','instant_messenger_content', '<title>Expresso Messenger</title>', 'window.xsl','',true,true,false);
 	}
 	
