[Phpfreechat-svn] SF.net SVN: phpfreechat: [642] trunk/src/pfcinfo.class.php
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2006-07-04 15:54:48
|
Revision: 642 Author: kerphi Date: 2006-07-04 08:54:40 -0700 (Tue, 04 Jul 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=642&view=rev Log Message: ----------- Now a timeout parameter is used to identify if a user is online or offline Modified Paths: -------------- trunk/src/pfcinfo.class.php Modified: trunk/src/pfcinfo.class.php =================================================================== --- trunk/src/pfcinfo.class.php 2006-07-04 15:33:50 UTC (rev 641) +++ trunk/src/pfcinfo.class.php 2006-07-04 15:54:40 UTC (rev 642) @@ -36,16 +36,23 @@ } /** + * @param $channel the returned list is the list of nicknames present on the given channel (NULL for the whole server) + * @param $timeout is the time to wait before a nickname is considered offline * @return array(string) a list of online nicknames */ - function getOnlineNick($channel = NULL) + function getOnlineNick($channel = NULL, $timeout = 20) { $container =& $this->getContainerInstance(); $res = $container->getOnlineNick($channel); $users = array(); if (isset($res["nickid"])) - foreach($res["nickid"] as $nickid) - $users[] = $container->getNickname($nickid); + { + for($i = 0; $i < count($res["nickid"]); $i++) + { + if (time()-$timeout < $res["timestamp"][$i]) + $users[] = $container->getNickname($res["nickid"][$i]); + } + } return $users; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |