[Phpfreechat-svn] SF.net SVN: phpfreechat: [489] trunk/src/commands
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2006-05-11 16:30:40
|
Revision: 489 Author: kerphi Date: 2006-05-11 09:11:14 -0700 (Thu, 11 May 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=489&view=rev Log Message: ----------- Code cleaning: when a user close his window, take care to disconnect users from the server and from the joined channels. Modified Paths: -------------- trunk/src/commands/getonlinenick.class.php trunk/src/commands/update.class.php Modified: trunk/src/commands/getonlinenick.class.php =================================================================== --- trunk/src/commands/getonlinenick.class.php 2006-05-11 15:51:03 UTC (rev 488) +++ trunk/src/commands/getonlinenick.class.php 2006-05-11 16:11:14 UTC (rev 489) @@ -7,19 +7,21 @@ function run(&$xml_reponse, $clientid, $param, $sender, $recipient, $recipientid) { $c =& $this->c; + $container =& $c->getContainerInstance(); - // get the actual nicklist - $nicklist_sid = $c->prefix."nicklist_".$c->getId()."_".$clientid."_".$recipientid; - $oldnicklist = isset($_SESSION[$nicklist_sid]) ? $_SESSION[$nicklist_sid] : array(); - - $container =& $c->getContainerInstance(); - $disconnected_users = $container->removeObsoleteNick(NULL,$c->timeout); + // take care to disconnect timeouted users on this channel $disconnected_users = $container->removeObsoleteNick($recipient,$c->timeout); foreach ($disconnected_users as $u) { $cmd =& pfcCommand::Factory("notice"); $cmd->run($xml_reponse, $clientid, _pfc("%s quit (timeout)",$u), $sender, $recipient, $recipientid, 2); } + + // get the cached nickname list + $nicklist_sid = $c->prefix."nicklist_".$c->getId()."_".$clientid."_".$recipientid; + $oldnicklist = isset($_SESSION[$nicklist_sid]) ? $_SESSION[$nicklist_sid] : array(); + + // get the real nickname list $users = $container->getOnlineNick($recipient); sort($users); // check if the nickname list must be updated Modified: trunk/src/commands/update.class.php =================================================================== --- trunk/src/commands/update.class.php 2006-05-11 15:51:03 UTC (rev 488) +++ trunk/src/commands/update.class.php 2006-05-11 16:11:14 UTC (rev 489) @@ -12,9 +12,20 @@ // do not update if user isn't active (didn't connect) if ($u->active) { + $container =& $c->getContainerInstance(); + + // take care to disconnect timeouted users on the server + $disconnected_users = $container->removeObsoleteNick(NULL,$c->timeout); + // if whould be possible to echo these disconnected users on a server tab + // server tab is not yet available so I just commente the code + // foreach ($disconnected_users as $u) + // { + // $cmd =& pfcCommand::Factory("notice"); + // $cmd->run($xml_reponse, $clientid, _pfc("%s quit (timeout)",$u), $sender, $recipient, $recipientid, 2); + // } + // ----- // check if other user talk to me or not - $container =& $c->getContainerInstance(); $nickid = $container->getNickId($u->nick); $pvnicks = $container->getMeta("privmsg", "nickname", $nickid); if (is_string($pvnicks)) $pvnicks = unserialize($pvnicks); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |