Index: trunk/instant_messenger/bkp/instant_messenger_64/inc/Socket.abstract.php
===================================================================
--- trunk/instant_messenger/bkp/instant_messenger_64/inc/Socket.abstract.php	(revision 260)
+++ 	(revision )
@@ -1,85 +1,0 @@
-<?php
-/*
-+-------------------------------------------------------------------------+
-|                                                                         |
-| @FILE_NAME:   Socket.abstract.php                                       |
-| @CLASS_NAME:  (abstract) Jabber                                         |
-|                                                                         |
-| @DATE:        Wed May,16 2007 07:58:59                                  |
-| @LAST_CHANGE: Wed May,16 2007 08:03:28                                  |
-|                                                                         |
-| @AUTHOR:      [NUTS] Rodrigo Souza - rodsouza@celepar.pr.gov.br         |
-|                                                                         |
-| @BRIEF:       Abstract class for connect with a socket                  |
-|                                                                         |
-+-------------------------------------------------------------------------+
-*/
-
-abstract class Socket
-{
-	protected final function open( $pSocket = false, $pTimeOut = 1, $pBlockingMode = 0 )
-	{
-      if ( !$pSocket )
-         return false;
-
-		$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
-
-      $pSocket = substr($pSocket, 6);
-      if ( $socket = socket_connect($sock, substr($pSocket, 0, strpos($pSocket, ":")), substr($pSocket, strpos($pSocket, ":") + 1)) )
-      {
-         socket_set_block($sock);
-      }
-
-      return $sock;
-	}
-
-   protected final function blocking($pSocket = false, $pBlockingMode = 1)
-   {
-      if ( !$pSocket || !is_resource($pSocket) )
-         return false;
-
-      if ( $pBlockingMode == 1 )
-      	socket_set_block($pSocket);
-		else
-			socket_set_nonblock($pSocket);
-   }
-
-	protected function read( $pSocket = false, $pLength = 4096 )
-	{
-      ini_set( 'track_errors', '1' );
-
-      if ( !$pSocket || !is_resource($pSocket) )
-         return false;
-
-      $return = socket_read($pSocket, $pLength);
-
-      if ( $php_errormsg )
-         return false;
-
-      return $return;
-	}
-
-	protected function write( $pSocket = false, $pData = false )
-	{
-      ini_set( 'track_errors', '1' );
-      
-      if ( (!$pSocket || !is_resource($pSocket)) || !$pData )
-         return false;
-
-		$return = @socket_write($pSocket, $pData);
-      
-      if ( $php_errormsg )
-         return false;
-
-      return $return;
-	}
-
-	protected final function close( $pSocket = false )
-	{
-      if ( !$pSocket || !is_resource($pSocket) )
-         return false;
-
-		return socket_close($pSocket);
-	}
-}
-?>
Index: trunk/instant_messenger/bkp/instant_messenger_64/inc/im_acl.inc.php
===================================================================
--- trunk/instant_messenger/bkp/instant_messenger_64/inc/im_acl.inc.php	(revision 260)
+++ 	(revision )
@@ -1,77 +1,0 @@
-<?php
-   for ( $i = 0; $i < sizeof($GLOBALS['phpgw_info']['user']['acl']); $i++ )
-   {
-      if ( $GLOBALS['phpgw_info']['user']['acl'][$i]['appname'] == 'instant_messenger')
-      {
-			require_once("im_sessions.inc.php");
-         
-         $webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url'];
-         $wz_dragdrop = $webserver_url."/phpgwapi/js/wz_dragdrop/";
-         $webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/';
-
-         if ( strrpos($webserver_url, '/') === false || strrpos($webserver_url, '/') != (strlen($webserver_url)-1) )
-            $webserver_url .= '/';
-
-         $webserver_url = $webserver_url . 'instant_messenger/';
-
-         require_once("IMConfigure.php");
-
-         $_transport = TRANSPORT_NON_SECURITY;
-         $_port = PORT_NON_SECURITY;
-
-			$SERVER = "127.0.0.1";
-
-			$fp  = "";
-			@$fp = stream_socket_client($_transport . "://" . $SERVER . ":" . $_port, $errno, $errstr, 10);
-
-         if ( $fp )
-         {
-
-            fwrite($fp, "GET /" . CONNECT . ";" . session_id() . " HTTP/1.1\r\nHost: " . $SERVER . ":" . $_port . "\r\nAccept: */*\r\n\r\n");
-
-            $js = array(
-                        $webserver_url . 'js/XMLTools.js',
-                        $webserver_url . 'js/im_functions.js',
-                        $webserver_url . 'js/im_fcommon.js',
-                        $webserver_url . 'js/im_var_globals.js',
-                        $webserver_url . 'js/im_images.js',
-                        $webserver_url . 'js/im_smiles.js',
-                        $webserver_url . 'js/im_templates.js',
-                        $webserver_url . 'js/im_win.js',
-                        $webserver_url . 'js/im_menu_action.js',
-                        $webserver_url . 'js/im_conf_font.js',
-                        $webserver_url . 'js/im_preferences.js',
-                        $webserver_url . 'js/im_init.js',
-						      $webserver_url . 'js/im_subscription.js',
-                       );
-
-            require_once('load_lang.php');
-
-         	print '
-               <link rel="stylesheet" href="' . $webserver_url . 'templates/default/css.css" />
-               <link rel="stylesheet" href="' . $webserver_url . 'templates/default/messenger.css" />
-               <script>
-                  var im_path="' . $webserver_url . '";
-                  var ini_wzdd = false;
-                  if ( !window.dd )
-                  {
-                     ini_wzdd = true;
-                     document.write(\'\<script src="' . $wz_dragdrop . 'wz_dragdrop.js"\>\<\/script\>\');
-                     var im_path="' . $webserver_url . '";
-                  }
-               </script>';
-         
-          print '
-               <script>
-                  if ( ini_wzdd )
-                     SET_DHTML("backFantom"+NO_DRAG);
-               </script>';
-
-          foreach ( $js as $key => $val )
-             print '<script src="' . $val . '?' . filemtime($_SERVER['DOCUMENT_ROOT'] . '/' . $val) . '"></script>';
-          
-         }
-         break;
-      }
-   }
-?>
Index: trunk/instant_messenger/bkp/instant_messenger_64/inc/Jabberd2.abstract.php
===================================================================
--- trunk/instant_messenger/bkp/instant_messenger_64/inc/Jabberd2.abstract.php	(revision 260)
+++ 	(revision )
@@ -1,117 +1,0 @@
-<?php
-
-ini_set('include_path', $_SERVER['DOCUMENT_ROOT'] . '/instant_messenger/inc/');
-
-require_once 'Jabber.abstract.php';
-
-class Jabberd2 extends Jabber
-{
-   final function connect($pUser = false, $pPassword = false)
-   {
-      try
-      {
-         if ( parent::connect($pUser, $pPassword) )
-            if ( $this->presence() )
-               return true;
-
-         return false;
-      }
-      catch(Exception $e)
-      {
-         $this->writeLog('ERROR', $e->getMessage());
-         return false;
-      }
-   }
-
-   function disconnect()
-   {
-      $this->_disconnect();
-   }
-
-   final function readSocket()
-   {
-      return $this->read();
-   }
-
-   final function writeSocket($pData)
-   {
-      return $this->write($pData);
-   }
-	
-	final function setPresence($pPresence)
-	{
-		$type = ( isset($pPresence['type']) ) ? $pPresence['type'] : NULL;
-		$to = ( isset($pPresence['to']) ) ? $pPresence['to'] : NULL;
-		$show = ( isset($pPresence['show']) ) ? $pPresence['show'] : NULL;
-		$status = ( isset($pPresence['status']) ) ? $pPresence['status'] : NULL;
-		$priority = ( isset($pPresence['priority']) ) ? $pPresence['priority'] : NULL;
-		
-		$this->presence($type, $to, $show, $status, $priority);
-	}
-	/*
-	 * Vcard
-	 */
-
-   final function getVcard($pVcard)
-   {
-		$this->iq('get', $pVcard, $pVcard, NULL, "vcard-temp", "<vCard xmlns='vcard-temp'/>");
-   }
-
-   final function newVcard($NewVcard)
-   {
-   	$id = $_SESSION['phpgw_info']['instant_messenger']['user'];
-   	$this->iq('set', $id, NULL, NULL, "vcard-temp", "<vCard xmlns='vcard-temp'>".$NewVcard."</vCard>");	
-   }
-	
-	/*
-	 *  Contacts
-	 */
-
-   final function getContacts()
-   {
-		$this->iq('get', 'contacts', NULL, NULL, 'jabber:iq:roster');
-   }
-   
-   final function addContacts($pContact)
-   {
-   	$addid = "adduser_" . time();
-   	$this->iq('set', $addid, NULL, NULL, "jabber:iq:roster", $pContact);
-   }
-   
-   final function removeContact($pContact)
-   {
-   	$delid  = 'deluser_' . time();
-   	$this->iq('set',$delid,NULL,NULL,"jabber:iq:roster","<item jid='".$pContact."' subscription='remove'/>");
-   }
-   
-   final function updateContact($pContact)
-   {
-   	$upid = 'updateuser_' . time();
-   	$this->iq('set', $upid, NULL, NULL, "jabber:iq:roster", $pContact);
-   }
-   
-   /*
-    * Presence 
-    */
-   
-   final function SubscriptionAcceptRequest($to = NULL)
-	{
-		$this->presence("subscribed", $to);
-	}
-
-	final function SubscriptionDenyRequest($to = NULL)
-	{
-		$this->presence("unsubscribed", $to);
-	}
-
-	final function Subscribe($to = NULL)
-	{
-		$this->presence("subscribe", $to);
-	}
-
-	final function Unsubscribe($to = NULL)
-	{
-		$this->presence("unsubscribe", $to);
-	}
-}
-?>
Index: trunk/instant_messenger/bkp/instant_messenger_64/inc/class.contacts_im.inc.php
===================================================================
--- trunk/instant_messenger/bkp/instant_messenger_64/inc/class.contacts_im.inc.php	(revision 260)
+++ 	(revision )
@@ -1,120 +1,0 @@
-<?php
-
-require_once "class.ldap_im.inc.php";
-require_once "class.db_im.inc.php"; 
-
-class contacts_im
-{
-	private $ldap;
-	private $db_user;
-	
-	function __construct()
-	{
-		$this->ldap = new ldap_im();
-		$this->db_user = new db_im();		
-	}
-
-	private function users_auth_im()
-	{
-		$db_acls = $this->db_user->get_accounts_acl();
-		
-		$search_uids = "|";
-		foreach($db_acls as $tmp)
-			$search_uids .= "(uidNumber=".$tmp['acl_account'].")";
-
-		// Busca Usuarios
-		$uids = $this->ldap->list_users_ldap($search_uids);
-		
-		$search_groups = "|";
-		foreach($db_acls as $tmp)
-			$search_groups .= "(gidNumber=".$tmp['acl_account'].")";
- 
-		// Busca Grupos
-		$groups = $this->ldap->list_groups_ldap($search_groups);
-				
-		$search_uids = "|";
-		if($groups)
-		{
-			foreach($groups as $tmp)
-			{
-				$members = $tmp['members'];	
-				foreach($members as $mb)		
-					$search_uids .= "(uid=".$mb.")";			
-			}
-		}
-		
-		if($uids)
-		{
-			foreach($uids as $tmp)	
-				$search_uids .= "(uid=".$tmp['uid'].")";
-		}
-		$uids_members = $this->ldap->list_users_ldap($search_uids);	
-					
-		if(count($uids_members) > 0)
-			return $uids_members;
-		else
-			return 0; 
-	}
-		
-	function list_contacts($param)
-	{
-		$users = $this->users_auth_im();
-		$ordenar = array();
-		$return = array();
-		$i = 0;
-		
-		foreach($users as $tmp)
-			$ordenar[] = $tmp['cn'].";".$tmp['mail'].";".$tmp['uid'].";".$tmp['dn'];
-					
-		natsort($ordenar);
-		$uid_unique = @array_values(@array_unique($ordenar));
-		
-		foreach($uid_unique as $tmp)
-		{	
-			$result = explode(";",$tmp);
-			if(strtolower($result[3]) == strtolower($param['ou']))
-			{
-				$return[$i]['cn']   = $result[0];
-				$return[$i]['mail'] = $result[1];
-				$return[$i]['uid']  = $result[2];
-				$i++;
-			}
-			unset($result);
-		}			
-	
-		if(count($return) > 0)
-			return $return;
-		else
-			return 0;
-	}
-	
-	function UserPermission($param)
-	{
-		$db_acls = $this->db_user->get_accounts_acl();
-		$members = array();		
-		$search_uid 	= "";
-		$search_groups = "|";
-		
-		$search_uid = $this->ldap->list_users_ldap("uid=".$param['uid']);
-
-		foreach($db_acls as $tmp)
-			if($tmp['acl_account'] == $search_uid[0]['uidnumber'])
-				return 1;
-			else
-				$search_groups .= "(gidNumber=".$tmp['acl_account'].")";
-
-		$groups = $this->ldap->list_groups_ldap($search_groups);
-
-		if($groups)
-		foreach($groups as $tmp){
-			$members = $tmp['members'];	
-			foreach($members as $mb){		
-				if(trim($mb) == trim($search_uid[0]['uid']))
-					return 1;
-			}			
-		}
-		
-		return 0;
-	}
-}
-?>
Index: trunk/instant_messenger/bkp/instant_messenger_64/inc/hook_admin.inc.php
===================================================================
--- trunk/instant_messenger/bkp/instant_messenger_64/inc/hook_admin.inc.php	(revision 260)
+++ 	(revision )
@@ -1,22 +1,0 @@
-<?php
-	/**************************************************************************\
-	* eGroupWare                                                               *
-	* http://www.egroupware.org                                                *
-	* Written by Joseph Engo <jengo@phpgroupware.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.                                              *
-	\**************************************************************************/
-
-// Only Modify the $file and $title variables.....
-	$title = 'instant_messenger';
-	$file = array(
-		'Site Configuration'	=> $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname)
-	);
-	
-//Do not modify below this line
-	display_section($appname,$title,$file);
-
-?>
Index: trunk/instant_messenger/bkp/instant_messenger_64/inc/load_lang.php
===================================================================
--- trunk/instant_messenger/bkp/instant_messenger_64/inc/load_lang.php	(revision 260)
+++ 	(revision )
@@ -1,26 +1,0 @@
-<?
-if ( !isset($_SESSION['phpgw_info']['instant_messenger']['lang']) || !is_array($_SESSION['phpgw_info']['instant_messenger']['lang']) )
-   if ( file_exists(($fn = dirname(__FILE__) . '/../setup/phpgw_pt-br.lang')) )
-      if ( ($fp = fopen($fn,'r')) )
-      {
-         while ($data = fgets($fp,16000))
-         {
-            list($message_id, $app_name, $null, $content) = explode("\t",substr($data,0,-1));
-            $_SESSION['phpgw_info']['instant_messenger']['lang'][$message_id] = $content;
-         }
-         fclose($fp);
-      }
-
-$script  = '<script>';
-$script .= 'var lang_im = [];';
-
-foreach ( $_SESSION['phpgw_info']['instant_messenger']['lang'] as $key => $value )
-   $script .= "lang_im['" . strtolower(addslashes($key)) . "'] = '" . addslashes($value) . "';";
-
-   #$_key = str_replace("'","\'",strtolower($key));
-   #$_val = str_replace("'","\'",$value);
-
-$script .= '</script>';
-
-echo $script;
-?>
Index: trunk/instant_messenger/bkp/instant_messenger_64/inc/class.ldap_im.inc.php
===================================================================
--- trunk/instant_messenger/bkp/instant_messenger_64/inc/class.ldap_im.inc.php	(revision 260)
+++ 	(revision )
@@ -1,183 +1,0 @@
-<?php
-class ldap_im
-{
-	private $ldap_host;
-	private $ldap_context;
-	private $conn;
-	private $user;
-	private $password;
-	
-	function __construct()
-	{
-		$this->ldap_host 	= $_SESSION['phpgw_info']['instant_messenger']['server_ldap_jabber'];
-		$this->ldap_context = $_SESSION['phpgw_info']['instant_messenger']['context_ldap_jabber'];
-		$this->user 		= $_SESSION['phpgw_info']['instant_messenger']['user_ldap_jabber'];
-		$this->password 	= $_SESSION['phpgw_info']['instant_messenger']['password_ldap_jabber'];
-		$this->connect_ldap(false);
-	}
-	
-	function __destruct()
-	{
-		ldap_close($this->conn);
-	}
-	
-	function connect_ldap($refer)
-	{
-		$this->conn = ldap_connect($this->ldap_host);
-		ldap_set_option($this->conn, LDAP_OPT_PROTOCOL_VERSION, 3);
-		ldap_set_option($this->conn, LDAP_OPT_REFERRALS, $refer);
-		if(trim($this->user) != "")
-			@ldap_bind($this->conn,$this->user,$this->password);
-		else		
-			@ldap_bind($this->conn);
-	}
-	
-	function get_photo_ldap($user,$getPhoto)
-	{
-		$user = ( $user == "user" ) ? $_SESSION['phpgw_info']['instant_messenger']['user'] : $user ;
-		
-		if ($this->conn) {
-			$filter="(&(uid=".$user.")(phpgwAccountType=u))";		
-			$justthese = array("jpegphoto");
-			$search = ldap_search($this->conn,$this->ldap_context, $filter, $justthese);
-			$entry = ldap_first_entry($this->conn, $search);
-			$jpeg_data = @ldap_get_values_len($this->conn, $entry, "jpegphoto");
-			
-			if( count($jpeg_data) > 1){
-
-				$photo = imagecreatefromstring($jpeg_data[0]);
-				if($photo){
-					if($getPhoto){
-						header("Content-Type: image/jpeg");
-						$width = imagesx($photo);
-						$height = imagesy($photo);
-						$twidth = 49;
-						$theight = 65;
-						$small_photo = imagecreatetruecolor ($twidth, $theight);
-						imagecopyresampled($small_photo, $photo, 0, 0, 0, 0,$twidth, $theight, $width, $height);
-						imagejpeg($small_photo,'',100);
-						return;		
-					}else{
-						return 1;
-					}				
-				}else{
-					return 0;
-				}
-			}else{
-				return 0;
-			}
-		}
-	}
-	
-	function photo_ldap($user)
-	{
-		$uid = ( $user['uid'] == "user" ) ? $_SESSION['phpgw_info']['instant_messenger']['user'] : $user['uid'] ;
-		return $this->get_photo_ldap($uid,false);
-	}
-	
-	function list_users_ldap($search)
-	{
-
-		if($this->conn){
-			$filter = "(&(".$search.")(phpgwAccountType=u))";
-			$justthese = array("uid","uidNumber","cn","mail","phpgwAccountVisible","dn");
-			$search = ldap_search($this->conn,$this->ldap_context,$filter,$justthese);
-			$entry = ldap_get_entries($this->conn,$search);
-		}
-		
-		if( $entry['count'] > 0){
-			$i = 0;
-			$result_user = array();
-			foreach($entry as $tmp)
-			{
-				if($tmp['uidnumber'][0] != "" && $tmp['phpgwaccountvisible'][0] != "-1"){
-					$result_user[$i]['uidnumber'] = $tmp['uidnumber'][0];			
-					$result_user[$i]['mail'] = $tmp['mail'][0];
-					$result_user[$i]['uid'] = $tmp['uid'][0];
-					$result_user[$i]['cn'] = $tmp['cn'][0];
-					$ou = explode("dc=",$tmp['dn']);
-					$ou = explode("ou=",$ou[0]);
-					$ou = array_pop($ou);
-					$result_user[$i]['dn'] = strtoupper(substr($ou,0,strlen($ou)-1));					
-					$i++;
-				}				
-			}
-			return $result_user;
-		}
-		return 0;
-	}
-	
-	function list_groups_ldap($search)
-	{
-	
-		if( $this->conn ){
-			$filter = "(&(".$search.")(objectClass=posixGroup))";
-			$justthese = array("gidnumber","cn","memberuid");			
-			$search = ldap_search($this->conn,$this->ldap_context, $filter, $justthese);
-			$entry = ldap_get_entries($this->conn,$search);
-		}
-
-		if($entry['count'] > 0){
-			$i = 0;
-			$result_groups = array();
-			foreach($entry as $tmpg){
-				if($tmpg['gidnumber'] != ""){
-					if(array_key_exists("memberuid", $tmpg)){
-						$result_groups[$i]['gidnumber'] = $tmpg['gidnumber'][0];						
-						@array_shift($tmpg['memberuid']);
-						foreach($tmpg['memberuid'] as $tmp)
-							$result_groups[$i]['members'][] = $tmp;					
-						$i++;
-					}
-				}
-			}	
-		}
-		
-		if(count($result_groups) > 0 ){
-			return $result_groups;
-		}else{
-			return 0;
-		}
-	}
-	
-	function list_organizations_ldap()
-	{
-		$result_org = array();
-		$i = 0;
-		if ($this->conn) {
-			$filter="ou=*";		
-			$justthese = array("ou");
-			$search = ldap_list($this->conn,$this->ldap_context, $filter, $justthese);
-			$entry = ldap_get_entries($this->conn, $search);
-		}
-		
-		foreach($entry as $tmp){
-			if($tmp['ou'][0] != ""){
-				$result_org[$i] = $tmp['ou'][0];
-				$i++;
-			}
-		}
-		sort($result_org);
-		return $result_org;
-	}
-	
-	function info_user($user)
-	{
-		$uid = "uid=".$user['uid'];
-		$i= 0;
-		
-		$entry = $this->list_users_ldap($uid);
-		
-		if( count($entry) > 0 )
-			return $entry;
-		else
-			return false;	
-	}
-}
-
-if(trim($_REQUEST['user']) != ""){
-	$obj_img = new ldap_im();
-	$obj_img->get_photo_ldap($_REQUEST['user'],true);
-}
-
-?>
Index: trunk/instant_messenger/bkp/instant_messenger_64/inc/class.download.inc.php
===================================================================
--- trunk/instant_messenger/bkp/instant_messenger_64/inc/class.download.inc.php	(revision 260)
+++ 	(revision )
@@ -1,155 +1,0 @@
-<?php
-
-class download
-{
-	
-	function Decode_String($string)
-	{
-		$base64 = $string;	
-		$base64_de = base64_decode($base64);
-		$array_info = unserialize($base64_de);
-	
-		if($array_info['server'] == $_SERVER['SERVER_ADDR']){
-			$this->down_file($array_info['fileUp']);
-		}else{
-			$url = "http://".$array_info['server'].$array_info['path'].$array_info['filePhp'].$base64;
-			header("Location:" . $url);
-		}
-	}
-
-	function down_file($file)
-	{   
-		 
-		ini_set("session.save_path","/php_sessions");
-		$size = filesize(ini_get("session.save_path").'/'. $file);
-		$NameFile = explode("_IM_SendFile_",$file);
-	
-		 if (!empty($file))
-	     {
-		        if (ereg('Opera(/| )([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']))
-		           $UserBrowser = "Opera";
-		        elseif (ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']))
-		            $UserBrowser = "IE";
-	            else
-		            $UserBrowser = '';
-
-				$strFileType = strrev(substr(strrev($NameFile),0,4));
-				$ContentType = "application/octet-stream";
-
-			   	if ($strFileType == ".asf") 
-			   		$ContentType = "video/x-ms-asf";
-			   	if ($strFileType == ".avi")
-			   		$ContentType = "video/avi";
-			   	if ($strFileType == ".doc")
-			   		$ContentType = "application/msword";
-			   	if ($strFileType == ".zip")
-			   		$ContentType = "application/zip";
-			   	if ($strFileType == ".xls")
-			   		$ContentType = "application/vnd.ms-excel";
-			   	if ($strFileType == ".gif")
-			   		$ContentType = "image/gif";
-			   	if ($strFileType == ".jpg" || $strFileType == "jpeg")
-			   		$ContentType = "image/jpeg";
-			   	if ($strFileType == ".wav")
-			   		$ContentType = "audio/wav";
-			   	if ($strFileType == ".mp3")
-			   		$ContentType = "audio/mpeg3";
-			   	if ($strFileType == ".mpg" || $strFileType == "mpeg")
-			   		$ContentType = "video/mpeg";
-			   	if ($strFileType == ".rtf")
-			   		$ContentType = "application/rtf";
-			   	if ($strFileType == ".htm" || $strFileType == "html")
-			   		$ContentType = "text/html";
-			   	if ($strFileType == ".xml") 
-			   		$ContentType = "text/xml";
-			   	if ($strFileType == ".xsl") 
-			   		$ContentType = "text/xsl";
-			   	if ($strFileType == ".css") 
-			   		$ContentType = "text/css";
-			   	if ($strFileType == ".php") 
-			   		$ContentType = "text/php";
-			   	if ($strFileType == ".asp") 
-			   		$ContentType = "text/asp";
-			   	if ($strFileType == ".pdf")
-			   		$ContentType = "application/pdf";
-			   	if ($strFileType == ".txt")
-			   		$ContentType = "text/plain";
-			   	if ($strFileType == ".log")
-			   		$ContentType = "text/plain";
-			   	if ($strFileType == ".wmv")
-			   		$ContentType = "video/x-ms-wmv";
-				if ($strFileType == ".sxc")
-					$ContentType = "application/vnd.sun.xml.calc";
-				if ($strFileType == ".odt")
-					$ContentType = "application/vnd.oasis.opendocument.text";
-				if ($strFileType == ".stc")
-					$ContentType = "application/vnd.sun.xml.calc.template";
-				if ($strFileType == ".sxd")
-					$ContentType = "application/vnd.sun.xml.draw";
-				if ($strFileType == ".std")
-					$ContentType = "application/vnd.sun.xml.draw.template";
-				if ($strFileType == ".sxi")
-					$ContentType = "application/vnd.sun.xml.impress";
-				if ($strFileType == ".sti")
-					$ContentType = "application/vnd.sun.xml.impress.template";
-				if ($strFileType == ".sxm")
-					$ContentType = "application/vnd.sun.xml.math";
-				if ($strFileType == ".sxw")
-					$ContentType = "application/vnd.sun.xml.writer";
-				if ($strFileType == ".sxq")
-					$ContentType = "application/vnd.sun.xml.writer.global";
-				if ($strFileType == ".stw")
-					$ContentType = "application/vnd.sun.xml.writer.template";
-				if ($strFileType == ".ps")
-					$ContentType = "application/postscript";
-				if ($strFileType == ".pps")
-					$ContentType = "application/vnd.ms-powerpoint";
-				if ($strFileType == ".odt")
-					$ContentType = "application/vnd.oasis.opendocument.text";
-				if ($strFileType == ".ott")
-					$ContentType = "application/vnd.oasis.opendocument.text-template";
-				if ($strFileType == ".oth")
-					$ContentType = "application/vnd.oasis.opendocument.text-web";
-				if ($strFileType == ".odm")
-					$ContentType = "application/vnd.oasis.opendocument.text-master";
-				if ($strFileType == ".odg")
-					$ContentType = "application/vnd.oasis.opendocument.graphics";
-				if ($strFileType == ".otg")
-					$ContentType = "application/vnd.oasis.opendocument.graphics-template";
-				if ($strFileType == ".odp")
-					$ContentType = "application/vnd.oasis.opendocument.presentation";
-				if ($strFileType == ".otp")
-					$ContentType = "application/vnd.oasis.opendocument.presentation-template";
-				if ($strFileType == ".ods")
-					$ContentType = "application/vnd.oasis.opendocument.spreadsheet";
-				if ($strFileType == ".ots")
-					$ContentType = "application/vnd.oasis.opendocument.spreadsheet-template";
-				if ($strFileType == ".odc")
-					$ContentType = "application/vnd.oasis.opendocument.chart";
-				if ($strFileType == ".odf")
-					$ContentType = "application/vnd.oasis.opendocument.formula";
-				if ($strFileType == ".odi")
-					$ContentType = "application/vnd.oasis.opendocument.image";
-				if ($strFileType == ".ndl")
-					$ContentType = "application/vnd.lotus-notes";
-								
-		        $mime_type = ($UserBrowser == 'IE' || $UserBrowser == 'Opera') ? 'application/octetstream' : 'application/octet-stream';
-	
-		        header("Content-Type: $ContentType");
-		        header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
-		        header("Pragma: public");
-		        header("Expires: 0");
-		        header("Content-Disposition: attachment; filename=\"" . $NameFile[1] . "\"");
-				header("Content-length: " . $size);
-				readfile(ini_get("session.save_path") . "/" . $file); 
-				die();
-	    }
-	}
-}
-
-if(isset ($_REQUEST['file'])){
-	$obj_down = new download();
-	$obj_down->Decode_String($_REQUEST['file']);
-}
-
-?>
Index: trunk/instant_messenger/bkp/instant_messenger_64/inc/im_sessions.inc.php
===================================================================
--- trunk/instant_messenger/bkp/instant_messenger_64/inc/im_sessions.inc.php	(revision 260)
+++ 	(revision )
@@ -1,24 +1,0 @@
-<?php
-
-	  $_SESSION['phpgw_info']['instant_messenger']['user']             = $GLOBALS['phpgw_info']['user']['account_lid'];
-	  $_SESSION['phpgw_info']['instant_messenger']['user_id']			 = $GLOBALS['phpgw_info']['user']['account_id'];         
-     $_SESSION['phpgw_info']['instant_messenger']['passwd']           = $GLOBALS['phpgw_info']['user']['passwd'];
-     $_SESSION['phpgw_info']['instant_messenger']['name_jabber']      = $GLOBALS['phpgw_info']['server']['name_jabber'];
-     $_SESSION['phpgw_info']['instant_messenger']['port_jabber']      = $GLOBALS['phpgw_info']['server']['port_jabber'];
-     $_SESSION['phpgw_info']['instant_messenger']['resource_jabber']  = $GLOBALS['phpgw_info']['server']['resource_jabber'];
-
-     # Conf. Ldap
-     $_SESSION['phpgw_info']['instant_messenger']['server_ldap_jabber']   = $GLOBALS['phpgw_info']['server']['server_ldap_jabber'];
-     $_SESSION['phpgw_info']['instant_messenger']['context_ldap_jabber']  = $GLOBALS['phpgw_info']['server']['context_ldap_jabber'];
-     $_SESSION['phpgw_info']['instant_messenger']['user_ldap_jabber']     = $GLOBALS['phpgw_info']['server']['user_ldap_jabber'];
-     $_SESSION['phpgw_info']['instant_messenger']['password_ldap_jabber'] = $GLOBALS['phpgw_info']['server']['password_ldap_jabber'];
-     $_SESSION['phpgw_info']['instant_messenger']['size_file_jabber']  	= $GLOBALS['phpgw_info']['server']['size_file_jabber'];	
-
-     $_SESSION['phpgw_info']['instant_messenger']['server']['db_name'] = $GLOBALS['phpgw_info']['server']['db_name'];
-     $_SESSION['phpgw_info']['instant_messenger']['server']['db_host'] = $GLOBALS['phpgw_info']['server']['db_host'];
-     $_SESSION['phpgw_info']['instant_messenger']['server']['db_port'] = $GLOBALS['phpgw_info']['server']['db_port'];
-     $_SESSION['phpgw_info']['instant_messenger']['server']['db_user'] = $GLOBALS['phpgw_info']['server']['db_user'];
-     $_SESSION['phpgw_info']['instant_messenger']['server']['db_pass'] = $GLOBALS['phpgw_info']['server']['db_pass'];
-     $_SESSION['phpgw_info']['instant_messenger']['server']['db_type'] = $GLOBALS['phpgw_info']['server']['db_type'];
-
-?>
Index: trunk/instant_messenger/bkp/instant_messenger_64/inc/class.Ujabber.inc.php
===================================================================
--- trunk/instant_messenger/bkp/instant_messenger_64/inc/class.Ujabber.inc.php	(revision 260)
+++ 	(revision )
@@ -1,542 +1,0 @@
-<?php
-
-class Ujabber
-{
-   /*
-    * Listen 
-    */
-   
-   final function listen()
-   {
-      $return = null;
-		
-		if($_SESSION['phpgw_info']['instant_messenger']['IM_disconnect'])
-		{
-      	$_SESSION['phpgw_info']['instant_messenger']['IM_disconnect'] = false;
-      	return "disconnected";
-		}
-		
-	   $_SESSION['phpgw_info']['instant_messenger']['timeClient'] = time();
-      $_SESSION['phpgw_info']['instant_messenger']['socket']['block'] = true;
-      $xml = $_SESSION['phpgw_info']['instant_messenger']['socket']['in'];
-
-      unset($_SESSION['phpgw_info']['instant_messenger']['socket']['in']);
-      $_SESSION['phpgw_info']['instant_messenger']['socket']['block'] = false;
-
-      ### Arranjo Tecnico ### 
-      $vkrd = $xml;
-      
-      if(isset($_SESSION['phpgw_info']['instant_messenger']['contacts']))
-         unset($_SESSION['phpgw_info']['instant_messenger']['contacts']);
-
-      ### - messages - ###
-      $_messages = "/<message[^>]+from='(\S+)'[^>]*>(?(?=.*?<composing |.*?<paused ).*?<(composing|paused) )(?(?=.*?<html).*?<html[^>]*><body[^>]*>(.*?)<\/body><\/html>).*?<\/message>/s";
-      $_messages = preg_match_all($_messages, $xml, $messages);
-      if ( $_messages !== false && $_messages > 0 )
-      {
-         $xml = preg_replace("/<message.*?<\/message>/", "", $xml);         
-         $return .= $this->getMessages($messages);
-      }
-      ### - Fim messages - ###
-
-      ### - contacts - ###
-      $_contacts = "/<iq[^>]+id='contacts'[^>]*>.*?<\/iq>/";
-      $_contacts = preg_match_all($_contacts, $xml, $_xml);
-
-      $_contacts = "/<item.*?(?(?=[^>]+name)[^>]+name='(.*?)')[^>]+subscription='(.*?)'[^>]+jid='(.*?)'";
-      $_contacts .= "(?(?=[^>]*\/>)[^>]*\/>|[^>]*><group>(.*?)<\/group><\/item>)/";
-      $_contacts = preg_match_all($_contacts, $_xml[0][0], $contacts);
-      if ( $_contacts !== false && $_contacts > 0 )
-      {
-         $xml = preg_replace("/<iq[^>]+id='contacts'[^>]*>.*?<\/iq>/", "", $xml);
-         $return .= rawurldecode(urldecode($this->getContacts($contacts)));
-      }
-      ### - Fim contacts - ###
-
-      ### - presence - ###
-      $xml = $_SESSION['phpgw_info']['instant_messenger']['presences'] . $xml;
-
-      $_presence  = "/<presence(?(?=[^>]+\/>)[^>]+\/>|[^>]+>.*?<\/presence>)/";
-      $_presence = preg_match_all($_presence, $xml, $presence);
-
-      $patterns[0] = '/<priority>[^<]*<\/priority>|<(\S) (?(?=[^>]*\/>)[^>]*\/>|[^>]*>.*?<\/\1>)/';
-      $patterns[1] = '/ xmlns=\'.*?\'| to=\'.*?\'/';
-      $patterns[2] = '/> +</';
-      $replacements[0] = '';
-      $replacements[1] = '';
-      $replacements[2] = '><';
-      $_xml = preg_replace($patterns, $replacements, implode('', $presence[0]));
-
-      $_presence  = "/<presence[^>]+from='(\S+)'[^>]*type='(unavailable)'(?(?=[^>]*\/>)[^>]*\/>|[^>]*>.*?<\/presence>)|";
-      $_presence .= "<presence[^>]+from='(\S+)'(?(?=[^>]+type)[^>]+type='(\S+)')[^>]*";
-      $_presence .= "(?(?=\/>)\/>|>";
-      $_presence .= "(?(?=<s[^>]*?>)<s[^>]*?>(.*?)<\/s[^>]*?>(?(?=<s[^>]*?>)<s[^>]*?>(.*?)<\/s[^>]*?>))";
-      $_presence .= "<\/presence>)/";
-      $_presence = preg_match_all($_presence, $_xml, $presence);
-      if ( $_presence !== false && $_presence > 0 )
-      {
-         foreach ( $presence[5] as $key => $val )
-         {
-            if ( !empty($presence[1][$key]) && (strpos($presence[1][$key], '/') !== false) )
-               $presence[1][$key] = substr($presence[1][$key], 0, strpos($presence[1][$key], '/'));
-            
-            if ( !empty($presence[3][$key]) && strpos($presence[3][$key], '/') !== false )
-               $presence[3][$key] = substr($presence[3][$key], 0, strpos($presence[3][$key], '/'));
-   
-            if ( !empty($val) && !preg_match("/^(away|chat|dnd|xa)$/", $val) )
-               if ( preg_match("/^(away|chat|dnd|xa)$/", $presence[6][$key]) )
-               {
-                  $aux = $presence[5][$key];
-                  $presence[5][$key] = $presence[6][$key];
-                  $presence[6][$key] = $aux;
-               }
-               else
-               {
-                  if ( empty($presence[6][$key]) )          
-                     $presence[6][$key] = $presence[5][$key];
-                  $presence[5][$key] = '';
-               }
-         }
-         $xml = preg_replace("/<presence[^>]\/?>|<presence[^>]>.*?<\/presence>/", "", $xml);
-
-         $return .= $this->getPresence($presence);
-      }
-      ### - Fim presence - ###
-
-      
-      ### - vcard - ###
-      ### - Arranjo Tecnico - ###
-      $_xml = $vkrd;
-      $_vcard = "/<iq.*? id='(.*?)' .*?(<vCard [^>]+\/>|<vCard.*?<\/vCard>)<\/iq>/"; 
-      $_vcard = preg_match_all($_vcard, $_xml, $vcard);
-      if( $_vcard !== false && $_vcard > 0)
-      {
-         $xml = preg_replace("/<iq.*?<vCard.*?<\/iq>/", "", $xml);
-         $return .= urldecode($this->getVcard($vcard));
-      }
-      ### - Fim vcard - ###
-      ## Final do Listen;
-
-      return $return;
-   }
-   
-   function reconnect()
-   {
-      require_once("IMConfigure.php");
-
-      $_transport = TRANSPORT_NON_SECURITY;
-      $_port = PORT_NON_SECURITY;
-
-		$SERVER = "127.0.0.1";
-
-		$fp  = "";
-		@$fp = stream_socket_client($_transport . "://" . $SERVER . ":" . $_port, $errno, $errstr, 10);
-
-		if ( $fp )
-		{
-			fwrite($fp, "GET /" . CONNECT . ";" . session_id() . " HTTP/1.1\r\nHost: " . $SERVER . ":" . $_port . "\r\nAccept: */*\r\n\r\n");
-			return 'true';
-		}
-		else
-			return 'false';
-   } 
-   
-   /*
-    * Contacts
-    */
-
-   function getContacts(array $pContacts)
-   {
-      $_group = array();
-      $return = NULL;
-      $jid = array_unique($pContacts[3]);
-      
-      foreach ( $jid as $key => $val )
-      {
-         $_SESSION['phpgw_info']['instant_messenger']['contacts'][] = $val;
-
-         $item  = NULL;
-         $item .= '<item name="' . (( !empty($pContacts[1][$key]) ) ? $pContacts[1][$key] : $val);
-         $item .= '" jid="' . $val;
-         $item .= '" subscription="' . $pContacts[2][$key];
-         $item .= '" />';
-
-         $_group[utf8_decode(strtolower(!empty($pContacts[4][$key]) ? $pContacts[4][$key] : 'default'))][] = $item;
-      } 
-      
-      ksort($_group);
-
-      foreach ( $_group as $key => $val )
-         $return .= '<group name="' . $key . '">' . implode('', $val) . '</group>';
-
-      return '<contacts>' . $return . '</contacts>';
-   }
-
-   function requireContacts()
-   {
-      $_SESSION['phpgw_info']['instant_messenger']['socket']['out']['getContacts'] = NULL;
-   }
-   
-  /*
-   * Presence 
-   */
-
-   function setPresence($pPresence)
-   {
-      $_SESSION['phpgw_info']['instant_messenger']['socket']['out']['setPresence'] = $pPresence;
-      foreach($pPresence as $key=>$presence)
-      	if($key == 'show' || $key == 'type')
-      	{
-      		$_SESSION['phpgw_info']['instant_messenger']['MyPresence'] = $presence;
-      	}
-   }
-   
-   function MyPresence()
-   {
-   	if(isset($_SESSION['phpgw_info']['instant_messenger']['MyPresence']))
-	   	return $_SESSION['phpgw_info']['instant_messenger']['MyPresence'];
-   }
-   
-   function getPresence(array $pPresence)
-   {
-      $offline = array();
-      foreach ( $pPresence[1] as $key => $val )
-      {
-         if ( empty($val) )
-            continue;
-
-         $_offline = true;
-         for ( $i = $key; $i < sizeof($pPresence[1]); $i++ )
-            if ( $pPresence[1][$key] == $pPresence[3][$i] || $pPresence[1][$key] == $pPresence[5][$i] )
-               $_offline = false;
-
-         if ( $_offline )
-            $offline[$key] = $val;
-      }
-
-      $online = array();
-      foreach ( $pPresence[3] as $key => $val )
-      {
-         if ( empty($val) )
-            continue;
-
-         $_online = true;
-         for ( $i = ($key + 1); $i < sizeof($pPresence[3]); $i++ )
-            if ( in_array($val, $offline) || $pPresence[3][$key] == $pPresence[3][$i] )
-               $_online = false;
-
-         if ( $_online )
-            $online[$key] = $val;
-      }
-
-      $return = NULL;
-
-      foreach ( $offline as $key => $val )
-      {
-         $val = ( strpos($val, '/') ) ? substr($val, 0, strpos($val, '/')) : $val;
-         $return .= "<presence from='" . $val . "' type='unavailable' />";
-      }
-      
-      foreach ( $online as $key => $val )
-      {
-         $val = ( strpos($val, '/') ) ? substr($val, 0, strpos($val, '/')) : $val;
-
-         if ( empty($pPresence[4][$key]) )
-            $pPresence[4][$key] = ( empty($pPresence[5][$key]) ) ?
-               'available' : $pPresence[5][$key];
-
-         $return .= "<presence from='" . $val . "' type='" . $pPresence[4][$key];
-         if ( empty($pPresence[6][$key]) )
-            $return .= "' />";
-         else
-            $return .= "'>" . $pPresence[6][$key] . "</presence>";
-
-         if ( strpos($pPresence[4][$key], 'subscribe') === false )
-         {
-            $session .= "<presence from='" . $val . "'><show>" . $pPresence[4][$key] . "</show>";
-            if ( !empty($pPresence[6][$key]) )
-               $session .= "<status>" . $pPresence[6][$key] . "</status>";
-            $session .= "</presence>";
-         }
-      }
-
-      $_SESSION['phpgw_info']['instant_messenger']['presences'] = $session;
-
-      return $return;
-   }
-
-   /*
-    * GetMessage
-    */
-   
-   function getMessages(array $pMessages)
-   {
-      $_messages = array();
-      $return = NULL;
-
-      foreach ( $pMessages[1] as $key => $val )
-      {
-         trim($pMessages[3][$key]);
-         if ( !empty($pMessages[3][$key]) )
-            $_messages[$val][] = $pMessages[3][$key];
-            
-         if ( !empty($pMessages[2][$key]) )
-         {
-            $return .= '<' . $pMessages[2][$key] . ' from="';
-            $return .= ( strpos($val, '/') ) ? substr($val, 0, strpos($val, '/')) : $val;
-            $return .= '" />';
-         }
-      }
-
-      foreach ( $_messages as $key => $val )
-      {
-         $return .= '<messages from="' . $key . '">';
-         foreach ( $val as $msg )
-            $return .= '<message>' . $msg . '</message>';
-         $return .= '</messages>';
-      }
-
-      return $return;
-   }
-
-   /*
-    * SendMessage
-    */
-
-   function SendMessage($pSendMessage)
-   {
-      $pSendMessage['body'] = stripslashes($pSendMessage['body']);
-      $_emotions  = '/<img emotion="(\S+)?"[^>]+>/';
-      $_emotions = preg_match_all($_emotions, $pSendMessage['body'], $emotions);
-
-      foreach ( $emotions[0] as $key => $val )
-         $emotions[0][$key] = '/' . addcslashes($val, './()[]{}^$*&?') . '/i';
-
-      $pSendMessage['body'] = preg_replace($emotions[0], $emotions[1], $pSendMessage['body']);
-
-      $to = $pSendMessage['to'];
-      $type = "normal";
-      $id = "";
-      $content = array(
-         "subject" => $pSendMessage['subject'] ? $pSendMessage['subject'] : "",
-         "thread" => $pSendMessage['thread'] ? $pSendMessage['thread'] : "",
-         "body" => $pSendMessage['body'] ? $pSendMessage['body'] : ""
-      );
-
-      $payload = "";
-
-      if ($to && is_array($content))
-      {
-         if (!$id)
-         {
-            $id = $type . "_" . time();
-         }
-
-         $xml = "<message to='$to' type='$type' id='$id'>";
-
-         if ($content['subject'])
-         {
-            $xml .= "<subject>" . $content['subject'] . "</subject>";
-         }
-
-         if ($content['thread'])
-         {
-            $xml .= "<thread>" . $content['thread'] . "</thread>";
-         }
-
-         $xml .= "<html><body>" . $content['body'] . "</body></html>";
-         $xml .= $payload;
-         $xml .= "</message>";
-         unset($id);
-
-         $_SESSION['phpgw_info']['instant_messenger']['socket']['out']['message'] .= $xml;
-      }
-      else
-      {
-         $this->writeLog("ERROR: SendMessage() #2");
-         return FALSE;
-      }
-   }
-
-   /*
-    * Composing / Paused Message
-    */
-
-   function composingMessage($pComposing)
-   {
-
-		$xml  = "<message xmlns='jabber:client' to='".$pComposing['to']."' id='".time()."' type='chat'>";
-		$xml .= "<x xmlns='jabber:x:event'>";
-		$xml .= "<composing/>";
-		$xml .= "</x>";
-		$xml .= "<composing xmlns='http://jabber.org/protocol/chatstates'/>";
-		$xml .= "</message>";
-   	$_SESSION['phpgw_info']['instant_messenger']['socket']['out']['message'] .= $xml;
-   }
-   
-   function pausedMessage($pComposing)
-   {
-		$xml  = "<message xmlns='jabber:client' to='".$pComposing['to']."' id='".time()."' type='chat'>";
-		$xml .= "<x xmlns='jabber:x:event'/>";
-		$xml .= "<paused xmlns='http://jabber.org/protocol/chatstates'/>";
-		$xml .= "</message>";
-
-		$_SESSION['phpgw_info']['instant_messenger']['socket']['out']['message'] .= $xml;
-   }
-   
-   /*
-    * UpdateContact
-    */
-   
-   function updateContact($pUser)
-   {
-      $jid   = $pUser['jid'];
-      $name  = $pUser['name'];
-      $group = $pUser['group'];
-      
-      if ( $jid )
-      {
-         $updatecontact  = "<item jid='$jid'";
-         $updatecontact .= " name='" . $name . "'";
-         $updatecontact .= "><group>" . $group . "</group></item>";
-         $_SESSION['phpgw_info']['instant_messenger']['socket']['out']['updateContact'] = $updatecontact;
-      }
-      $this->requireContacts();
-   }
-   
-   /*
-    * AddContact
-    */
-   
-   function addContacts($pUser)
-   {
-      $jid = explode("@",$pUser['email']);
-      $pJid = $jid[0]."@".$_SESSION['phpgw_info']['instant_messenger']['name_jabber'];
-      $pName = $pUser['name'];
-      $pGroup = $pUser['group'];
-
-      if(trim($jid[0]) != trim($this->username))
-      {
-         if ( $pJid )
-         {
-            $newcontact  = "<item jid='$pJid'";
-            $newcontact .= " name='" . $pName . "'";
-            $newcontact .= "><group>" . $pGroup . "</group></item>";
-            $_SESSION['phpgw_info']['instant_messenger']['socket']['out']['addContacts'] = $newcontact;
-            $this->subscribe($pJid);
-            $this->requireContacts();           
-         }
-      }
-   }
-   
-   /*
-    * RemoveContact
-    */
-    
-    function removeContact($pUser)
-    {
-         $pJid = $pUser['jid'];
-         $_SESSION['phpgw_info']['instant_messenger']['socket']['out']['removeContact'] = $pJid;
-         $this->unsubscribed($pJid);
-         $this->requireContacts();
-    }
-
-   /*
-    * Vcard
-    */
-
-   function newVcard($pVcardUser)
-   {
-      $pVcard = explode("_vkrd_", $pVcardUser['vcard']);
-
-      $xmlVcard  = "<FN>".$pVcard[0]."</FN>";
-      $xmlVcard .= "<NICKNAME>".$pVcard[1]."</NICKNAME>";
-      $xmlVcard .= "<ORG>";
-      $xmlVcard .= "<ORGNAME>".$pVcard[2]."</ORGNAME>";
-      $xmlVcard .= "<ORGUNIT>".$pVcard[3]."</ORGUNIT>";
-      $xmlVcard .= "</ORG>";
-      $xmlVcard .= "<ROLE>".$pVcard[4]."</ROLE>";
-      $xmlVcard .= "<BDAY>".$pVcard[5]."</BDAY>";
-      $xmlVcard .= "<DESC>".$pVcard[6]."</DESC>";
-      
-      $_SESSION['phpgw_info']['instant_messenger']['socket']['out']['newVcard'] = $xmlVcard;
-
-   }
-   
-   function getVcard(array $Vcard)
-   {
-      $div = "";
-      $_expr = "/<[^<vCard xmlns=\'vcard\-temp\'>].*[^<\/vCard>]>/";
-      array_shift($Vcard);
-      $div = '<vcard>';
-      $jid_user = $_SESSION['phpgw_info']['instant_messenger']['user'];
-      $jid_user .= "@" . $_SESSION['phpgw_info']['instant_messenger']['name_jabber'];
-      for($i = 0 ; $i < count($Vcard[0]) ; $i++)
-      {
-         preg_match($_expr,$Vcard[1][$i],$div_vcard);
-         $div_new[] = $div_vcard;
-
-         if ( $jid_user == $Vcard[0][$i] )
-            $_SESSION['phpgw_info']['instant_messenger']['vcard'] = $div_new[$i][0];
-         
-         $div .= '<div id="vcard_'.$Vcard[0][$i].'">'.urldecode($div_new[$i][0]).'</div>';
-      }
-      $div .= '</vcard>';
-         
-      return $div;
-   }
-   
-   function Vcard()
-   {
-      $contacts = array();
-      $contacts = $_SESSION['phpgw_info']['instant_messenger']['contacts'];
-      $jid_user = $this->getJid();
-
-      if( count($contacts) > 0 )
-      {
-         array_unshift($contacts,$jid_user);
-
-         foreach($contacts as $user)
-            $_SESSION['phpgw_info']['instant_messenger']['socket']['out']['vcard'][] = $user;
-         return "true";
-      }else{
-         return "false";
-      }
-   }
-   
-   function VcardUser()
-   {
-   	$_SESSION['phpgw_info']['instant_messenger']['socket']['out']['vcard'][] = $this->getJid();;
-   }
-   
-   function getJid()
-   {
-      $jid = $_SESSION['phpgw_info']['instant_messenger']['user'] . "@" . $_SESSION['phpgw_info']['instant_messenger']['name_jabber'];
-      return $jid;   
-   }
-   
-   function subscribe($pJid)
-   {
-      $jid = (is_array($pJid)) ? $pJid['jid'] : $pJid ;
-      $_SESSION['phpgw_info']['instant_messenger']['socket']['out']['Subscribe'] = $jid;
-   }
-   
-   function subscribed($pJid)
-   {
-      $jid = (is_array($pJid)) ? $pJid['jid'] : $pJid ;
-      $_SESSION['phpgw_info']['instant_messenger']['socket']['out']['SubscriptionAcceptRequest'] = $jid;
-   }
-   
-   function unsubscribe($pJid)
-   {
-      $jid = (is_array($pJid)) ? $pJid['jid'] : $pJid ;
-      $_SESSION['phpgw_info']['instant_messenger']['socket']['out']['Unsubscribe'] = $jid;
-   }
-   
-   function unsubscribed($pJid)
-   {
-      $jid = (is_array($pJid)) ? $pJid['jid'] : $pJid ;
-      $_SESSION['phpgw_info']['instant_messenger']['socket']['out']['SubscriptionDenyRequest'] = $jid;   
-   }
-}
-?>
Index: trunk/instant_messenger/bkp/instant_messenger_64/inc/class.db_im.inc.php
===================================================================
--- trunk/instant_messenger/bkp/instant_messenger_64/inc/class.db_im.inc.php	(revision 260)
+++ 	(revision )
@@ -1,97 +1,0 @@
-<?php
-define('PHPGW_INCLUDE_ROOT','../');	
-define('PHPGW_API_INC','../phpgwapi/inc');
-require_once(PHPGW_API_INC.'/class.db.inc.php');
-	
-class db_im
-{	
-	
-	var $db;
-	var $db_name;
-	var $db_host;
-	var $db_port;
-	var $db_user;
-	var $db_pass;
-	var $db_type;
-	var $teste;
-	
-	function db_im(){
-		$this->db_name = $_SESSION['phpgw_info']['instant_messenger']['server']['db_name'];
-		$this->db_host = $_SESSION['phpgw_info']['instant_messenger']['server']['db_host'];
-		$this->db_port = $_SESSION['phpgw_info']['instant_messenger']['server']['db_port'];
-		$this->db_user = $_SESSION['phpgw_info']['instant_messenger']['server']['db_user'];
-		$this->db_pass = $_SESSION['phpgw_info']['instant_messenger']['server']['db_pass'];
-		$this->db_type = $_SESSION['phpgw_info']['instant_messenger']['server']['db_type'];
-		
-		$this->db = new db();		
-		$this->db->connect($this->db_name,$this->db_host,$this->db_port,$this->db_user,$this->db_pass,$this->db_type);
-	}
-
-	function get_accounts_acl()
-	{
-		$result = array();
-		$query = "select acl_appname, acl_account from phpgw_acl where acl_appname = 'instant_messenger' order by acl_account";	
- 		
- 		if (!$this->db->query($query))
-        	return null;
-		
-		while($this->db->next_record())
-			$result[] = $this->db->row();
-
-		return $result;
-	}
-	
-	function query_db($pQuery)
-	{
-		if (!$this->db->query($pQuery))
-        	return false;
-		else
-			return true;
-	}
-	
-	function set_preferences($param)
-	{
-		$preferences = $param['preferences'];
-		$user_id  = $_SESSION['phpgw_info']['instant_messenger']['user_id']; 
-		$app_name = $this->name_app();
-
-		$query = "insert into phpgw_preferences values('".$user_id."','".$app_name."','".serialize($preferences)."')";
-		
-		if($this->query_db($query))	 
-			return "true";
-		else{
-			$query = "update phpgw_preferences set preference_value = '".serialize($preferences)."' where preference_app='".$app_name."' and preference_owner='".$user_id."'";
-			if($this->query_db($query))
-				return "true";
-			else
-				return "false";			
-		}		
-	}
-	
-	function get_preferences()
-	{
-		$result = array();
-		$user_id  = $_SESSION['phpgw_info']['instant_messenger']['user_id'];
-		$app_name = $this->name_app();
-		
-		$query = "select * from phpgw_preferences where preference_owner = '".$user_id."' and preference_app = '".$app_name."'";
-		
- 		if (!$this->db->query($query))
-        	return NULL;
-		
-		while($this->db->next_record())
-			$result[] = $this->db->row();
-
-		if(count($result) > 0){
-			return unserialize($result[0]['preference_value']);
-		}else{
-			return "ch_offline:true;in_time:1;rd_nm:true;rd_ch:false";
-		}
-	}
-	
-	function name_app()
-	{
-		return "instant_messenger";
-	}
-}
-?>
Index: trunk/instant_messenger/bkp/instant_messenger_64/inc/IMConfigure.php
===================================================================
--- trunk/instant_messenger/bkp/instant_messenger_64/inc/IMConfigure.php	(revision 260)
+++ 	(revision )
@@ -1,33 +1,0 @@
-<?php
-   ###
-   # definitions of access - BEGIN
-   #
-      define('CONNECT', 'con');
-      define('CLOSE', 'close');
-      define('GET_MESSAGE', 'getMessage');
-      define('SEND_MESSAGE', 'send');
-   #
-   # definitions of access - END
-   ###
-
-   ###
-   # definitions of time - BEGIN
-   #
-      define('DISCONNECT_AFTERWARDS_OF', 20);
-      define('READ_SOCKET_AFTER_OF', 2);
-   #
-   # definitions of time - END
-   ###
-
-   ###
-   # definitions of socket - BEGIN
-   #
-      define('TRANSPORT_NON_SECURITY', 'tcp');
-      define('PORT_NON_SECURITY', '8000');
-
-      //define('TRANSPORT_SECURITY', 'sslv3');
-      //define('PORT_SECURITY', '9001');
-   #
-   # definitions of socket - END
-   ###
-?>
Index: trunk/instant_messenger/bkp/instant_messenger_64/inc/Jabber.abstract.php
===================================================================
--- trunk/instant_messenger/bkp/instant_messenger_64/inc/Jabber.abstract.php	(revision 260)
+++ 	(revision )
@@ -1,317 +1,0 @@
-<?php
-/*
-+-------------------------------------------------------------------------+
-|                                                                         |
-| @FILE:        Jabber.abstract.php                                       |
-| @ABSTRACT:    Jabber                                                    |
-| @EXTENDS:     Socket (Socket.class.php)                                 |
-|                                                                         |
-| @DATE:        Wed May,16 2007 08:18:59                                  |
-| @LAST_CHANGE: Wed May,16 2007 09:03:28                                  |
-|                                                                         |
-| @AUTHOR:      [NUTS] Rodrigo Souza - rodsouza@celepar.pr.gov.br         |
-|                                                                         |
-| @BRIEF:       Abstract class for connect with any Jabber server         |
-|                                                                         |
-+-------------------------------------------------------------------------+
-*/
-
-require_once 'Socket.abstract.php';
-
-abstract class Jabber extends Socket
-{
-   const J_FILE    = '/var/log/expresso/Jabber.log';
-   const J_ALL     = false;
-   const J_ERROR   = true;
-   const J_WARNING = true;
-   const J_NOTICE  = true;
-
-   const ALL     = 'ALL';
-   const ERROR   = 'ERROR';
-   const WARNING = 'WARNING';
-   const NOTICE  = 'NOTICE';
-
-   private final function _connect( $pUser = false, $pPassword = false )
-   {
-      try
-      {	
-         if ( !preg_match('/^(.+)@(.+)\/(.+):(\d+)$/',$pUser, $matches) )
-            throw new Exception('[connect] #1 ' . $pUser . ' must be [USER]@[DOMAIN]/[RESOURCE]:[PORT] and [PORT] is integer. File: ' . __FILE__ . '  ::  ' . __LINE__);
-
-         list($subject, $USER, $SERVER, $RESOURCE, $PORT) = $matches;
-
-         if ( !($socket = $this->open('tcp://' . $SERVER . ':' . $PORT, 1, 1)) )
-            throw new Exception('[connect] #2 can\'t access tcp://' . $SERVER . ':' . $PORT . '. File: ' . __FILE__ . '  ::  ' . __LINE__);
-
-         $this->_socket = $socket;
-
-         $xml  = "<?xml version='1.0' encoding='UTF-8'?>";
-         $xml .= "<stream:stream to='" . $SERVER . "' xmlns='jabber:client' ";
-         $xml .= "xmlns:stream='http://etherx.jabber.org/streams' version='1.0'>";
-
-         if ( $this->write($xml) === false )
-            throw new Exception('[connect] #3 it isn\'t possible write in the socket ' . $socket . '. File: ' . __FILE__ . '  ::  ' . __LINE__);
-
-         $this->_server = $SERVER;
-         $this->_username = $USER;
-         $this->_password = $pPassword;
-         $this->_resource = $RESOURCE;
-      }
-      catch(Exception $e)
-      {
-         $this->writeLog('ERROR', $e->getMessage());
-         return false;
-      }
-   }
-
-   protected function connect( $pUser = false, $pPassword = false )
-   {   
-      try
-      {
-         $this->_connect($pUser, $pPassword);
-         $this->blocking($this->_socket, 0);
-			
-			$xml = $this->read();
-         
-         if ( $xml === false )
-            throw new Exception('[connect] #1 it isn\'t possible read the socket. File: ' . __FILE__ . '  ::  ' . __LINE__);
-         
-         if ( preg_match('/(<starttls .*<required\/><\/starttls>)/', $xml, $matches) )
-         {
-            if ( !$this->starttls() )
-               throw new Exception('[connect] #2 it isn\'t possible start tls. File: ' . __FILE__ . '  ::  ' . __LINE__);
-         }
-         else
-	 		{
-            if ( !$this->_plain() )
-               throw new Exception('[connect] #3 it isn\'t possible carry out the verification. File: ' . __FILE__ . '  ::  ' . __LINE__);
-	 		}
-
-         return true;
-      }
-      catch(Exception $e)
-      {
-         $this->writeLog('ERROR', $e->getMessage());
-         $this->_disconnect();
-         return false;
-      }
-   }
-
-   protected final function _disconnect()
-   {
-      try
-      {
-         $xml = "</stream:stream>";
-
-         if ( $this->write($xml) === false )
-            throw new Exception('[disconnect] #1 Cannot write to socket (' . $this->_socket . '). File: ' . __FILE__ . '  ::  ' . __LINE__);
-
-         if ( ($xml = $this->read()) === false )
-            throw new Exception('[disconnect] #2 it isn\'t possible read the socket. File: ' . __FILE__ . '  ::  ' . __LINE__);
-      }
-      catch(Exception $e)
-      {
-         $this->writeLog('ERROR', $e->getMessage());
-         return false;
-      }
-   }
-
-   private final function starttls()
-   {
-      try
-      {
-         $xml = "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>";
-         
-         if ( $this->write($xml) === false )
-            throw new Exception('[starttls] #1 Cannot write to socket (' . $this->_socket . '). File: ' . __FILE__ . '  ::  ' . __LINE__);
-
-         if ( ($xml = $this->read()) === false )
-            throw new Exception('[starttls] #2 it isn\'t possible read the socket. File: ' . __FILE__ . '  ::  ' . __LINE__);
-
-         if ( !preg_match('/<proceed.*\/>/', $xml, $matches) )
-            throw new Exception('[starttls] #3 can\'t start tls in the socket ' .$this->_socket . '. File: ' . __FILE__ . '  ::  ' . __LINE__);
-
-		   stream_socket_enable_crypto($this->_socket, TRUE, STREAM_CRYPTO_METHOD_TLS_CLIENT);
-
-         $xml  = "<?xml version='1.0' encoding='UTF-8'?>";
-         $xml .= "<stream:stream to='" . $this->_server . "' xmlns='jabber:client' ";
-         $xml .= "xmlns:stream='http://etherx.jabber.org/streams' version='1.0'>";
-         if ( $this->write($xml) === false )
-            throw new Exception('[starttls] #4 Cannot write to socket (' . $this->_socket . '). File: ' . __FILE__ . '  ::  ' . __LINE__);
-
-         usleep(90000);
-         $this->blocking($this->_socket, 0);
-
-         if ( ($xml = $this->read()) === false )
-            throw new Exception('[starttls] #5 it isn\'t possible read the socket. File: ' . __FILE__ . '  ::  ' . __LINE__);
-
-         if ( !$this->_plain() )
-            throw new Exception('[starttls] #6 it isn\'t possible carry out the verification. File: ' . __FILE__ . '  ::  ' . __LINE__);
-
-         return true;
-      }
-      catch(Exception $e)
-      {
-         $this->writeLog('ERROR', $e->getMessage());
-         return false;
-      }
-   }
-
-   private final function _plain()
-   {
-      try
-      {
-			//$this->blocking($this->_socket, 1);
-
-         if ( ($xml = $this->read()) === false )
-            throw new Exception('[_plain] #1 it isn\'t possible read the socket. File: ' . __FILE__ . '  ::  ' . __LINE__);
-
-         $xml  = "<username>" . $this->_username . "</username>";
-         $xml .= "<password>" . $this->_password . "</password>";
-         $xml .= "<resource>" . $this->_resource . "</resource>";
-
-         unset($this->_password);
-
-         if ( !$this->iq('set', 'auth_1', NULL, NULL, "jabber:iq:auth", $xml) )
-            throw new Exception('[_plain] #2 it isn\'t possible carry out the verification. File: ' . __FILE__ . '  ::  ' . __LINE__);
-
-         while ( !preg_match("/<iq xmlns='jabber:client' id='auth_1' type='(result|error)'/", ($readSocket = $this->read()), $matches) )
-         	   usleep(10000);
-
-			if($matches[1] == "error")
-				return false;
-
-         if ( ($xml = $this->read()) === false )
-            throw new Exception('[_plain] #3 it isn\'t possible read the socket. File: ' . __FILE__ . '  ::  ' . __LINE__);
-
-         return true;
-      }
-      catch(Exception $e)
-      {
-         $this->writeLog('ERROR', $e->getMessage());
-         return false;
-      }
-   }
-
-	private final function _iq($pType = false, $pId = false, $pTo = false, $pFrom = false, $pXmlns = false, $pLoad = false )
-	{
-		$xml  = "<iq type='" . $pType . "' id='" . $pId . "'";
-		$xml .= ( $pTo ) ? " to='" . $pTo . "'" : "";
-		$xml .= ( $pFrom ) ? " from='" . $pFrom . "'" : "";
-
-		if ( $pXmlns == "vcard-temp" )
-      {
-			$xml .= ">";
-			$xml .= $pLoad;
-		}
-      else
-      {
-			$xml .= "><query xmlns='" . $pXmlns . "'";
-			$xml .= ( $pLoad ) ? ">" . $pLoad . "</query>" : "/>";
-		}
-
-		$xml .= "</iq>";
-		
-		return $xml;	
-	}
-
-   protected final function iq($pType = false, $pId = false, $pTo = false, $pFrom = false, $pXmlns = false, $pLoad = false)
-   {
-      try
-      {
-         if ( !preg_match("/^(get|set|result|error)$/i", $pType, $matches) )
-            throw new Exception('[iq] #1 type must be GET, SET, RESULT or ERROR. File: ' . __FILE__ . '  ::  ' . __LINE__);
-
-		   if ( $this->write($this->_iq($pType, $pId, $pTo, $pFrom, $pXmlns, $pLoad)) === false )
-            throw new Exception('[iq] #2 Cannot write to socket (' . $this->_socket . '). File: ' . __FILE__ . '  ::  ' . __LINE__);
-         else
-            return true;
-      }
-      catch(Exception $e)
-      {
-         $this->writeLog('ERROR', $e->getMessage());
-         return false;
-      }
-   }
-
-	protected final function presence($pType = false, $pTo = false, $pShow = false, $pStatus = false, $pPriority = false)
-	{
-      try
-      {
-         $xml  = "<presence";
-         $xml .= ($pTo)   ? " to='{$pTo}'" : '';
-         $xml .= ($pType) ? " type='{$pType}'" : '';
-         
-         if ( !($pStatus || $pShow || $pPriority) )
-				$xml .= "/>";
-			else
-			{
-			 $xml .= ">";
-	         $xml .= ($pStatus) ? "<status>" . $pStatus . "</status>" : '';
-	         $xml .= ($pShow) ? "<show>" . $pShow . "</show>" : '';
-	         $xml .= ($pPriority) ? "<priority>" . $pPriority . "</priority>" : '';
-	         $xml .= ($pStatus || $pShow || $pPriority) ? "</presence>" : '';
-			}
-
-         if ( $this->write($xml) === false )
-            throw new Exception('[presence] #1 it isn\'t possible send presence for ' . $this->_server . '. File: ' . __FILE__ . '  ::  ' . __LINE__);
-
-         return true;
-      }
-      catch(Exception $e)
-      {
-         $this->writeLog('ERROR', $e->getMessage());
-         return false;
-      }
-	}
-
-   protected final function read()
-   {
-      $return = NULL;
-      do
-      {
-         $line = NULL;
-         $line = utf8_decode(parent::read($this->_socket, 4096));
-
-         if ( $line === false )
-         {
-            $return = false;
-            break;
-         }
-
-         if ( $line != NULL )
-            $return .= $line ;
-      }
-      while ( $line != NULL );
-
-      return $return;
-   }
-
-	protected final function write($pData = false)
-   {
-      if ( !$pData )
-         return false;
-
-      return parent::write($this->_socket, utf8_encode($pData));
-   }
-
-   protected final function writeLog($pType = false, $pLog = false)
-   {
-      if ( !defined('self::'.$pType) && !$pLog )
-         return false;
-
-      if ( !(bool)constant('self::J_'.$pType) && !(bool)constant('self::J_ALL') )
-         return false;
-
-      $log  = date('m/d/Y H:i:s');
-      $log .= ' [' . constant('self::'.$pType) . '] :: ';
-      $log .= $pLog . "\n";
-      if ( $fp = fopen (self::J_FILE, "a+") )
-      {
-         fwrite($fp, $log);
-         fclose($fp);
-      }
-   }
-}
-
-?>
Index: trunk/instant_messenger/bkp/instant_messenger_64/inc/Language.class.php
===================================================================
--- trunk/instant_messenger/bkp/instant_messenger_64/inc/Language.class.php	(revision 260)
+++ 	(revision )
@@ -1,41 +1,0 @@
-<?php
-
-class Language
-{
-   const _DEFAULT_LANGUAGE_ = 'ENGLISH';
-   static private $_language = NULL;
-
-   static private $_phrase = NULL;
-
-   function __construct()
-   {
-      echo 'ok';
-   }
-
-   function setLanguage( $pLanguage = false )
-   {
-      if ( !$pLanguage || !is_file($pLanguage . '_language.txt') )
-         return false;
-
-      $this->_language = $pLanguage;
-      $this->_phrase = file($this->_language . '_language.txt');
-
-      foreach($this->_phrase as $val )
-      {
-         $_phrase = explode('§§', $val);
-         if ( sizeof($_phrase) != 2 )
-            continue;
-         $this->_phrase[$_phrase[0]] = $_phrase[1];
-      }
-   }
-
-   public function phrase( $pPhrase )
-   {
-      if ( !$this->_phrase || !isset($this->_phrase[$pPhrase]) )
-         return '** ' . self::_DEFAULT_LANGUAGE_;
-      else
-         return $this->_phrase[$pPhrase];
-   }
-}
-
-?>
