smf/smfservermodule/smfserver/smfplugins/smfpostproviderplugin.h
changeset 10 1d94eb8df9c2
parent 9 b85b0c039c14
equal deleted inserted replaced
9:b85b0c039c14 10:1d94eb8df9c2
     1 /**
       
     2  * Copyright (c) 2010 Sasken Communication Technologies Ltd.
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of the "Eclipse Public License v1.0" 
       
     6  * which accompanies  this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html"
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
       
    11  *
       
    12  * Contributors:
       
    13  * Manasij Roy, Nalina Hariharan
       
    14  * 
       
    15  * Description:
       
    16  * Interface specification for getting/posting updates to a social site
       
    17  *
       
    18  */
       
    19 
       
    20 
       
    21 #ifndef SMFPOSTPROVIDERPLUGIN_H_
       
    22 #define SMFPOSTPROVIDERPLUGIN_H_
       
    23 
       
    24 #include <smfpluginbase.h>
       
    25 #include <smfcontact.h>
       
    26 #include <smfpost.h>
       
    27 #include <smflocation.h>
       
    28 
       
    29 //TODO:- Moved to SmfPost as it should b common betn client n plugin
       
    30 ///**
       
    31 // * SmfPresenceInfo.
       
    32 // * Indicates the presence information of user like Online, Offline, Busy, 
       
    33 // * Do no disturb, Appear Offline etc.
       
    34 // */
       
    35 //enum SmfPresenceInfo
       
    36 //	{
       
    37 //	  ENotSupported,
       
    38 //	  EOnline,
       
    39 //	  EOffline,
       
    40 //	  EBusy,
       
    41 //	  EDoNotDisturb,
       
    42 //	  EAppearOffline,
       
    43 //	  EOther
       
    44 //	};
       
    45 
       
    46 /**
       
    47  * @ingroup smf_plugin_group
       
    48  * Interface to get/update the posts to a service provider. This class
       
    49  * provides basic functionality to allow applications to obtain list of
       
    50  * posts, updates posts or change the presence information to a social 
       
    51  * networking service.
       
    52  *
       
    53  * All of the functionality described here should be implemented by a service
       
    54  * specific plug-in.
       
    55  */
       
    56 class SmfPostProviderPlugin : public SmfPluginBase
       
    57 	{
       
    58 public:
       
    59 	
       
    60 	/**
       
    61 	 * Destructor
       
    62 	 */
       
    63 	virtual ~SmfPostProviderPlugin( ) {}
       
    64 	
       
    65 	/**
       
    66 	 * Method that returns maximum no of chars (unicode) that service 
       
    67 	 * provider can post without truncation. Negative value means 
       
    68 	 * no limit
       
    69 	 * @return Max characters that can be posted without truncation
       
    70 	 */
       
    71 	virtual qint32 maxCharsInPost( ) const = 0;
       
    72 	/**
       
    73 	 * Method that returns maximum no of items that can be returned 
       
    74 	 * in a single query to getPosts. Negative value means feature 
       
    75 	 * not supported.
       
    76 	 * @return Max items that can be returned in a single query
       
    77 	 */
       
    78 	virtual qint32 maxItems( ) const = 0;
       
    79 
       
    80 	/**
       
    81 	 * <Method that returns all the formatting of posts that this 
       
    82 	 * service provider supports. May return 0 items to mean 
       
    83 	 * only QString is supported.
       
    84 	 * @return Supported formats of posts
       
    85 	 */
       
    86 	virtual QVector<QTextFormat> supportedFormats ( ) const = 0;
       
    87 	
       
    88 	/**
       
    89 	 * Method that returns whether this SP supports Appearence
       
    90 	 * @return Returns true if Appearance is supported, else false. 
       
    91 	 * @see SmfAppearenceInfo
       
    92 	 */
       
    93 	virtual bool supportsAppearence ( ) const = 0;
       
    94 	
       
    95 	/**
       
    96 	 * Method to get the latest posts
       
    97 	 * @param aRequest [out] The request data to be sent to network
       
    98 	 * @param aUser The user's contact in this SP, omit for self contact
       
    99 	 * @param aPageNum The page to be extracted
       
   100 	 * @param aItemsPerPage Number of items per page
       
   101 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
       
   102 	 */
       
   103 	virtual SmfPluginError retrieve( SmfPluginRequestData &aRequest,
       
   104 			const SmfContact *aUser=0,
       
   105 			const int aPageNum = SMF_FIRST_PAGE, 
       
   106 			const int aItemsPerPage = SMF_ITEMS_PER_PAGE ) = 0;
       
   107 
       
   108 	
       
   109 	/**
       
   110 	 * Method to update a post to own area.
       
   111 	 * @param aRequest [out] The request data to be sent to network
       
   112 	 * @param aPostData The post data to be posted
       
   113 	 * @param aLocation The location
       
   114 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
       
   115 	 */
       
   116 	virtual SmfPluginError post( SmfPluginRequestData &aRequest,
       
   117 			const SmfPost &aPostData, 
       
   118 			const SmfLocation &aLocation ) = 0;
       
   119 	
       
   120 	/**
       
   121 	 * Method to update the last post to own area with new data
       
   122 	 * @param aRequest [out] The request data to be sent to network
       
   123 	 * @param aPostData The edited/new data to be posted
       
   124 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
       
   125 	 */
       
   126 	virtual SmfPluginError updatePost( SmfPluginRequestData &aRequest,
       
   127 			const SmfPost &aPostData ) = 0;
       
   128 	
       
   129 	/**
       
   130 	 * Method to update a post to a particular contact
       
   131 	 * @param aRequest [out] The request data to be sent to network
       
   132 	 * @param aPostData The post data to be posted
       
   133 	 * @param aContact The contact where the data has to be posted
       
   134 	 * @param aLocation The location
       
   135 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
       
   136 	 */
       
   137 	virtual SmfPluginError postDirected( SmfPluginRequestData &aRequest,
       
   138 			const SmfPost &aPostData, 
       
   139 			const SmfContact &aContact, 
       
   140 			const SmfLocation *aLocation = NULL ) = 0;
       
   141 	
       
   142 	
       
   143 	/**
       
   144 	 * Method to post a comment on a post.
       
   145 	 * @param aRequest [out] The request data to be sent to network
       
   146 	 * @param aTarget Post on which comment has to be posted
       
   147 	 * @param aComment comment to be posted
       
   148 	 * @param aLocation location data
       
   149 	 */
       
   150 	virtual SmfPluginError commentOnAPost(SmfPluginRequestData &aRequest,
       
   151 			const SmfPost &aTarget,
       
   152 			const SmfPost &aComment, 
       
   153 			const SmfLocation *aLocation = NULL) = 0;
       
   154 	
       
   155 	/**
       
   156 	 * Method to update the presence information of the user
       
   157 	 * @param aRequest [out] The request data to be sent to network
       
   158 	 * @param aAppearence The appearence information
       
   159 	 * @param aStatus The status string
       
   160 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
       
   161 	 */
       
   162 	virtual SmfPluginError postAppearence( SmfPluginRequestData &aRequest,  
       
   163 			const SmfPresenceInfo &aAppearence,
       
   164 			const QString &aStatus ) = 0;
       
   165 	
       
   166 	/**
       
   167 	 * Share /a contact's post to user's friends and followers
       
   168 	 * (e.g. retweet in twitter, share on facebook)
       
   169 	 * @param aRequest [out] The request data to be sent to network
       
   170 	 * @param aPostData data to be posted
       
   171 	 * @param aContact contact to which the post belonged
       
   172 	 * @param aEdited whether user changed items within the post
       
   173 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
       
   174 	 */
       
   175 	virtual SmfPluginError sharePost( SmfPluginRequestData &aRequest, 
       
   176 			const SmfPost &aPostData, 
       
   177 			const SmfContact &aContact, 
       
   178 			const bool &aEdited) = 0;
       
   179 	
       
   180 	/**
       
   181 	 * Customised method for SmfPostProviderPlugin interface
       
   182 	 * @param aRequest [out] The request data to be sent to network
       
   183 	 * @param aOperation The operation type (should be known between 
       
   184 	 * the client interface and the plugin)
       
   185 	 * @param aData The data required to form the request (The type 
       
   186 	 * of data should be known between client and the plugin)
       
   187 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
       
   188 	 */
       
   189 	virtual SmfPluginError customRequest( SmfPluginRequestData &aRequest, 
       
   190 			const int &aOperation, QByteArray *aData ) = 0;
       
   191 
       
   192 	
       
   193 	};
       
   194 
       
   195 Q_DECLARE_INTERFACE( SmfPostProviderPlugin, "org.symbian.smf.plugin.contact.posts/v1.0" );
       
   196 
       
   197 #endif /* SMFPOSTPROVIDERPLUGIN_H_ */