Index: /trunk/jabberit_messenger/inc/webservice.php
===================================================================
--- /trunk/jabberit_messenger/inc/webservice.php	(revision 1885)
+++ /trunk/jabberit_messenger/inc/webservice.php	(revision 1900)
@@ -13,4 +13,5 @@
 class webService
 {
+	private $attribute;
 	private $conn;
 	private $contextLdap;
@@ -23,4 +24,5 @@
 	private $fileLdapInternal = false;
 	private $fileLdapExternal = false;
+	private $version3;
 	
 	function __construct()
@@ -42,4 +44,12 @@
 			$this->fileLdapInternal = true;
 		}
+		
+		$this->attribute = "uid";
+		
+		if ( file_exists('attributeLdap.php') )
+		{
+			require_once('attributeLdap.php');
+			$this->attribute = trim($attributeTypeName);
+		}
 	}
 	
@@ -54,5 +64,5 @@
 		if( $this->version3 )
 			if( !ldap_set_option($this->conn,LDAP_OPT_PROTOCOL_VERSION,3) )
-				$this->version = false;
+				$this->version3 = false;
 
 		ldap_set_option($this->conn, LDAP_OPT_REFERRALS, $this->refer);
@@ -179,6 +189,6 @@
 				if( $this->conn )
 				{
-					$filter = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))";
-					$justthese = array("uid","cn","dn");
+					$filter = "(&(phpgwaccounttype=u)(".$this->attribute."=".$uid.")(!(phpgwaccountvisible=-1)))";
+					$justthese = array($this->attribute,"cn","dn");
 					$search = ldap_search( $this->conn, $this->contextLdap, $filter,$justthese);
 					$get_entries = ldap_get_entries( $this->conn, $search);
