Changeset 895


Ignore:
Timestamp:
05/21/09 15:54:11 (15 years ago)
Author:
alexandrecorreia
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/jabberit_messenger/inc/class.contacts_im.inc.php

    r865 r895  
    2020        private $db; 
    2121        private $ou_User; 
     22        private $hostsJabber; 
     23        private $serverJabber; 
    2224                 
    2325        public final function __construct() 
     
    3436                $this->ou_User = substr($this->ou_User,strpos($this->ou_User, "ou=")); 
    3537                $this->ou_User = strtoupper(substr($this->ou_User, 0, strpos($this->ou_User, ",dc="))); 
     38                 
     39                // Hosts Jabber 
     40                $this->hostsJabber = unserialize($_SESSION['phpgw_info']['jabberit_messenger']['map_org_realm_jabberit']); 
     41                $this->hostsJabber =  explode(";", $this->hostsJabber); 
     42                 
     43                // Server Name Jabber 
     44                $this->serverJabber = $_SESSION['phpgw_info']['jabberit_messenger']['name_jabberit']; 
    3645        } 
    3746 
     
    7281                $users  = $this->users_auth_im($param['name']); 
    7382                $order  = array(); 
    74  
     83                 
    7584                if (!is_array($users) && trim($users) === 'Many Results') 
    7685                        return "<error>Many Results</error>"; 
     
    7887                if( is_array($users) ) 
    7988                {        
     89                        if( is_array($this->hostsJabber) ) 
     90                        { 
     91                                for( $i = 0 ; $i < count($users); $i++ ) 
     92                                { 
     93                                        foreach($this->hostsJabber as $values) 
     94                                        { 
     95                                                $itens = explode(":", $values); 
     96                                                if( $users[$i]['dn'] == $itens[0] ) 
     97                                                        $users[$i]['jid'] = $users[$i]['jid']."@".$itens[1]; 
     98                                        } 
     99                                } 
     100                        } 
     101                         
    80102                        foreach($users as $tmp) 
    81103                        { 
     
    83105                                        $order[$tmp['dn']] = array(); 
    84106 
    85                                 $order[$tmp['dn']][] = '<data><cn>' . $tmp['cn'] . '</cn><mail>' . $tmp['mail'] .'</mail><uid>' . $tmp['uid'] . '</uid><photo>' . $tmp['photo'] . '</photo></data>'; 
     107                                if( (strpos($tmp['jid'], "@" )) === false ) 
     108                                        $tmp['jid'] = $tmp['jid']."@".$this->serverJabber; 
     109 
     110                                $_SESSION['debug'][] = $order[$tmp['dn']][] = '<data><cn>' . $tmp['cn'] . '</cn><mail>' . $tmp['mail'] .'</mail><uid>' . $tmp['uid'] . '</uid><jid>' . $tmp['jid'] . '</jid><photo>' . $tmp['photo'] . '</photo></data>'; 
    86111                        } 
    87112                         
Note: See TracChangeset for help on using the changeset viewer.