smf/inc/smfplugins/smfcontacts/smfpostproviderplugin.h
changeset 7 be09cf1f39dd
parent 6 c39a6cfd1fb9
child 8 4102c67b6e56
equal deleted inserted replaced
6:c39a6cfd1fb9 7:be09cf1f39dd
     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 <smfplace.h>
       
    28 
       
    29 // Forward declaration
       
    30 class SmfPluginUtil;
       
    31 
       
    32 /**
       
    33  * SmfPresenceInfo.
       
    34  * Indicates the presence information of user like Online, Offline, Busy, 
       
    35  * Do no disturb, Appear Offline etc.
       
    36  */
       
    37 enum SmfPresenceInfo
       
    38 	{
       
    39 	  ENotSupported,
       
    40 	  EOnline,
       
    41 	  EOffline,
       
    42 	  EBusy,
       
    43 	  EDoNotDisturb,
       
    44 	  EAppearOffline,
       
    45 	  EOther
       
    46 	};
       
    47 
       
    48 /**
       
    49  * @ingroup smf_plugin_group
       
    50  * Interface to get/update the posts to a service provider. This class
       
    51  * provides basic functionality to allow applications to obtain list of
       
    52  * posts, updates posts or change the presence information to a social 
       
    53  * networking service.
       
    54  *
       
    55  * All of the functionality described here should be implemented by a service
       
    56  * specific plug-in.
       
    57  */
       
    58 class SmfPostProviderPlugin : public SmfPluginBase
       
    59 	{
       
    60 public:
       
    61 	/**
       
    62 	 * Constructor with default argument
       
    63 	 * @param aUtil The SmfPluginUtil instance. The plugins can 
       
    64 	 * call the method getAuthKeys() of this class, with its pluginID to 
       
    65 	 * get the OAuth keys, keys are returned only if this plugin is 
       
    66 	 * authorised by Smf franework
       
    67 	 */
       
    68 	SmfPostProviderPlugin( SmfPluginUtil* aUtil );
       
    69 	
       
    70 	/**
       
    71 	 * Destructor
       
    72 	 */
       
    73 	~SmfPostProviderPlugin( );
       
    74 	
       
    75 	/**
       
    76 	 * Method that returns maximum no of chars (unicode) that service 
       
    77 	 * provider can post without truncation. Negative value means 
       
    78 	 * no limit
       
    79 	 * @return Max characters that can be posted without truncation
       
    80 	 */
       
    81 	virtual qint32 maxCharsInPost( ) const = 0;
       
    82 	/**
       
    83 	 * Method that returns maximum no of items that can be returned 
       
    84 	 * in a single query to getPosts. Negative value means feature 
       
    85 	 * not supported.
       
    86 	 * @return Max items that can be returned in a single query
       
    87 	 */
       
    88 	virtual qint32 maxItems( ) const = 0;
       
    89 
       
    90 	/**
       
    91 	 * <Method that returns all the formatting of posts that this 
       
    92 	 * service provider supports. May return 0 items to mean 
       
    93 	 * only QString is supported.
       
    94 	 * @return Supported formats of posts
       
    95 	 */
       
    96 	virtual QVector<QTextFormat> supportedFormats ( ) const = 0;
       
    97 	
       
    98 	/**
       
    99 	 * Method that returns whether this SP supports Appearence
       
   100 	 * @return Returns true if Appearance is supported, else false. 
       
   101 	 * @see SmfAppearenceInfo
       
   102 	 */
       
   103 	virtual bool supportsAppearence ( ) const = 0;
       
   104 	
       
   105 	/**
       
   106 	 * Method to get the latest posts
       
   107 	 * @param aRequest [out] The request data to be sent to network
       
   108 	 * @param aUser The user's contact in this SP, omit for self contact
       
   109 	 * @param aPageNum The page to be extracted
       
   110 	 * @param aItemsPerPage Number of items per page
       
   111 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
       
   112 	 */
       
   113 	virtual SmfPluginError retrieve( SmfPluginRequestData &aRequest,
       
   114 			const SmfContact *aUser=0,
       
   115 			const int aPageNum = SMF_FIRST_PAGE, 
       
   116 			const int aItemsPerPage = SMF_ITEMS_PER_PAGE ) = 0;
       
   117 
       
   118 	
       
   119 	/**
       
   120 	 * Method to update a post to own area.
       
   121 	 * @param aRequest [out] The request data to be sent to network
       
   122 	 * @param aPostData The post data to be posted
       
   123 	 * @param aLocation The location
       
   124 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
       
   125 	 */
       
   126 	virtual SmfPluginError post( SmfPluginRequestData &aRequest,
       
   127 			const SmfPost &aPostData, 
       
   128 			const SmfPlace &aLocation ) = 0;
       
   129 	
       
   130 	/**
       
   131 	 * Method to update the last post to own area with new data
       
   132 	 * @param aRequest [out] The request data to be sent to network
       
   133 	 * @param aPostData The edited/new data to be posted
       
   134 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
       
   135 	 */
       
   136 	virtual SmfPluginError updatePost( SmfPluginRequestData &aRequest,
       
   137 			const SmfPost &aPostData ) = 0;
       
   138 	
       
   139 	/**
       
   140 	 * Method to update a post to a particular contact
       
   141 	 * @param aRequest [out] The request data to be sent to network
       
   142 	 * @param aPostData The post data to be posted
       
   143 	 * @param aContact The contact where the data has to be posted
       
   144 	 * @param aLocation The location
       
   145 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
       
   146 	 */
       
   147 	virtual SmfPluginError postDirected( SmfPluginRequestData &aRequest,
       
   148 			const SmfPost &aPostData, 
       
   149 			const SmfContact &aContact, 
       
   150 			const SmfPlace *aLocation = NULL ) = 0;
       
   151 	
       
   152 	
       
   153 	/**
       
   154 	 * Method to post a comment on a post.
       
   155 	 * @param aRequest [out] The request data to be sent to network
       
   156 	 * @param aTarget Post on which comment has to be posted
       
   157 	 * @param aComment comment to be posted
       
   158 	 * @param aLocation location data
       
   159 	 */
       
   160 	virtual SmfPluginError commentOnAPost(SmfPluginRequestData &aRequest,
       
   161 			const SmfPost& aTarget,
       
   162 			const SmfPost& aComment, 
       
   163 			const SmfPlace *aLocation = NULL);
       
   164 	
       
   165 	/**
       
   166 	 * Method to update the presence information of the user
       
   167 	 * @param aRequest [out] The request data to be sent to network
       
   168 	 * @param aAppearence The appearence information
       
   169 	 * @param aStatus The status string
       
   170 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
       
   171 	 */
       
   172 	virtual SmfPluginError postAppearence( SmfPluginRequestData &aRequest,  
       
   173 			const SmfPresenceInfo &aAppearence,
       
   174 			const QString &aStatus ) = 0;
       
   175 	
       
   176 	/**
       
   177 	 * Share /a contact's post to user's friends and followers
       
   178 	 * (e.g. retweet in twitter, share on facebook)
       
   179 	 * @param aRequest [out] The request data to be sent to network
       
   180 	 * @param aPostData data to be posted
       
   181 	 * @param aContact contact to which the post belonged
       
   182 	 * @param aEdited whether user changed items within the post
       
   183 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
       
   184 	 */
       
   185 	virtual SmfPluginError sharePost( SmfPluginRequestData &aRequest, 
       
   186 			const SmfPost& aPostData, 
       
   187 			const SmfContact& aContact, 
       
   188 			const bool &aEdited);
       
   189 
       
   190 	
       
   191 	};
       
   192 
       
   193 Q_DECLARE_INTERFACE( SmfPostProviderPlugin, "org.symbian.smf.plugin.contact.posts/v1.0" );
       
   194 
       
   195 #endif /* SMFPOSTPROVIDERPLUGIN_H_ */