@@ -204,6 +214,6 @@
 				if( $this->conn )
 				{
-					$filter = "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))";
-					$justthese = array("uid","cn","dn");
+					$filter = "(&(phpgwaccounttype=u)(".$this->attribute."=".$uid.")(!(phpgwaccountvisible=-1)))";
+					$justthese = array($this->attribute,"cn","dn");
 					$search = ldap_search( $this->conn, $this->contextLdap, $filter, $justthese);
 					$get_entries = ldap_get_entries( $this->conn, $search);
@@ -245,6 +255,6 @@
 				if( $this->conn )
 				{
-					$filter			= "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))";
-					$justthese		= array("uid","jpegPhoto");
+					$filter			= "(&(phpgwaccounttype=u)(".$this->attribute."=".$uid.")(!(phpgwaccountvisible=-1)))";
+					$justthese		= array($this->attribute,"jpegPhoto");
 					$search			= ldap_search($this->conn,$this->contextLdap,$filter,$justthese);
 					$get_entries	= ldap_get_entries($this->conn,$search);
@@ -277,6 +287,6 @@
 			if( $this->conn )
 			{
-				$filter			= "(&(phpgwaccounttype=u)(uid=".$uid.")(!(phpgwaccountvisible=-1)))";
-				$justthese		= array("uid","jpegPhoto");
+				$filter			= "(&(phpgwaccounttype=u)(".$this->attribute."=".$uid.")(!(phpgwaccountvisible=-1)))";
+				$justthese		= array($this->attribute,"jpegPhoto");
 				$search			= ldap_search($this->conn,$this->contextLdap,$filter,$justthese);
 				$get_entries	= ldap_get_entries($this->conn,$search);
Index: /trunk/jabberit_messenger/inc/attributeLdap.php
===================================================================
--- /trunk/jabberit_messenger/inc/attributeLdap.php	(revision 1900)
+++ /trunk/jabberit_messenger/inc/attributeLdap.php	(revision 1900)
@@ -0,0 +1,16 @@
+<?php
+ 
+  /***************************************************************************\
+  *  Expresso - Expresso Messenger                                            *
+  *  	- Alexandre Correia / Rodrigo Souza							          *
+  *  	- JETI - http://jeti-im.org/										  *
+  * ------------------------------------------------------------------------- *
+  *  This program is free software; you can redistribute it and/or modify it  *
+  *  under the terms of the GNU General Public License as published by the    *
+  *  Free Software Foundation; either version 2 of the License, or (at your   *
+  *  option) any later version.                                               *
+  \***************************************************************************/
+  
+	$attributeTypeName = "uid";
+
+?>
Index: /trunk/jabberit_messenger/inc/login.php
===================================================================
--- /trunk/jabberit_messenger/inc/login.php	(revision 1799)
+++ /trunk/jabberit_messenger/inc/login.php	(revision 1900)
@@ -36,41 +36,25 @@
 			$PROTOCOL = trim("https");
 
+		// Define Attribute Ldap
+		$attribute = "uid";
+		if ( file_exists('inc/attributeLdap.php') )
+		{
+			require_once('attributeLdap.php');
+			$attribute = trim($attributeTypeName);
+		}
+
 		// Uid user
-		$uid = $_SESSION['phpgw_info']['jabberit_messenger']['user_jabber'];
-		
-		$organization = explode(",", $_SESSION['phpgw_info']['jabberit_messenger']['attributes_org_ldap_jabberit']);
-
-		$organization_user = $_SESSION['phpgw_info']['jabberit_messenger']['account_dn'];
-		$organization_user = substr($organization_user, strpos($organization_user,"ou=") + 3 , strlen($organization_user));
-		$organization_user = substr($organization_user, 0, strpos($organization_user, ","));
+		if( $attribute === "uid" )
+		{
+			$uid = $_SESSION['phpgw_info']['jabberit_messenger']['user_jabber'];
+		}
+		else
+		{
+			$uid = "DEFINA AQUI A VARIAVEL DE SESSÃO QUE CONTEM O ATRIBUTO DE AUTENTICAÇÂO";
+		}
 		
 		// FirstName
 		$CnName = explode(" ",$_SESSION['phpgw_info']['jabberit_messenger']['fullname']);
 		
-		if(is_array($organization))
-		{
-			foreach($organization as $attr)
-			{
-				$tmp = explode(";",$attr);
-				if( strtolower(trim($tmp[0])) == strtolower(trim($organization_user)))
-				{
-					switch(strtolower(trim($tmp[1])))
-					{
-						case "mail" :
-								$uid = $_SESSION['phpgw_info']['jabberit_messenger']['mail'];
-								$uid = substr($uid,0,strpos($uid,"@"));	
-								break;
-	
-						case "description" :
-								// SERPRO
-								// parte antes do arroba;
-								// Informe aqui a parte da sessão correspondente; 
-								$uid = "description"; 										
-								break;
-					}
-				}
-			}
-		}
-
 		//Enable/Disable VoIP Service -> Voip Server Config
 		$voip_enabled = false;
Index: /trunk/jabberit_messenger/inc/class.uiconfig.inc.php
===================================================================
--- /trunk/jabberit_messenger/inc/class.uiconfig.inc.php	(revision 1768)
+++ /trunk/jabberit_messenger/inc/class.uiconfig.inc.php	(revision 1900)
@@ -75,11 +75,8 @@
 													'label_config1' => lang("Site Configuration Jabber"),
 													'label_config2' => lang("Map organization for realm jabber"),
-													'label_config3' => lang("Configuration of authentication attribute by Organization (OU)"),													
 													'value_config1' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname=jabberit_messenger'),												
 													'value_config2' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uihostsjabber.edit_conf'),
-													'value_config3' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uiconforganization.edit_conf'),
 													'value_image1' 	=> "jabberit_messenger/templates/default/images/navbar.png",
 													'value_image2' 	=> "jabberit_messenger/templates/default/images/gear.png",
-													'value_image3' 	=> "jabberit_messenger/templates/default/images/table.png"													
 													));
 	
Index: /trunk/jabberit_messenger/inc/class.contacts_im.inc.php
===================================================================
--- /trunk/jabberit_messenger/inc/class.contacts_im.inc.php	(revision 1884)
+++ /trunk/jabberit_messenger/inc/class.contacts_im.inc.php	(revision 1900)
@@ -198,5 +198,5 @@
 				$result[] = $this->ldap->getUsersLdapRoot("cn=*".$pName."*", $filter_uid);
         }
