[Phpfreechat-svn] SF.net SVN: phpfreechat: [747] trunk/src
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2006-09-10 19:18:45
|
Revision: 747 http://svn.sourceforge.net/phpfreechat/?rev=747&view=rev Author: kerphi Date: 2006-09-10 12:18:38 -0700 (Sun, 10 Sep 2006) Log Message: ----------- [en] New /help command use to list available commands (in future, it's planned to display command syntax/description). [fr] Nouvelle commande /help permettan de lister les commandes disponibles (dans le future elle permettra egalement de donner une description de chaque commandes) Modified Paths: -------------- trunk/src/client/pfcclient.js Added Paths: ----------- trunk/src/commands/help.class.php Modified: trunk/src/client/pfcclient.js =================================================================== --- trunk/src/client/pfcclient.js 2006-09-10 17:27:25 UTC (rev 746) +++ trunk/src/client/pfcclient.js 2006-09-10 19:18:38 UTC (rev 747) @@ -324,6 +324,13 @@ this.displayMsg( cmd, this.res.getLabel('phpfreechat current version is %s',param) ); } } + else if (cmd == "help") + { + if (resp == "ok") + { + this.displayMsg( cmd, param); + } + } else if (cmd == "rehash") { if (resp == "ok") Added: trunk/src/commands/help.class.php =================================================================== --- trunk/src/commands/help.class.php (rev 0) +++ trunk/src/commands/help.class.php 2006-09-10 19:18:38 UTC (rev 747) @@ -0,0 +1,38 @@ +<?php + +require_once(dirname(__FILE__)."/../pfccommand.class.php"); + +class pfcCommand_help extends pfcCommand +{ + var $usage = "/help"; + + function run(&$xml_reponse, $p) + { + $clientid = $p["clientid"]; + $param = $p["param"]; + $sender = $p["sender"]; + $recipient = $p["recipient"]; + $recipientid = $p["recipientid"]; + + $c =& $this->c; + $u =& $this->u; + + $ignore = array("updatemynick", "getnewmsg", "notice", "getonlinenick", "error", "update", "asknick"); + + $cmdlist = array(); + $dh = opendir(dirname(__FILE__)); + while (false !== ($file = readdir($dh))) + { + if (!preg_match("/^([a-z]+).class.php$/i",$file,$res)) continue; + if (!in_array($res[1],$ignore)) $cmdlist[] = $res[1]; + } + sort($cmdlist); + + $str = _pfc("Here is the command list:")."<br/>"; + $str .= implode("<br/>", $cmdlist); + + $xml_reponse->addScript("pfc.handleResponse('".$this->name."', 'ok', '".$str."');"); + } +} + +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |