Index: modules/content_retriever/content_retriever.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/content_distribution/modules/content_retriever/content_retriever.module,v
retrieving revision 1.1.2.8
diff -u -p -r1.1.2.8 content_retriever.module
--- modules/content_retriever/content_retriever.module	8 Feb 2010 12:19:14 -0000	1.1.2.8
+++ modules/content_retriever/content_retriever.module	8 Feb 2010 22:43:17 -0000
@@ -511,23 +584,30 @@ function _content_retriever_save_file($f
  * 
  * @param $api_key
  * string containing a valid API key for this service
- * 
- * @param $param1 thru $param3
- * various: placeholder vars for passing parameters to the web
+ *
+ * @param ...
+ * Any additional arguments are passed on to the web
  * service methods - can be anything valid for the method call being
- * invoked - empty strings by default 
+ * invoked.
  * 
  * @return
  * array containing results of the call 
  */
-function content_retriever_xmlrpc($endpoint, $method, $api_key, $session_id = '',$param1 = '', $param2 = '', $param3 = '') {
+function content_retriever_xmlrpc($endpoint, $method, $api_key, $session_id = '') {
   //check if HTTP requests are enabled and report error if not
   if (variable_get('drupal_http_request_fails', FALSE) == TRUE) {
     drupal_set_message(t('Drupal is unable to make HTTP requests. Please reset the HTTP request status.'), 'error', FALSE);
     watchdog('integration', 'Drupal is unable to make HTTP requests. Please reset the HTTP request status.', array(), WATCHDOG_CRITICAL);
   }
   else {
+
+    // The system.connect has a special format.
+  	if ($method == 'system.connect') {
+      $result = xmlrpc($endpoint, $method);
+      return $result;
+  	}
   	
+  	//check for an API key - if not supplied, presume not required
   	if ($api_key != '') {
   	  //use api key to get a hash code for the service.
   	  $timestamp = (string) strtotime("now");
@@ -543,125 +623,21 @@ function content_retriever_xmlrpc($endpo
         $method,
       );
       $hash = hash_hmac("sha256", implode(';', $hash_parameters), $api_key);
+      
+      $connection_args = array($endpoint, $method, $hash, $domain, $timestamp, $nonce, $session_id);
   	}  
-  		
-  	switch ($method) {
-  	  case 'system.connect': 	              
-          $result = xmlrpc($endpoint, $method);
-  	  break;
-  	  case 'user.login':
-  	    //check for an API key - if not supplied, presume not required
-        if ($api_key == '') {          
-          $result = xmlrpc($endpoint, $method, $session_id, (string) $param1, (string) $param2);
-        }
-        else {
-          $result = xmlrpc($endpoint, $method, $hash, $domain, $timestamp, $nonce, $session_id, (string) $param1, (string) $param2);
-        }
-  	  break;
-  	  case 'user.logout':
-  	    //check for an API key - if not supplied, presume not required
-        if ($api_key == '') {          
-          $result = xmlrpc($endpoint, $method, $session_id);
-        }
-        else {
-          $result = xmlrpc($endpoint, $method, $hash, $domain, $timestamp, $nonce, $session_id);
-        }
-  	  break;
-  	  case 'views.get':
-  	    //check for an API key - if not supplied, presume not required
-        if ($api_key == '') {
-          $result = xmlrpc($endpoint, $method, $session_id, 
-            (string) $param1, // $param1 is view name
-            'default',        // 'default' is display_id parameter hardcoded to default. 
-            (array) $param2,  // $param2 is array of view arguments
-            0, // offset
-            0  // limit
-            // format_output which we're not passing at all.
-          );
-        }
-        else {
-          //var_dump($endpoint, $method, $hash, $domain, $timestamp, $nonce, $session_id, $param1, $param2);
-          $result = xmlrpc($endpoint, $method, $hash, $domain, $timestamp, $nonce, $session_id, 
-            (string) $param1, // $param1 is view name
-            'default',        // 'default' is display_id parameter hardcoded to default. 
-            (array) $param2,  // $param2 is array of view arguments
-            0, // offset
-            0  // limit
-            // format_output which we're not passing at all.
-          );
-        }
-  	  break;
-  	  
-  	  case 'file.getNodeFiles':
-  	    //check for an API key - if not supplied, presume not required
-        if ($api_key == '') {
-          //$param1 is nid
-          $result = xmlrpc($endpoint, $method, $session_id, (int) $param1);
-        }
-        else {
-          $result = xmlrpc($endpoint, $method, $hash, $domain, $timestamp, $nonce, $session_id, (int) $param1);
-        }
-  	  break;
-  	  
-  	  case 'file.get':
-  	    //check for an API key - if not supplied, presume not required
-        if ($api_key == '') {
-          //$param1 is fid
-          $result = xmlrpc($endpoint, $method, $session_id, (int) $param1);
-        }
-        else {
-          $result = xmlrpc($endpoint, $method, $hash, $domain, $timestamp, $nonce, $session_id, (int) $param1);
-        }
-  	  break;
-  	  
-  	  case 'nodequeue.getQueues':
-  	    //check for an API key - if not supplied, presume not required
-        if ($api_key == '') {
-          $result = xmlrpc($endpoint, $method, $session_id);
-        }
-        else {
-          $result = xmlrpc($endpoint, $method, $hash, $domain, $timestamp, $nonce, $session_id);
-        }
-  	  break;
-  	  
-  	  case 'node.get':
-  	    //check for an API key - if not supplied, presume not required
-        if ($api_key == '') {
-          //$param1 is nid, $param2 is array of cck field names
-          $result = xmlrpc($endpoint, $method, $session_id, (int) $param1, (array) $param2);
-        }
-        else {
-          $result = xmlrpc($endpoint, $method, $hash, $domain, $timestamp, $nonce, $session_id, (int) $param1, (array) $param2);
-        }
-  	  break;
-  	  
-  	  case 'image.getNodeImages':
-  	    //check for an API key - if not supplied, presume not required
-        if ($api_key == '') {
-          //$param1 is nid
-          $result = xmlrpc($endpoint, $method, $session_id, (int) $param1);
-        }
-        else {
-          $result = xmlrpc($endpoint, $method, $hash, $domain, $timestamp, $nonce, $session_id, (int) $param1);
-        }
-  	  break;
-  	  
-  	  case 'node.getAllTypes':
-  	    //check for an API key - if not supplied, presume not required
-        if ($api_key == '') {
-          //$param1 is nid
-          $result = xmlrpc($endpoint, $method, $session_id);
-        }
-        else {
-          $result = xmlrpc($endpoint, $method, $hash, $domain, $timestamp, $nonce, $session_id);
-        }
-  	  break;
-  	  
-  	  default:
-  	    $result = array();
-  	    watchdog('integration', 'Unknown method call attempted.', array(), WATCHDOG_NOTICE);
-  	  break;
+  	else {
+  	  $connection_args = array($endpoint, $method, $session_id);
   	}
+  	
+  	// Get all the arguments this function has been passed.
+  	$xmlrpc_args = func_get_args();
+  	// Splice in the connection arguments.
+  	array_splice($xmlrpc_args, 0, 4, $connection_args);
+  	
+  	// Call the xmlrpc.
+  	$result = call_user_func_array('xmlrpc', $xmlrpc_args);
+  	
     return $result;
   }
 }
