Index: wp-includes/class-wp-xmlrpc-server.php
===================================================================
--- wp-includes/class-wp-xmlrpc-server.php	(revision 19751)
+++ 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.newPost'            => 'this:wp_newPost',
 
 			// Blogger API
 			'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs',
@@ -1711,6 +1712,149 @@
 		return $formats;
 	}
 
+	/**
+	 * Create a new post
+	 * 
+	 * Wraps the functionality of wp_insert_post
+	 *
+	 * The 'content_struct' argument the arguments of wp_insert_post with additional the following:
+	 * - sticky
+	 * - custom_fields
+	 * - terms
+	 * - wp_post_format
+	 * - enclosure
+	 *
+	 * @since 3.4
+	 *
+	 * @param array $args Method parameters. Contains:
+	 *  - blog_id
+	 *  - username
+	 *  - password
+	 *  - content_struct
+	 * @return int
+	 */
+	function wp_newPost( $args ) {
+		$this->escape( $args );
+
+		$blog_ID        = (int) $args[0]; // we will support this in the near future
+		$username       = $args[1];
+		$password       = $args[2];
+		$content_struct = $args[3];
+
+		if ( !$user = $this->login($username, $password) )
+			return $this->error;
+
+		$defaults = array( 'post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user->ID,
+			'ping_status' => get_option('default_ping_status'), 'post_parent' => 0,
+			'menu_order' => 0, 'to_ping' =>  '', 'pinged' => '', 'post_password' => '',
+			'guid' => '', 'post_content_filtered' => '', 'post_excerpt' => '',
+			'post_content' => '', 'post_title' => '' );
+
+		$post_data = wp_parse_args( $content_struct, $defaults );
+
+		$post_type = get_post_type_object( $post_data['post_type'] ); 
+		if( ! ( (bool)$post_type ) ) 
+			return new IXR_Error( 403, __( 'Invalid post type' ) ); 
+
+		if( ! current_user_can( $post_type->cap->edit_posts ) ) 
+			return new IXR_Error( 401, __( 'Sorry, you are not allowed to post on this site.' ) ); 
+
+		do_action( 'xmlrpc_call', 'wp.newPost' );
+
+		switch ( $post_data['post_status'] ) { 
+			case 'draft': 
+			case 'pending': 
+				break; 
+			case 'private': 
+				if( ! current_user_can( $post_type->cap->publish_posts ) ) 
+ 					return new IXR_Error( 401, __( 'Sorry, you are not allowed to create private posts in this post type' )); 
+				break; 
+			case 'publish': 
+				if( ! current_user_can( $post_type->cap->publish_posts ) ) 
+					return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts in this post type' )); 
+				break; 
+			default: 
+				$post_data['post_status'] = 'draft';
+			break; 
+		}
+
+		if( !isset( $post_data['ID'] ) || intval( $post_data['ID'] ) == 0 ) {
+			$post_ID = $post_data['ID'] = get_default_post_to_edit( $post_data['post_type'], true )->ID;
+		}
+		else {
+			$post_ID = intval( $post_data['ID'] );
+		}
+
+		if( $post_data['post_type'] == 'post' ) {
+			if( ! current_user_can( $post_type->cap->edit_others_posts ) )
+				return new IXR_Error( 401, __( 'Sorry, you are not allowed to stick this post.' ) );
+
+			$sticky = $post_data['sticky'] ? true : false;
+
+			if( $sticky ) {
+				if( $post_data['post_status'] != 'publish' )
+					return new IXR_Error( 401, __( 'Only published posts can be made sticky.' ));
+				stick_post( $post_ID );
+			}
+			else {
+				unstick_post( $post_ID );
+			}
+		}
+
+		if( isset ( $post_data['custom_fields'] ) && post_type_supports( $post_data['post_type'], 'custom-fields' ) ) {
+			$this->set_custom_fields( $post_ID, $post_data['custom_fields'] );
+		}
+
+		if( isset( $post_data['terms'] ) ) {
+			$post_type_taxonomies = get_object_taxonomies( $post_data['post_type'] );
+			$terms = $post_data['terms'];
+			$taxonomies = array_keys( $terms );
+
+			// validating term ids
+			foreach( $taxonomies as $taxonomy ) {
+				if( ! in_array( $taxonomy , $post_type_taxonomies ) )
+					return new IXR_Error( 401, __( 'Sorry, one of the given taxonomy is not supported by the post type.' ));
+
+				$term_ids = $terms[ $taxonomy ];
+				foreach ( $term_ids as $term_id) {
+					$term = get_term( $term_id, $taxonomy );
+
+					if ( is_wp_error( $term ) )
+						return new IXR_Error( 500, $term->get_error_message() );
+
+					if ( ! $term )
+						return new IXR_Error( 401, __( 'Invalid term ID' ) );
+				}
+			}
+
+			foreach( $taxonomies as $taxonomy ) {
+				$term_ids = $terms[ $taxonomy ];
+				$term_ids = array_map( 'intval', $term_ids );
+				$term_ids = array_unique( $term_ids );
+				wp_set_object_terms( $post_ID , $term_ids, $taxonomy , $append);
+			}
+		}
+
+		if( isset( $post_data['wp_post_format'] ) ) {
+			set_post_format( $post_ID, $post_data['wp_post_format'] );
+		}
+
+		// Handle enclosures
+		$thisEnclosure = isset( $post_data['enclosure'] ) ? $post_data['enclosure'] : null;
+		$this->add_enclosure_if_new( $post_ID, $thisEnclosure );
+		$this->attach_uploads( $post_ID, $post_data['post_content'] );
+
+		$post_ID = wp_insert_post( $post_data, true );
+
+		if ( is_wp_error( $post_ID ) ) 
+			return new IXR_Error( 500, $post_ID->get_error_message() ); 
+
+		if ( ! $post_ID ) 
+			return new IXR_Error( 401, __( 'Sorry, your entry could not be posted. Something wrong happened.' ) ); 
+
+		return $post_ID;
+	}
+
 	/* Blogger API functions.
 	 * specs on http://plant.blogger.com/api and http://groups.yahoo.com/group/bloggerDev/
 	 */