-		
+	
         if( !$this->groupsLocked() )
         {
@@ -239,10 +239,12 @@
 				for($i = 0 ; $i < count($this->hostsJabberLdap); $i++)
 				{
-					if( !@array_key_exists($this->hostsJabberLdap[$i]['serverLdap'], $serversLdap) )
+					if( !array_key_exists($this->hostsJabberLdap[$i]['serverLdap'], $serversLdap) )
+					{
 						$result[] = $this->ldap->getUsersLdapCatalog("cn=*".$pName."*", false, $this->hostsJabberLdap[$i]['serverLdap'] );
+					}
 				}
 			}
         }
-
+        
         if ( is_array($result) )
         {
Index: /trunk/jabberit_messenger/inc/jabberit_sessions.inc.php
===================================================================
--- /trunk/jabberit_messenger/inc/jabberit_sessions.inc.php	(revision 1799)
+++ /trunk/jabberit_messenger/inc/jabberit_sessions.inc.php	(revision 1900)
@@ -61,5 +61,4 @@
 		$_SESSION['phpgw_info']['jabberit_messenger']['name_company']					= $GLOBALS['phpgw_info']['server']['name_company_applet_jabberit'];
 		$_SESSION['phpgw_info']['jabberit_messenger']['use_attribute_jabberit']			= $GLOBALS['phpgw_info']['server']['use_attribute_jabberit'];
-		$_SESSION['phpgw_info']['jabberit_messenger']['attributes_org_ldap_jabberit']	= $GLOBALS['phpgw_info']['server']['attributes_org_ldap_jabberit'];
 		$_SESSION['phpgw_info']['jabberit_messenger']['map_org_realm_jabberit']			= $GLOBALS['phpgw_info']['server']['map_org_realm_jabberit'];
 		
Index: /trunk/jabberit_messenger/inc/class.ldap_im.inc.php
===================================================================
--- /trunk/jabberit_messenger/inc/class.ldap_im.inc.php	(revision 1881)
+++ /trunk/jabberit_messenger/inc/class.ldap_im.inc.php	(revision 1900)
@@ -20,5 +20,5 @@
 class ldap_im
 {
-	private $attr_org;
+	private $attribute;
 	private $common;
 	private $hostsJabber;
@@ -38,7 +38,4 @@
 		$this->ldap_pass	= $_SESSION['phpgw_info']['jabberit_messenger']['password_ldap_jabberit'];
 
-		// Attributes org ldap;
-		$this->attr_org = explode(",", $_SESSION['phpgw_info']['jabberit_messenger']['attributes_org_ldap_jabberit']);
-		
 		// Hosts Jabber
 		$this->hostsJabber = unserialize($_SESSION['phpgw_info']['jabberit_messenger']['map_org_realm_jabberit']);
@@ -47,4 +44,9 @@
 		$this->max_result = 30;
 		
+		if ( file_exists('inc/attributeLdap.php') )
+		{
+			require_once('attributeLdap.php');
+			$this->attribute = trim($attributeTypeName);
+		}
 	}
 
@@ -333,5 +335,5 @@
 			{
 				$filter 	= ( $uid ) ? "(&(phpgwaccounttype=u)(|".$uid.")(".$search ."))" : "(&(phpgwaccounttype=u)(".$search ."))";
-				$justthese	= array("uid","uidNumber","cn","mail","phpgwAccountVisible","dn","jpegPhoto");								
+				$justthese	= array( $this->attribute ,"uidNumber" ,"cn" ,"mail" ,"phpgwAccountVisible" ,"dn" ,"jpegPhoto" );								
 				$searchRoot	= ( $this->ldap_org != "*" ) ? "ou=".$this->ldap_org.",".$this->ldap_context : $this->ldap_context;
 				$search1	= @ldap_search($this->ldap, $searchRoot, $filter, $justthese, 0, $this->max_result + 1);
@@ -358,5 +360,5 @@
 			$searchRoot	= ( $ous ) ? $ous.",".$this->ldap_context : $this->ldap_context ;
 			$filter		= "(&(phpgwaccounttype=u)(|".$uidnumber.")(".$search ."))";
-			$justthese	= array("uid","uidNumber","cn","mail","phpgwAccountVisible","dn","jpegPhoto");								
+			$justthese	= array( $this->attribute, "uidNumber", "cn", "mail", "phpgwAccountVisible", "dn", "jpegPhoto" );								
 			$search		= ldap_search( $this->ldap, $searchRoot, $filter, $justthese, 0, $this->max_result + 1);
 			$entry		= ldap_get_entries( $this->ldap, $search );
@@ -369,20 +371,22 @@
 	private final function resultArray($pArray, $pConn, $pOrg = false)
 	{
-		$entry = $pArray;
-		$result = array();
-
-		$j = 0;
-		for($i = 0 ; $i < $entry['count']; $i++)
+		$entry	= $pArray;
+		$result	= array();
+		$j		= 0;
+		
+		for( $i = 0 ; $i < $entry['count']; $i++ )
 		{
 			if ( $entry[$i]['phpgwaccountvisible'][0] != '-1' )
 			{
-				$result[$j]['uidnumber'] = $entry[$i]['uidnumber'][0];			
-				$result[$j]['mail']	=  $entry[$i]['mail'][0];
-				$result[$j]['uid']	=  $entry[$i]['uid'][0];
-				$result[$j]['jid']	= $entry[$i]['uid'][0];
+				$result[$j]['uidnumber']	= $entry[$i]['uidnumber'][0];			
+				$result[$j]['mail']			= $entry[$i]['mail'][0];
+				$result[$j]['uid']			= $entry[$i][$this->attribute][0];
+				$result[$j]['jid']			= $entry[$i][$this->attribute][0];
+				
 				$ou = explode("dc=", $entry[$i]['dn']);
 				$ou = explode("ou=",$ou[0]);
 				$ou = array_pop($ou);
 				$result[$j]['ou']	= strtoupper(substr($ou,0,strlen($ou)-1));
+				
 				if( $pOrg === "*" )
 					$result[$j]['ouAll'] = "*";
@@ -404,30 +408,6 @@
 		
 			$organization = $this->attr_org;
-	
-			if(is_array($organization))
-			{
-				foreach($organization as $attr)
-				{
-					$tmp = explode(";",$attr);
-					if( strtolower(trim($tmp[0])) == strtolower(trim($result[$i]['dn'])) )
-					{
-						switch(strtolower(trim($tmp[1])))
-						{
-							case "mail" :
-									$uid = $result[$i]['mail'];
-									$uid = substr($uid,0,strpos($uid,"@"));	
-									$result[$i]['uid'] = $uid;
-									break;
-	
-							case "description" :
-									// SERPRO
-									// parte antes do arroba; 
-									$result[$i]['uid'] = $result[$i]['description']; 										
-									break;
-						}
-					}
-				}
-			}
-		}
+		}
+		
 		return $result;
 	}
Index: unk/jabberit_messenger/inc/class.uiconforganization.inc.php
===================================================================
--- /trunk/jabberit_messenger/inc/class.uiconforganization.inc.php	(revision 1780)
+++ 	(revision )
@@ -1,107 +1,0 @@
-<?php
-
-  /***************************************************************************\
-  *  Expresso - Expresso Messenger                                            *
-  *  	- Alexandre Correia / Rodrigo Souza							          *
-  * ------------------------------------------------------------------------- *
-  *  This program is free software; you can redistribute it and/or modify it  *
-  *  under the terms of the GNU General Public License as published by the    *
-  *  Free Software Foundation; either version 2 of the License, or (at your   *
-  *  option) any later version.                                               *
-  \***************************************************************************/
-
-require_once "class.ldap_im.inc.php";
-
-class uiconforganization
-{
-
-	private $bo;
-	private $ldap;
-
-	public $public_functions = array(
-		'backPage'  => True,
-		'edit_conf' => True,
-	);
-
-	public final function edit_conf()
-	{
-		if( !$GLOBALS['phpgw']->acl->check('run',1,'admin') )
-		{
-			$GLOBALS['phpgw']->redirect_link('/admin/index.php');
-		}		
-
-		$GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin') .' - ' . 'Configurar o Atributo de Autenticação';	
-		
-		$_SESSION['phpgwinfo']['db_host'] = $GLOBALS['phpgw_info']['server']['db_host'];
-    	$_SESSION['phpgwinfo']['db_port'] = $GLOBALS['phpgw_info']['server']['db_port'];
-    	$_SESSION['phpgwinfo']['db_name'] = $GLOBALS['phpgw_info']['server']['db_name'];
-    	$_SESSION['phpgwinfo']['db_user'] = $GLOBALS['phpgw_info']['server']['db_user'];
-    	$_SESSION['phpgwinfo']['db_pass'] = $GLOBALS['phpgw_info']['server']['db_pass']; 
-    	$_SESSION['phpgwinfo']['db_type'] = $GLOBALS['phpgw_info']['server']['db_type'];
-			
-		$webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url'];
-		$webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/';
-		
-		$GLOBALS['phpgw']->common->phpgw_header();
-		echo parse_navbar();
-
-		$options_attributes = array('uid','mail','description');
-		$attributes .= "<option value='-1'>-- ".lang('Choice attribute')." --</option>";
-		foreach($options_attributes as $tmp )
-			$attributes .= "<option value='".$tmp."'>".$tmp."</option>";
-
-		$options_orgAttributes = explode(",",$GLOBALS['phpgw_info']['server']['attributes_org_ldap_jabberit']);
-		natcasesort($options_orgAttributes);
-		
-		foreach($options_orgAttributes as $key => $tmp)
-		{
-			if( $tmp != "" )
-			{
-				$attr = explode(";", $tmp);
-				$orgAttributes .= "<tr id='".$attr[0]."' style='width:40%' class='row_off'>";
-				$orgAttributes .= "<td>".$attr[0]."</td>";
-				$orgAttributes .= "<td>".$attr[1]."</td>";
-				$orgAttributes .= "<td><a href=\"javascript:constructScript.removeOrg('".$attr[0]."');\">Excluir</a>";
-				$orgAttributes .= "</td></tr>";
-			}
-		}
-		
-		// Load Language;
-		require_once "load_lang.php";
-				
-		$GLOBALS['phpgw']->template->set_file(array('jabberit_messenger'=>'confOrganization.tpl'));
-		$GLOBALS['phpgw']->template->set_block('jabberit_messenger','confOrg');	
-		$GLOBALS['phpgw']->template->set_var(array(
-										'action_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=jabberit_messenger.uiconforganization.backPage'),
-										'attributes_list' => $attributes,			
-										'lang_add' => 'Adicionar',
-										'lang_Attribute' => lang('Attribute'),	
-										'lang_Back' => 'Voltar',
-										'lang_cancel' => lang('Cancel'),
-										'lang_Delete' => lang('Delete'),										
-										'lang_save' => lang('Save'),
-										'lang_Organization' => lang('Organization'),
-										'organizations_attributes' => $orgAttributes,
-										));
-	
-		$GLOBALS['phpgw']->template->pparse('out','confOrg');
-	}
-	
-	public final function backPage()
-	{
-		if( !$GLOBALS['phpgw']->acl->check('run',1,'admin') )
-		{
-			$GLOBALS['phpgw']->redirect_link('/admin/index.php');
-		}		
-		
-		if ($_POST['cancel'])
-		{
-			$GLOBALS['phpgw']->redirect_link('/index.php?menuaction=jabberit_messenger.uiconfig.configServer');
-		}
-
-		$GLOBALS['phpgw']->redirect_link('/index.php?menuaction=jabberit_messenger.uiconfig.configServer');
-	}
-	
-}
-
-?>
