[Phpfreechat-svn] SF.net SVN: phpfreechat: [786] trunk/src
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2006-09-22 20:34:25
|
Revision: 786 http://svn.sourceforge.net/phpfreechat/?rev=786&view=rev Author: kerphi Date: 2006-09-22 13:33:57 -0700 (Fri, 22 Sep 2006) Log Message: ----------- [en] Disk space optimization: when the last user quit a channel or a private room, the messages history is purged in the container. [1h15] [fr] Optimisation de l'espace disque : lorsque le dernier utilisateur quitte un salon ou un chat priv?\195?\169, l'historique des messages est automatiquement effac?\195?\169. [1h15] Modified Paths: -------------- trunk/src/pfccontainer.class.php trunk/src/proxies/checktimeout.class.php Modified: trunk/src/pfccontainer.class.php =================================================================== --- trunk/src/pfccontainer.class.php 2006-09-22 12:47:39 UTC (rev 785) +++ trunk/src/pfccontainer.class.php 2006-09-22 20:33:57 UTC (rev 786) @@ -83,6 +83,15 @@ $this->rmMeta('channelid-to-nickid', $this->encode($chan), $nickid); $this->rmMeta('nickid-to-channelid', $nickid, $this->encode($chan)); + // if the user is the last one to quit this room, + // then clean the room history + $ret = $this->getOnlineNick($chan); + if (count($ret['nickid']) == 0) + { + $this->rmMeta('channelid-to-msg', $this->encode($chan)); + $this->rmMeta('channelid-to-msgid', $this->encode($chan)); + } + // get the current user's channels list $channels = $this->getMeta("nickid-to-channelid",$nickid); $channels = $channels["value"]; @@ -219,7 +228,7 @@ if ($chan == NULL) $chan = 'SERVER'; - $online_user = array(); + $online_user = array('nick'=>array(),'nickid'=>array(),'timestamp'=>array()); $ret = $this->getMeta("channelid-to-nickid", $this->encode($chan)); for($i = 0; $i<count($ret['timestamp']); $i++) { Modified: trunk/src/proxies/checktimeout.class.php =================================================================== --- trunk/src/proxies/checktimeout.class.php 2006-09-22 12:47:39 UTC (rev 785) +++ trunk/src/proxies/checktimeout.class.php 2006-09-22 20:33:57 UTC (rev 786) @@ -43,15 +43,17 @@ $u =& $this->u; // disconnect users from specific channels - $container =& $c->getContainerInstance(); - $disconnected_users = $container->removeObsoleteNick($c->timeout); + $ct =& $c->getContainerInstance(); + $disconnected_users = $ct->removeObsoleteNick($c->timeout); for($i=0; $i<count($disconnected_users["nick"]); $i++) { $nick = $disconnected_users["nick"][$i]; for($j=0; $j<count($disconnected_users["channels"][$i]); $j++) { $chan = $disconnected_users["channels"][$i][$j]; - if ($chan != 'SERVER') + $online_users = $ct->getOnlineNick($chan); + if ($chan != 'SERVER' && + count($online_users['nickid'])) { $cmdp = $p; $cmdp["param"] = _pfc("%s quit (timeout)", $nick); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |