Index: xmlrpc_example/xmlrpc_example.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/examples/xmlrpc_example/xmlrpc_example.module,v
retrieving revision 1.3
diff -u -p -r1.3 xmlrpc_example.module
--- xmlrpc_example/xmlrpc_example.module	10 Feb 2010 23:57:51 -0000	1.3
+++ xmlrpc_example/xmlrpc_example.module	27 Aug 2010 09:03:03 -0000
@@ -13,6 +13,7 @@
  * is probably the more common way to do XMLRPC at this time.
  *
  * @see hook_xmlrpc()
+ * @see hook_xmlrpc_alter()
  * @see xmlrpc()
  * @see xmlrpc_errno()
  * @see xmlrpc_error_msg()
@@ -85,6 +85,36 @@ function _xmlrpc_example_subtract($num1,
   }
 }
 
+/**
+ * Implements hook_xmlrpc_alter() to add a method after the fact.
+ *
+ * This is what you would use to modify the information for a method provided
+ * by another module, like changing its callback or even hiding it for security
+ * reasons. In this example, we are using it to add a second method to our own
+ * module and remove the "bad" method.
+ *
+ * @see hook_xmlrpc_alter()
+ */
+function xmlrpc_example_xmlrpc_alter(&$methods) {
+  // First, locate the "bad" method and remove it from the list of methods
+  $offset = -1;
+  foreach ($methods as $index => $method) {
+    if ($method[0] === 'xmlrpc_example.bad') {
+      $offset = $index;
+    }
+  }
+  if ($offset != -1) {
+    unset($methods[$offset]);
+  }
+
+  // Second, add a new method in the xmlrpc_example package
+  $methods[] =  array(
+    'xmlrpc_example.subtract',
+    '_xmlrpc_example_subtract',
+    array('int', 'int', 'int'),
+    t('Return difference of the two arguments. Provided by the hook_xmlrpc_alter() implementation.')
+  );
+}
 
 // Now begins the client/UI portion of the module.
 /**
