Index: wp-includes/class-wp-xmlrpc-server.php
===================================================================
--- wp-includes/class-wp-xmlrpc-server.php	(revision 18772)
+++ wp-includes/class-wp-xmlrpc-server.php	(working copy)
@@ -63,7 +63,8 @@
 			'wp.getCommentStatusList' => 'this:wp_getCommentStatusList',
 			'wp.getMediaItem'		=> 'this:wp_getMediaItem',
 			'wp.getMediaLibrary'	=> 'this:wp_getMediaLibrary',
-			'wp.getPostFormats'     => 'this:wp_getPostFormats',
+			'wp.getPostFormats'		=> 'this:wp_getPostFormats',
+			'wp.getPosts'			=> 'this:wp_getPosts',
 
 			// Blogger API
 			'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs',
@@ -1702,6 +1703,171 @@
 		return $formats;
 	}
 
+	/**
+	  * Retrieves posts
+	  *
+	  * @since 3.3
+	  *
+	  * @uses wp_get_recent_posts()
+	  * @param array $args Method parameters. Contains:
+	  *  - int     $blog_id
+	  *  - string  $username
+	  *  - string  $password
+	  *  - array   $filter optional
+	  * @return array
+	  */
+	function wp_getPosts( $args ) {
+		$this->escape( $args );
+
+		$blog_ID    = (int) $args[0];
+		$username   = $args[1];
+		$password   = $args[2];
+		$filter     = $args[3];
+
+		if ( !$user = $this->login( $username, $password ) )
+			return $this->error;
+
+		$query = array();
+
+		if ( isset( $filter['post_type'] ) ) {
+			$post_type = get_post_type_object( $filter['post_type'] );
+			if( !( (bool)$post_type ) )
+					return new IXR_Error( 403, __( 'The post type specified is not valid' ) );
+
+			if( ! current_user_can( $post_type->cap->edit_posts ) )
+				return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts in this post type' ));
+			$query['post_type'] = $filter['post_type'];
+		}
+
+		if ( isset ( $filter['numberposts'] ) ) {
+			$query['numberposts'] = absint( $filter['numberposts'] );
+
+			if ( isset ( $filter['offset'] ) ) {
+				$query['offset'] = absint( $filter['offset'] );
+			}
+		}
+
+		do_action('xmlrpc_call', 'wp.getPosts');
+
+		$posts_list = wp_get_recent_posts( $query );
+
+		if ( !$posts_list )
+			return array( );
+
+		// holds all the post data
+		$struct = array();
+
+		foreach ( $posts_list as $post ) {
+
+			$post_type = get_post_type_object( $post['post_type'] );
+			if( !current_user_can( $post_type->cap->edit_posts ) )
+				continue;
+
+			$post_date = mysql2date( 'Ymd\TH:i:s', $post['post_date'], false );
+			$post_date_gmt = mysql2date( 'Ymd\TH:i:s', $post['post_date_gmt'], false );
+
+			// For drafts use the GMT version of the post date
+			if ( $post['post_status'] == 'draft' )
+				$post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $post['post_date'] ), 'Ymd\TH:i:s' );
+
+			$post_content = get_extended( $post['post_content'] );
+			$link = post_permalink( $post['ID'] );
+
+			// Consider future posts as published
+			if ( $post['post_status'] === 'future' )
+				$post['post_status'] = 'publish';
+
+			// Get post format
+			$post_format = get_post_format( $post['ID'] );
+			if ( empty( $post_format ) )
+				$post_format = 'standard';
+
+			$sticky = null;
+			if( $post['post_type'] == 'post' ) {
+				$sticky = false;
+				if ( is_sticky( $post['ID'] ) )
+					$sticky = true;
+			}
+
+			$post_type_taxonomies = get_object_taxonomies( $post['post_type'] , 'names');
+			$terms = wp_get_object_terms( $post['ID'], $post_type_taxonomies );
+
+			$enclosure = array();
+			foreach ( (array) get_post_custom( $post['ID'] ) as $key => $val) {
+				if ($key == 'enclosure') {
+					foreach ( (array) $val as $enc ) {
+						$encdata = split("\n", $enc);
+						$enclosure['url'] = trim(htmlspecialchars($encdata[0]));
+						$enclosure['length'] = (int) trim($encdata[1]);
+						$enclosure['type'] = trim($encdata[2]);
+						break 2;
+					}
+				}
+			}
+
+			// backward compatiblity
+			$categories = array();
+			$catids = wp_get_post_categories( $post['ID'] );
+			foreach($catids as $catid) {
+				$categories[] = get_cat_name($catid);
+			}
+
+			$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_data = array(
+				'postid'			=> $post['ID'],
+				'title'				=> $post['post_title'],
+				'description'		=> $post_content['main'],
+				'mt_excerpt'		=> $post['post_excerpt'],
+
+				'post_status'		=> $post['post_status'],
+				'post_type'			=> $post['post_type'],
+				'wp_slug'			=> $post['post_name'],
+				'wp_password'		=> $post['post_password'],
+
+				'wp_page_order'		=> $post['menu_order'],
+				'wp_page_parent_id'	=> $post['post_parent'],
+
+				'wp_author_id'		=> $post['post_author'],
+
+				'mt_allow_comments'	=> $post['comment_status'],
+				'mt_allow_pings'	=> $post['ping_status'],
+
+				'dateCreated'		=> new IXR_Date($post_date),
+				'date_created_gmt'	=> new IXR_Date($post_date_gmt),
+
+				'userid'			=> $post['post_author'],
+				'sticky'			=> $sticky,
+				'custom_fields'		=> $this->get_custom_fields( $post['ID'] ),
+				'terms'				=> $terms,
+
+				'link'				=> $link,
+				'permaLink'			=> $link,
+
+				// backward compatibility
+				'categories'		=> $categories,
+				'mt_keywords'		=> $tagnames,
+				'wp_post_format'	=> $post_format,
+			);
+
+			if ( ! empty( $enclosure ) )
+				$post_data['enclosure'] = $enclosure;
+
+			$struct[] = $post_data;
+
+		}
+
+		return $struct;
+	}
+
 	/* Blogger API functions.
 	 * specs on http://plant.blogger.com/api and http://groups.yahoo.com/group/bloggerDev/
 	 */
