31
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "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 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
* A Client MTM to access MMS notifications in a manual fetch mode.
|
|
16 |
* All this is needed to support new mtm type for Symbian OS messaging
|
|
17 |
* UI components.
|
|
18 |
*
|
|
19 |
*/
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
#ifndef MMSNOTIFICATIONCLIENTMTM
|
|
24 |
#define MMSNOTIFICATIONCLIENTMTM
|
|
25 |
|
|
26 |
// INCLUDES
|
|
27 |
#include <mmsclient.h>
|
|
28 |
|
|
29 |
// CONSTANTS
|
|
30 |
|
|
31 |
// MACROS
|
|
32 |
|
|
33 |
// DATA TYPES
|
|
34 |
|
|
35 |
typedef struct {
|
|
36 |
TInt mmboxTotalInBytes; // quota used in mmbox, in bytes
|
|
37 |
TInt mmboxTotalInMessageCount; // quota used in mmbox, number of messages
|
|
38 |
TInt mmboxQuotaInBytes; // quota defined for user's mmbox, in bytes
|
|
39 |
TInt mmboxQuotaInMessageCount; // quota defined for user's mmbox, number of messages
|
|
40 |
TTime date; // date and time when the mmbox is updated
|
|
41 |
TInt error; // error about last mmbox update
|
|
42 |
}TMmboxInfo;
|
|
43 |
|
|
44 |
// FUNCTION PROTOTYPES
|
|
45 |
|
|
46 |
// FORWARD DECLARATIONS
|
|
47 |
|
|
48 |
// CLASS DECLARATION
|
|
49 |
|
|
50 |
/**
|
|
51 |
* Client Mtm for MMS Notifications
|
|
52 |
*
|
|
53 |
*/
|
|
54 |
class CMmsNotificationClientMtm : public CMmsClientMtm
|
|
55 |
{
|
|
56 |
public: // Constructors and destructor
|
|
57 |
|
|
58 |
|
|
59 |
IMPORT_C static CMmsNotificationClientMtm* NewL(
|
|
60 |
CRegisteredMtmDll& aRegisteredMtmDll,
|
|
61 |
CMsvSession& aSession );
|
|
62 |
|
|
63 |
/**
|
|
64 |
* Destructor.
|
|
65 |
*/
|
|
66 |
~CMmsNotificationClientMtm();
|
|
67 |
|
|
68 |
public: // New functions
|
|
69 |
|
|
70 |
/**
|
|
71 |
* Send current forward entry (has to be current context)
|
|
72 |
* @param aCompletionStatus iStatus member of an active object.
|
|
73 |
* Will be set as completed when the request has finished.
|
|
74 |
* @param aSendingTime time at which the message selection is to be sent
|
|
75 |
* given as local time. If aSending time is zero or in the past, the
|
|
76 |
* message is scheduled to be sent as soon as possible.
|
|
77 |
* Defaults to zero meaning immediate sending.
|
|
78 |
* @return pointer to an operation active object.
|
|
79 |
* If successful, this is an asynchronously completing operation.
|
|
80 |
* In failure, a completed operation with status set to the relevant
|
|
81 |
* error code will be returned.
|
|
82 |
* In case the notification is already in use (there is
|
|
83 |
* an operation ongoing) a completed operation with status set KErrInUse
|
|
84 |
* is returned.
|
|
85 |
* If the entry is reserved, the progress of the completed operation
|
|
86 |
* will contain the id of the related entry that was reserved
|
|
87 |
* The returned completed operation also completes the status of the caller
|
|
88 |
* so there is no difference between the operation completing immediately
|
|
89 |
* with an error or starting and then completing with error.
|
|
90 |
*/
|
|
91 |
virtual CMsvOperation* SendL(
|
|
92 |
TRequestStatus& aCompletionStatus,
|
|
93 |
const TTime aSendingTime = TTime( 0 ) );
|
|
94 |
|
|
95 |
/**
|
|
96 |
* Returns possible extension text related to the notification
|
|
97 |
* @return descriptor containing the text extension in the notification
|
|
98 |
* empty descriptor if extension does not exist
|
|
99 |
*/
|
|
100 |
virtual const TPtrC GetExtendedText() const;
|
|
101 |
|
|
102 |
/**
|
|
103 |
* Lists all MMS Notifications, that have no active operation,
|
|
104 |
* for unfetched messages.<br>
|
|
105 |
* Caller must delete the array when no longer needed.<br>
|
|
106 |
* The notifications have similar format as messages, but they
|
|
107 |
* contain only MMS headers, and no attachments.<br>
|
|
108 |
* Individual fields can be queried the same way as for messages.
|
|
109 |
* @return Array of entry IDs of MMS Notifications.
|
|
110 |
*/
|
|
111 |
virtual CMsvEntrySelection* ListNotificationsL();
|
|
112 |
|
|
113 |
/**
|
|
114 |
* DeleteNotificationL deletes selected notifications.
|
|
115 |
* @param aSelection contains list of notifications to be deleted
|
|
116 |
* @param aDeleteType specifies which type of delete operation is done:
|
|
117 |
* -EMmsDeleteNotificationOnly: only notification entry from Inbox is deleted
|
|
118 |
* -EMmsDeleteMMBoxOnly: only corresponding message from network is deleted
|
|
119 |
* -EMmsDeleteBoth: both are deleted
|
|
120 |
* @param aCompletionStatus iStatus member of an active object.
|
|
121 |
* It will be set as completed when the request has finished.
|
|
122 |
* @return pointer to an operation active object.
|
|
123 |
* If successful, this is an asynchronously completing operation.
|
|
124 |
* If failed, this is a completed operation, with status set to
|
|
125 |
* the relevant error code.
|
|
126 |
*/
|
|
127 |
virtual CMsvOperation* DeleteNotificationL(
|
|
128 |
const CMsvEntrySelection& aSelection,
|
|
129 |
TMmsDeleteOperationType aDeleteType,
|
|
130 |
TRequestStatus& aCompletionStatus );
|
|
131 |
|
|
132 |
/**
|
|
133 |
* UnscheduledDeleteNotificationL
|
|
134 |
* EXACTLY SAME AS DeleteNotificationL ABOVE, BUT:
|
|
135 |
* This version performs unscheduled delete meaning that the returned
|
|
136 |
* operation will not complete before the whole operation has been executed.
|
|
137 |
* (Previous version completes as soon as MessageServer has scheduled
|
|
138 |
* the request)
|
|
139 |
*/
|
|
140 |
virtual CMsvOperation* UnscheduledDeleteNotificationL(
|
|
141 |
const CMsvEntrySelection& aSelection,
|
|
142 |
TMmsDeleteOperationType aDeleteType,
|
|
143 |
TRequestStatus& aCompletionStatus );
|
|
144 |
|
|
145 |
/**
|
|
146 |
* DeleteAllNotificationsL deletes all the notifications found from Inbox
|
|
147 |
* @param aDeleteType specifies which type of delete operation is done:
|
|
148 |
* -EMmsDeleteNotificationOnly: only notification entry from Inbox is deleted
|
|
149 |
* -EMmsDeleteMMBoxOnly: only corresponding message from network is deleted
|
|
150 |
* -EMmsDeleteBoth: both are deleted
|
|
151 |
* @param aCompletionStatus iStatus member of an active object.
|
|
152 |
* It will be set as completed when the request has finished.
|
|
153 |
* @return pointer to an operation active object.
|
|
154 |
* If successful, this is an asynchronously completing operation.
|
|
155 |
* If failed, this is a completed operation, with status set to
|
|
156 |
* the relevant error code.
|
|
157 |
*/
|
|
158 |
virtual CMsvOperation* DeleteAllNotificationsL(
|
|
159 |
TMmsDeleteOperationType aDeleteType,
|
|
160 |
TRequestStatus& aCompletionStatus );
|
|
161 |
|
|
162 |
/**
|
|
163 |
* DeleteForwardEntryL deletes the given selection of forward entries.
|
|
164 |
* Caller should make sure that all the entries in the selection are:
|
|
165 |
* - either in Outbox or Sent Folder
|
|
166 |
* - forward entry created earlier through this API
|
|
167 |
* Entries that do not meet these requirements, are left untouched.
|
|
168 |
* After the call, current context points to forward entry parent (outbox
|
|
169 |
* or sent folder)
|
|
170 |
* Note: that forward request entries should not be deleted directly e.g.
|
|
171 |
* with CMsvEntry, because of the possible locked notification in Inbox.
|
|
172 |
* This method handles this notification.
|
|
173 |
* @param aSelection contains list of forward entries to be deleted
|
|
174 |
*/
|
|
175 |
virtual void DeleteForwardEntryL( const CMsvEntrySelection& aSelection );
|
|
176 |
|
|
177 |
/**
|
|
178 |
* Fetch MMS messages referred by the notification selection
|
|
179 |
* from current MMSC to inbox.<br>
|
|
180 |
* If aSelection is empty, the function leaves.
|
|
181 |
*
|
|
182 |
* If the aSelection contains only entries that are not notifications or
|
|
183 |
* are notifications that are not allowed to start a new operation,
|
|
184 |
* The fetch is not started. The function leaves.
|
|
185 |
*
|
|
186 |
* Only real free notifications are fetched.
|
|
187 |
* No error code is returned, if some of the notifications are not fetched and there are
|
|
188 |
* notifications to be fetched.
|
|
189 |
*
|
|
190 |
* @param aSelection selection of notification entries.<br>
|
|
191 |
* @param aCompletionStatus iStatus member of an active object.<br>
|
|
192 |
* It will be set as completed when the request has finished.
|
|
193 |
* @return pointer to an operation active object.<br>
|
|
194 |
* If successful, this is an asynchronously completing operation.<br>
|
|
195 |
* If failed, this is a completed operation, with status set to
|
|
196 |
* the relevant error code.
|
|
197 |
*/
|
|
198 |
virtual CMsvOperation* FetchMessagesL(
|
|
199 |
const CMsvEntrySelection& aSelection,
|
|
200 |
TRequestStatus& aCompletionStatus );
|
|
201 |
|
|
202 |
/**
|
|
203 |
* MmBoxInfoL gives info about MMBox, if available.
|
|
204 |
* @param aMmboxInfo struct about mmboxInfo
|
|
205 |
* @return
|
|
206 |
* ETrue, if info is available.
|
|
207 |
* EFalse, if info is not available.
|
|
208 |
*/
|
|
209 |
|
|
210 |
virtual TBool MmboxInfoL( TMmboxInfo& aMmboxInfo );
|
|
211 |
|
|
212 |
|
|
213 |
/**
|
|
214 |
* UpdateMmBoxListL updates the list of notifications available
|
|
215 |
* in the MMBox.
|
|
216 |
* @param aCompletionStatus iStatus member of an active object.
|
|
217 |
* It will be set as completed when the request has finished.
|
|
218 |
* @return pointer to an operation active object.
|
|
219 |
* If successful, this is an asynchronously completing operation.
|
|
220 |
* If failed, this is a completed operation, with status set to
|
|
221 |
* the relevant error code.
|
|
222 |
*/
|
|
223 |
virtual CMsvOperation* UpdateMmBoxListL(
|
|
224 |
TRequestStatus& aCompletionStatus );
|
|
225 |
|
|
226 |
/**
|
|
227 |
* Get the Mmbox folder
|
|
228 |
* @return
|
|
229 |
* Id of the mmbox folder
|
|
230 |
*/
|
|
231 |
virtual TMsvId GetMmboxFolderL();
|
|
232 |
|
|
233 |
/**
|
|
234 |
* Get number of MMS Notifications for unfetched messages that
|
|
235 |
* have no active operation.<br>
|
|
236 |
* If the receiving of Multimedia Messages has been turned off,
|
|
237 |
* there may be a number of notifications waiting for processing.<br>
|
|
238 |
* When the receiving of messages is turned on again, the UI may want
|
|
239 |
* to check the number of pending notifications before giving the
|
|
240 |
* "FetchAll" command.
|
|
241 |
* @return Number of MMS notifications waiting for processing
|
|
242 |
*/
|
|
243 |
virtual TInt NotificationCount();
|
|
244 |
|
|
245 |
|
|
246 |
/**
|
|
247 |
* Get the value of application id header if present in the notification.
|
|
248 |
*
|
|
249 |
* @since 3.2
|
|
250 |
*/
|
|
251 |
virtual const TPtrC GetApplicationId() const;
|
|
252 |
|
|
253 |
|
|
254 |
public: // Functions from base classes
|
|
255 |
|
|
256 |
/**
|
|
257 |
* Creates an entry representing forward request based on
|
|
258 |
* the notification being the current context.
|
|
259 |
* @param aDestination refers to the folder where the entry is created
|
|
260 |
* @param aPartlist NOT USED
|
|
261 |
* @param aCompletionStatus reference to the status of an active object.
|
|
262 |
* This status will be set as completed when the operation completes.
|
|
263 |
* @return Pointer to message server operation (active object).
|
|
264 |
* The progress information provides the id of the created message
|
|
265 |
* when the message has been created in a 8-bit descriptor.
|
|
266 |
* While the operation is in progress the package will contain a null
|
|
267 |
* id (KMsvNullIndexEntryId). If there was an error while creating
|
|
268 |
* the message, then the message will be deleted and the package will
|
|
269 |
* contain null id.
|
|
270 |
*/
|
|
271 |
virtual CMsvOperation* ForwardL(
|
|
272 |
TMsvId aDestination,
|
|
273 |
TMsvPartList aPartList,
|
|
274 |
TRequestStatus& aCompletionStatus );
|
|
275 |
|
|
276 |
/**
|
|
277 |
* Not supported.
|
|
278 |
* Implementation of the base class is overridden.
|
|
279 |
*/
|
|
280 |
virtual CMsvOperation* SendL(
|
|
281 |
CMsvEntrySelection& aSelection,
|
|
282 |
TRequestStatus& aCompletionStatus,
|
|
283 |
TTime aSendingTime );
|
|
284 |
|
|
285 |
/**
|
|
286 |
* Fetch the multimedia message of the notification from current MMSC to inbox.<br>
|
|
287 |
* @param aId Entry ID of a notification that refers to an
|
|
288 |
* unfetched message.
|
|
289 |
* @param aCompletionStatus iStatus member of an active object.<br>
|
|
290 |
* It will be set as completed when the request has finished.
|
|
291 |
* @return pointer to an operation active object.<br>
|
|
292 |
* If successful, this is an asynchronously completing operation.<br>
|
|
293 |
* If failed, this is a completed operation, with status set to
|
|
294 |
* the relevant error code.
|
|
295 |
*/
|
|
296 |
virtual CMsvOperation* FetchMessageL(
|
|
297 |
TMsvId aId,
|
|
298 |
TRequestStatus& aCompletionStatus );
|
|
299 |
|
|
300 |
/**
|
|
301 |
* Fetch multimedia messages for all notifications that are free to be fetched
|
|
302 |
* in Inbox from current MMSC to inbox.<br>
|
|
303 |
* If the Inbox does not contain any notification, the function leaves.
|
|
304 |
* @param aCompletionStatus iStatus member of an active object.<br>
|
|
305 |
* It will be set as completed when the request has finished.
|
|
306 |
* @aparam aForced indicates if the messages should be fetched regardless
|
|
307 |
* or current mode settings.
|
|
308 |
* ETrue = user initiated fetch, use override
|
|
309 |
* EFalse = event triggered fetch, fetch only if settings allow.
|
|
310 |
* @return pointer to an operation active object.<br>
|
|
311 |
* If successful, this is an asynchronously completing operation.<br>
|
|
312 |
* If failed, this is a completed operation, with status set to
|
|
313 |
* the relevant error code.
|
|
314 |
*/
|
|
315 |
virtual CMsvOperation* FetchAllL( TRequestStatus& aCompletionStatus,
|
|
316 |
TBool aForced = ETrue );
|
|
317 |
|
|
318 |
/**
|
|
319 |
* QueryCapability
|
|
320 |
*/
|
|
321 |
virtual TInt QueryCapability( TUid aCapability, TInt& aResponse );
|
|
322 |
|
|
323 |
protected: // New functions
|
|
324 |
|
|
325 |
|
|
326 |
protected: // Functions from base classes
|
|
327 |
|
|
328 |
|
|
329 |
private:
|
|
330 |
|
|
331 |
/**
|
|
332 |
* By default Symbian OS constructor is private.
|
|
333 |
* @param aRegisteredMtmDll Reference to Mtm Dll registry class
|
|
334 |
* @param aSession Reference to a Message Server session.
|
|
335 |
*/
|
|
336 |
CMmsNotificationClientMtm(
|
|
337 |
CRegisteredMtmDll& aRegisteredMtmDll,
|
|
338 |
CMsvSession& aSession );
|
|
339 |
|
|
340 |
/**
|
|
341 |
* By default Symbian OS constructor is private.
|
|
342 |
*/
|
|
343 |
void ConstructL();
|
|
344 |
|
|
345 |
/**
|
|
346 |
* Creates an entry representing forward request based on
|
|
347 |
* the notification being the current context.
|
|
348 |
* @param aDestination refers to the folder where the entry is created
|
|
349 |
* @return entry id of the created forward request entry
|
|
350 |
*/
|
|
351 |
TMsvId CreateForwardEntryL( const TMsvId aDestination );
|
|
352 |
|
|
353 |
/**
|
|
354 |
* ReserveNotificationOperationL
|
|
355 |
* method first tests whether an operation is allowed or not.
|
|
356 |
* If allowed, further operations are not possible
|
|
357 |
* If not allowed, error is returned
|
|
358 |
* @param aNotifId pointing to a notification entry
|
|
359 |
* @param aOperation (fetching, forwarding or deleting)
|
|
360 |
* @return Errorcode:
|
|
361 |
* KErrNone if operation was allowed and is now reserved for
|
|
362 |
* this application
|
|
363 |
* KErrInUse if notification already has an operation ongoing
|
|
364 |
*/
|
|
365 |
TInt ReserveNotificationOperationL( const TMsvId aNotifIf, const TUint32 aOperation );
|
|
366 |
|
|
367 |
/**
|
|
368 |
* MarkFreeNotificationsReservedL
|
|
369 |
* reserves notifications
|
|
370 |
* aSelection contains only reserved notifications, others are dropped out.
|
|
371 |
* @param aSelection selection of notification entries
|
|
372 |
* @param aOperation (fetching, forwarding or deleting)
|
|
373 |
* @return
|
|
374 |
*/
|
|
375 |
|
|
376 |
void MarkFreeNotificationsReservedL( CMsvEntrySelection& aNotifications, const TUint32 aOperation );
|
|
377 |
|
|
378 |
/**
|
|
379 |
* check if the notification is free to start a new operation
|
|
380 |
*/
|
|
381 |
TBool FreeNotification( TMsvEntry& aEntry, const TUint32 aOperation );
|
|
382 |
|
|
383 |
/**
|
|
384 |
* Reserve the notification
|
|
385 |
*/
|
|
386 |
void MarkNotificationOperationReserved( TMsvEntry& aEntry, const TUint32 aOperation );
|
|
387 |
|
|
388 |
/**
|
|
389 |
* Find duplicate notification
|
|
390 |
* @param aParent entry id, under where the duplicate is searched
|
|
391 |
* @param aHeaders the original mms headers, whose duplicate is searched
|
|
392 |
* @param aDuplicate entry id of the found duplicate
|
|
393 |
*/
|
|
394 |
void FindDuplicateNotificationL( TMsvId aParent, CMmsHeaders& aHeaders,
|
|
395 |
TMsvId& aDuplicate);
|
|
396 |
|
|
397 |
public: // Data
|
|
398 |
|
|
399 |
protected: // Data
|
|
400 |
|
|
401 |
private: // Data
|
|
402 |
|
|
403 |
public: // Friend classes
|
|
404 |
|
|
405 |
protected: // Friend classes
|
|
406 |
|
|
407 |
private: // Friend classes
|
|
408 |
};
|
|
409 |
|
|
410 |
#endif // MMSNOTIFICATIONCLIENTMTM
|
|
411 |
|
|
412 |
// End of File
|