Thread: [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. |
From: <ke...@us...> - 2006-07-17 08:56:26
|
Revision: 655 Author: kerphi Date: 2006-07-17 01:56:18 -0700 (Mon, 17 Jul 2006) ViewCVS: http://svn.sourceforge.net/phpfreechat/?rev=655&view=rev Log Message: ----------- Bug fix: the getLastMsg function ignored the number of last messages parameter (2nd parameter). Modified Paths: -------------- trunk/src/pfcinfo.class.php Modified: trunk/src/pfcinfo.class.php =================================================================== --- trunk/src/pfcinfo.class.php 2006-07-12 12:16:41 UTC (rev 654) +++ trunk/src/pfcinfo.class.php 2006-07-17 08:56:18 UTC (rev 655) @@ -58,15 +58,18 @@ function getLastMsg($channel, $nb) { + // to be sure the $nb params is a positive number + if ( !( $nb >= 0 ) ) $nb = 10; + // to get the channel recipient name // @todo must use another function to get a private message last messages $channel = pfcCommand_join::GetRecipient($channel); $container =& $this->getContainerInstance(); $lastmsg_id = $container->getLastId($channel); - $lastmsg_raw = $container->read($channel, $lastmsg_id-10); + $lastmsg_raw = $container->read($channel, $lastmsg_id-$nb); return $lastmsg_raw; } } -?> \ No newline at end of file +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2006-10-04 09:40:52
|
Revision: 819 http://svn.sourceforge.net/phpfreechat/?rev=819&view=rev Author: kerphi Date: 2006-10-04 02:40:34 -0700 (Wed, 04 Oct 2006) Log Message: ----------- [en] New API function (pfcinfo) used to rehash (clear the cache). [10min] [fr] Nouvelle fonction dans l'API pfcinfo permettant de vider le cache (rehash). [10min] Modified Paths: -------------- trunk/src/pfcinfo.class.php Modified: trunk/src/pfcinfo.class.php =================================================================== --- trunk/src/pfcinfo.class.php 2006-10-04 09:34:53 UTC (rev 818) +++ trunk/src/pfcinfo.class.php 2006-10-04 09:40:34 UTC (rev 819) @@ -56,6 +56,10 @@ return $users; } + /** + * Return the last $nb message from the $channel room. + * The messages format is very basic, it's raw data (it will certainly change in future) + */ function getLastMsg($channel, $nb) { // to be sure the $nb params is a positive number @@ -70,6 +74,16 @@ $lastmsg_raw = $container->read($channel, $lastmsg_id-$nb); return $lastmsg_raw; } + + /** + * Rehash the server config (same as /rehash command) + * Usefull to take into account new server's parameters + */ + function rehash() + { + $destroyed = $this->destroyCache(); + return $destroyed; + } } -?> +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-01-22 09:01:24
|
Revision: 934 http://svn.sourceforge.net/phpfreechat/?rev=934&view=rev Author: kerphi Date: 2007-01-22 01:01:25 -0800 (Mon, 22 Jan 2007) Log Message: ----------- Buf Fix : http://sourceforge.net/tracker/index.php?func=detail&aid=1633936&group_id=158880&atid=809603 Modified Paths: -------------- trunk/src/pfcinfo.class.php Modified: trunk/src/pfcinfo.class.php =================================================================== --- trunk/src/pfcinfo.class.php 2007-01-21 22:09:53 UTC (rev 933) +++ trunk/src/pfcinfo.class.php 2007-01-22 09:01:25 UTC (rev 934) @@ -43,6 +43,9 @@ function getOnlineNick($channel = NULL, $timeout = 20) { $container =& $this->getContainerInstance(); + + if ($channel != NULL) $channel = pfcCommand_join::GetRecipient($channel); + $res = $container->getOnlineNick($channel); $users = array(); if (isset($res["nickid"])) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-02-20 10:18:57
|
Revision: 973 http://svn.sourceforge.net/phpfreechat/?rev=973&view=rev Author: kerphi Date: 2007-02-20 02:18:56 -0800 (Tue, 20 Feb 2007) Log Message: ----------- [en] Bug fix: the pfcInfo methodes should not print errors when the chat cache could not be found [0h15] [fr] Bug fix : les m?\195?\169thodes de pfcInfo ne doivent pas afficher une erreur lors le cache du chat n'existe pas [0h15] Modified Paths: -------------- trunk/src/pfcinfo.class.php Modified: trunk/src/pfcinfo.class.php =================================================================== --- trunk/src/pfcinfo.class.php 2007-02-20 08:23:37 UTC (rev 972) +++ trunk/src/pfcinfo.class.php 2007-02-20 10:18:56 UTC (rev 973) @@ -20,8 +20,9 @@ { $this->errors[] = _pfc("Error: the cached config file doesn't exists"); return; - } + } // then intitialize the pfcglobalconfig + $params = array(); $params["serverid"] = $serverid; $params["data_private_path"] = $data_private_path; $this->c =& pfcGlobalConfig::Instance($params); @@ -32,8 +33,15 @@ */ function getErrors() { - return array_merge($this->errors, $this->c->getErrors()); + if ($this->c != null) + return array_merge($this->errors, $this->c->getErrors()); + else + return $this->errors; } + function hasErrors() + { + return count($this->getErrors()) > 0; + } /** * @param $channel the returned list is the list of nicknames present on the given channel (NULL for the whole server) @@ -42,6 +50,8 @@ */ function getOnlineNick($channel = NULL, $timeout = 20) { + if ($this->hasErrors()) return array(); + $ct =& pfcContainer::Instance(); if ($channel != NULL) $channel = pfcCommand_join::GetRecipient($channel); @@ -65,6 +75,8 @@ */ function getLastMsg($channel, $nb) { + if ($this->hasErrors()) return array(); + // to be sure the $nb params is a positive number if ( !( $nb >= 0 ) ) $nb = 10; @@ -84,6 +96,8 @@ */ function rehash() { + if ($this->hasErrors()) return false; + $destroyed = $this->c->destroyCache(); return $destroyed; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |