# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: /var/www/GSoC/wordtrunk/wp-includes
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: class-wp-xmlrpc-server.php
--- class-wp-xmlrpc-server.php Base (BASE)
+++ class-wp-xmlrpc-server.php Locally Modified (Based On LOCAL)
@@ -64,6 +64,7 @@
 			'wp.getMediaItem'		=> 'this:wp_getMediaItem',
 			'wp.getMediaLibrary'	=> 'this:wp_getMediaLibrary',
 			'wp.getPostFormats'     => 'this:wp_getPostFormats',
+                        'wp.deletePost'         => 'this:wp_deletePost',
 
 			// Blogger API
 			'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs',
@@ -1702,6 +1703,60 @@
 		return $formats;
 	}
 
+        /**
+         * Delete a  post
+         *
+         * @uses wp_delete_post()
+         * @param array $args Method parameters. Contains:
+         *  - int     $post_ids
+         *  - string  $username
+         *  - string  $password
+         * @return array post_ids
+         */
+        function wp_deletePost( $args ) {
+
+		$this->escape( $args );
+
+		$post_IDs   = $args[0]; // this could be an array
+		$username   = $args[1];
+		$password   = $args[2];
+
+
+		if ( ! $user = $this->login( $username, $password ) )
+			return $this->error;
+
+                if( ! is_array( $post_IDs ) )
+                    $post_IDs = array( (int)$post_IDs );
+
+                foreach ( $post_IDs as $post_ID ) {
+
+                        $post_ID = (int)$post_ID;
+
+                        $post = wp_get_single_post( $post_ID, ARRAY_A );
+                        if ( empty( $post["ID"] ) )
+                                return new IXR_Error( 404, __( 'One of the post ID is invalid.' ) );
+
+                        $post_type = get_post_type_object( $post['post_type'] );
+                        if( ! current_user_can( $post_type->cap->delete_post, $post_ID ) )
+                                return new IXR_Error( 401, __( 'Sorry, you are not allowed to delete one of the posts.' ));
+                    
+                }
+
+                // this holds all the id of deleted posts and return it
+                $deleted_posts = array();
+
+                foreach( $post_IDs as $post_ID ) {
+
+                        $result = wp_delete_post( $post_ID );
+                        if ( $result )
+                                $deleted_posts[] = $post_ID;
+
+                }
+
+		return $deleted_posts;
+
+        }
+
 	/* Blogger API functions.
 	 * specs on http://plant.blogger.com/api and http://groups.yahoo.com/group/bloggerDev/
 	 */
