example/clientapi/smf/inc/smfplugins/smfcontacts/smfpostproviderplugin.h
changeset 2 86af6c333601
parent 1 4b1e636e8a71
--- a/example/clientapi/smf/inc/smfplugins/smfcontacts/smfpostproviderplugin.h	Thu Mar 25 14:44:08 2010 +0530
+++ b/example/clientapi/smf/inc/smfplugins/smfcontacts/smfpostproviderplugin.h	Tue Apr 06 16:35:37 2010 +0530
@@ -8,9 +8,9 @@
  * Copyright (c) 2010 Sasken Communication Technologies Ltd. 
  * All rights reserved.
  * This component and the accompanying materials are made available 
- * under the terms of the "{License}" 
+ * under the terms of the "Eclipse Public License v1.0"
  * which accompanies  this distribution, and is available 
- * at the URL "{LicenseUrl}".
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html"
  * 
  * @section DESCRIPTION
  *
@@ -20,11 +20,10 @@
 #ifndef SMFPOSTPROVIDERPLUGIN_H_
 #define SMFPOSTPROVIDERPLUGIN_H_
 
-#include <smfproviderbase.h>
+#include <smfpluginbase.h>
 #include <smfcontact.h>
 #include <smfpost.h>
-#include <smfstatusdata.h>
-
+#include <smfplace.h>
 
 /**
  * SmfPresenceInfo.
@@ -43,6 +42,7 @@
 	};
 
 /**
+ * @ingroup smf_plugin_group
  * Interface to get/update the posts to a service provider. This class
  * provides basic functionality to allow applications to obtain list of
  * posts, updates posts or change the presence information to a social 
@@ -51,7 +51,7 @@
  * All of the functionality described here should be implemented by a service
  * specific plug-in.
  */
