Author: leithoff
New Revision: 34717
URL: http://www.egroupware.org/viewvc/egroupware?rev=34717&view=rev
Log:
- phpfreechat: hook tab_closed -> set up hook and impement new hook tab_closed, to disconnect a user that closes his tab (jdots template) @TODO: implement that on close window too, when in window mode
Modified:
trunk/phpfreechat/inc/class.phpfreechat_hooks.inc.php
trunk/phpfreechat/setup/setup.inc.php
Modified: trunk/phpfreechat/inc/class.phpfreechat_hooks.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/trunk/phpfreechat/inc/class.phpfreechat_hooks.inc.php?rev=34717&r1=34716&r2=34717&view=diff
— trunk/phpfreechat/inc/class.phpfreechat_hooks.inc.php (original)
+++ trunk/phpfreechat/inc/class.phpfreechat_hooks.inc.php Mon Apr 18 18:06:35 2011
@@ -46,6 +46,54 @@
$location = is_array($args) ? $args[‘location’] : $args;
//echo “
admin_prefs_sidebox_hooks::all_hooks(”.print_r($args,True).") appname=’$appname’, location=’$location’
\n";-
if ($location == 'tab_closed') -
{ -
//error_log(__METHOD__.__LINE__.' Hook called:'.$location); -
require_once(EGW_INCLUDE_ROOT.'/phpfreechat/phpfreechat/src/phpfreechat.class.php'); -
include(EGW_INCLUDE_ROOT.'/phpfreechat/phpfreechat_config.php'); -
$chat = new phpFreeChat($params); -
// initialize the global config object -
$c =& pfcGlobalConfig::Instance( $params ); -
//error_log(__METHOD__.__LINE__.array2string($c)); -
// need to initiate the user config object here because it uses sessions -
$u =& pfcUserConfig::Instance(); -
$channel2name = $name2channel =array(); -
foreach ((array)$u->channels as $key => $values) -
{ -
$channel2name[$values['recipient']] = $values['name']; -
$name2channel[$values['recipient']] = $values['name']; -
} -
//error_log(__METHOD__.__LINE__.array2string($u)); -
$pfcContainer =& pfcContainer::Instance(); -
$nickid = $u->nickid; -
$nick = $u->nick; -
$cmd = "notice"; -
//error_log(__METHOD__.__LINE__.array2string($nickid)); -
// get the current user's channels list -
$channels = array(); -
$ret2 = $pfcContainer->getMeta("nickid-to-channelid",$nickid); -
//error_log(__METHOD__.__LINE__.array2string($ret2)); -
foreach($ret2["value"] as $userchan) -
{ -
//error_log(__METHOD__.__LINE__.array2string($userchan)); -
$userchan = $pfcContainer->decode($userchan); -
if ($userchan != 'SERVER') -
{ -
// tell the others -
$param = lang("%1 is leaving channel %2 by closing his chat window",$nick,(!empty($channel2name[$userchan])?$channel2name[$userchan]:$userchan)); -
$pfcContainer->write($userchan, $nick, $cmd, $param); -
// disconnect the user from each joined channels -
$pfcContainer->removeNick($userchan, $nickid); -
$channels[] = $userchan; -
} -
} -
// now disconnect the user from the server -
// (order is important because the SERVER channel has timestamp informations) -
$userchan = 'SERVER'; -
$du = $pfcContainer->removeNick($userchan, $nickid); -
} -
if ($GLOBALS['egw_info']['user']['apps']['preferences'] && $location != 'admin') { // future possible prefs
Modified: trunk/phpfreechat/setup/setup.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/trunk/phpfreechat/setup/setup.inc.php?rev=34717&r1=34716&r2=34717&view=diff
— trunk/phpfreechat/setup/setup.inc.php (original)
+++ trunk/phpfreechat/setup/setup.inc.php Mon Apr 18 18:06:35 2011
@@ -30,6 +30,7 @@
$setup_info[‘phpfreechat’][‘tables’] = array(‘egw_phpfreechat’); // handled by pfc itself atm.
$setup_info[‘phpfreechat’][‘hooks’][‘admin’] = ‘phpfreechat_hooks::all_hooks’;
+$setup_info[‘phpfreechat’][‘hooks’][‘tab_closed’] = ‘phpfreechat_hooks::all_hooks’;
/* Dependencies for this app to work */
$setup_info[‘phpfreechat’][‘depends’][] = array(
Benefiting from Server Virtualization: Beyond Initial Workload
Consolidation – Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve
application availability and disaster protection. Learn more about boosting
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs