messagingfw/wappushfw/MiscPushMsgUtils/inc/CUnknownPushMsgEntry.h
changeset 62 db3f5fa34ec7
parent 0 8e480a14352b
equal deleted inserted replaced
60:9f5ae1728557 62:db3f5fa34ec7
       
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @publishedPartner
       
    19  @released
       
    20 */
       
    21 
       
    22 #ifndef __CUNKNOWNPUSHMSGENTRY_H__
       
    23 #define __CUNKNOWNPUSHMSGENTRY_H__
       
    24 
       
    25 #include <pushentry.h>
       
    26 
       
    27 // Forward declarations
       
    28 class RResourceFile;
       
    29 
       
    30 #ifdef __MESSAGING_API_V2__
       
    31 class MMsvAttachmentManager;
       
    32 #endif // __MESSAGING_API_V2__
       
    33 
       
    34 /** 
       
    35 Handles storage of WAP Push Messages of unknown types in the message server.
       
    36 
       
    37 If the framework receives a Push message but there are no Content Handlers for the specified
       
    38 media type and are not BIO messages, then this class is used to store these Unknown 
       
    39 Wap Push messages.
       
    40 
       
    41 Apart from the data stored by the base class, the following data are stored:
       
    42 
       
    43 1. Content Type of the message.
       
    44 
       
    45 2. Message Body - this is the binary data contained in the message. No data conversion is performed. This
       
    46 can be a very large amount of data.
       
    47 
       
    48 3. Time that the message was sent
       
    49 
       
    50 4. Content Filename of the message. Content Filename is the name of the file where the 
       
    51 Push message content is stored.
       
    52 
       
    53 @see	CPushMsgEntryBase
       
    54 
       
    55 @publishedPartner
       
    56 @released
       
    57 */
       
    58 class CUnknownPushMsgEntry:public CPushMsgEntryBase
       
    59 	{
       
    60 public:
       
    61 	IMPORT_C static	CUnknownPushMsgEntry* NewL();
       
    62 	IMPORT_C static CUnknownPushMsgEntry* NewL(const TPtrC8& aAppURI);
       
    63 	IMPORT_C static CUnknownPushMsgEntry* NewL(TInt& aAppID);
       
    64 	IMPORT_C ~CUnknownPushMsgEntry();
       
    65 
       
    66 	IMPORT_C TMsvId SaveL(CMsvSession& aSession, TMsvId aParent);
       
    67 	IMPORT_C void UpdateL(CMsvSession& aSession);
       
    68 	IMPORT_C void RetrieveL(CMsvSession& aSession, TMsvId aMsgId);
       
    69 
       
    70 	inline const TDesC&	ContentType() const;
       
    71 	IMPORT_C void SetContentTypeL(const TDesC& aContentType);
       
    72 	IMPORT_C const TDesC8& MessageData() const;
       
    73 	IMPORT_C void SetMessageDataL(const TDesC8& aMessageData);	
       
    74 	IMPORT_C const TDesC& ContentFileNameL();	
       
    75 	IMPORT_C void SetContentFileNameL(const TDesC& aFilename);
       
    76 
       
    77 	inline void	SetTimeSent(const TTime& aTime);
       
    78 	inline const TTime& TimeSent( ) const;
       
    79 	TInt32 PushMsgType() const;
       
    80 private:
       
    81 	void ConstructL();
       
    82 	void ConstructL(const TPtrC8& aAppURI);
       
    83 	void ConstructL(TInt& aAppID);
       
    84 	
       
    85 	CUnknownPushMsgEntry();
       
    86 	void SetPushMsgType();
       
    87 
       
    88 #ifdef __MESSAGING_API_V2__
       
    89 	void SaveMessageBodyL(MMsvAttachmentManager& aAttachManager, const TDesC& aFileName);
       
    90 #else
       
    91 	void SaveMessageBodyL(const CMsvEntry& aEntry, TFileName& aFileName);
       
    92 #endif // __MESSAGING_API_V2__
       
    93 
       
    94 	const TDesC& ContentTypeExtension(const TDesC& aContentType);
       
    95 
       
    96 #ifdef __MESSAGING_API_V2__
       
    97 	void DoRetrieveAttachmentL(MMsvAttachmentManager& aAttachManager);
       
    98 #else
       
    99 	void DoRetrieveAttachmentL(const CMsvEntry& aEntry);
       
   100 #endif // __MESSAGING_API_V2__
       
   101 
       
   102 	void OpenResourceFileL(RResourceFile& aFile);
       
   103 	void SetDefaultBaseFileNameL();
       
   104 
       
   105 	IMPORT_C void ExternalizeL(RMsvWriteStream& aStream);
       
   106 	IMPORT_C void InternalizeL(RMsvReadStream& aStream);
       
   107 
       
   108 private:
       
   109 	/** Descriptor buffer contains the data of the message */
       
   110 	HBufC8* iMessageData;
       
   111 	/** A File Session */
       
   112 	RFs     iRFs;
       
   113 
       
   114 	/** Time that the message was sent */
       
   115 	TTime iTimeSent;
       
   116 	/** Descriptor buffer for the content type of the message */
       
   117 	HBufC* iContentType;
       
   118 	/** Descriptor buffer for the content filename of the message */
       
   119 	HBufC* iFilename;
       
   120 	/** Default base filename read from the wappushunknown resource file */
       
   121 	TFileName iDefaultBaseFilename;
       
   122 	};
       
   123 
       
   124 #include <push/cunknownpushmsgentry.inl>
       
   125 
       
   126 #endif // __CUNKNOWNPUSHMSGENTRY_H__