-class SmfPostProviderPlugin : public QObject
+class SmfPostProviderPlugin : public SmfPluginBase
 	{
 	Q_OBJECT
 public:
@@ -67,76 +67,120 @@
 	~SmfPostProviderPlugin( );
 	
 	/**
-	 * Method to get the provider information
-	 * @return Instance of SmfProviderBase
+	 * Method that returns maximum no of chars (unicode) that service 
+	 * provider can post without truncation. Negative value means 
+	 * no limit
+	 * @return Max characters that can be posted without truncation
+	 */
+	virtual qint32 maxCharsInPost( ) const = 0;
+	/**
+	 * Method that returns maximum no of items that can be returned 
+	 * in a single query to getPosts. Negative value means feature 
+	 * not supported.
+	 * @return Max items that can be returned in a single query
 	 */
-	virtual SmfProviderBase* getProviderInfo( ) = 0;
+	virtual qint32 maxItems( ) const = 0;
+
+	/**
+	 * <Method that returns all the formatting of posts that this 
+	 * service provider supports. May return 0 items to mean 
+	 * only QString is supported.
+	 * @return Supported formats of posts
+	 */
+	virtual QVector<QTextFormat> supportedFormats ( ) const = 0;
+	
+	/**
+	 * Method that returns whether this SP supports Appearence
+	 * @return Returns true if Appearance is supported, else false. 
+	 * @see SmfAppearenceInfo
+	 */
+	virtual bool supportsAppearence ( ) const = 0;
 	
 	/**
 	 * Method to get the latest posts
-	 * @param aStatusData
 	 * @param aRequest [out] The request data to be sent to network
+	 * @param aUser The user's contact in this SP, omit for self contact
 	 * @param aPageNum The page to be extracted
 	 * @param aItemsPerPage Number of items per page
 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
 	 */
-	virtual SmfPluginError getPosts( const SmfStatusData aStatusData,
-			SmfPluginRequestData *aRequest,
-			const int aPageNum = 0, 
-			const int aItemsPerPage = 10 ) = 0;
+	virtual SmfPluginError retrieve( SmfPluginRequestData *aRequest,
+			const SmfContact* aUser = 0,
+			const int aPageNum = SMF_FIRST_PAGE, 
+			const int aItemsPerPage = SMF_ITEMS_PER_PAGE ) = 0;
 
+	
 	/**
-	 * Method to update a post
+	 * Method to update a post to own area.
+	 * @param aRequest [out] The request data to be sent to network
 	 * @param aPostData The post data to be posted
 	 * @param aLocation The location
-	 * @param aRequest [out] The request data to be sent to network
 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
 	 */
-	virtual SmfPluginError updatePost( const SmfPost aPostData, 
-			const QtMobility::QContactGeolocation aLocation,
-			SmfPluginRequestData *aRequest ) = 0;
+	virtual SmfPluginError post( SmfPluginRequestData *aRequest,
+			const SmfPost aPostData, 
+			const SmfPlace aLocation ) = 0;
+	
+	/**
+	 * Method to update the last post to own area with new data
+	 * @param aRequest [out] The request data to be sent to network
+	 * @param aPostData The edited/new data to be posted
+	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+	 */
+	virtual SmfPluginError updatePost( SmfPluginRequestData *aRequest,
+			const SmfPost aPostData ) = 0;
 	
 	/**
 	 * Method to update a post to a particular contact
+	 * @param aRequest [out] The request data to be sent to network
 	 * @param aPostData The post data to be posted
 	 * @param aContact The contact where the data has to be posted
 	 * @param aLocation The location
-	 * @param aRequest [out] The request data to be sent to network
 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
 	 */
-	virtual SmfPluginError updatePostDirected( const SmfPost aPostData, 
+	virtual SmfPluginError postDirected( SmfPluginRequestData *aRequest,
+			const SmfPost aPostData, 
 			const SmfContact aContact, 
-			const QtMobility::QContactGeolocation aLocation,
-			SmfPluginRequestData *aRequest ) = 0;
+			const SmfPlace aLocation = NULL ) = 0;
+	
+	
 	/**
-	 * Method to update the presence information of the user
-	 * @param aAppearence The appearence information
+	 * Method to post a comment on a post.
 	 * @param aRequest [out] The request data to be sent to network
-	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+	 * @param aTarget Post on which comment has to be posted
+	 * @param aComment comment to be posted
+	 * @param aLocation location data
 	 */
-	virtual SmfPluginError postAppearence( const SmfPresenceInfo aAppearence,
-			SmfPluginRequestData *aRequest ) = 0;
+	virtual SmfPluginError commentOnAPost(SmfPluginRequestData *aRequest,
+			const SmfPost& aTarget,
+			const SmfPost& aComment, 
+			const SmfPlace* aLocation = NULL);
 	
 	/**
-	 * Method to get the result for a network request.
-	 * @param aTransportResult The result of transport operation
-	 * @param aReply The QNetworkReply instance for the request
-	 * @param aResult [out] An output parameter to the plugin manager.If the 
-	 * return value is SmfSendRequestAgain, QVariant will be of type 
-	 * SmfPluginRequestData. 
-	 * If last operation was getPosts(), aResult will be of type QList<SmfPost>
-	 * If last operation was updatePost() or updatePostDirected() or 
-	 * postAppearence, aResult will be of type bool
-	 * @param aRetType [out] SmfPluginRetType
-	 * @param aIsLastPage [out] true if this the last page, else false
-	 * @return SmfPluginError 
+	 * Method to update the presence information of the user
+	 * @param aRequest [out] The request data to be sent to network
+	 * @param aAppearence The appearence information
+	 * @param aStatus The status string
+	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
 	 */
-	virtual SmfPluginError responseAvailable( 
-			const SmfTransportResult aTransportResult, 
-			QNetworkReply *aReply, 
-			QVariant* aResult, 
-			SmfPluginRetType aRetType,
-			bool aIsLastPage) = 0;
+	virtual SmfPluginError postAppearence( SmfPluginRequestData *aRequest,  
+			const SmfPresenceInfo aAppearence,
+			const QString aStatus ) = 0;
+	
+	/**
+	 * Share /a contact's post to user's friends and followers
+	 * (e.g. retweet in twitter, share on facebook)
+	 * @param aRequest [out] The request data to be sent to network
+	 * @param aPostData data to be posted
+	 * @param aContact contact to which the post belonged
+	 * @param aEdited whether user changed items within the post
+	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+	 */
+	virtual SmfPluginError sharePost( SmfPluginRequestData *aRequest, 
+			const SmfPost& aPostData, 
+			const SmfContact& aContact, 
+			const bool aEdited);
+
 	
 	};