Change to docs only regarding plugin info
[squirrelmail.git] / src / squirrelmail_rpc.php
index 6b0f179ca4f0a8971715daf71806691ee43c3c3b..4a1acbacf31be106eb15d5e697f62274f4e7ab34 100644 (file)
@@ -6,13 +6,17 @@
   * This file contains the entry point to the "SquirrelMail API" -- the 
   * remote procedure call request receiver.
   * 
-  * @copyright © 1999-2007 The SquirrelMail Project Team
+  * @copyright © 1999-2008 The SquirrelMail Project Team
   * @license http://opensource.org/licenses/gpl-license.php GNU Public License
   * @version $Id$
   * @package squirrelmail
   * @since 1.5.2
   *
   */
+
+/** This is the squirrelmail_rpc page */
+define('PAGE_NAME', 'squirrelmail_rpc');
+
 //FIXME: If we decide to route ALL requests, even normal page
 //       requests through this file, need to change page requests
 //       to something like this
@@ -51,13 +55,31 @@ require('../include/init.php');
 
 
 
+//FIXME: do we need to put this list somewhere else?
+//FIXME: do we want to use constants instead?  probably not a bad idea, although plugins probably won't, so we still want to try to keep track of the plugin error codes too if possible (new plugin website should help)
+/**
+  * Known core error codes:
+  *
+  * 1    - No RPC action was given in request (please use "rpc_action")
+  * 2    - RPC action was not understood (perhaps a needed plugin is
+  *        not installed and activated?)
+  *
+  * Known plugin error codes:
+  *
+  * 500  - Empty Folders plugin empty_folders_purge_trash action failed
+  * 501  - Empty Folders plugin empty_folders_purge_all action failed
+  * 502  - Empty Folders plugin empty_folders_delete_all action failed
+  *
+  */
+
+
+
 /**
   * Get RPC Action (can be in either GET or POST)
   *
   */
 if (!sqGetGlobalVar('rpc_action', $rpc_action, SQ_FORM)) {
-//FIXME: establish error codes (using 99 in the interim)
-    sm_rpc_return_error(99, _("No RPC action given"));
+    sm_rpc_return_error(1, _("No RPC action given"));
 }
 
 
@@ -92,10 +114,12 @@ $oTemplate->header('Cache-Control: no-cache');
   * in an array in case we can think of more parameters 
   * to add in the future.
   *
+  * Known users of this hook:
+  *    empty_folders
+  *
   */
-$handled_by_plugin = boolean_hook_function('squirrelmail_rpc',
-                                           $temp=array(&$rpc_action),
-                                           1);
+$temp = array(&$rpc_action);
+$handled_by_plugin = boolean_hook_function('squirrelmail_rpc', $temp, 1);
 
 
 
@@ -154,7 +178,7 @@ if (!$handled_by_plugin) switch (strtolower($rpc_action)) {
       *
       */
     default:
-        sm_rpc_return_error(99, _("RPC action not understood"));
+        sm_rpc_return_error(2, _("RPC action not understood"));
         break;
 
 }