Index: wp-includes/class-wp-xmlrpc-server.php
===================================================================
--- wp-includes/class-wp-xmlrpc-server.php	(revision 19640)
+++ wp-includes/class-wp-xmlrpc-server.php	(working copy)
@@ -64,6 +64,7 @@
 			'wp.getMediaItem'		=> 'this:wp_getMediaItem',
 			'wp.getMediaLibrary'	=> 'this:wp_getMediaLibrary',
 			'wp.getPostFormats'     => 'this:wp_getPostFormats',
+			'wp.getPost'			=> 'this:wp_getPost',
 
 			// Blogger API
 			'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs',
@@ -1702,6 +1703,183 @@
 		return $formats;
 	}
 
+	/**
+	 * Prepares term data for return in an XML-RPC object
+	 *
+	 * @param array $term The unprepared term data
+	 * @return array The prepared term data
+	 */
+	function prepare_term( $term ) {
+		$_term = (array) $term;
+
+		return apply_filters( 'xmlrpc_prepare_term', $_term, $term );
+	}
+
+	function prepare_post( $post, $fields ) {
+		// holds the data for this post. built up based on $fields
+		$_post = array( 'post_id' => $post['ID'] );
+
+		// prepare common post fields
+		$post_fields = array(
+			'post_title' => $post['post_title'],
+			'post_date' => new IXR_Date(mysql2date( 'Ymd\TH:i:s', $post['post_date'], false )),
+			'post_date_gmt' => new IXR_Date(mysql2date( 'Ymd\TH:i:s', $post['post_date_gmt'], false )),
+			'post_modified' => new IXR_Date(mysql2date( 'Ymd\TH:i:s', $post['post_modified'], false )),
+			'post_modified_gmt' => new IXR_Date(mysql2date( 'Ymd\TH:i:s', $post['post_modified_gmt'], false )),
+			'post_status' => $post['post_status'],
+			'post_type' => $post['post_type'],
+			'post_slug' => $post['post_name'],
+			'post_author' => $post['post_author'],
+			'post_password' => $post['post_password'],
+			'post_excerpt' => $post['post_excerpt'],
+			'post_content' => $post['post_content'],
+			'link' => post_permalink( $post['ID'] ),
+			'comment_status' => $post['comment_status'],
+			'ping_status' => $post['ping_status'],
+			'sticky' => ($post['post_type'] === 'post' && is_sticky( $post['ID'] ) ),
+		);
+
+		// Consider future posts as published
+		if ( $post_fields['post_status'] === 'future' )
+			$post_fields['post_status'] = 'publish';
+
+		// Fill in blank post format
+		$post_fields['post_format'] = get_post_format( $post['ID'] );
+		if ( empty( $post_fields['post_format'] ) )
+			$post_fields['post_format'] = 'standard';
+
+		// Merge requested $post_fields fields into $_post
+		if ( in_array( 'post', $fields ) ) {
+			$_post = array_merge( $_post, $post_fields );
+		} else {
+			$requested_fields = array_intersect_key( $post_fields, array_flip( $fields ) );
+			$_post = array_merge( $_post, $requested_fields );
+		}
+
+		$all_taxonomy_fields = in_array( 'taxonomies', $fields );
+
+		if ( $all_taxonomy_fields || in_array( 'terms', $fields ) ) {
+			$post_type_taxonomies = get_object_taxonomies( $post['post_type'] , 'names' );
+			$terms = wp_get_object_terms( $post['ID'], $post_type_taxonomies );
+			$_post['terms'] = array();
+			foreach ( $terms as $term ) {
+				$_post['terms'][] = $this->prepare_term( $term );
+			}
+		}
+
+		// backward compatiblity
+		if ( $all_taxonomy_fields || in_array( 'tags', $fields ) ) {
+			$tagnames = array();
+			$tags = wp_get_post_tags( $post['ID'] );
+			if ( !empty( $tags ) ) {
+				foreach ( $tags as $tag )
+					$tagnames[] = $tag->name;
+				$tagnames = implode( ', ', $tagnames );
+			} else {
+				$tagnames = '';
+			}
+			$_post['tags'] = $tagnames;
+		}
+
+		// backward compatiblity
+		if ( $all_taxonomy_fields || in_array( 'categories', $fields ) ) {
+			$categories = array();
+			$catids = wp_get_post_categories( $post['ID'] );
+			foreach($catids as $catid) {
+				$categories[] = get_cat_name($catid);
+			}
+			$_post['categories'] = $categories;
+		}
+
+		if ( in_array( 'custom_fields', $fields ) )
+			$_post['custom_fields'] = $this->get_custom_fields( $post['ID'] );
+
+		if ( in_array( 'enclosure', $fields ) ) {
+			$_post['enclosure'] = array();
+			$enclosures = (array) get_post_meta( $post['ID'], 'enclosure' );
+			if ( ! empty ( $enclosures ) ) {
+				$encdata = explode("\n", $enclosures[0]);
+				$_post['enclosure']['url'] = trim(htmlspecialchars($encdata[0]));
+				$_post['enclosure']['length'] = (int) trim($encdata[1]);
+				$_post['enclosure']['type'] = trim($encdata[2]);
+			}
+		}
+
+		return apply_filters( 'xmlrpc_prepare_post', $_post, $post, $fields );
+	}
+
+	/**
+	 * Retrieve a post.
+	 *
+	 * The optional $fields parameter specifies what fields will be included
+	 * in the response array. This should be a list of field names. 'post_id' will
+	 * always be included in the response regardless of the value of $fields.
+	 *
+	 * Instead of, or in addition to, individual field names, conceptual group
+	 * names can be used to specify multiple fields. The available conceptual
+	 * groups are 'post' (all basic fields), 'taxonomies', 'custom_fields',
+	 * and 'enclosure'.
+	 *
+	 * @uses wp_get_single_post()
+	 * @param array $args Method parameters. Contains:
+	 *  - int     $post_id
+	 *  - string  $username
+	 *  - string  $password
+	 *  - array   $fields optional
+	 * @return array contains (based on $fields parameter):
+	 *  - 'post_id'
+	 *  - 'post_title'
+	 *  - 'post_date'
+	 *  - 'post_date_gmt'
+	 *  - 'post_modified'
+	 *  - 'post_modified_gmt'
+	 *  - 'post_status'
+	 *  - 'post_type'
+	 *  - 'post_slug'
+	 *  - 'post_author'
+	 *  - 'post_password'
+	 *  - 'post_excerpt'
+	 *  - 'post_content'
+	 *  - 'link'
+	 *  - 'comment_status'
+	 *  - 'ping_status'
+	 *  - 'sticky'
+	 *  - 'custom_fields'
+	 *  - 'terms'
+	 *  - 'categories'
+	 *  - 'tags'
+	 *  - 'enclosure'
+	 */
+	function wp_getPost( $args ) {
+		$this->escape( $args );
+
+		$blog_id            = (int) $args[0];
+		$username           = $args[1];
+		$password           = $args[2];
+		$post_id            = (int) $args[3];
+
+		if ( isset( $args[4] ) )
+			$fields = $args[4];
+		else
+			$fields = apply_filters( 'xmlrpc_default_post_fields', array( 'post', 'terms', 'custom_fields' ), 'wp.getPost' );
+
+		if ( ! $user = $this->login( $username, $password ) )
+			return $this->error;
+
+		do_action( 'xmlrpc_call', 'wp.getPost' );
+
+		$post = wp_get_single_post( $post_id, ARRAY_A );
+
+		if ( empty( $post["ID"] ) )
+			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
+
+		$post_type = get_post_type_object( $post['post_type'] );
+		if( ! current_user_can( $post_type->cap->edit_posts, $post_id ) )
+			return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ));
+
+		return $this->prepare_post( $post, $fields );
+	}
+
 	/* Blogger API functions.
 	 * specs on http://plant.blogger.com/api and http://groups.yahoo.com/group/bloggerDev/
 	 */
