--- a/messagingapp/msgappfw/client/bwins/csserverclientapiu.def Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgappfw/client/bwins/csserverclientapiu.def Sun Jul 25 18:59:19 2010 +0530
@@ -7,22 +7,22 @@
?GetTotalUnreadCountL@CCSRequestHandler@@QAEKXZ @ 6 NONAME ; unsigned long CCSRequestHandler::GetTotalUnreadCountL(void)
?RemoveResultsEventL@CCSRequestHandler@@QAEXPAVMCsResultsObserver@@@Z @ 7 NONAME ; void CCSRequestHandler::RemoveResultsEventL(class MCsResultsObserver *)
?MarkMessagingHistoryReadL@CCSRequestHandler@@QAEXH@Z @ 8 NONAME ; void CCSRequestHandler::MarkMessagingHistoryReadL(int)
- ?NewLC@CCSRequestHandler@@SAPAV1@XZ @ 9 NONAME ; class CCSRequestHandler * CCSRequestHandler::NewLC(void)
- ?RemoveCachingStatusEventL@CCSRequestHandler@@QAEXPAVMCsCachingStatusObserver@@@Z @ 10 NONAME ; void CCSRequestHandler::RemoveCachingStatusEventL(class MCsCachingStatusObserver *)
+ ?RemoveCachingStatusEventL@CCSRequestHandler@@QAEXPAVMCsCachingStatusObserver@@@Z @ 9 NONAME ; void CCSRequestHandler::RemoveCachingStatusEventL(class MCsCachingStatusObserver *)
+ ?NewLC@CCSRequestHandler@@SAPAV1@XZ @ 10 NONAME ; class CCSRequestHandler * CCSRequestHandler::NewLC(void)
?RequestResultsEventL@CCSRequestHandler@@QAEXPAVMCsResultsObserver@@@Z @ 11 NONAME ; void CCSRequestHandler::RequestResultsEventL(class MCsResultsObserver *)
?GetConversationUnreadListL@CCSRequestHandler@@QAEXPAV?$RPointerArray@VCCsClientConversation@@@@@Z @ 12 NONAME ; void CCSRequestHandler::GetConversationUnreadListL(class RPointerArray<class CCsClientConversation> *)
?GetConversationListL@CCSRequestHandler@@QAEXXZ @ 13 NONAME ; void CCSRequestHandler::GetConversationListL(void)
- ?GetMessagingHistoryL@CCSRequestHandler@@QAEXH@Z @ 14 NONAME ; void CCSRequestHandler::GetMessagingHistoryL(int)
- ?Version@CCSRequestHandler@@QBE?AVTVersion@@XZ @ 15 NONAME ; class TVersion CCSRequestHandler::Version(void) const
- ?GetCachingStatusL@CCSRequestHandler@@QAEEXZ @ 16 NONAME ; unsigned char CCSRequestHandler::GetCachingStatusL(void)
- ?RequestCachingStatusEventL@CCSRequestHandler@@QAEXPAVMCsCachingStatusObserver@@@Z @ 17 NONAME ; void CCSRequestHandler::RequestCachingStatusEventL(class MCsCachingStatusObserver *)
- ?RequestConversationChangeEventL@CCSRequestHandler@@QAEXPAVMCsConversationChangeObserver@@PAVCCsClientConversation@@@Z @ 18 NONAME ; void CCSRequestHandler::RequestConversationChangeEventL(class MCsConversationChangeObserver *, class CCsClientConversation *)
- ?ClearMessagingHistoryL@CCSRequestHandler@@QAEXH@Z @ 19 NONAME ; void CCSRequestHandler::ClearMessagingHistoryL(int)
- ?MarkConversationReadL@CCSRequestHandler@@QAEXH@Z @ 20 NONAME ; void CCSRequestHandler::MarkConversationReadL(int)
- ?RemoveConversationListChangeEventL@CCSRequestHandler@@QAEXPAVMCsConversationListChangeObserver@@@Z @ 21 NONAME ; void CCSRequestHandler::RemoveConversationListChangeEventL(class MCsConversationListChangeObserver *)
- ?GetConversationsL@CCSRequestHandler@@QAEXPAVCCsClientConversation@@@Z @ 22 NONAME ; void CCSRequestHandler::GetConversationsL(class CCsClientConversation *)
+ ?GetMessagingHistoryL@CCSRequestHandler@@QAEXHHH@Z @ 14 NONAME ; void CCSRequestHandler::GetMessagingHistoryL(int, int, int)
+ ?GetConversationFromMessageIdL@CCSRequestHandler@@QAEPAVCCsClientConversation@@H@Z @ 15 NONAME ; class CCsClientConversation * CCSRequestHandler::GetConversationFromMessageIdL(int)
+ ?Version@CCSRequestHandler@@QBE?AVTVersion@@XZ @ 16 NONAME ; class TVersion CCSRequestHandler::Version(void) const
+ ?GetCachingStatusL@CCSRequestHandler@@QAEEXZ @ 17 NONAME ; unsigned char CCSRequestHandler::GetCachingStatusL(void)
+ ?RequestCachingStatusEventL@CCSRequestHandler@@QAEXPAVMCsCachingStatusObserver@@@Z @ 18 NONAME ; void CCSRequestHandler::RequestCachingStatusEventL(class MCsCachingStatusObserver *)
+ ?RequestConversationChangeEventL@CCSRequestHandler@@QAEXPAVMCsConversationChangeObserver@@PAVCCsClientConversation@@@Z @ 19 NONAME ; void CCSRequestHandler::RequestConversationChangeEventL(class MCsConversationChangeObserver *, class CCsClientConversation *)
+ ?ClearMessagingHistoryL@CCSRequestHandler@@QAEXH@Z @ 20 NONAME ; void CCSRequestHandler::ClearMessagingHistoryL(int)
+ ?MarkConversationReadL@CCSRequestHandler@@QAEXH@Z @ 21 NONAME ; void CCSRequestHandler::MarkConversationReadL(int)
+ ?RemoveConversationListChangeEventL@CCSRequestHandler@@QAEXPAVMCsConversationListChangeObserver@@@Z @ 22 NONAME ; void CCSRequestHandler::RemoveConversationListChangeEventL(class MCsConversationListChangeObserver *)
?GetConversationIdL@CCSRequestHandler@@QAEHH@Z @ 23 NONAME ; int CCSRequestHandler::GetConversationIdL(int)
- ?NewL@CCSRequestHandler@@SAPAV1@XZ @ 24 NONAME ; class CCSRequestHandler * CCSRequestHandler::NewL(void)
- ?GetConversationFromMessageIdL@CCSRequestHandler@@QAEPAVCCsClientConversation@@H@Z @ 25 NONAME ; class CCsClientConversation * CCSRequestHandler::GetConversationFromMessageIdL(int)
- ?GetConversationFromConversationIdL@CCSRequestHandler@@QAEPAVCCsClientConversation@@H@Z @ 26 NONAME ; class CCsClientConversation * CCSRequestHandler::GetConversationFromConversationIdL(int)
+ ?GetConversationFromConversationIdL@CCSRequestHandler@@QAEPAVCCsClientConversation@@H@Z @ 24 NONAME ; class CCsClientConversation * CCSRequestHandler::GetConversationFromConversationIdL(int)
+ ?GetConversationsL@CCSRequestHandler@@QAEXPAVCCsClientConversation@@HH@Z @ 25 NONAME ; void CCSRequestHandler::GetConversationsL(class CCsClientConversation *, int, int)
+ ?NewL@CCSRequestHandler@@SAPAV1@XZ @ 26 NONAME ; class CCSRequestHandler * CCSRequestHandler::NewL(void)
--- a/messagingapp/msgappfw/client/eabi/csserverclientapiu.def Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgappfw/client/eabi/csserverclientapiu.def Sun Jul 25 18:59:19 2010 +0530
@@ -1,12 +1,12 @@
EXPORTS
_ZN17CCSRequestHandler15ShutdownServerLEv @ 1 NONAME
_ZN17CCSRequestHandler17GetCachingStatusLEv @ 2 NONAME
- _ZN17CCSRequestHandler17GetConversationsLEP21CCsClientConversation @ 3 NONAME
+ _ZN17CCSRequestHandler17GetConversationsLEP21CCsClientConversationii @ 3 NONAME
_ZN17CCSRequestHandler18GetConversationIdLEi @ 4 NONAME
_ZN17CCSRequestHandler19DeleteConversationLEi @ 5 NONAME
_ZN17CCSRequestHandler19RemoveResultsEventLEP18MCsResultsObserver @ 6 NONAME
_ZN17CCSRequestHandler20GetConversationListLEv @ 7 NONAME
- _ZN17CCSRequestHandler20GetMessagingHistoryLEi @ 8 NONAME
+ _ZN17CCSRequestHandler20GetMessagingHistoryLEiii @ 8 NONAME
_ZN17CCSRequestHandler20GetTotalUnreadCountLEv @ 9 NONAME
_ZN17CCSRequestHandler20RequestResultsEventLEP18MCsResultsObserver @ 10 NONAME
_ZN17CCSRequestHandler21MarkConversationReadLEi @ 11 NONAME
@@ -19,16 +19,16 @@
_ZN17CCSRequestHandler29GetConversationIdFromAddressLER7TDesC16 @ 18 NONAME
_ZN17CCSRequestHandler30RemoveConversationChangeEventLEP29MCsConversationChangeObserverP21CCsClientConversation @ 19 NONAME
_ZN17CCSRequestHandler31RequestConversationChangeEventLEP29MCsConversationChangeObserverP21CCsClientConversation @ 20 NONAME
- _ZN17CCSRequestHandler34RemoveConversationListChangeEventLEP33MCsConversationListChangeObserver @ 21 NONAME
- _ZN17CCSRequestHandler35RequestConversationListChangeEventLEP33MCsConversationListChangeObserver @ 22 NONAME
- _ZN17CCSRequestHandler4NewLEv @ 23 NONAME
- _ZN17CCSRequestHandler5NewLCEv @ 24 NONAME
- _ZNK17CCSRequestHandler7VersionEv @ 25 NONAME
- _ZTI17CCSRequestHandler @ 26 NONAME
- _ZTI22CCsNotificationHandler @ 27 NONAME
- _ZTI29CCsConversationChangeObserver @ 28 NONAME
- _ZTV17CCSRequestHandler @ 29 NONAME
- _ZTV22CCsNotificationHandler @ 30 NONAME
- _ZTV29CCsConversationChangeObserver @ 31 NONAME
- _ZN17CCSRequestHandler34GetConversationFromConversationIdLEi @ 32 NONAME
+ _ZN17CCSRequestHandler34GetConversationFromConversationIdLEi @ 21 NONAME
+ _ZN17CCSRequestHandler34RemoveConversationListChangeEventLEP33MCsConversationListChangeObserver @ 22 NONAME
+ _ZN17CCSRequestHandler35RequestConversationListChangeEventLEP33MCsConversationListChangeObserver @ 23 NONAME
+ _ZN17CCSRequestHandler4NewLEv @ 24 NONAME
+ _ZN17CCSRequestHandler5NewLCEv @ 25 NONAME
+ _ZNK17CCSRequestHandler7VersionEv @ 26 NONAME
+ _ZTI17CCSRequestHandler @ 27 NONAME
+ _ZTI22CCsNotificationHandler @ 28 NONAME
+ _ZTI29CCsConversationChangeObserver @ 29 NONAME
+ _ZTV17CCSRequestHandler @ 30 NONAME
+ _ZTV22CCsNotificationHandler @ 31 NONAME
+ _ZTV29CCsConversationChangeObserver @ 32 NONAME
--- a/messagingapp/msgappfw/client/src/ccsrequesthandler.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgappfw/client/src/ccsrequesthandler.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -232,6 +232,8 @@
TInt error = KErrNone;
RPointerArray<CCsConversationEntry> ConversationEntryList;
+ TInt totalConversationCount(0);
+
// Parse the results
RDesReadStream resultStream(iConvResultsBuffer->Des());
TInt conversationEntryCount = 0;
@@ -240,6 +242,9 @@
conversationEntryCount = resultStream.ReadInt32L();
+ //Read total conversation count
+ totalConversationCount = resultStream.ReadInt32L();
+
resultStream.Pop());
if(error != KErrNone)
@@ -289,7 +294,7 @@
// Pass the results to the observer
if ( iResultsObserver )
{
- iResultsObserver->Conversations(ConversationEntryList);
+ iResultsObserver->Conversations(ConversationEntryList, totalConversationCount);
}
// cleanup heap data
@@ -705,7 +710,9 @@
// convresation view.
// -----------------------------------------------------------------------------
EXPORT_C void CCSRequestHandler::GetConversationsL(
- CCsClientConversation* aClientConversation)
+ CCsClientConversation* aClientConversation,
+ TInt aKnownIndex,
+ TInt aPageSize)
{
PRINT( _L("Enter CCSRequestHandler::GetConversationsL") );
@@ -724,7 +731,11 @@
// Stream over the temp buffer
RBufWriteStream dataStream(*dataBuf);
dataStream.PushL();
-
+
+ //Write requested details in buffer.
+ dataStream.WriteInt32L(aKnownIndex);
+ dataStream.WriteInt32L(aPageSize);
+
// Write the Client Conversation in the stream
aClientConversation->ExternalizeL(dataStream);
dataStream.CommitL();
@@ -1332,7 +1343,9 @@
// -----------------------------------------------------------------------------
// CCSRequestHandler::GetMessagingHistoryL()
// -----------------------------------------------------------------------------
-EXPORT_C void CCSRequestHandler::GetMessagingHistoryL(TInt aContactId)
+EXPORT_C void CCSRequestHandler::GetMessagingHistoryL(TInt aContactId,
+ TInt aKnownIndex,
+ TInt aPageSize)
{
TInt conversationId = GetConversationIdL(aContactId);
if ( conversationId == -1 )
@@ -1343,7 +1356,7 @@
//set dummy entry
CCsConversationEntry *entry = CCsConversationEntry::NewL();
clientConversation->SetConversationEntryL(entry);
- GetConversationsL(clientConversation);
+ GetConversationsL(clientConversation,aKnownIndex,aPageSize);
//delete
delete clientConversation;
--- a/messagingapp/msgappfw/msghistory/inc/msghistoryprivate.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgappfw/msghistory/inc/msghistoryprivate.h Sun Jul 25 18:59:19 2010 +0530
@@ -28,6 +28,7 @@
class MsgItem;
class MsgHistoryPrivate : public CBase,
+public CActive,
public MCsResultsObserver,
public MCsConversationChangeObserver
{
@@ -42,12 +43,24 @@
*/
~MsgHistoryPrivate();
+public:// CActive
+
+ /**
+ * RunL.
+ */
+ void RunL();
+
+ /**
+ * DoCancel
+ */
+ void DoCancel();
+
public:
/*
* GetMessagingHistory
* @param aContactId, contactId
*/
- TBool GetMessagingHistory( TInt aContactId );
+ TBool GetMessagingHistory( TInt aContactId , TInt aKnownIndex = 0 );
/*
* ClearMessagingHistory
@@ -96,10 +109,12 @@
*
* @param aConversationEntryList List of conversation entries
* returned by server.
+ * @param aTotalCount total number of conversaitons entries in the conversation
*/
void Conversations(
- RPointerArray<CCsConversationEntry>& aConversationEntryList);
+ RPointerArray<CCsConversationEntry>& aConversationEntryList,
+ TInt& aTotalCount);
public://MCsConversationChangeObserver
@@ -157,20 +172,56 @@
void SetMsgAttributes
(MsgItem& item, const CCsConversationEntry& entry);
-
+private :
+ /**
+ * Make the active object alive
+ */
+ void IssueRequest();
+
private:
+ /**
+ * Msghistory Internal States
+ */
+ enum MsgHistoryStates
+ {
+ EInit = 500,
+ EFetchMoreConversations
+ };
+ /**
+ * MsgHistoryStates
+ * Own
+ */
+ MsgHistoryStates currentState;
+
+ /**
+ * Current entry being processed
+ * Own.
+ */
+ TInt mCurrentIndex;
+
/*
* MsgHistoryImpl
* Not Own
*/
MsgHistoryImpl* q_ptr;
-
+
/*
* CCSRequestHandler
* Own
*/
CCSRequestHandler* handler;
+ /*
+ * List of MsgItem's
+ * Own
+ */
+ QList<MsgItem> msgs;
+
+ /*
+ * Contact Id
+ * Own
+ */
+ TInt contactId;
};
#endif // __MSG_HISTORY_PRIVATE__
--- a/messagingapp/msgappfw/msghistory/src/msghistoryimpl.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgappfw/msghistory/src/msghistoryimpl.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -27,7 +27,7 @@
MsgHistoryImpl::MsgHistoryImpl(QObject* parent)
:QObject(parent)
{
- d_ptr = new MsgHistoryPrivate(this);
+ d_ptr = q_check_ptr (new MsgHistoryPrivate(this));
//connect signals
connect(this, SIGNAL(messagesReady(QList<MsgItem>&)),
--- a/messagingapp/msgappfw/msghistory/src/msghistoryprivate.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgappfw/msghistory/src/msghistoryprivate.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -29,14 +29,20 @@
// CONSTANTS
_LIT(KUnixEpoch, "19700000:000000.000000");
+const TInt KMaxConversationIPCLimit = 250;
+
//---------------------------------------------------------------
// MsgHistoryPrivate::MsgHistoryPrivate
// @see header
//---------------------------------------------------------------
MsgHistoryPrivate::MsgHistoryPrivate( MsgHistoryImpl* ptr )
-:q_ptr(ptr)
- {
+:CActive(EPriorityStandard),
+currentState(EInit),
+q_ptr(ptr)
+
+ {
+ CActiveScheduler::Add(this);
handler = CCSRequestHandler::NewL();
handler->RequestResultsEventL(this);
}
@@ -49,15 +55,69 @@
{
if ( handler )
delete handler;
+ if(msgs.count())
+ {
+ msgs.clear();
+ }
+ // Cancel the active Object
+ Cancel();
}
+// ---------------------------------------------------------------------------
+// RunL
+// ---------------------------------------------------------------------------
+//
+void MsgHistoryPrivate::RunL()
+{
+ if (iStatus != KErrNone)
+ {
+ return;
+ }
+ //process
+ switch (currentState)
+ {
+ case EFetchMoreConversations:
+ GetMessagingHistory(contactId, msgs.count());
+ break;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// DoCancel
+// ---------------------------------------------------------------------------
+//
+void MsgHistoryPrivate::DoCancel()
+{
+ currentState = EInit;
+ contactId = -1;
+
+}
+
+// ---------------------------------------------------------------------------
+// Make the active object alive.
+// ---------------------------------------------------------------------------
+//
+void MsgHistoryPrivate::IssueRequest()
+{
+ if (!IsActive())
+ {
+ iStatus = KRequestPending;
+ TRequestStatus* status = &iStatus;
+ SetActive();
+ User::RequestComplete(status, KErrNone);
+ }
+}
//---------------------------------------------------------------
// MsgHistoryPrivate::GetMessagingHistory
// @see header
//---------------------------------------------------------------
-TBool MsgHistoryPrivate::GetMessagingHistory( const TInt aContactId )
+TBool MsgHistoryPrivate::GetMessagingHistory( const TInt aContactId ,
+ TInt aKnownIndex)
{
- TRAPD(err, handler->GetMessagingHistoryL(aContactId));
+ contactId = aContactId;
+ TRAPD(err, handler->GetMessagingHistoryL(contactId,
+ aKnownIndex,
+ KMaxConversationIPCLimit));
if ( err == KErrNone )
return ETrue;
@@ -160,18 +220,29 @@
// @see header
//---------------------------------------------------------------
void MsgHistoryPrivate::Conversations
-( RPointerArray<CCsConversationEntry>& aConversationEntryList )
+( RPointerArray<CCsConversationEntry>& aConversationEntryList,
+ TInt& aTotalCount)
{
- QList<MsgItem> msgs;
-
- for(TInt i=aConversationEntryList.Count()-1; i >= 0; --i )
+
+ for(TInt i = 0 ; i < aConversationEntryList.Count(); i++ )
{
MsgItem item;
PopulateMsgItem(item,*(aConversationEntryList[i]));
msgs.append(item);
}
- //emit signal
- q_ptr->messagesReadyEvent(msgs);
+ //emit signal, when all the messages in the conversation are fetched.
+ if(msgs.count()== aTotalCount)
+ {
+ currentState = EInit;
+ q_ptr->messagesReadyEvent(msgs);
+ msgs.clear();
+
+ }
+ else
+ {
+ currentState = EFetchMoreConversations;
+ IssueRequest();
+ }
}
//---------------------------------------------------------------
--- a/messagingapp/msgappfw/plugins/previewplugin/inc/ccspreviewpluginhandler.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgappfw/plugins/previewplugin/inc/ccspreviewpluginhandler.h Sun Jul 25 18:59:19 2010 +0530
@@ -40,6 +40,7 @@
class CCsPreviewPlugin;
class CClientMtmRegistry;
class CMmsClientMtm;
+class CBIOClientMtm;
class CUniDataModel;
class MMsvAttachmentManager;
@@ -132,6 +133,18 @@
*@param aSelection, CMsvEntrySelections
*/
void HandleEventL(CMsvEntrySelection* aSelection);
+
+ /**
+ * Process MMS entry
+ *@param aEntry, TMsvEntry
+ */
+ void HandleMMSEntryL(const TMsvEntry& aEntry);
+
+ /**
+ * Process VCard enry
+ *@param aEntry, TMsvEntry
+ */
+ void HandleVCardEntryL(const TMsvEntry& aEntry);
/**
* Bind bodytext to sql statement.
@@ -233,6 +246,12 @@
* Own.
*/
CMmsClientMtm* iMmsMtm;
+
+ /**
+ * BioMsg client mtm object
+ * Own.
+ */
+ CBIOClientMtm* iBioClientMtm;
/*
* File session
--- a/messagingapp/msgappfw/plugins/previewplugin/src/ccspreviewpluginhandler.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgappfw/plugins/previewplugin/src/ccspreviewpluginhandler.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -18,7 +18,10 @@
// USER INCLUDES
#include "ccspreviewpluginhandler.h"
#include "UniObject.h"
+#include "msgbiouids.h"
// SYSTEM INCLUDES
+#include <bioscmds.h>
+#include <biocmtm.h>
#include <mmsclient.h>
#include <mtclreg.h>
#include <msvids.h>
@@ -53,6 +56,8 @@
_LIT(KSelectProcessingStateStmt, " SELECT message_id, msg_processingstate FROM conversation_messages WHERE message_id=:message_id ");
// Remove record from conversation_messages table.
_LIT(KRemoveMsgStmnt,"DELETE FROM conversation_messages WHERE message_id=:message_id");
+//Insert vcard meta-daa query
+_LIT(KSqlInsertBioMsgStmt, "INSERT OR REPLACE INTO conversation_messages ( message_id, msg_processingstate, preview_path ) VALUES( :message_id, :msg_processingstate, :preview_path )");
const TInt KDefaultMaxSize = 300 * 1024;
//Preview thumbnail size
@@ -101,6 +106,12 @@
iMmsMtm = NULL;
}
+ if (iBioClientMtm)
+ {
+ delete iBioClientMtm;
+ iBioClientMtm = NULL;
+ }
+
if (iMtmRegistry)
{
delete iMtmRegistry;
@@ -144,7 +155,11 @@
//create mms client mtm
iMmsMtm = static_cast<CMmsClientMtm*> (iMtmRegistry-> NewMtmL(
- KSenduiMtmMmsUid));
+ KSenduiMtmMmsUid));
+
+ // create biomsg client mtm
+ iBioClientMtm = static_cast<CBIOClientMtm*> (iMtmRegistry->NewMtmL(
+ KSenduiMtmBioUid));
//create thumbnail manager
iThumbnailManager = CThumbnailManager::NewL(*this);
@@ -275,7 +290,7 @@
//
void CCsPreviewPluginHandler::HandleEventL(CMsvEntrySelection* aSelection)
{
- PRINT ( _L("Enter CCsPreviewPluginHandler::HandleEvent") );
+ PRINT ( _L("Enter CCsPreviewPluginHandler::HandleEvent start.") );
TMsvEntry entry;
TMsvId service;
@@ -285,190 +300,277 @@
{
error = iSession->GetEntry(aSelection->At(i), service, entry);
- if ( (KErrNone == error) && !entry.InPreparation() && entry.Visible()
- && (KSenduiMtmMmsUidValue == entry.iMtm.iUid))
+ if ((KErrNone == error) && !entry.InPreparation() && entry.Visible())
{
PRINT ( _L("Enter CCsPreviewPluginHandler::HandleEvent for loop started.") );
-
- TInt msgId = entry.Id();
-
- // check if the msg is already under processing Or processed
- if( EPreviewMsgNotProcessed != msgProcessingState(msgId) )
- {
- // skip processing this event for the given message
- continue;
- }
- else
- {
- // start processing message, set flag
- setMsgProcessingState(msgId, EPreviewMsgProcessing);
- }
-
- // update db with message preview data
- RSqlStatement sqlInsertStmt;
- CleanupClosePushL(sqlInsertStmt);
- sqlInsertStmt.PrepareL(iSqlDb, KSqlInsertStmt);
-
- // parse message
- iMmsMtm->SwitchCurrentEntryL(msgId);
- iMmsMtm->LoadMessageL();
-
- CUniDataModel* iUniDataModel = CUniDataModel::NewL(ifsSession,
- *iMmsMtm);
- CleanupStack::PushL(iUniDataModel);
- iUniDataModel->RestoreL(*this, ETrue);
-
- //msg property
- TInt msgProperty = 0;
- if (iUniDataModel->AttachmentList().Count() > 0)
- {
- msgProperty |= EPreviewAttachment;
- }
-
- //check for msg forward
- //Validate if the mms msg can be forwarded or not
- if (ValidateMsgForForward(iUniDataModel))
- {
- msgProperty |= EPreviewForward;
- }
-
- TPtrC videoPath;
- TPtrC imagePath;
-
- // preview parsing
- TInt slideCount = iUniDataModel->SmilModel().SlideCount();
- TBool isBodyTextSet = EFalse;
- TBool isImageSet = EFalse;
- TBool isAudioSet = EFalse;
- TBool isVideoSet = EFalse;
-
- for (int i = 0; i < slideCount; i++)
- {
- int slideobjcount =
- iUniDataModel->SmilModel().SlideObjectCount(i);
- for (int j = 0; j < slideobjcount; j++)
+ if ((KSenduiMtmMmsUidValue == entry.iMtm.iUid))
{
- CUniObject *obj =
- iUniDataModel->SmilModel(). GetObjectByIndex(i, j);
- CMsgMediaInfo *mediaInfo = obj->MediaInfo();
-
- TPtrC8 mimetype = obj->MimeType();
- TMsvAttachmentId attachId = obj->AttachmentId();
-
- //bodytext
- if (!isBodyTextSet && (mimetype.Find(_L8("text"))
- != KErrNotFound))
- {
- //bind bodytext into statement
- BindBodyText(sqlInsertStmt, attachId);
- isBodyTextSet = ETrue;
- }
-
- //image parsing
- if (!isVideoSet && !isImageSet && (mimetype.Find(_L8("image"))
- != KErrNotFound))
- {
- //get thumbnail for this image
- isImageSet = ETrue;
- imagePath.Set(mediaInfo->FullFilePath());
- msgProperty |= EPreviewImage;
-
- if (EFileProtNoProtection != mediaInfo->Protection())
- {
- msgProperty |= EPreviewProtectedImage;
- }
- if (mediaInfo->Corrupt())
- {
- msgProperty |= EPreviewCorruptedImage;
- }
-
- if (!(EPreviewProtectedImage & msgProperty) &&
- !(EPreviewCorruptedImage & msgProperty))
- {
- //Generate thumbnail for non protected,
- //non corrupted image.
- GetThumbNailL(attachId, mimetype, msgId);
- }
- }
-
- //audio content
- if (!isVideoSet && !isAudioSet && (mimetype.Find(_L8("audio"))
- != KErrNotFound))
- {
- isAudioSet = ETrue;
- msgProperty |= EPreviewAudio;
- if (EFileProtNoProtection != mediaInfo->Protection())
- {
- msgProperty |= EPreviewProtectedAudio;
- }
- if (mediaInfo->Corrupt())
- {
- msgProperty |= EPreviewCorruptedAudio;
- }
- }
-
- //video content
- if (!( isImageSet || isAudioSet) && !isVideoSet && (mimetype.Find(_L8("video"))
- != KErrNotFound))
- {
- videoPath.Set(mediaInfo->FullFilePath());
- isVideoSet = ETrue;
- msgProperty |= EPreviewVideo;
- if (EFileProtNoProtection != mediaInfo->Protection())
- {
- msgProperty |= EPreviewProtectedVideo;
- }
- if (mediaInfo->Corrupt())
- {
- msgProperty |= EPreviewCorruptedVideo;
- }
+ HandleMMSEntryL(entry);
+ }
+ else if ((KSenduiMtmSmsUidValue == entry.iMtm.iUid) || (KSenduiMtmBioUidValue == entry.iMtm.iUid))
+ {
+ if ((KMsgBioUidVCard.iUid == entry.iBioType))
+ {
+ HandleVCardEntryL(entry);
}
}
}
+ }//end for loop
- //set preview path
- TInt previewPathIndex = sqlInsertStmt.ParameterIndex(_L(
- ":preview_path"));
- if (isVideoSet)
+ PRINT ( _L("Exit CCsPreviewPluginHandler::HandleEvent end.") );
+ }
+// -----------------------------------------------------------------------------
+// CCsPreviewPluginHandler::HandleMMSEntryL()
+//
+// -----------------------------------------------------------------------------
+//
+void CCsPreviewPluginHandler::HandleMMSEntryL(const TMsvEntry& aEntry)
+ {
+ PRINT ( _L("Enter CCsPreviewPluginHandler::HandleMMSEntry start.") );
+
+ TInt msgId = aEntry.Id();
+
+ // check if the msg is already under processing Or processed
+ if (EPreviewMsgNotProcessed != msgProcessingState(msgId))
+ {
+ // skip processing this event for the given message
+ return;
+ }
+
+ // start processing message, set flag
+ setMsgProcessingState(msgId, EPreviewMsgProcessing);
+
+ // update db with message preview data
+ RSqlStatement sqlInsertStmt;
+ CleanupClosePushL(sqlInsertStmt);
+ sqlInsertStmt.PrepareL(iSqlDb, KSqlInsertStmt);
+
+ // parse message
+ iMmsMtm->SwitchCurrentEntryL(msgId);
+ iMmsMtm->LoadMessageL();
+
+ CUniDataModel* iUniDataModel = CUniDataModel::NewL(ifsSession, *iMmsMtm);
+ CleanupStack::PushL(iUniDataModel);
+ iUniDataModel->RestoreL(*this, ETrue);
+
+ //msg property
+ TInt msgProperty = 0;
+ if (iUniDataModel->AttachmentList().Count() > 0)
+ {
+ msgProperty |= EPreviewAttachment;
+ }
+
+ //check for msg forward
+ //Validate if the mms msg can be forwarded or not
+ if (ValidateMsgForForward(iUniDataModel))
+ {
+ msgProperty |= EPreviewForward;
+ }
+
+ TPtrC videoPath;
+ TPtrC imagePath;
+
+ // preview parsing
+ TInt slideCount = iUniDataModel->SmilModel().SlideCount();
+ TBool isBodyTextSet = EFalse;
+ TBool isImageSet = EFalse;
+ TBool isAudioSet = EFalse;
+ TBool isVideoSet = EFalse;
+
+ for (int i = 0; i < slideCount; i++)
+ {
+ int slideobjcount = iUniDataModel->SmilModel().SlideObjectCount(i);
+ for (int j = 0; j < slideobjcount; j++)
{
- User::LeaveIfError(sqlInsertStmt.BindText(previewPathIndex,
- videoPath));
- }
- else if (isImageSet)
- {
- User::LeaveIfError(sqlInsertStmt.BindText(previewPathIndex,
- imagePath));
- }
+ CUniObject *obj = iUniDataModel->SmilModel(). GetObjectByIndex(i,
+ j);
+ CMsgMediaInfo *mediaInfo = obj->MediaInfo();
+
+ TPtrC8 mimetype = obj->MimeType();
+ TMsvAttachmentId attachId = obj->AttachmentId();
+
+ //bodytext
+ if (!isBodyTextSet
+ && (mimetype.Find(_L8("text")) != KErrNotFound))
+ {
+ //bind bodytext into statement
+ BindBodyText(sqlInsertStmt, attachId);
+ isBodyTextSet = ETrue;
+ }
+
+ //image parsing
+ if (!isVideoSet && !isImageSet && (mimetype.Find(_L8("image"))
+ != KErrNotFound))
+ {
+ //get thumbnail for this image
+ isImageSet = ETrue;
+ imagePath.Set(mediaInfo->FullFilePath());
+ msgProperty |= EPreviewImage;
- //msg_id
- TInt msgIdIndex = sqlInsertStmt.ParameterIndex(_L(":message_id"));
- User::LeaveIfError(sqlInsertStmt.BindInt(msgIdIndex, msgId));
+ if (EFileProtNoProtection != mediaInfo->Protection())
+ {
+ msgProperty |= EPreviewProtectedImage;
+ }
+ if (mediaInfo->Corrupt())
+ {
+ msgProperty |= EPreviewCorruptedImage;
+ }
+
+ if (!(EPreviewProtectedImage & msgProperty)
+ && !(EPreviewCorruptedImage & msgProperty))
+ {
+ //Generate thumbnail for non protected,
+ //non corrupted image.
+ GetThumbNailL(attachId, mimetype, msgId);
+ }
+ }
+
+ //audio content
+ if (!isVideoSet && !isAudioSet && (mimetype.Find(_L8("audio"))
+ != KErrNotFound))
+ {
+ isAudioSet = ETrue;
+ msgProperty |= EPreviewAudio;
+ if (EFileProtNoProtection != mediaInfo->Protection())
+ {
+ msgProperty |= EPreviewProtectedAudio;
+ }
+ if (mediaInfo->Corrupt())
+ {
+ msgProperty |= EPreviewCorruptedAudio;
+ }
+ }
- //subjext
- TInt subjectIndex = sqlInsertStmt.ParameterIndex(_L(":subject"));
- User::LeaveIfError(sqlInsertStmt.BindText(subjectIndex,
- iMmsMtm->SubjectL()));
+ //video content
+ if (!(isImageSet || isAudioSet) && !isVideoSet && (mimetype.Find(
+ _L8("video")) != KErrNotFound))
+ {
+ videoPath.Set(mediaInfo->FullFilePath());
+ isVideoSet = ETrue;
+ msgProperty |= EPreviewVideo;
+ if (EFileProtNoProtection != mediaInfo->Protection())
+ {
+ msgProperty |= EPreviewProtectedVideo;
+ }
+ if (mediaInfo->Corrupt())
+ {
+ msgProperty |= EPreviewCorruptedVideo;
+ }
+ }
+ }
+ }
- //msg_property
- TInt msgPropertyIndex = sqlInsertStmt.ParameterIndex(_L(
- ":msg_property"));
- User::LeaveIfError(sqlInsertStmt.BindInt(msgPropertyIndex,
- msgProperty));
+ //set preview path
+ TInt previewPathIndex = sqlInsertStmt.ParameterIndex(_L(
+ ":preview_path"));
+ if (isVideoSet)
+ {
+ User::LeaveIfError(
+ sqlInsertStmt.BindText(previewPathIndex, videoPath));
+ }
+ else if (isImageSet)
+ {
+ User::LeaveIfError(
+ sqlInsertStmt.BindText(previewPathIndex, imagePath));
+ }
+
+ //msg_id
+ TInt msgIdIndex = sqlInsertStmt.ParameterIndex(_L(":message_id"));
+ User::LeaveIfError(sqlInsertStmt.BindInt(msgIdIndex, msgId));
+
+ //subjext
+ TInt subjectIndex = sqlInsertStmt.ParameterIndex(_L(":subject"));
+ User::LeaveIfError(sqlInsertStmt.BindText(subjectIndex,
+ iMmsMtm->SubjectL()));
+
+ //msg_property
+ TInt msgPropertyIndex = sqlInsertStmt.ParameterIndex(_L(
+ ":msg_property"));
+ User::LeaveIfError(sqlInsertStmt.BindInt(msgPropertyIndex, msgProperty));
+
+ //msg_processingstate
+ TInt msgProcessingStateIndex = sqlInsertStmt.ParameterIndex(
+ _L(":msg_processingstate"));
+ User::LeaveIfError(sqlInsertStmt.BindInt(msgProcessingStateIndex,
+ EPreviewMsgProcessed));
+
+ //execute sql stament
+ User::LeaveIfError(sqlInsertStmt.Exec());
+
+ //cleanup
+ CleanupStack::PopAndDestroy(2, &sqlInsertStmt);
+
+ PRINT ( _L("Enter CCsPreviewPluginHandler::HandleMMSEntry end.") );
+ }
- //msg_processingstate
- TInt msgProcessingStateIndex = sqlInsertStmt.ParameterIndex(_L(":msg_processingstate"));
- User::LeaveIfError(sqlInsertStmt.BindInt(msgProcessingStateIndex, EPreviewMsgProcessed));
+// -----------------------------------------------------------------------------
+// CCsPreviewPluginHandler::HandleVCardEntryL()
+//
+// -----------------------------------------------------------------------------
+//
+void CCsPreviewPluginHandler::HandleVCardEntryL(const TMsvEntry& aEntry)
+ {
+ PRINT ( _L("Enter CCsPreviewPluginHandler::HandleBioMsgEntry start.") );
- //execute sql stament
- User::LeaveIfError(sqlInsertStmt.Exec());
+ TMsvId msgId = aEntry.Id();
+
+ // check if the msg is already under processing Or processed
+ TInt msgProcessState = EPreviewMsgNotProcessed;
+ msgProcessState = msgProcessingState(msgId);
+ if (EPreviewMsgProcessed == msgProcessState)
+ {
+ return;
+ }
+ //get attachments
+ CMsvEntry* cMsvEntry = CMsvEntry::NewL(iBioClientMtm->Session(), msgId,
+ TMsvSelectionOrdering());
+
+ CleanupStack::PushL(cMsvEntry);
+ CMsvStore* store = cMsvEntry->ReadStoreL();
+ CleanupStack::PushL(store);
+ MMsvAttachmentManager& attachMan = store->AttachmentManagerL();
- //cleanup
- CleanupStack::PopAndDestroy(2, &sqlInsertStmt);
+ TInt attachmentCount = attachMan.AttachmentCount();
+ if (attachmentCount)
+ {
+ // get attachment file path
+ RFile file = attachMan.GetAttachmentFileL(0);
+ CleanupClosePushL(file);
+ TFileName fullName;
+ User::LeaveIfError(file.FullName(fullName));
+
+ // update db with meta-data
+ RSqlStatement sqlInsertStmt;
+ CleanupClosePushL(sqlInsertStmt);
+ sqlInsertStmt.PrepareL(iSqlDb, KSqlInsertBioMsgStmt);
+
+ //msg_id
+ TInt msgIdIndex = sqlInsertStmt.ParameterIndex(_L(":message_id"));
+ User::LeaveIfError(sqlInsertStmt.BindInt(msgIdIndex, msgId));
+
+ //set attachment path
+ TInt previewPathIndex = sqlInsertStmt.ParameterIndex(_L(
+ ":preview_path"));
+ User::LeaveIfError(sqlInsertStmt.BindText(previewPathIndex, fullName));
+
+ //msg_processingstate
+ TInt msgProcessingStateIndex = sqlInsertStmt.ParameterIndex(
+ _L(":msg_processingstate"));
+ User::LeaveIfError(sqlInsertStmt.BindInt(msgProcessingStateIndex,
+ EPreviewMsgProcessed));
+
+ //execute sql stament
+ User::LeaveIfError(sqlInsertStmt.Exec());
+
+ //cleanup
+ CleanupStack::PopAndDestroy(&sqlInsertStmt);
+ CleanupStack::PopAndDestroy(&file);
}
-}//end for loop
+
+ CleanupStack::PopAndDestroy(2, cMsvEntry);//cMsvEntry,store
-PRINT ( _L("Exit CCsPreviewPluginHandler::HandleEvent") );
-}
+ PRINT ( _L("Enter CCsPreviewPluginHandler::HandleBioMsgEntry End.") );
+ }
// -----------------------------------------------------------------------------
// CCsPreviewPluginHandler::RestoreReady()
--- a/messagingapp/msgappfw/plugins/previewplugin/tsrc/group/test_pluginpreview.mmp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgappfw/plugins/previewplugin/tsrc/group/test_pluginpreview.mmp Sun Jul 25 18:59:19 2010 +0530
@@ -63,6 +63,7 @@
USERINCLUDE ..\inc
USERINCLUDE ..\..\inc
+USERINCLUDE ..\..\..\..\..\..\inc
USERINCLUDE ..\..\..\..\..\msgutils\unidatautils\unidatamodel\inc
USERINCLUDE ..\..\..\..\..\..\messagingappbase\obexmtms\TObexMTM\INC
USERINCLUDE ..\..\..\..\utils\inc
--- a/messagingapp/msgappfw/plugins/previewplugin/tsrc/group/test_pluginpreview.pkg Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgappfw/plugins/previewplugin/tsrc/group/test_pluginpreview.pkg Sun Jul 25 18:59:19 2010 +0530
@@ -31,11 +31,11 @@
;rom will not allow to update it if name is testframework, after install need to rename it to testframework.ini
;INI FILE
-"..\init\test_plugin.ini" -"c:\Testframework\testframework.ini"
+"..\init\testframework.ini" -"c:\Testframework\ttestframework.ini"
;CFG FILES
-"..\conf\test_plugin.cfg" -"c:\Testframework\test_plugin.cfg"
+"..\conf\test_pluginpreview.cfg" -"c:\Testframework\test_pluginpreview.cfg"
-"\EPOC32\RELEASE\ARMV5\UREL\test_plugin.dll" -"!:\sys\bin\test_plugin.dll"
+"\EPOC32\RELEASE\ARMV5\UREL\test_pluginpreview.dll" -"!:\sys\bin\test_pluginpreview.dll"
--- a/messagingapp/msgappfw/server/inc/ccsconversation.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgappfw/server/inc/ccsconversation.h Sun Jul 25 18:59:19 2010 +0530
@@ -112,6 +112,19 @@
void
GetEntryListL(
RPointerArray<CCsConversationEntry>* aConversationEntryList);
+
+ /**
+ * GetEntryListL
+ * This function shall return all the entries this conversation holds
+ *
+ * @param aConversationEntryList, list of conversation entries
+ * @param aStartIndex, start index for conversation entries.
+ * @param aEndIndex, end index for conversation entries.
+ */
+ void GetEntryListL(
+ RPointerArray<CCsConversationEntry>* aConversationEntryList,
+ TInt aStartIndex,
+ TInt aEndIndex);
/**
* GetEntryL
--- a/messagingapp/msgappfw/server/inc/ccsconversationcache.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgappfw/server/inc/ccsconversationcache.h Sun Jul 25 18:59:19 2010 +0530
@@ -74,6 +74,23 @@
GetConversationListL(
RPointerArray<CCsClientConversation>* aClientConversationList);
+/**
+ * GetConversationsL
+ * Gets the Conversation Entries of a given Client Conversation
+ *
+ * @param aClientConversation object of CCsClientConversation
+ * for which the Converstion entries needs to be fetched
+ * @param aConversationEntryList list of CCsConversationEntries
+ * @param aKnownIndex - last message index of client total messages.
+ * @param aPageSize - Number of messages need to be fetched.
+ * @param aTotalConversationCount - Has total number of message count
+ */
+ void GetConversationsL(
+ const CCsClientConversation* aClientConversation,
+ RPointerArray<CCsConversationEntry>* aConversationEntryList,
+ TInt aKnownIndex, TInt aPageSize,
+ TInt& aTotalConversationCount);
+
/**
* GetConversationUnreadListL
* Get Conversation list with contact details and unread conversation
--- a/messagingapp/msgappfw/server/src/ccsconversation.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgappfw/server/src/ccsconversation.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -219,6 +219,33 @@
}
// ----------------------------------------------------------------------------
+// CCsConversation::GetEntryListL
+// This function shall return segment of Conversation Entry
+// of ConversationEntry based on aStartIndex and aEndIndex
+// ----------------------------------------------------------------------------
+void
+CCsConversation::GetEntryListL (
+ RPointerArray<CCsConversationEntry>* aConversationEntryList,
+ TInt aStartIndex,
+ TInt aEndIndex)
+ {
+ TInt EntryCount = iEntryList->Count();
+ if (EntryCount > 0 && aStartIndex>=0 && aEndIndex<=EntryCount)
+ {
+ // loop through each entry make a clone and add
+ // it to aConversationEntryList class
+ for (TInt index=aEndIndex-1 ; index>=aStartIndex ; index--)
+ {
+ CCsConversationEntry* conEntry =
+ (static_cast<CCsConversationEntry*>(
+ (*iEntryList)[index]))->CloneL();
+ aConversationEntryList->Append(conEntry);
+ }
+ }
+ }
+
+
+// ----------------------------------------------------------------------------
// CCsConversation::AddEntryL
// Add a entry to this conversation
// ----------------------------------------------------------------------------
--- a/messagingapp/msgappfw/server/src/ccsconversationcache.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgappfw/server/src/ccsconversationcache.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -200,6 +200,54 @@
// ----------------------------------------------------------------------------
// CCsConversationCache::GetConversationsL
+// Get segment of conversations for a given conversation Id, knownIndex and page size.
+// The return list is set inside aConversationEntryList and aTotalConversationCount
+// has total conversation count.
+// ----------------------------------------------------------------------------
+void
+CCsConversationCache::GetConversationsL(
+ const CCsClientConversation* aClientConversation,
+ RPointerArray<CCsConversationEntry>* aConversationEntryList,
+ TInt aKnownIndex,
+ TInt aPageSize,
+ TInt& aTotalConversationCount)
+ {
+ TInt conversationCount = iConversationList->Count();
+
+ // Get the entry id from Client Conversation for which conversations are required
+ TCsConversationEntryID conversationEntryID =
+ aClientConversation->GetConversationEntryId();
+
+ for (TInt loop= 0; loop < conversationCount; loop++ )
+ {
+ //match entry ID;
+ CCsConversation* conversation =
+ static_cast<CCsConversation*>((*iConversationList)[loop]);
+
+ if(conversationEntryID == conversation->GetConversationId())
+ {
+ TInt endIndex = conversation->GetEntryCount();
+ TInt startIndex(0);
+ if((aKnownIndex!= 0) || (aPageSize !=0 ))
+ {
+ endIndex = endIndex- aKnownIndex;
+ startIndex = endIndex - aPageSize;
+ if( startIndex < 0 ) startIndex = 0;
+ }
+ // Search the conversation id and get the list inside
+ // No need to check, becz it is initialize here only.
+ conversation->GetEntryListL(aConversationEntryList,
+ startIndex,endIndex);
+ // May, meanwhile new conversation cached.
+ aTotalConversationCount = conversation->GetEntryCount();
+ break;
+ }
+ }
+ PRINT1 ( _L("CCsConversationCache::GetConversationsL - conversationCount:%d"),
+ conversationCount );
+ }
+// ----------------------------------------------------------------------------
+// CCsConversationCache::GetConversationsL
// Get All Conversations for a given conversation Id
// the return list is set inside aConversationEntryList
// ----------------------------------------------------------------------------
@@ -689,7 +737,7 @@
CCsClientConversation* CCsConversationCache::GetConversationFromMessageIdL(TInt aMessageId)
{
TInt conversationCount = iConversationList->Count();
-
+ CCsClientConversation *clientConv = NULL;
for ( TInt loop = 0; loop < conversationCount; loop++ )
{
CCsConversation* conversation =
@@ -704,13 +752,13 @@
TInt messageId = entryList[loop1]->EntryId();
if ( messageId == aMessageId )
{
- CCsClientConversation *clientConv = CreateClientConvLC(conversation, entryList[loop1]);
+ clientConv = CreateClientConvLC(conversation, entryList[loop1]);
CleanupStack::Pop();
- return clientConv;
+ break;
}
}
}
- return NULL;
+ return clientConv;
}
//end of file
--- a/messagingapp/msgappfw/server/src/ccssession.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgappfw/server/src/ccssession.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -489,7 +489,11 @@
// Stream over the buffer
RDesReadStream stream(bufferPtr);
stream.PushL();
-
+
+ //Read known index and page size
+ TInt knownIndex = stream.ReadInt32L();
+ TInt pageSize = stream.ReadInt32L();
+
// get cache pointer
CCsConversationCache* cache = iServer->ConversationCacheInterface();
@@ -506,8 +510,13 @@
new (ELeave) RPointerArray<CCsConversationEntry>(10);
CleanupResetAndDestroyPushL(conversationEntryList);
- // get conversationlist for given ClientConversation
- cache->GetConversationsL(ClientConversation, conversationEntryList);
+ // get conversation entry list for given ClientConversation
+ TInt totalCount(0);
+ cache->GetConversationsL (ClientConversation,
+ conversationEntryList,
+ knownIndex,
+ pageSize,
+ totalCount);
// create a new buffer for writing into stream
// write all list data into stream
@@ -520,7 +529,10 @@
TInt ItemCount = conversationEntryList->Count();
//write recent conversation entry list
writeStream.WriteInt32L(ItemCount);
-
+
+ //Write total count in the stream to update UI
+ writeStream.WriteInt32L(totalCount);
+
// Write the conversation entry
for (TInt iloop = 0; iloop < ItemCount; iloop++)
{
--- a/messagingapp/msgnotifications/msgindicatorplugin/inc/msgindicator_p.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgnotifications/msgindicatorplugin/inc/msgindicator_p.h Sun Jul 25 18:59:19 2010 +0530
@@ -18,7 +18,11 @@
#ifndef MSGINDICATOR_PRIVATE_H
#define MSGINDICATOR_PRIVATE_H
+
+#include <e32base.h>
#include "msginfodefs.h"
+
+// Forward Declarations
class MsgIndicator;
class CCSRequestHandler;
class IndicatorData;
@@ -27,7 +31,7 @@
* Message indicator class.
* Handles client request and showing the indications.
*/
-class MsgIndicatorPrivate
+class MsgIndicatorPrivate : public CBase
{
public:
/**
--- a/messagingapp/msgnotifications/msgindicatorplugin/src/msgindicator.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgnotifications/msgindicatorplugin/src/msgindicator.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -121,7 +121,7 @@
InteractionActivated),
mIndicatorType(NULL)
{
- d_ptr = new MsgIndicatorPrivate(this);
+ QT_TRAP_THROWING( d_ptr = new MsgIndicatorPrivate(this));
}
// ----------------------------------------------------------------------------
--- a/messagingapp/msgnotifications/msgindicatorplugin/src/msgindicator_p.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgnotifications/msgindicatorplugin/src/msgindicator_p.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -33,7 +33,7 @@
MsgIndicatorPrivate::MsgIndicatorPrivate(MsgIndicator* inidcator) :
q_ptr(inidcator), mCvServer(NULL)
{
- TRAP_IGNORE(initL());
+ initL();
}
// ----------------------------------------------------------------------------
--- a/messagingapp/msgnotifications/msgnotifier/inc/msgnotifier_p.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgnotifications/msgnotifier/inc/msgnotifier_p.h Sun Jul 25 18:59:19 2010 +0530
@@ -33,7 +33,7 @@
* @class MsgNotifierPrivate
*/
-class MsgNotifierPrivate : public MCsConversationListChangeObserver
+class MsgNotifierPrivate : public CBase, public MCsConversationListChangeObserver
{
public:
--- a/messagingapp/msgnotifications/msgnotifier/inc/msgstorehandler.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgnotifications/msgnotifier/inc/msgstorehandler.h Sun Jul 25 18:59:19 2010 +0530
@@ -40,7 +40,7 @@
* @class MsgStoreHandler
* handles the Messaging store for outbox events.
*/
-class MsgStoreHandler: public MMsvSessionObserver, public MMsvEntryObserver
+class MsgStoreHandler: public CBase, public MMsvSessionObserver, public MMsvEntryObserver
{
public:
--- a/messagingapp/msgnotifications/msgnotifier/src/msgnotifier.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgnotifications/msgnotifier/src/msgnotifier.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -54,7 +54,7 @@
{
QDEBUG_WRITE("MsgNotifier::MsgNotifier : Enter")
- d_ptr = new MsgNotifierPrivate(this);
+ QT_TRAP_THROWING(d_ptr = new MsgNotifierPrivate(this));
mSimHandler = new MsgSimNumDetector();
--- a/messagingapp/msgnotifications/msgnotifier/src/msgnotifier_p.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgnotifications/msgnotifier/src/msgnotifier_p.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -48,7 +48,7 @@
{
QDEBUG_WRITE("MsgNotifierPrivate::MsgNotifierPrivate : Enter")
- TRAP_IGNORE(initL());
+ initL();
QDEBUG_WRITE("MsgNotifierPrivate::MsgNotifierPrivate : Exit")
}
@@ -60,7 +60,7 @@
{
QDEBUG_WRITE("MsgNotifierPrivate::~MsgNotifierPrivate : Enter")
if (mCvServer) {
- mCvServer->RemoveConversationListChangeEventL(this);
+ TRAP_IGNORE(mCvServer->RemoveConversationListChangeEventL(this));
delete mCvServer;
mCvServer = NULL;
}
@@ -103,10 +103,11 @@
updateUnreadIndications(true);
updateOutboxIndications();
- mSettingsManager = new XQSettingsManager();
+ QT_TRYCATCH_LEAVING(mSettingsManager = new XQSettingsManager());
// define property
- mPSUtils = new XQPublishAndSubscribeUtils(*mSettingsManager);
+ QT_TRYCATCH_LEAVING(mPSUtils = new XQPublishAndSubscribeUtils(*mSettingsManager));
+
XQPublishAndSubscribeSettingsKey convIdKey(
KMsgCVIdProperty, KMsgCVIdKey);
bool success = mPSUtils->defineProperty(convIdKey,
@@ -121,7 +122,7 @@
QDEBUG_WRITE_FORMAT("MsgNotifierPrivate::initL "
"writing ret value",success)
- mSts = new XQSystemToneService();
+ QT_TRYCATCH_LEAVING(mSts = new XQSystemToneService());
QDEBUG_WRITE("MsgNotifierPrivate::initL : Exit")
}
--- a/messagingapp/msgnotifications/msgnotifier/src/msgstorehandler.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgnotifications/msgnotifier/src/msgstorehandler.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -39,7 +39,7 @@
MsgStoreHandler::MsgStoreHandler(MsgNotifierPrivate* notifier, CCSRequestHandler* aCvServer) :
iMsvSession(NULL), iNotifier(notifier), iRequestHandler(aCvServer)
{
- TRAP_IGNORE(InitL());
+ InitL();
}
// ---------------------------------------------------------
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmsreadfile.h Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,471 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#ifndef MMSREADFILE_H
-#define MMSREADFILE_H
-
-// INCLUDES
-#include <e32base.h>
-#include <badesca.h>
-#include <f32file.h>
-#include <msvstd.h>
-
-// forward references
-class CMmsAttaStructure;
-class CMmsHeaders;
-class CEikonEnv;
-class CMmsClientMtm;
-
-// Out-of-range value for any MMS header with assigned number
-// Used in coverage tests to get coverage for "default" branches
-// in "case" statements.
-const TInt KMmsTestIllegalValue = 255;
-
-//
-// TEST KEY WORDS
-// Extended to include all MMS headers to allow generation of arbitrary PDUs
-// Content type header cannot be separately defined,
-// it will always be "multipat/mixed" or "multipart/related"
-_LIT8( KTestEndOfFile, "EOF" );
-_LIT8( KTestNewMessage, "MESSAGE BEGIN" );
-//------------------------------------------------
-_LIT8( KTestMessageType, "MESSAGE-TYPE" ); //X-Mms-Message-Type
-_LIT8( KTestDate, "DATE" ); // Date
-_LIT8( KTestFrom, "FROM" ); // From
-_LIT8( KTestTo, "TO" ); // To
-_LIT8( KTestCc, "CC" ); // Cc
-_LIT8( KTestBcc, "BCC" ); // Bcc
-_LIT8( KTestSubject, "SUBJECT" ); // Subject
-_LIT8( KTestExpiryRel, "EXPIRY-REL" ); // X-Mms-Expiry, relative
-_LIT8( KTestExpiryAbs, "EXPIRY-ABS" ); // X-Mms-Expiry, absolute
-_LIT8( KTestDeliveryTimeRel, "DELIVERY-TIME-REL" ); // X-Mms-Delivery-Time, relative
-_LIT8( KTestDeliveryTimeAbs, "DELIVERY-TIME-ABS" ); // X-Mms-Delivery-Time, absolute
-_LIT8( KTestPriority, "PRIORITY" ); // X-Mms-Priority
-_LIT8( KTestSenderVisibility, "SENDER-VISIBILITY" ); // X-Mms-Sender-Visibility
-_LIT8( KTestDeliveryReport, "DELIVERY-REPORT" ); // X-Mms-Delivery-Report
-_LIT8( KTestReadReply, "READ-REPLY" ); // X-Mms-Read-Report
-// ---------------------------------------------------
-_LIT8( KTestNewAttachment, "ATTACHMENT" );
-_LIT8( KTestAttachmentType, "ATTACHMENTTYPE" );
-_LIT8( KTestAttachmentName, "ATTACHMENTNAME" );
-_LIT8( KTestAttachmentContLoc, "ATTACHMENTCONTLOC" );
-_LIT8( KTestAttachmentCharset, "ATTACHMENTCHARSET" );
-_LIT8( KTestAttachmentCid, "ATTACHMENTCID" );
-_LIT8( KTestAttachmentRoot, "ATTACHMENTROOT" );
-// content-type and x-type parameters for attachments
-// should appear in name-value pairs.
-// Test program is not responsible for verifying illegal scripts
-_LIT8( KTestAttContTypeParamName, "ContTypeParamName" );
-_LIT8( KTestAttContTypeParamValue, "ContTypeParamValue" );
-_LIT8( KTestAttXTypeParamName, "X-TypeParamName" );
-_LIT8( KTestAttXTypeParamValue, "X-TypeParamValue" );
-// -----------------------------------------------------
-_LIT8( KTestMessageClass, "MESSAGE-CLASS" ); // X-Mms-Message-Class
-_LIT8( KTestDelivRepSendAllow, "DELIV-REP-SEND-ALLOW" ); // X-Mms-Report-Allowed
-_LIT8( KTestAcceptAdvertis, "ACCEPT-ADVERTISEMENTS" );
-_LIT8( KTestRetryCount, "RETRY-COUNT" );
-_LIT8( KTestRetryInterval, "RETRY-INTERVAL" );
-// -------------------------------------------------
-_LIT8( KTestAlias, "ALIAS" );
-_LIT8( KTestFromAlias, "FROMALIAS" );
-_LIT8( KTestToAlias, "TOALIAS" );
-_LIT8( KTestCcAlias, "CCALIAS" );
-_LIT8( KTestBccAlias, "BCCALIAS" );
-// -------------------------------------------------
-// more Message headers to allow testing all possible PDUs and
-// MMS 1.1 headers
-_LIT8( KTestReplyCharging, "REPLY-CHARGING" ); // X-Mms-Reply-Charging
-_LIT8( KTestReplyChargAbs, "REPLY-CHARG-DEADLINE-ABS" ); // X-Mms-Reply-Charging, absolute
-_LIT8( KTestReplyChargRel, "REPLY-CHARG-DEADLINE-REL" ); // X-Mms-Reply-Charging, relative
-_LIT8( KTestReplyChargSize, "REPLY-CHARG-SIZE" ); // X-Mms-Reply-Charging-Size (octets)
-_LIT8( KTestReplyChargID, "REPLY-CHARGING-ID" ); // X-Mms-Reply-Charging-ID
-_LIT8( KTestTID, "TID" );
-_LIT8( KTestContentLocation, "CONTLOC" ); // X-Mms-Content-Location
-// The following three must appear as triplets.
-// index must be first, address and date may appear in any order
-_LIT8( KTestPreviouslySentIndex, "PREVIOUSINDEX" ); // forwarded count for X-Mms-PreviouslySent headers
-_LIT8( KTestPreviouslySentBy, "PREV-SENT-BY" ); // X-Mms-Previously-Sent-By
-_LIT8( KTestPreviouslySentDate, "PREV-SENT-DATE" ); // X-Mms-Previously-Sent-Date
-//---
-_LIT8( KTestMessageId, "MESSAGE-ID" ); // Message-ID
-_LIT8( KTestMessageSize, "MESSAGE-SIZE" ); // X-Mms-Message-Size (octets)
-_LIT8( KTestVersion, "MMS-VERSION" ); // X-MMS-Version (hex:, 10 = 1.0, 11 = 1.1 etc. )
-_LIT8( KTestReadStatus, "READ-STATUS" ); // X-Mms-Read-Status
-_LIT8( KTestResponseStatus, "RESPONSE-STATUS" ); // X-Mms-Response-Status
-_LIT8( KTestResponseText, "RESPONSE-TEXT" ); // X-Mms-Response-Text
-_LIT8( KTestRetrieveStatus, "RETRIEVE-STATUS" ); // X-Mms-Retrieve-Status
-_LIT8( KTestRetrieveText, "RETRIEVE-TEXT" ); // X-Mms-Retrieve-Text
-_LIT8( KTestStatus, "STATUS" ); // X-Mms-Status
-// -------------------------------------------------
-// MMS 1.2 headers
-_LIT8( KTestAttribute, "ATTRIBUTE" ); // X-Mms-Attribute
-// The value should be one of the following:
-// BCC, CC, CONTENT, CONTENT-TYPE, DATE, DELIVERY-REPORT, DELIVERY-TIME-ABS,
-// EXPIRY-ABS, FROM, MESSAGE-CLASS, MESSAGE-ID, MESSAGE-SIZE, PRIORITY,
-// READ-REPLY, SUBJECT, TO, REPLY-CHARGING, REPLY-CHARGING-ID,
-// REPLY-CHARG-DEADLINE-ABS, REPLY-CHARG-SIZE, PREV-SENT-BY,
-// PREV-SENT-DATE, ADDITIONAL-HEADERS
-_LIT8( KTestDistributionIndicator, "DISTRIBUTION-INDICATOR" ); // X-Mms-Distribution-Indicator
-_LIT8( KTestLimit, "LIMIT" ); // X-Mms-Limit
-_LIT8( KTestMessageQuota, "MESSAGE-QUOTA" ); // X-Mms-Mbox-Quota, message number
-_LIT8( KTestSizeQuota, "SIZE-QUOTA" ); // X-Mms-Mbox-Quota, size quota
-_LIT8( KTestMessageTotal, "MESSAGE-TOTAL" ); // X-Mms-Mbox-Totals, message number
-_LIT8( KTestSizeTotal, "SIZE-TOTAL" ); // X-Mms-Mbox-Totals, total size
-_LIT8( KTestMessageCount, "MESSAGE-COUNT" ); // X-Mms-Message-Count
-_LIT8( KTestAddKeyword, "ADD-KEYWORD" ); // X-Mms-MM-Flags
-_LIT8( KTestRemoveKeyword, "REMOVE-KEYWORD" ); // X-Mms-MM-Flags
-_LIT8( KTestFilterKeyword, "FILTER-KEYWORD" ); // X-Mms-MM-FLags
-_LIT8( KTestMMState, "MESSAGE-STATE" ); // X-Mms-MM-State
-_LIT8( KTestQuota, "QUOTA" ); // X-Mms-Quotas
-_LIT8( KTestStart, "START" ); // X-Mms-Start
-_LIT8( KTestStore, "STORE" ); // X-Mms-Store
-_LIT8( KTestStored, "STORED" ); // X-Mms-Stored
-_LIT8( KTestStoreStatus, "STORE-STATUS" ); // X-Mms-Store-Status
-_LIT8( KTestStoreStatusText, "STORE-STATUS-TEXT" ); // X-Mms-Store-Status-Text
-_LIT8( KTestTotals, "TOTALS" ); // X-Mms-Totals
-// Delete confirmation header structure
-// This consists of index, content location, response status and response status text.
-// All three values are not always necessary for each index, but at least content-location
-// and response status should be present.
-// The index retains its value until a new index is encountered.
-_LIT8( KTestDeleteInfoIndex, "DELETESTATUSINDEX" ); // index for next delete info fields
-// This header must precede content-location, response-status and response-text fields
-// in a delete confirmation. Index retains its value until a new index is encountered.
-
-// Element descriptor header not implemented
-
-// Application id headers
-// These will officially be supported in MMS encapsulation version 1.3
-// Java has non-standard support even earlier
-
-_LIT8( KTestApplicId, "APPLIC-ID" ); // X-Mms-Applic-ID
-_LIT8( KTestReplyApplicId, "REPLY-APPLIC-ID" ); // X-Mms-Reply-Applic-ID
-_LIT8( KTestApplicInfo, "AUX-APPLIC-INFO" ); // X-Mms-Aux-Applic-Info
-
-// Since Encapsulation 1.3
-_LIT8( KTestContentClass, "CONTENT-CLASS" ); // X-Mms-Content-Class
-_LIT8( KTestDrmContent, "DRM-CONTENT" ); // X-Mms-DRM-Content
-_LIT8( KTestAdaptationAllowed, "ADAPTATION-ALLOWED" ); // X-Mms-Adaptation-Allowed
-_LIT8( KTestRecommendedRetrievalMode, "REC-RETRIEVAL-MODE" ); // X-Mms-Recommended-Retrieval-Mode
-_LIT8( KTestRecRetrievalModeText, "REC-RETR-MODE-TEXT" ); // X-Mms-Recommended-Retrieval-Mode-Text
-_LIT8( KTestReplaceId, "REPLACE-ID" ); // X-Mms-Replace-ID
-_LIT8( KTestStatusText, "STATUS-TEXT" ); // X-Mms-Status-Text
-_LIT8( KTestCancelId, "CANCEL-ID" ); // X-Mms-Cancel-ID
-_LIT8( KTestCancelStatus, "CANCEL-STATUS" ); // X-Mms-Cancel-Status
-
-// DATA TYPES
-#define aSet 1
-#define aReset 0
-#define PartCount 100
-#define MaxAttaCount 10
-#define DefaultBufLen 256
-#define MaxRecipients 5
-
-// status returned by ReadRow
-enum TTestReadStatus
- {
- ETestUnknown,
- ETestNewMessage,
- ETestNewAttachment,
- ETestEof, // End of file
- ETestMessageType,
- ETestDate,
- ETestFrom,
- ETestTo,
- ETestCc,
- ETestBcc,
- ETestAlias,
- ETestFromAlias,
- ETestToAlias,
- ETestCcAlias,
- ETestBccAlias,
- ETestSubject,
- ETestExpiryRel,
- ETestExpiryAbs,
- ETestDeliveryTimeRel,
- ETestDeliveryTimeAbs,
- ETestPriority,
- ETestSenderVisibility,
- ETestDeliveryReport,
- ETestReadReply,
- ETestAttachmentType,
-// ETestAttachmentName,
- ETestAttachmentCharset,
- ETestAttachmentCid,
- ETestAttachmentRoot,
- ETestSettings,
- ETestMessageClass,
- ETestDelivReportSendAllow,
- ETestSingleMessageClass,
- ETestReplyCharging,
- ETestReplyChargAbs,
- ETestReplyChargRel,
- ETestReplyChargSize,
- ETestReplyChargID,
- ETestTID,
- ETestContentLocation,
- ETestPreviouslySentIndex,
- ETestPreviouslySentBy,
- ETestPreviouslySentDate,
- ETestMessageId,
- ETestMessageSize,
- ETestVersion,
- ETestReadStatus,
- ETestResponseStatus,
- ETestResponseText,
- ETestRetrieveStatus,
- ETestRetrieveText,
- ETestStatus,
- ETestAttribute,
- ETestDistributionIndicator,
- ETestLimit,
- ETestMessageQuota,
- ETestSizeQuota,
- ETestMessageTotal,
- ETestSizeTotal,
- ETestMessageCount,
- ETestAddKeyword,
- ETestRemoveKeyword,
- ETestFilterKeyword,
- ETestMMState,
- ETestQuota,
- ETestStart,
- ETestStore,
- ETestStored,
- ETestStoreStatus,
- ETestStoreStatusText,
- ETestTotals,
- ETestDeleteInfoIndex,
- ETestApplicId,
- ETestReplyApplicId,
- ETestApplicInfo,
- ETestContentClass,
- ETestDrmContent,
- ETestAdaptationAllowed,
- ETestRecommendedRetrievalMode,
- ETestRecRetrievalModeText,
- ETestReplaceId,
- ETestStatusText,
- ETestCancelId,
- ETestCancelStatus,
- ETestAttaRecommendedName,
- ETestAttachmentContLoc,
- ETestAttContTypeParamName,
- ETestAttContTypeParamValue,
- ETestAttXTypeParamName,
- ETestAttXTypeParamValue
-
- };
-
-// VALUE KEYWORDS
-_LIT( KPersonal, "Personal" );
-_LIT( KAdvertisement, "Advertisement" );
-_LIT( KInformational, "Informational" );
-_LIT( KAuto, "Auto" );
-_LIT( KLow, "Low" );
-_LIT( KNormal, "Normal" );
-_LIT( KHigh, "High" );
-_LIT( KHide, "Hide" );
-_LIT( KShow, "Show" );
-_LIT( KYes, "Yes" );
-_LIT( KNo, "No" );
-_LIT( KOn, "On" );
-_LIT( KOff, "Off" );
-_LIT( KDeferred, "Deferred" );
-_LIT( KExpired, "Expired" );
-_LIT( KRetrieved, "Retrieved" );
-_LIT( KRejected, "Rejected" );
-_LIT( KUnrecognized, "Unrecognized" );
-_LIT( KIndeterminate, "Indeterminate" );
-_LIT( KForwarded, "Forwarded" );
-_LIT( KUnreachable, "Unreachable" );
-_LIT( KDraft, "Draft");
-_LIT( KSent, "Sent" );
-_LIT( KNew, "New" );
-// X-Mms-Message-Type
-_LIT( KSendReq, "SendReq" );
-_LIT( KSendConf, "SendConf" );
-_LIT( KNotifInd, "NotifInd" );
-_LIT( KNotifResp, "NotifResp" );
-_LIT( KRetrConf, "RetrConf" );
-_LIT( KAckInd, "AckInd" );
-_LIT( KDelInd, "DelInd" );
-_LIT( KReadReqInd, "ReadReqInd" );
-_LIT( KReadOrigInd, "ReadOrigInd" );
-_LIT( KForwardRec, "ForwardReq" );
-_LIT( KForwardConf, "ForwardConf" );
-_LIT( KMBoxStoreReq, "MBoxStoreReq" );
-_LIT( KMBoxStoreConf, "MBoxStoreConf" );
-_LIT( KMBoxViewReq, "MBoxViewReq" );
-_LIT( KMBoxViewConf, "MBoxViewConf" );
-_LIT( KMBoxUploadReq, "MBoxUploadReq" );
-_LIT( KMBoxUploadConf, "MBoxUploadConf" );
-_LIT( KMBoxDeleteReq, "MBoxDeleteReq" );
-_LIT( KMBoxDeleteConf, "MBoxDeleteConf" );
-_LIT( KMBoxDescr, "MBoxDescr" );
-_LIT( KDeleteReq, "DeleteReq" );
-_LIT( KDeleteConf, "DeleteConf" );
-_LIT( KCancelReq, "CancelReq" );
-_LIT( KCancelResp, "CancelConf" );
-// X-Mms-Read-Status
-_LIT( KRead, "Read" );
-_LIT( KDelNotRead, "DeletedNotRead" );
-// X-Mms-Reply-Charging
-_LIT( KRequested, "Requested" );
-_LIT( KReqTextOnly, "ReqTextOnly" );
-_LIT( KAccepted, "Accepted" );
-_LIT( KAccTextOnly, "AccTextOnly" );
-// X-Mms-Cancel-Status (only receival of request, not actual cancellation)
-_LIT( KCancelSuccessful, "CancelSuccess" );
-_LIT( KCancelCorrupted, "CancelCorrupted" );
-// X-Mms-Content-Class
-_LIT( KText, "Text" );
-_LIT( KImageBasic, "ImageBasic" );
-_LIT( KImageRich, "ImageRich" );
-_LIT( KVideoBasic, "VideoBasic" );
-_LIT( KVideoRich, "VideoRich" );
-_LIT( KMegaPixel, "MegaPixel" );
-_LIT( KContentBasic, "ContentBasic" );
-_LIT( KContentRich, "ContentRich" );
-// X-Mms-Recommended-Retrieval-Mode
-_LIT( KManual, "Manual" );
-
-//X-Mms-ResponseStatus
-// legacy values
-_LIT( KOk, "OK" );
-_LIT( KErrUnspecified, "Unspecified" );
-_LIT( KErrServiceDenied, "ServiceDenied" );
-_LIT( KErrMessageFormatCorrupt, "FormatCorrupt" );
-_LIT( KErrAddressUnresolved, "AddressUnresolved" );
-_LIT( KErrMessageNotFound, "MessageNotFound" );
-_LIT( KErrNetworkProblem, "NetworkProblem" );
-_LIT( KErrContentNotAccepted, "ContentNotAccepted" );
-_LIT( KErrUnsupportedMessage, "UnsupportedMessage" );
-// values since 1.1 (and 1.2)
-_LIT( KErrTransient, "TransientFailure" );
-_LIT( KErrTransientAddressUnresolved, "TransientAddressUnresolved" );
-_LIT( KErrTransientNotFound, "TransientMessageNotFound" );
-_LIT( KErrTransientNetworkproblem, "TransientNetworkProblem" );
-_LIT( KErrTransientPartialSuccess, "PartialSuccess" );
-_LIT( KErrPermanent, "PermanentFailure" );
-_LIT( KErrPermanentServiceDenied, "PermanentServiceDenied" );
-_LIT( KErrPermanentMessageFormatCorrupt, "PermanentFormatCorrupt" );
-_LIT( KErrPermanentAddressUnresolved, "PermanentAddressUnresolved" );
-_LIT( KErrPermanentNotFound, "PermanentMessageNotFound" );
-_LIT( KErrPermanentContentNotAccepted, "PermanentContentNotAccepted" );
-_LIT( KErrReplyChargingLimitNotMet, "ReplyChargingLimitNotMet" );
-_LIT( KErrReplyChargingRequestNotAccepted, "ReplyChargingRequestNotAccepted" );
-_LIT( KErrReplyChargingForwardingDenied, "ReplyChargingForwardingDenied" );
-_LIT( KErrReplyChargingNotSupported, "ReplyChargingNotSupported" );
-_LIT( KErrAddressHidingNotSupported, "AddressHidingNotSupported" );
-_LIT( KErrPermanentLackOfPrepaid, "PermanentLackOfPrepaid" );
-//X-Mms-RetrieveStatus (one extra value)
-_LIT( KErrRetrieveContentUnsupported, "PermanentContentUnsupported" );
-//X-Mms-Store-Status (one extra value)
-_LIT( KErrMMBoxFull, "MMBoxFull" );
-
-_LIT8( KTestContent, "Content" ); // For attribute list only
-_LIT8( KTestAdditionalHeaders, "ADDITIONAL-HEADERS" ); // For attribute list only
-_LIT8( KTestDeliveryTime, "DELIVERY-TIME"); // for attribute list only
-_LIT8( KTestExpiry, "EXPIRY"); // for attribute list only
-_LIT8( KTestReplyCharg, "REPLY-CHARG-DEADLINE" ); // for attribute list only
-_LIT8( KTestContentType, "CONTENT-TYPE" ); // for attribute list only
-
-/**
-* CMmsReadFile
-*/
-NONSHARABLE_CLASS( CMmsReadFile ):public CBase
- {
- public: // Constructors and destructor
-
- static CMmsReadFile* NewL(RFs& aFs, RFileReadStream& aReadStream ); // Two-phased constructor.
- virtual ~CMmsReadFile(); // Destructor
-
- public: // New functions
-
- TInt CompleteTestL(TInt aMessageCounter, CMmsHeaders& aMmsHeaders);
- TTestReadStatus ReadRowL();
- void CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders );
- TInt FindAlias(TPtrC alias);
- void SetAttaStructure( TBool aOldAttaStructure = EFalse );
-
- protected: // Functions from base classes
-
- private:
-
- CMmsReadFile(); // C++ default constructor.
- // By default constructor is private.
- void ConstructL( RFs& aFs, RFileReadStream& aReadStream );
- void Reset();
-
- public: // data
- TInt iMessageType;
-
-
- private: // Data
-
- RFs iFs;
- RFileReadStream* iReader;
- TBuf<DefaultBufLen> iValueBuffer;
- CDesCArray* iAliasArray; // aliases
- HBufC8* iByteBuffer;
- TTime iDate;
- CArrayPtrFlat<CMmsAttaStructure>* iAttaStructures;
- TInt iAttaCount;
- TInt iAttaRoot;
- TInt iAliasCount;
- TInt iNextMessageType;
- TParse iParse;
- TFileName iFilename;
-
- protected: // Data
- private: // Data
-
- // CArrayFixFlat <TestMessage>* iMessages;
-
- public: // Friend classes
- protected: // Friend classes
- private: // Friend classes
-
- };
-
-
-NONSHARABLE_CLASS( CMmsAttaStructure ):public CBase
- {
- public: // Constructors and destructor
- static CMmsAttaStructure* NewL(); // Two-phased constructor.
- virtual ~CMmsAttaStructure(); // Destructor
- private:
- CMmsAttaStructure(); // C++ default constructor.
- // By default constructor is private.
- void ConstructL();
-
- public: // Data
- HBufC8* iAtta;
- HBufC8* iAttaName; // content location
- HBufC8* iAttaType;
- HBufC8* iAttaCid;
- TInt iAttaCharset;
- HBufC* iAttaRecommendedName; // recommended filename
- CDesC8ArrayFlat* iContentTypeParams; // zero or more "parameter"
- CDesC8ArrayFlat* iXTypeParams; // zero or more X-Type "parameters"
-
- };
-
-
-#endif // MMSREADFILE_H
-
-// End of File
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmstestbed.h Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#ifndef MMSTESTBED_H
-#define MMSTESTBED_H
-
-#ifdef BUILD_MMSTESTBED_DLL
-#define MMSTESTBED_EXPORT Q_DECL_EXPORT
-#else
-#define MMSTESTBED_EXPORT Q_DECL_IMPORT
-#endif
-
-#include <QObject>
-#include <QString>
-
-#include <msvids.h> //for consts like KMsvNullIndexEntryIdValue
-#include <MSVAPI.H>
-#include <MTCLREG.H>
-#include <mmsclient.h>
-//#include <mmsservercommon.h>
-
-class CTestUiTimer;
-class CMsvSession;
-class CMmsClientMtm;
-class CMmsSettings;
-class CMmsHeaders;
-class CLogEvent;
-class CLogViewEvent;
-class CLogFilter;
-class CLogClient;
-
-class MMSTESTBED_EXPORT MmsTestBed : public QObject, public MMsvSessionObserver
- {
- Q_OBJECT
-
-public:
- /**
- *
- */
- MmsTestBed();
- ~MmsTestBed();
- void setConnectionLocal(bool value);
- void fromOutboxToMmsc();
- void fromMmscToInbox();
- /**
- * cleanup MMS service
- */
- void cleanupAndCreateNewService();
- void deleteNotifications();
- void restoreFactorySettings();
- void setFetchingState( TMmsReceivingMode aState );
- void sendFromFile();
- void sendOneByOne();
- void sendNotifications();
- void copyDrafts();
- void garbageCollection(TUint32 aReason = 0x00000001); //0x00000001 == KMmsReasonBoot
- void messageVariation();
- void cancelSendScheduling();
- void scheduledSend(TMsvId aBoxId, TInt aDelay = 5);
- void deleteSendSchedule();
- void cancelFetchScheduling();
- void fetchForced(TInt aDelay = 5);
- void deleteFetchSchedule();
- void doAFetchCycle();
- void createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry);
- void cleanOutbox();
- void cleanInbox();
- void cleanSent();
- void cleanDrafts();
- void cleanAll();
- void reply();
- void replyToAll();
- void forward();
- void sendReadReport(); // send a read report
- int fromOutboxToMmscWithMemoryFailure(); // returns memory failure count
- int fromMmscToInboxWithMemoryFailure(); // returns memory failure count
- void sendViaClient();
- void scheduledFetch(TInt aDelay = 5);
- void fetchForcedImmediate();
- void getEventType();
- void addEventType();
- void deleteEventType();
- void cleanLog();
- void setOnline(bool value);
- void generateDeliveryReport( CMmsHeaders* aMmsHeaders );
- void sendDeliveryReport();
-
-signals:
- void entryCreatedInDraft(long int id);
- void entryMovedToOutbox(long int id);
- void entryMovedToSent(long int id);
- void entryCreatedInInbox(long int id);
-
-protected:
- /**
- * From MMsvSessionObserver
- */
- void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
- TAny* aArg2, TAny* aArg3);
-
-private:
- void findDefaultL();
- void createMmsService();
- void cleanup();
- void deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry);
- void testFile(TFileName& aFilePath, TInt aCommand = 0, TMsvId aBox = KMsvGlobalOutBoxIndexEntryId);
- void addMMBoxDescriptions();
- void encodeMessageFromDrafts();
- TMsvId findMMSFolder();
- bool checkLogClient();
- int getLogEntries();
-
-private:
- //data
- CTestUiTimer* iTimer;
- CMsvOperationActiveSchedulerWait* iWait;
- CMsvSession* iSession;
- CClientMtmRegistry* iClientMtmRegistry;
- CMmsClientMtm* iMmsClient;
- CMmsSettings* iSettings;
- CMmsHeaders* iMmsHeaders;
- TMsvId iServiceId;
- TMsvId iDefaultServiceId;
- TMsvSessionEvent iEvent;
- RFs iFs;
- TFileName iFilename;
- TFileName iCurrentFile;
- TFileName iCurrentPath;
- TParse iParse; // parse buffer as member to save stack space
- CBufFlat* iEncodeBuffer;
- CMsvEntrySelection* iMsvEntrySelection;
- CLogEvent* iLogEvent;
- CLogClient* iLogClient;
- CLogViewEvent* iLogView;
- CLogFilter* iLogFilter;
- };
-
-#endif // MMSTESTBED_H
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmstestbed.hrh Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#include <bldvariant.hrh>
-
-
-#ifndef MMSTESTBED_HRH
-#define MMSTESTBED_HRH
-
-enum
-{
- EAppMainOk = 1,
- EAppMainCancel,
- //
- EMenufrmCmdCascadeTest,
- ECleanup,
- ECleanOutbox,
- ESaveSettings,
- ELoadSettings,
- ECleanInbox,
- EShowIn,
- EShowOut,
- EOutToMMSC,
- EMMSCToIn,
- ESendScheduled,
- EReceiveScheduled,
- EShowSent,
- ECleanSent,
- EStartMyNotifier,
- EGetEventType,
- EAddEventType,
- EDeleteEventType,
- EViewLog,
- ECleanLog,
- EShowWapAccessPoints,
- ESelectWapAccessPoint,
- EShowConnectionMode,
- EShowIAP,
- EConnectToIAP,
- EDeleteSendSchedule,
- EDeleteReceiveSchedule,
- EDeleteNotifications,
- ERestoreFactorySettings,
- ECreateFromFile,
- EShowNotifications,
- ESendDeliveryReport,
- EShowDrafts,
- ECleanDrafts,
- ECleanAll,
- EFetchingDeferred,
- EFetchingOn,
- ESendFromFile,
- ESwitchToLocal,
- ESwitchToGlobal,
- EDecodeLoggingOn,
- EDecodeLoggingOff,
- EBinaryDumpOn,
- EBinaryDumpOff,
- ESendNotification,
- ECreateToInbox,
- ECreateToSentItems,
- ESendFromDrafts,
- EFindMMSFolder,
- ESendOneByOne,
- ECreateToDrafts,
- ESendViaClient,
- ESendMemFail,
- EFetchMemFail,
- EReceiveForced,
- ECreateHeadersFromFile,
- ESwitchToOffline,
- ESwitchToOnline,
- ECopyDrafts,
- ECreateNotification,
- EReply,
- EReplyToAll,
- EForward,
- EFetchingManual,
- EFirstBoot,
- ENoFirstBoot,
- EFindNetworkStatus,
- ESendReadReport,
- ECreateMMBoxViewConf,
- EGetMMBoxView,
- ECleanMMBox,
- EShowMMBox
-};
-
-#define ETestLabel1 1
-#define ETestLabel2 2
-#define ETestLabel3 3
-#define ETestLabel4 4
-
-#define EServiceList 2
-
-
-enum TTestBedDlgCtrlIds
- {
- ETestEditField = 1
- };
-
-enum TEditServiceControls
- {
- EFolderLabel = 1,
- EEditUri
-// EEditServiceFolder,
-// ENameLabel,
-// EEditServiceName,
-// ENumberLabel,
-// EEditServiceNumber
- };
-
-enum
- {
- EFsViewDialogId = 1
- };
-
-#endif
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmsteststaticutils.h Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,203 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#ifndef MMSTESTSTATICUTILS_H
-#define MMSTESTSTATICUTILS_H
-
-#include <e32std.h>
-#include <msvstd.h>
-#include <badesca.h>
-
-#include "mmsconst.h"
-
-class RFs;
-class CMsvSession;
-class CMmsEncode;
-class CMmsHeaders;
-
-#ifdef __WINS__
-_LIT( KRootPath, "c:\\" );
-#else
-// This is removable disk.
-// drive letter should not be hard coded, must be investigated further
-// We use c: for a while for the tests (to be cahnged later)
-_LIT( KRootPath, "c:\\" );
-//_LIT( KRootPath, "e:\\" );
-#endif
-
-// directory where mmbox descriptions are created
-_LIT( KMmsMMBoxDescriptionDirectory, "C:\\mmsmmboxdescriptions\\");
-// directory where created headers are dumped
-_LIT( KMmsDumpDirectory, "C:\\mmsdump\\");
-// content type of MMS PDUs
-_LIT8( KMmsMimeType, "application/vnd.wap.mms-message" );
-
-_LIT( KWild, "*" );
-
-
-/**
- * joined array structure
- *
- */
-NONSHARABLE_CLASS( TMmsJoinedArrays ): public MDesCArray
- {
-public:
- TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2);
- TInt MdcaCount() const;
- TPtrC16 MdcaPoint(TInt aIndex) const;
-private:
- CDesCArray* const & iArray1;
- CDesCArray* const & iArray2;
- };
-
-/**
- * static utility functions
- *
- */
-class TMmsTestUtils
- {
-
-public:
-
- /**
- *
- */
- TMmsTestUtils();
-
- /**
- * read phone number for sending messages
- *
- * @param aFileName full path for filename
- * @param aFs file system handle
- * @return allocated pointer containing the name
- * The caller must delete the pointer when no longer needed
- */
- static HBufC* ReadContactFromFileL( TDesC& aFileName, RFs& aFs );
-
- static void DecodeLoggingOnL();
- static void DecodeLoggingOffL();
- static void BinaryDumpOnL();
- static void BinaryDumpOffL();
-
- /**
- * Clean all temporary directories used in local mode.
- * Does not delete the directories, only the contents
- *
- * @param aFs file system handle
- */
- static void CleanDirectoryL( RFs& aFs );
-
- /**
- * Dump a binary message
- *
- * @param aBuffer buffer containing the binary message
- * @param aFilename full path of the directory whenre the dump goes
- * @param aParse reference to parser (to save stack space)
- * @param aFs file system handle
- */
- static void Dump(
- CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs );
-
- /**
- * Delete all MMS messages and notifications from a given folder
- *
- * @param aBoxId folder id
- * @param aSession Messaging server session
- */
- static void CleanBoxL(TMsvId aBoxId, CMsvSession& aSession);
-
- /**
- * turn on logging messages sent to email addresses
- */
- static void EmailLoggingOnL();
-
- /**
- * turn off logging messages sent to email addresses
- */
- static void EmailLoggingOffL();
-
- /**
- * load list of children into selection and return count
- *
- * @param aBoxId folder id
- * @param aMsvEntrySelection reference to a pointer that will contain the list of child ids
- * caller is responsible of deleting the pointer afterwards.
- * Pointer may be NULL at entry, and a new pointer will be allocated
- * @param aSession messge server session
- * @param aMessageType child MTM type, default is multimedia message
- * @return number of entries in selection
- */
- static TInt CountChildrenL(
- TMsvId aBoxId,
- CMsvEntrySelection*& aMsvEntrySelection,
- CMsvSession& aSession,
- TUid aMessageType = KUidMsgTypeMultimedia);
-
- /**
- * Create a folder entry
- *
- * @param aSession messge server session
- * @param aParentFolder the parent folder
- * @param aFolderName name of the folder
- * @param aFolderId will contain the if of the new folder if creation was successful
- */
- static void CreateFolderEntryL(
- CMsvSession& aSession,
- TMsvId aParentFolder,
- const TDesC& aFolderName,
- TMsvId& aFolderId );
-
- /**
- * Create an MMS notification from data in buffer
- * @param aNotificationFolder mms notification folder (target folder)
- * @param aServiceId id of MMS service
- * @param aEncodeBuffer buffer that contains the data
- * @param aSession message server session
- * @return id of the created notification
- */
- static TMsvId CreateNotificationEntryL(
- TMsvId aNotificationFolder,
- TMsvId aServiceId,
- CBufFlat* aEncodeBuffer,
- CMsvSession& aSession );
-
- /**
- * Encode an MMS notification into buffer
- * @param aUrl url of the notification for local messages a filepath
- * @param aSize size of the message
- * @param aMmsHeaders MMS headers structure for creating the notification
- * @param aMmsEncoder reference to CMmsEncode class
- * @param aEncodeBuffer flat buffer that will contain the encoded notification
- */
- static void FormNotification(
- TDesC8& aUrl,
- TInt aSize,
- CMmsHeaders& aMmsHeaders,
- CMmsEncode& aMmsEncoder,
- CBufFlat* aEncodeBuffer );
-
-
- static TBool IsDrive(const TDesC& aFileName);
- static TBool IsDir(const TDesC& aFileName, RFs& aFs);
- static TBool IsFile(const TDesC& aFileName, RFs& aFs);
-
-
-private:
-
- };
-
-
-#endif // MMSTESTSTATICUTILS_H
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmstestuitimer.h Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#ifndef C_TESTUITIMER_H
-#define C_TESTUITIMER_H
-
-
-#include <e32base.h>
-
-#define KPeriod 10000 // period of timer
-
-/**
- * timer for test programs
- */
-NONSHARABLE_CLASS( CTestUiTimer ): public CTimer
- {
-public:
-
- static CTestUiTimer* NewL();
- virtual ~CTestUiTimer();
-
- void RunL();
- void DoCancel();
- void ConstructL();
- void IssueRequest();
- void TimeoutOperation(CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds);
-
-private:
- CTestUiTimer();
-
-public:
- TTimeIntervalMicroSeconds32 period;
-
-private: // data
- CActive* iObject;
- };
-
-#endif // C_TESTUITIMER_H
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/mmstestbed.pro Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-QT += testlib
-QT -= gui
-
-TEMPLATE = lib
-
-TARGET = mmstestbed
-
-INCLUDEPATH += .
-INCLUDEPATH += inc
-INCLUDEPATH += ../../inc
-
-INCLUDEPATH += ../../../../../mmsengine/inc
-INCLUDEPATH += ../../../../../mmsengine/mmsserver/inc
-INCLUDEPATH += ../../../../../mmsengine/mmsmessage/inc
-INCLUDEPATH += ../../../../../mmsengine/mmscodec/inc
-INCLUDEPATH += ../../../../../inc
-INCLUDEPATH += ../../../../../mmsengine/mmsengine/inc
-INCLUDEPATH += ../../../../../../../mmsengine/inc
-INCLUDEPATH += ../../../../../../../mmsengine/mmscodec/inc
-INCLUDEPATH += ../../../../../../../mmsengine/mmshttptransport/inc
-INCLUDEPATH += ../../../../../../../mmsengine/mmsmessage/inc
-INCLUDEPATH += ../../../../../../../mmsengine/mmsconninit/inc
-#INCLUDEPATH += ../../../mmsengine/mmscodec/inc
-INCLUDEPATH += ../../../../../../../mmsengine/mmsserver/inc
-INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
-
-DEFINES += BUILD_MMSTESTBED_DLL
-
-SOURCES += src/mmstestbed.cpp \
- src/mmsteststaticutils.cpp \
- src/mmsreadfile.cpp \
- src/mmstestuitimer.cpp
-
-HEADERS += inc/mmstestbed.h \
- inc/mmsteststaticutils.h \
- inc/mmsreadfile.h \
- inc/mmstestuitimer.h \
- inc/mmstestbed.hrh
-
-SYMBIAN_PLATFORMS = WINSCW ARMV5
-
-symbian {
- TARGET.CAPABILITY = CAP_GENERAL_DLL
- TARGET.EPOCSTACKSIZE = 0x8000
- TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
- TARGET.EPOCALLOWDLLDATA = 1
- }
-
-# Build.inf rules
-BLD_INF_RULES.prj_exports += \
- "$${LITERAL_HASH}include <platform_paths.hrh>"
-
-LIBS += -lmsgs \
- -lmmsmessage \
- -lmmsconninit \
- -lmmscodec \
- -lmmsserversettings \
- -lcentralrepository \
- -lapparc \
- -lbafl \
- -lefsrv \
- -lesock \
- -lestor \
- -leuser \
- -llogcli \
- -llogwrap \
- -lapgrfx \
- -lapmime
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/src/mmsreadfile.cpp Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1799 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-// INCLUDE FILES
-#include <e32base.h>
-#include <badesca.h>
-#include <e32def.h>
-#include <s32file.h>
-#include <msvids.h>
-#include <mtmdef.h>
-//#include <eikenv.h>
-#include <apgcli.h>
-#include <CMsvMimeHeaders.h>
-#include <AknNoteWrappers.h>
-
-#include <mmsservercommon.h>
-#include "mmsconst.h"
-#include "mmsclient.h"
-#include "mmsheaders.h"
-#include "mmsreadfile.h"
-#include "mmsmmboxviewheaders.h"
-#include "mmsmmboxmessageheaders.h"
-#include "mmsmmboxflags.h"
-#include "mmssettings.h"
-
-
-// EXTERNAL DATA STRUCTURES
-
-// EXTERNAL FUNCTION PROTOTYPES
-
-// CONSTANTS
-const TInt KMmsGranularity = 8;
-_LIT( K1970, "19700000:000000.000000" ); // 1-Jan 1970 0:00:00
-
-
-// MACROS
-
-// LOCAL CONSTANTS AND MACROS
-
-// MODULE DATA STRUCTURES
-
-// LOCAL FUNCTION PROTOTYPES
-
-// ==================== LOCAL FUNCTIONS ====================
-
-
-// ================= MEMBER FUNCTIONS =======================
-
-
-// C++ default constructor can NOT contain any code, that
-// might leave.
-//
-CMmsReadFile::CMmsReadFile()
- {
- // all member variables in a class derived from CBase
- // are automatically set to 0.
- }
-
-
-//
-void CMmsReadFile::ConstructL(RFs& aFs, RFileReadStream& aReadStream )
- {
- // iRowBuffer = HBufC8::NewMaxL( 500 ); // Max row length!!!!
- iFs = aFs;
- iReader = &aReadStream;
- iByteBuffer = HBufC8::NewL( DefaultBufLen );
- iAliasArray = new ( ELeave ) CDesCArrayFlat( KMmsGranularity );
- iAttaStructures = new ( ELeave ) CArrayPtrFlat<CMmsAttaStructure>( KMmsGranularity );
- Reset();
- }
-
-// Two-phased constructor.
-CMmsReadFile* CMmsReadFile::NewL(RFs& aFs, RFileReadStream& aReadStream )
- {
- CMmsReadFile* self = new ( ELeave ) CMmsReadFile();
- CleanupStack::PushL( self );
- self->ConstructL( aFs, aReadStream );
- CleanupStack::Pop();
- return self;
- }
-
-
-// Destructor
-CMmsReadFile::~CMmsReadFile()
- {
- Reset(); // resets and destroys all array data
- if (iAliasArray != NULL) iAliasArray->Reset();
- delete iByteBuffer;
- delete iAliasArray;
- delete iAttaStructures;
- }
-
-void CMmsReadFile::Reset()
- {
- // reset all arrays
- if (iAttaStructures != NULL) iAttaStructures->ResetAndDestroy();
- iAttaCount = 0;
- iAttaRoot = 0;
- }
-
-// ---------------------------------------------------------
-// CMmsReadFile()::CompleteTest
-// ---------------------------------------------------------
-//
-TInt CMmsReadFile::CompleteTestL( TInt aMessageCounter, CMmsHeaders& aMmsHeaders )
-{
- Reset(); // new message
-
- TUint32 val;
- TUint limit = 1000000;
- TUint sizeLimit = 1000 * 1024; //max message size 1000 kB!
- TUint allLimit = 999999;
- TInt error;
- TRadix radix = EDecimal;
- TLex16 lex;
- TTestReadStatus readStatus = ETestUnknown;
- CMmsAttaStructure* oneAtta = NULL;
- TInt index;
- TTime y1970( K1970 );
- TTimeIntervalMicroSeconds interval;
- TTime date;
- TInt order = 0;
- TInt16 shortInteger = 0;
-
- //iso luuppi, joka kiertää ja lukee kunnes EOF tule vastaan
- //Big Loop, which passes around and read until the EOF
-
- iMessageType = iNextMessageType;
- while(readStatus != ETestEof)
- {
- readStatus = ReadRowL();
- if ( readStatus == ETestEof )
- {
- return(-1);
- }
- if ( readStatus == ETestUnknown )
- {
- // A line containing only comments, or an unknown tag
- // As using the scripts to test settings is no longer supported,
- // any old keywords used to test CMmsSettings class are ignored
- continue;
- }
- if( readStatus == ETestNewMessage )
- {
- iNextMessageType = readStatus;
- if(aMessageCounter++)
- {
- return(NULL);
- }
- else
- {
- iMessageType = iNextMessageType;
- continue;
- }
- }
- if ( iMessageType == ETestNewMessage)
- {
- switch(readStatus)
- {
- case ETestFrom:
- aMmsHeaders.SetSenderL( iValueBuffer );
- break;
- case ETestFromAlias:
- index = FindAlias(iValueBuffer);
- if(index >= 0)
- {
- aMmsHeaders.SetSenderL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ) );
- }
- break;
- case ETestTo:
- aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientTo );
- break;
- case ETestToAlias:
- index = FindAlias(iValueBuffer);
- if(index >= 0)
- {
- aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsTo );
- }
- break;
- case ETestCc:
- aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientCc );
- break;
- case ETestCcAlias:
- index = FindAlias(iValueBuffer);
- if(index >= 0)
- {
- aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsCc );
- }
- break;
- case ETestBcc:
- aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientBcc );
- break;
- case ETestBccAlias:
- index = FindAlias(iValueBuffer);
- if(index >= 0)
- {
- aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsBcc );
- }
- break;
- case ETestSubject:
- aMmsHeaders.SetSubjectL( iValueBuffer );
- break;
- case ETestExpiryRel:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetExpiryInterval( val );
- }
- break;
- case ETestExpiryAbs:
- error = iDate.Set(iValueBuffer);
- interval = iDate.MicroSecondsFrom( y1970 );
- // expiry date in seconds from 1.1.1970.
- aMmsHeaders.SetExpiryDate( (interval.Int64())/1000000 );
- break;
- case ETestDeliveryTimeRel:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetDeliveryTimeInterval( val );
- }
- break;
- case ETestDeliveryTimeAbs:
- error = iDate.Set(iValueBuffer);
- interval = iDate.MicroSecondsFrom( y1970 );
- aMmsHeaders.SetDeliveryDate( (interval.Int64())/1000000 );
- break;
- case ETestDate:
- error = iDate.Set(iValueBuffer);
- interval = iDate.MicroSecondsFrom( y1970 );
- aMmsHeaders.SetDate( (interval.Int64())/1000000 );
- case ETestPriority:
- val = 0;
- if ((iValueBuffer.CompareF(KLow)) == 0)
- {
- val = EMmsPriorityLow;
- }
- else if ((iValueBuffer.CompareF(KNormal)) == 0)
- {
- val = EMmsPriorityNormal;
- }
- else if ((iValueBuffer.CompareF(KHigh)) == 0)
- {
- val = EMmsPriorityHigh;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetMessagePriority( val );
- break;
- case ETestSenderVisibility:
- val = 0;
- if ((iValueBuffer.CompareF(KHide)) == 0)
- {
- val = EMmsSenderVisibilityHide;
- }
- else if ((iValueBuffer.CompareF(KShow)) == 0)
- {
- val = EMmsSenderVisibilityShow;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetSenderVisibility( val );
- break;
- case ETestDeliveryReport:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = EMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = EMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetDeliveryReport( val );
- break;
- case ETestDelivReportSendAllow:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = EMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = EMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetReportAllowed( val );
- break;
-
- case ETestReadReply:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = EMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = EMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetReadReply( val );
- break;
- case ETestNewAttachment:
- oneAtta = CMmsAttaStructure::NewL();
- iAttaStructures->AppendL(oneAtta);
- oneAtta->iAtta->Des().Copy( iValueBuffer );
- iAttaCount++;
- break;
- case ETestAttachmentType:
- if (oneAtta != NULL)
- {
- oneAtta->iAttaType->Des().Copy( iValueBuffer );
- }
- break;
- case ETestAttachmentContLoc:
- if (oneAtta != NULL)
- {
- oneAtta->iAttaName->Des().Copy( iValueBuffer );
- }
- break;
- case ETestAttaRecommendedName:
- if (oneAtta != NULL)
- {
- oneAtta->iAttaRecommendedName->Des().Copy( iValueBuffer );
- }
- break;
- case ETestAttachmentCharset:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- if (oneAtta != NULL)
- {
- oneAtta->iAttaCharset = val;
- }
- }
- break;
- case ETestAttachmentCid:
- if (oneAtta != NULL)
- {
- oneAtta->iAttaCid->Des().Copy(iValueBuffer);
- }
- break;
- case ETestAttContTypeParamName:
- iByteBuffer->Des().Copy( iValueBuffer );
- if (oneAtta != NULL)
- {
- oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
- }
- break;
- case ETestAttContTypeParamValue:
- iByteBuffer->Des().Copy( iValueBuffer );
- if (oneAtta != NULL)
- {
- oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
- }
- break;
- case ETestAttXTypeParamName:
- iByteBuffer->Des().Copy( iValueBuffer );
- if (oneAtta != NULL)
- {
- oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
- }
- break;
- case ETestAttXTypeParamValue:
- iByteBuffer->Des().Copy( iValueBuffer );
- if (oneAtta != NULL)
- {
- oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
- }
- break;
- case ETestAttachmentRoot:
- iAttaRoot = iAttaCount;
- break;
- case ETestAlias:
- // all aliases are global even if they appear
- // in the middle of a message
- iAliasArray->AppendL( iValueBuffer );
- iAliasCount++;
- break;
- case ETestMessageClass: // should be handled!
- val = EMmsClassPersonal;
- if ((iValueBuffer.CompareF(KPersonal)) == 0)
- {
- val = EMmsClassPersonal;
- }
- else if ((iValueBuffer.CompareF(KAdvertisement)) == 0)
- {
- val = EMmsClassAdvertisement;
- }
- else if ((iValueBuffer.CompareF(KInformational)) == 0)
- {
- val = EMmsClassInformational;
- }
- else if ((iValueBuffer.CompareF(KAuto)) == 0)
- {
- val = EMmsClassAuto;
- }
- else
- {
- val = (TMmsMessageClass)KMmsTestIllegalValue;
- }
- aMmsHeaders.SetMessageClass( val );
- break;
- case ETestReplyCharging:
- val = 0;
- if ((iValueBuffer.CompareF(KRequested)) == 0)
- {
- val = KMmsReplyChargingRequested;
- }
- else if ((iValueBuffer.CompareF(KReqTextOnly)) == 0)
- {
- val = KMmsReplyChargingRequestedTextOnly;
- }
- else if ((iValueBuffer.CompareF(KAccepted)) == 0)
- {
- val = KMmsReplyChargingAccepted;
- }
- else if ((iValueBuffer.CompareF(KAccTextOnly)) == 0)
- {
- val = KMmsReplyChargingAcceptedTextOnly;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetReplyCharging( val );
- break;
- case ETestReplyChargAbs:
- error = date.Set(iValueBuffer);
- if ( error == KErrNone )
- {
- interval = date.MicroSecondsFrom( y1970 );
- aMmsHeaders.SetReplyChargingDate( (interval.Int64())/1000000 );
- }
- break;
- case ETestReplyChargRel:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetReplyChargingInterval( val );
- }
- break;
- case ETestReplyChargSize:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,sizeLimit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetReplyChargingSize( val );
- }
- break;
- case ETestReplyChargID:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetReplyChargingIdL( iByteBuffer->Des() );
- break;
- case ETestTID:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetTidL( iByteBuffer->Des() );
- break;
- case ETestContentLocation:
- iByteBuffer->Des().Copy( iValueBuffer );
- if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
- aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf ||
- aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteReq )
- {
- aMmsHeaders.MMBoxMessageHeadersL().ContentLocationList().AppendL( iByteBuffer->Des() );
- }
- else if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
- {
- aMmsHeaders.InsertDeleteContentLocationL( order, iByteBuffer->Des() );
- }
- else
- {
- aMmsHeaders.SetContentLocationL( iByteBuffer->Des() );
- }
- break;
- case ETestPreviouslySentIndex:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- order = val;
- break;
- case ETestPreviouslySentBy:
- aMmsHeaders.InsertPreviouslySentByL( order, iValueBuffer );
- break;
- case ETestPreviouslySentDate:
- error = date.Set(iValueBuffer);
- if ( error == KErrNone )
- {
- interval = date.MicroSecondsFrom( y1970 );
- aMmsHeaders.InsertPreviouslySentDateL( order, (interval.Int64())/1000000 );
- }
- break;
- case ETestMessageId:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetMessageIdL( iByteBuffer->Des() );
- break;
- case ETestMessageSize:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,sizeLimit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetMessageSize( val );
- }
- break;
- case ETestVersion:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,EHex,limit);
- shortInteger = TInt16( val );
- if (error == KErrNone)
- {
- aMmsHeaders.SetMmsVersion( shortInteger );
- }
- break;
- case ETestReadStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KRead)) == 0)
- {
- val = KMmsReadStatusRead;
- }
- else if ((iValueBuffer.CompareF(KDelNotRead)) == 0)
- {
- val = KMmsReadStatusDeletedWithoutBeingRead;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetReadStatus( val );
- break;
- case ETestResponseStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KOk)) == 0)
- {
- val = KMmsStatusOk;
- }
- else if ((iValueBuffer.CompareF(KErrUnspecified)) == 0)
- {
- val = KMmsErrorUnspecified;
- }
- else if ((iValueBuffer.CompareF(KErrServiceDenied)) == 0)
- {
- val = KMmsErrorServiceDenied;
- }
- else if ((iValueBuffer.CompareF(KErrMessageFormatCorrupt)) == 0)
- {
- val = KMmsErrorMessageFormatCorrupt;
- }
- else if ((iValueBuffer.CompareF(KErrAddressUnresolved)) == 0)
- {
- val = KMmsErrorSendingAddressUnresolved;
- }
- else if ((iValueBuffer.CompareF(KErrMessageNotFound)) == 0)
- {
- val = KMmsErrorMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrNetworkProblem)) == 0)
- {
- val = KMmsErrorNetworkProblem;
- }
- else if ((iValueBuffer.CompareF(KErrContentNotAccepted)) == 0)
- {
- val = KMmsErrorNoContentAccepted;
- }
- else if ((iValueBuffer.CompareF(KErrUnsupportedMessage)) == 0)
- {
- val = KMmsErrorUnsupportedMessage;
- }
- else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
- {
- val = KMmsErrorTransientFailure;
- }
- else if ((iValueBuffer.CompareF(KErrTransientAddressUnresolved)) == 0)
- {
- val = KMmsErrorTransientSendingAddressUnresolved;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
- {
- val = KMmsErrorTransientMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
- {
- val = KMmsErrorTransientNetworkProblem;
- }
- else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
- {
- val = KMmsErrorPermanentFailure;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
- {
- val = KMmsErrorPermanentServiceDenied;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
- {
- val = KMmsErrorPermanentMessageFormatCorrupt;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentAddressUnresolved)) == 0)
- {
- val = KMmsErrorPermanentSendingAddressUnresolved;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
- {
- val = KMmsErrorPermanentMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentContentNotAccepted)) == 0)
- {
- val = KMmsErrorPermanentContentNotAccepted;
- }
- else if ((iValueBuffer.CompareF(KErrReplyChargingLimitNotMet)) == 0)
- {
- val = KMmsErrorPermanentReplyChargingLimitationsNotMet;
- }
- else if ((iValueBuffer.CompareF(KErrReplyChargingRequestNotAccepted)) == 0)
- {
- val = KMmsErrorPermanentReplyChargingRequestNotAccepted;
- }
- else if ((iValueBuffer.CompareF(KErrReplyChargingForwardingDenied)) == 0)
- {
- val = KMmsErrorPermanentReplyChargingForwardingDenied;
- }
- else if ((iValueBuffer.CompareF(KErrReplyChargingNotSupported)) == 0)
- {
- val = KMmsErrorPermanentReplyChargingNotSupported;
- }
- else if ((iValueBuffer.CompareF(KErrTransientPartialSuccess)) == 0)
- {
- val = KMmsErrorTransientPartialSuccess;
- }
- else if ((iValueBuffer.CompareF(KErrAddressHidingNotSupported)) == 0)
- {
- val = KMmsErrorPermanentAddressHidingNotSupported;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
- {
- aMmsHeaders.InsertDeleteStatusL( order, val );
- }
- else
- {
- aMmsHeaders.SetResponseStatus( val );
- }
- break;
- case ETestResponseText:
- if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
- {
- aMmsHeaders.InsertDeleteResponseTextL( order, iValueBuffer );
- }
- else
- {
- aMmsHeaders.SetResponseTextL( iValueBuffer );
- }
- break;
- case ETestRetrieveStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KOk)) == 0)
- {
- val = KMmsStatusOk;
- }
- else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
- {
- val = KMmsErrorTransientFailure;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
- {
- val = KMmsErrorReceiveTransientMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
- {
- val = KMmsErrorReceiveTransientNetworkProblem;
- }
- else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
- {
- val = KMmsErrorPermanentFailure;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
- {
- val = KMmsErrorPermanentServiceDenied;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
- {
- val = KMmsErrorReceivePermanentMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrRetrieveContentUnsupported)) == 0)
- {
- val = KMmsErrorReceivePermanentContentUnsupported;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetResponseStatus( val );
- break;
- case ETestRetrieveText:
- aMmsHeaders.SetResponseTextL( iValueBuffer );
- break;
- case ETestStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KDeferred)) == 0)
- {
- val = KMmsMessageStatusDeferred;
- }
- else if ((iValueBuffer.CompareF(KExpired)) == 0)
- {
- val = KMmsMessageStatusExpired;
- }
- else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
- {
- val = KMmsMessageStatusRetrieved;
- }
- else if ((iValueBuffer.CompareF(KRejected)) == 0)
- {
- val = KMmsMessageStatusRejected;
- }
- else if ((iValueBuffer.CompareF(KUnrecognized)) == 0)
- {
- val = KMmsMessageStatusUnrecognized;
- }
- else if ((iValueBuffer.CompareF(KIndeterminate)) == 0)
- {
- val = KMmsMessageStatusIndeterminate;
- }
- else if ((iValueBuffer.CompareF(KForwarded)) == 0)
- {
- val = KMmsMessageStatusForwarded;
- }
- else if ((iValueBuffer.CompareF(KUnreachable)) == 0)
- {
- val = KMmsMessageStatusUnreachable;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetStatus( val );
- break;
- case ETestMessageType:
- val = 0;
- if ((iValueBuffer.CompareF(KSendReq)) == 0)
- {
- val = KMmsMessageTypeMSendReq;
- }
- else if ((iValueBuffer.CompareF(KSendConf)) == 0)
- {
- val = KMmsMessageTypeMSendConf;
- }
- else if ((iValueBuffer.CompareF(KNotifInd)) == 0)
- {
- val = KMmsMessageTypeMNotificationInd;
- }
- else if ((iValueBuffer.CompareF(KNotifResp)) == 0)
- {
- val = KMmsMessageTypeMNotifyRespInd;
- }
- else if ((iValueBuffer.CompareF(KRetrConf)) == 0)
- {
- val = KMmsMessageTypeMRetrieveConf;
- }
- else if ((iValueBuffer.CompareF(KAckInd)) == 0)
- {
- val = KMmsMessageTypeAcknowledgeInd;
- }
- else if ((iValueBuffer.CompareF(KDelInd)) == 0)
- {
- val = KMmsMessageTypeDeliveryInd;
- }
- else if ((iValueBuffer.CompareF(KReadReqInd)) == 0)
- {
- val = KMmsMessageTypeReadRecInd;
- }
- else if ((iValueBuffer.CompareF(KReadOrigInd)) == 0)
- {
- val = KMmsMessageTypeReadOrigInd;
- }
- else if ((iValueBuffer.CompareF(KForwardRec)) == 0)
- {
- val = KMmsMessageTypeForwardReq;
- }
- else if ((iValueBuffer.CompareF(KForwardConf)) == 0)
- {
- val = KMmsMessageTypeForwardConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxStoreReq)) == 0)
- {
- val = KMmsMessageTypeMboxStoreReq;
- }
- else if ((iValueBuffer.CompareF(KMBoxStoreConf)) == 0)
- {
- val = KMmsMessageTypeMboxStoreConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxViewReq)) == 0)
- {
- val = KMmsMessageTypeMboxViewReq;
- }
- else if ((iValueBuffer.CompareF(KMBoxViewConf)) == 0)
- {
- val = KMmsMessageTypeMboxViewConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxUploadReq)) == 0)
- {
- val = KMmsMessageTypeMBoxUploadReq;
- }
- else if ((iValueBuffer.CompareF(KMBoxUploadConf)) == 0)
- {
- val = KMmsMessageTypeMBoxUploadConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxDeleteReq)) == 0)
- {
- val = KMmsMessageTypeMBoxDeleteReq;
- }
- else if ((iValueBuffer.CompareF(KMBoxDeleteConf)) == 0)
- {
- val = KMmsMessageTypeMBoxDeleteConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxDescr)) == 0)
- {
- val = KMmsMessageTypeMBoxDescr;
- }
- else if ((iValueBuffer.CompareF(KDeleteReq)) == 0)
- {
- val = KMmsMessageTypeDeleteReq;
- }
- else if ((iValueBuffer.CompareF(KDeleteConf)) == 0)
- {
- val = KMmsMessageTypeDeleteConf;
- }
- else if ((iValueBuffer.CompareF(KCancelReq)) == 0)
- {
- val = KMmsMessageTypeCancelReq;
- }
- else if ((iValueBuffer.CompareF(KCancelResp)) == 0)
- {
- val = KMmsMessageTypeCancelConf;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetMessageType( val );
- break;
- case ETestAttribute:
- val = 0;
- iByteBuffer->Des().Copy( iValueBuffer );
- if ((iByteBuffer->Des().CompareF(KTestBcc)) == 0)
- {
- val = KMmsAssignedBcc;
- }
- else if ((iByteBuffer->Des().CompareF(KTestCc)) == 0)
- {
- val = KMmsAssignedCc;
- }
- else if ((iByteBuffer->Des().CompareF(KTestContent)) == 0)
- {
- val = KMmsAssignedContent;
- }
- else if ((iByteBuffer->Des().CompareF(KTestContentType)) == 0)
- {
- val = KMmsAssignedContentType;
- }
- else if ((iByteBuffer->Des().CompareF(KTestDate)) == 0)
- {
- val = KMmsAssignedDate;
- }
- else if ((iByteBuffer->Des().CompareF(KTestDeliveryReport)) == 0)
- {
- val = KMmsAssignedDeliveryReport;
- }
- else if ((iByteBuffer->Des().CompareF(KTestDeliveryTime)) == 0)
- {
- val = KMmsAssignedDeliveryTime;
- }
- else if ((iByteBuffer->Des().CompareF(KTestExpiry)) == 0)
- {
- val = KMmsAssignedExpiry;
- }
- else if ((iByteBuffer->Des().CompareF(KTestFrom)) == 0)
- {
- val = KMmsAssignedFrom;
- }
- else if ((iByteBuffer->Des().CompareF(KTestMessageClass)) == 0)
- {
- val = KMmsAssignedMessageClass;
- }
- else if ((iByteBuffer->Des().CompareF(KTestMessageId)) == 0)
- {
- val = KMmsAssignedMessageId;
- }
- else if ((iByteBuffer->Des().CompareF(KTestMessageSize)) == 0)
- {
- val = KMmsAssignedMessageSize;
- }
- else if ((iByteBuffer->Des().CompareF(KTestPriority)) == 0)
- {
- val = KMmsAssignedPriority;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReadReply)) == 0)
- {
- val = KMmsAssignedReadReply;
- }
- else if ((iByteBuffer->Des().CompareF(KTestSubject)) == 0)
- {
- val = KMmsAssignedSubject;
- }
- else if ((iByteBuffer->Des().CompareF(KTestTo)) == 0)
- {
- val = KMmsAssignedTo;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReplyCharging)) == 0)
- {
- val = KMmsAssignedReplyCharging;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReplyChargID)) == 0)
- {
- val = KMmsAssignedReplyChargingID;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReplyCharg)) == 0)
- {
- val = KMmsAssignedReplyChargingDeadline;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReplyChargSize)) == 0)
- {
- val = KMmsAssignedReplyChargingSize;
- }
- else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentBy)) == 0)
- {
- val = KMmsAssignedPreviouslySentBy;
- }
- else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentDate)) == 0)
- {
- val = KMmsAssignedPreviouslySentDate;
- }
- else if ((iByteBuffer->Des().CompareF(KTestAdditionalHeaders)) == 0)
- {
- val = KMmsAssignedAdditionalHeaders;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxViewHeadersL().AttributeArray().InsertInOrder(val);
- break;
- case ETestDistributionIndicator:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetDistributionIndicator( val );
- break;
- case ETestLimit:
- aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if( error == KErrNone )
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(val);
- }
- break;
- case ETestMessageQuota:
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(val);
- }
- break;
- case ETestSizeQuota:
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(val);
- }
- break;
- case ETestMessageTotal:
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(val);
- }
- break;
- case ETestSizeTotal:
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(val);
- }
- break;
- case ETestMessageCount:
- aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(val);
- }
- break;
- case ETestAddKeyword:
- aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsAddToken, iValueBuffer);
- break;
- case ETestRemoveKeyword:
- aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsRemoveToken, iValueBuffer);
- break;
- case ETestFilterKeyword:
- aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsFilterToken, iValueBuffer);
- break;
- case ETestMMState:
- val = 0;
- if ((iValueBuffer.CompareF(KDraft)) == 0)
- {
- val = KMmsDraft;
- }
- else if ((iValueBuffer.CompareF(KSent)) == 0)
- {
- val = KMmsSent;
- }
- else if ((iValueBuffer.CompareF(KNew)) == 0)
- {
- val = KMmsNew;
- }
- else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
- {
- val = KMmsRetrieved;
- }
- else if ((iValueBuffer.CompareF(KForwarded)) == 0)
- {
- val = KMmsForwarded;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
- aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf )
- {
- aMmsHeaders.MMBoxViewHeadersL().MMStateArray().InsertInOrder( val );
- }
- else
- {
- aMmsHeaders.MMBoxMessageHeadersL().SetMMState( val );
- }
- break;
- case ETestQuota:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxViewHeadersL().SetMmsQuotas( val );
- break;
- case ETestStart:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMmsStart(val);
- }
- break;
- case ETestStore:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxMessageHeadersL().SetMmsStore( val );
- break;
- case ETestStored:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxMessageHeadersL().SetMmsStored( val );
- break;
- case ETestStoreStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KOk)) == 0)
- {
- val = KMmsStatusOk;
- }
- else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
- {
- val = KMmsErrorTransientFailure;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
- {
- val = KMmsErrorStoreStatusTransientNetworkProblem;
- }
- else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
- {
- val = KMmsErrorPermanentFailure;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
- {
- val = KMmsErrorPermanentServiceDenied;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
- {
- val = KMmsErrorPermanentMessageFormatCorrupt;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
- {
- val = KMmsErrorStoreStatusPermanentMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrMMBoxFull)) == 0)
- {
- val = KMmsErrorStoreStatusPermanentMmboxFull;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatus( val );
- break;
- case ETestStoreStatusText:
- aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatusTextL( iValueBuffer );
- break;
- case ETestTotals:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxViewHeadersL().SetMmsTotals( val );
- break;
-
- case ETestDeleteInfoIndex:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- order = val;
- break;
-
- case ETestApplicId:
- aMmsHeaders.SetApplicIdL( iValueBuffer );
- break;
- case ETestReplyApplicId:
- aMmsHeaders.SetReplyApplicIdL( iValueBuffer );
- break;
- case ETestApplicInfo:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetAuxApplicInfoL( iByteBuffer->Des() );
- break;
- case ETestContentClass:
- val = 0;
- if ((iValueBuffer.CompareF(KText)) == 0)
- {
- val = KMmsContentClassText;
- }
- else if ((iValueBuffer.CompareF(KImageBasic)) == 0)
- {
- val = KMmsContentClassImageBasic;
- }
- else if ((iValueBuffer.CompareF(KImageRich)) == 0)
- {
- val = KMmsContentClassImageRich;
- }
- else if ((iValueBuffer.CompareF(KVideoBasic)) == 0)
- {
- val = KMmsContentClassVideoBasic;
- }
- else if ((iValueBuffer.CompareF(KVideoRich)) == 0)
- {
- val = KMmsContentClassVideoRich;
- }
- else if ((iValueBuffer.CompareF(KMegaPixel)) == 0)
- {
- val = KMmsContentClassMegaPixel;
- }
- else if ((iValueBuffer.CompareF(KContentBasic)) == 0)
- {
- val = KMmsContentClassContentBasic;
- }
- else if ((iValueBuffer.CompareF(KContentRich)) == 0)
- {
- val = KMmsContentClassContentRich;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetContentClass( val );
- break;
- case ETestDrmContent:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetDrmContent( val );
- break;
- case ETestAdaptationAllowed:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetAdaptationAllowed( val );
- break;
- case ETestRecommendedRetrievalMode:
- val = 0;
- if ((iValueBuffer.CompareF(KManual)) == 0)
- {
- val = KMmsRecommendedRetrievalModeManual;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetRecommendedRetrievalMode( val );
- break;
- case ETestRecRetrievalModeText:
- aMmsHeaders.SetRecommendedRetrievalModeTextL( iValueBuffer );
- break;
- case ETestReplaceId:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
- break;
- case ETestStatusText:
- aMmsHeaders.SetResponseTextL( iValueBuffer );
- break;
- case ETestCancelId:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
- break;
- case ETestCancelStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KCancelSuccessful)) == 0)
- {
- val = KMmsCancelRequestSuccessfullyReceived;
- }
- else if ((iValueBuffer.CompareF(KCancelCorrupted)) == 0)
- {
- val = KMmsCancelRequestCorrupted;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetCancelStatus( val );
- break;
- default:
- break;
- }
- }
- else
- {
- switch(readStatus)
- {
- case ETestAlias:
- iAliasArray->AppendL( iValueBuffer );
- iAliasCount++;
- break;
-
- default:
- break;
- }
-
- }
- }
- return(-1);
-}
-
-// ---------------------------------------------------------
-// CMmsReadFile()::ReadRowL
-// ---------------------------------------------------------
-//
-TTestReadStatus CMmsReadFile::ReadRowL()
- {
-
- TBuf8<DefaultBufLen> RowBuffer;
- TBuf8<32> KeyBuffer;
-
- // READ ONE ROW AND DROP CR+LF FROM THE END OF LINE
- TChar delim( 10 );
- iReader->ReadL( RowBuffer, delim);
- TInt length = RowBuffer.Length();
- if ( RowBuffer.Length() < 2 )
- {
- return ETestEof;
- }
- RowBuffer.Delete(length - 2,2);
-
- // DROP POSSIBLE COMMENT OUT
- TInt pos = RowBuffer.Locate( ';' );
- if ( pos >= 0 ) RowBuffer.Delete( pos, length-pos-2 );
-
- if ( RowBuffer.Length() == 0 )
- {
- // the line contained only comment
- return ETestUnknown;
- }
-
- // First split the row (:)
- pos = RowBuffer.Locate( ':' );
- if (pos > 0)
- {
- TPtrC8 p = RowBuffer.Mid( pos+1 );
- length = p.Length();
- iValueBuffer.Zero();
- for (TInt i=0; i < length; ++i)
- {
- iValueBuffer.Append(p[i]);
- }
- iValueBuffer.Trim();
- TPtrC8 pp = RowBuffer.Left(pos);
- KeyBuffer.CopyUC(pp);
- KeyBuffer.Trim();
- }
- // TRY TO FIND CORRECT TAG
- if ((KeyBuffer.CompareF(KTestNewMessage)) == 0) return(ETestNewMessage);
- if ((KeyBuffer.CompareF(KTestMessageType)) == 0) return ETestMessageType;
- if ((KeyBuffer.CompareF(KTestDate)) == 0) return ETestDate;
- if ((KeyBuffer.CompareF(KTestFrom)) == 0) return ETestFrom;
- if ((KeyBuffer.CompareF(KTestTo)) == 0) return ETestTo;
- if ((KeyBuffer.CompareF(KTestCc)) == 0) return ETestCc;
- if ((KeyBuffer.CompareF(KTestBcc)) == 0) return ETestBcc;
- if ((KeyBuffer.CompareF(KTestSubject)) == 0) return ETestSubject;
- if ((KeyBuffer.CompareF(KTestExpiryRel)) == 0) return ETestExpiryRel;
- if ((KeyBuffer.CompareF(KTestExpiryAbs)) == 0) return ETestExpiryAbs;
- if ((KeyBuffer.CompareF(KTestDeliveryTimeRel)) == 0) return ETestDeliveryTimeRel;
- if ((KeyBuffer.CompareF(KTestDeliveryTimeAbs)) == 0) return ETestDeliveryTimeAbs;
- if ((KeyBuffer.CompareF(KTestPriority)) == 0) return ETestPriority;
- if ((KeyBuffer.CompareF(KTestSenderVisibility)) == 0) return ETestSenderVisibility;
- if ((KeyBuffer.CompareF(KTestDeliveryReport)) == 0) return ETestDeliveryReport;
- if ((KeyBuffer.CompareF(KTestReadReply)) == 0) return ETestReadReply;
- if ((KeyBuffer.CompareF(KTestNewAttachment)) == 0) return ETestNewAttachment;
- if ((KeyBuffer.CompareF(KTestAttachmentName)) == 0) return ETestAttaRecommendedName;
- if ((KeyBuffer.CompareF(KTestAttachmentContLoc)) == 0) return ETestAttachmentContLoc;
- if ((KeyBuffer.CompareF(KTestAttachmentType)) == 0) return ETestAttachmentType;
- if ((KeyBuffer.CompareF(KTestAttachmentCharset)) == 0) return ETestAttachmentCharset;
- if ((KeyBuffer.CompareF(KTestAttachmentCid)) == 0) return ETestAttachmentCid;
- if ((KeyBuffer.CompareF(KTestAttachmentRoot)) == 0) return ETestAttachmentRoot;
- if ((KeyBuffer.CompareF(KTestEndOfFile)) == 0) return ETestEof;
- if ((KeyBuffer.CompareF(KTestMessageClass)) == 0) return ETestMessageClass;
- if ((KeyBuffer.CompareF(KTestDelivRepSendAllow)) == 0) return ETestDelivReportSendAllow;
- if ((KeyBuffer.CompareF(KTestAlias)) == 0 ) return ETestAlias;
- if ((KeyBuffer.CompareF(KTestFromAlias)) == 0 ) return ETestFromAlias;
- if ((KeyBuffer.CompareF(KTestToAlias)) == 0 ) return ETestToAlias;
- if ((KeyBuffer.CompareF(KTestCcAlias)) == 0 ) return ETestCcAlias;
- if ((KeyBuffer.CompareF(KTestBccAlias)) == 0 ) return ETestBccAlias;
- if ((KeyBuffer.CompareF(KTestReplyCharging)) == 0 ) return ETestReplyCharging;
- if ((KeyBuffer.CompareF(KTestReplyChargAbs)) == 0 ) return ETestReplyChargAbs;
- if ((KeyBuffer.CompareF(KTestReplyChargRel)) == 0 ) return ETestReplyChargRel;
- if ((KeyBuffer.CompareF(KTestReplyChargSize)) == 0 ) return ETestReplyChargSize;
- if ((KeyBuffer.CompareF(KTestReplyChargID)) == 0 ) return ETestReplyChargID;
- if ((KeyBuffer.CompareF(KTestTID)) == 0 ) return ETestTID;
- if ((KeyBuffer.CompareF(KTestContentLocation)) == 0 ) return ETestContentLocation;
- if ((KeyBuffer.CompareF(KTestPreviouslySentIndex)) == 0 ) return ETestPreviouslySentIndex;
- if ((KeyBuffer.CompareF(KTestPreviouslySentBy)) == 0 ) return ETestPreviouslySentBy;
- if ((KeyBuffer.CompareF(KTestPreviouslySentDate)) == 0 ) return ETestPreviouslySentDate;
- if ((KeyBuffer.CompareF(KTestMessageId)) == 0 ) return ETestMessageId;
- if ((KeyBuffer.CompareF(KTestMessageSize)) == 0 ) return ETestMessageSize;
- if ((KeyBuffer.CompareF(KTestVersion)) == 0 ) return ETestVersion;
- if ((KeyBuffer.CompareF(KTestReadStatus)) == 0 ) return ETestReadStatus;
- if ((KeyBuffer.CompareF(KTestResponseStatus)) == 0 ) return ETestResponseStatus;
- if ((KeyBuffer.CompareF(KTestResponseText)) == 0 ) return ETestResponseText;
- if ((KeyBuffer.CompareF(KTestRetrieveStatus)) == 0 ) return ETestRetrieveStatus;
- if ((KeyBuffer.CompareF(KTestRetrieveText)) == 0 ) return ETestRetrieveText;
- if ((KeyBuffer.CompareF(KTestStatus)) == 0 ) return ETestStatus;
- if ((KeyBuffer.CompareF(KTestAttribute)) == 0 ) return ETestAttribute;
- if ((KeyBuffer.CompareF(KTestDistributionIndicator)) == 0 ) return ETestDistributionIndicator;
- if ((KeyBuffer.CompareF(KTestLimit)) == 0 ) return ETestLimit;
- if ((KeyBuffer.CompareF(KTestMessageQuota)) == 0 ) return ETestMessageQuota;
- if ((KeyBuffer.CompareF(KTestSizeQuota)) == 0 ) return ETestSizeQuota;
- if ((KeyBuffer.CompareF(KTestMessageTotal)) == 0 ) return ETestMessageTotal;
- if ((KeyBuffer.CompareF(KTestSizeTotal)) == 0 ) return ETestSizeTotal;
- if ((KeyBuffer.CompareF(KTestMessageCount)) == 0 ) return ETestMessageCount;
- if ((KeyBuffer.CompareF(KTestAddKeyword)) == 0 ) return ETestAddKeyword;
- if ((KeyBuffer.CompareF(KTestRemoveKeyword)) == 0 ) return ETestRemoveKeyword;
- if ((KeyBuffer.CompareF(KTestFilterKeyword)) == 0 ) return ETestFilterKeyword;
- if ((KeyBuffer.CompareF(KTestMMState)) == 0 ) return ETestMMState;
- if ((KeyBuffer.CompareF(KTestQuota)) == 0 ) return ETestQuota;
- if ((KeyBuffer.CompareF(KTestStart)) == 0 ) return ETestStart;
- if ((KeyBuffer.CompareF(KTestStore)) == 0 ) return ETestStore;
- if ((KeyBuffer.CompareF(KTestStored)) == 0 ) return ETestStored;
- if ((KeyBuffer.CompareF(KTestStoreStatus)) == 0 ) return ETestStoreStatus;
- if ((KeyBuffer.CompareF(KTestStoreStatusText)) == 0 ) return ETestStoreStatusText;
- if ((KeyBuffer.CompareF(KTestTotals)) == 0 ) return ETestTotals;
- if ((KeyBuffer.CompareF(KTestDeleteInfoIndex)) == 0 ) return ETestDeleteInfoIndex;
- if ((KeyBuffer.CompareF(KTestApplicId)) == 0 ) return ETestApplicId;
- if ((KeyBuffer.CompareF(KTestReplyApplicId)) == 0 ) return ETestReplyApplicId;
- if ((KeyBuffer.CompareF(KTestApplicInfo)) == 0 ) return ETestApplicInfo;
- if ((KeyBuffer.CompareF(KTestContentClass)) == 0 ) return ETestContentClass;
- if ((KeyBuffer.CompareF(KTestDrmContent)) == 0 ) return ETestDrmContent;
- if ((KeyBuffer.CompareF(KTestAdaptationAllowed)) == 0 ) return ETestAdaptationAllowed;
- if ((KeyBuffer.CompareF(KTestRecommendedRetrievalMode)) == 0 ) return ETestRecommendedRetrievalMode;
- if ((KeyBuffer.CompareF(KTestRecRetrievalModeText)) == 0 ) return ETestRecRetrievalModeText;
- if ((KeyBuffer.CompareF(KTestReplaceId)) == 0 ) return ETestReplaceId;
- if ((KeyBuffer.CompareF(KTestStatusText)) == 0 ) return ETestStatusText;
- if ((KeyBuffer.CompareF(KTestCancelId)) == 0 ) return ETestCancelId;
- if ((KeyBuffer.CompareF(KTestCancelStatus)) == 0 ) return ETestCancelStatus;
- if ((KeyBuffer.CompareF(KTestAttContTypeParamName)) == 0 ) return ETestAttContTypeParamName;
- if ((KeyBuffer.CompareF(KTestAttContTypeParamValue)) == 0 ) return ETestAttContTypeParamValue;
- if ((KeyBuffer.CompareF(KTestAttXTypeParamName)) == 0 ) return ETestAttXTypeParamName;
- if ((KeyBuffer.CompareF(KTestAttXTypeParamValue)) == 0 ) return ETestAttXTypeParamValue;
- return ETestUnknown;
- }
-
-// ---------------------------------------------------------
-// CMmsReadFile()::CreateMessageL
-// program build a message from given parts
-// ---------------------------------------------------------
-//
-void CMmsReadFile::CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders )
- {
-
- // Reset inactivity timer to keem viewServer from crashing
- User::ResetInactivityTime();
-
- TInt i;
- TInt error = KErrNone;
- RFile attaFile;
- _LIT8(KLeftAngle, "<");
- _LIT8(KRightAngle, ">");
- // we can't use "seconds from" as it only returns a
- // 32 bit signed integer. If fails in 2038.
- // "microseconds from" returns a 64 bit signed integer
-
- CMsvStore* store = aMmsClient->Entry().EditStoreL();
- CleanupStack::PushL(store);
- aMmsHeaders->StoreL(*store);
- store->CommitL();
- CleanupStack::PopAndDestroy( store );
- store = NULL;
-
- aMmsClient->LoadMessageL(); // read store is needed to do this
-
- store = aMmsClient->Entry().EditStoreL();
- CleanupStack::PushL(store);
- CMsvAttachment* attaInfo = NULL;
- TMsvAttachmentId attaId = 0;
-
- for ( i=0; i < iAttaStructures->Count(); ++i)
- {
- attaId = KMsvNullIndexEntryId;
- iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
-
- error = attaFile.Open( iFs, iFilename, EFileShareReadersOnly | EFileRead );
- User::LeaveIfError( error );
-
- CleanupClosePushL(attaFile);
-
- CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
- CleanupStack::PushL( mimeHeaders );
- TPtrC8 contentType = iAttaStructures->At(i)->iAttaType->Des();
-
- TDataRecognitionResult result;
- result.Reset(); // make sure that it is cleared
-
- if(iAttaStructures->At(i)->iAttaCid->Length())
- {
- TPtr8 attaCID = iAttaStructures->At(i)->iAttaCid->Des();
- if (attaCID.Find(KLeftAngle) == 0 &&
- attaCID.Find(KRightAngle) == attaCID.Length()-1 )
- {
- // remove angle brackets from cid
- attaCID = attaCID.Mid(1,attaCID.Length()-2);
- }
- mimeHeaders->SetContentIdL(attaCID);
- }
-
- if (iAttaStructures->At(i)->iAttaCharset)
- {
- mimeHeaders->SetMimeCharset(iAttaStructures->At(i)->iAttaCharset);
- }
-
- if (iAttaStructures->At(i)->iAttaName->Length())
- {
- iFilename.Copy(iAttaStructures->At(i)->iAttaName->Des());
- }
- iParse.Set( iFilename, NULL, NULL );
- iFilename.Copy( iParse.NameAndExt() );
-
- mimeHeaders->SetContentLocationL( iFilename );
-
- // if Mime type has not been set, use RapaRecognizer
- if ( iAttaStructures->At(i)->iAttaType->Length() == 0 && iFilename.Length() > 0)
- {
- // TO BE IMPLEMENTED
-
- RApaLsSession lsSession;
-
- if ( lsSession.Connect() == KErrNone )
- {
- CleanupClosePushL( lsSession );
-
- iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
- if ( lsSession.RecognizeData( iFilename, TPtrC8(), result ) == KErrNone )
- {
- // Check confidence level. Recognization must be at least
- // "EProbable". We don't accept the result if it is "EPossible"
- // or "EUnlikely" or "ENotRecognized"!
-
- if ( result.iConfidence < CApaDataRecognizerType::EProbable )
- {
- result.Reset(); // clear buffer and try again with longer buffer
- }
-
- TPtrC8 mimeBuf8 = result.iDataType.Des8();
-
- if ( mimeBuf8.Length() == 0 )
- {
- // Open file buffer and try again..
-
- TInt bufSize = 0;
- (void)lsSession.GetMaxDataBufSize( bufSize ); // ignore errors
- if ( bufSize <= 0 )
- {
- bufSize = 30;
- }
- HBufC8* buf = HBufC8::NewLC( bufSize );
- TPtr8 des = buf->Des();
-
- RFile file;
- TInt err=file.Open( iFs, iFilename, EFileShareReadersOnly );
- if ( err == KErrNone )
- {
- err = file.Read( des );
- file.Close();
- if ( err == KErrNone )
- {
- if ( ( lsSession.RecognizeData( iFilename, des, result ) ) == KErrNone )
- {
- mimeBuf8.Set( result.iDataType.Des8() );
- }
- }
-
- }
- CleanupStack::PopAndDestroy(); // buf
- }
- if ( mimeBuf8.Length() > 0 &&
- result.iConfidence >= CApaDataRecognizerType::EProbable )
- {
- contentType.Set( result.iDataType.Des8() );
- }
- }
- CleanupStack::PopAndDestroy(1); // lssession
- }
- }
-
- if ( contentType.Length() > 0 )
- {
- TInt position = contentType.Find( KMmsSlash8 );
- if ( position >= 0 )
- {
- mimeHeaders->SetContentTypeL( contentType.Left( position ) );
- }
- if ( position < contentType.Length() - 1 )
- {
- mimeHeaders->SetContentSubTypeL( contentType.Mid( position + 1 ) );
- }
-// CreateAttachment2L sets the content type to attaInfo
-// attaInfo->SetMimeTypeL( contentType );
- }
-
- if (iAttaStructures->At(i)->iAttaRecommendedName->Length())
- {
- iFilename.Copy(iAttaStructures->At(i)->iAttaRecommendedName->Des());
- iParse.Set( iFilename, NULL, NULL );
- iFilename.Copy( iParse.NameAndExt() );
- mimeHeaders->SetSuggestedFilenameL( iFilename );
- }
-
- TInt j = 0;
- for ( j = 0; j < iAttaStructures->At(i)->iContentTypeParams->MdcaCount(); ++j )
- {
- mimeHeaders->ContentTypeParams().AppendL( iAttaStructures->At(i)->iContentTypeParams->MdcaPoint( j ) );
- }
- for ( j = 0; j < iAttaStructures->At(i)->iXTypeParams->MdcaCount(); ++j )
- {
- mimeHeaders->XTypeParams().AppendL( iAttaStructures->At(i)->iXTypeParams->MdcaPoint( j ) );
- }
-
- attaInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
- // attaInfo does not go onto cleaunpstack because ownership will
- // be transferred to attachment manager.
-
- aMmsClient->CreateAttachment2L(
- *store,
- attaFile,
- contentType,
- *mimeHeaders,
- attaInfo,
- attaId);
- attaInfo = NULL; // ownership transferred
-
- CleanupStack::PopAndDestroy(); // mimeHeaders
- CleanupStack::PopAndDestroy(); // attaFile.Close()
-
- if ( iAttaRoot > 0 && iAttaRoot == ( i + 1 ) )
- {
- aMmsClient->SetMessageRootL( attaId );
- }
- }
-
- store->CommitL();
- CleanupStack::PopAndDestroy(); // store
-
- // This frees all memory and resets all values
- Reset();
- // Reset inactivity timer to keem viewServer from crashing
- User::ResetInactivityTime();
- }
-
-
-// ---------------------------------------------------------
-// CMmsReadFile()::FindAlias
-// program build a message from given parts
-// ---------------------------------------------------------
-//
-TInt CMmsReadFile::FindAlias( TPtrC aAlias )
- {
- TBuf<DefaultBufLen> abuf;
- for( TInt i=0; i < iAliasCount; ++i )
- {
- abuf.Copy( iAliasArray->MdcaPoint(i) );
- abuf.SetLength( abuf.Locate('=') );
- if( ( abuf.CompareF( aAlias ) ) == 0 ) return( i );
- }
- return( -1 );
- }
-
-
-// C++ default constructor can NOT contain any code, that
-// might leave.
-//
-CMmsAttaStructure::CMmsAttaStructure()
- {
- iAtta = NULL;
- iAttaType = NULL;
- iAttaName = NULL;
- iAttaCid = NULL;
- iAttaRecommendedName = NULL;
- }
-
-
-//
-void CMmsAttaStructure::ConstructL()
- {
- iAtta = HBufC8::NewL(DefaultBufLen);
- iAttaType = HBufC8::NewL(DefaultBufLen);
- iAttaName = HBufC8::NewL(DefaultBufLen);
- iAttaCid = HBufC8::NewL(DefaultBufLen);
- iAttaRecommendedName = HBufC::NewL(DefaultBufLen);
- iAttaCharset = 0;
- iXTypeParams = new(ELeave) CDesC8ArrayFlat(4);
- iContentTypeParams = new(ELeave) CDesC8ArrayFlat(4);
-
- }
-
-// Two-phased constructor.
-CMmsAttaStructure* CMmsAttaStructure::NewL()
- {
- CMmsAttaStructure* self = new ( ELeave ) CMmsAttaStructure;
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop();
- return self;
- }
-
-// Destructor
-CMmsAttaStructure::~CMmsAttaStructure()
- {
- delete iAtta;
- delete iAttaName;
- delete iAttaType;
- delete iAttaCid;
- delete iAttaRecommendedName;
- if ( iContentTypeParams )
- {
- iContentTypeParams->Reset();
- }
- delete iContentTypeParams;
- if ( iXTypeParams )
- {
- iXTypeParams->Reset();
- }
- delete iXTypeParams;
- }
-
-
-// End of File
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/src/mmstestbed.cpp Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2357 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#include <mtmdef.h>
-#include <CoreApplicationUIsSDKCRKeys.h>
-#include <mmsheaders.h>
-#include <mmscmds.h>
-#include <mmsencode.h>
-#include <mmscliententry.h>
-#include <logwrap.h>
-#include <logcli.h>
-#include <logview.h>
-#include "mmssettings.h" //use mmssettings.h instead of cmmssettings.h
-#include "mmstestbed.h"
-#include "mmsreadfile.h"
-#include "mmstestuitimer.h"
-#include "mmsteststaticutils.h"
-#include "mmstestbed.hrh"
-
-//constants
-_LIT( KMmsSender, "0601234567" );
-
-MmsTestBed::MmsTestBed()
- {
- //start the timer
- iTimer = CTestUiTimer::NewL();
- iTimer->Cancel();
-
- iWait = CMsvOperationActiveSchedulerWait::NewLC();
- // don't leave iWait on cleanup stack
- CleanupStack::Pop();
-
- //open msvsession
- iSession = CMsvSession::OpenSyncL(*this);
- //create client registry
- iClientMtmRegistry = CClientMtmRegistry::NewL(*iSession);
- //create client mtm
- iMmsClient = (CMmsClientMtm *) iClientMtmRegistry->NewMtmL(
- KUidMsgTypeMultimedia);
-
- User::LeaveIfError( iFs.Connect() );
- iFs.SetSessionPath( KRootPath );
- iSettings = CMmsSettings::NewL();
- iMmsHeaders = CMmsHeaders::NewL(iSettings->MmsVersion());
- findDefaultL();
- iServiceId = iDefaultServiceId;
-
- //validate the settings
- iSettings->ValidateSettings();
-
- iLogEvent = CLogEvent::NewL();
- iLogEvent->SetEventType(KLogMmsEventTypeUid);
- iLogClient = NULL; // we test soon if this is available
- iLogView = NULL; // needs log client
- if ( checkLogClient() )
- {
- // first we generate a general view of all events
- // we'll set the filter when we update the view
- iLogView = CLogViewEvent::NewL( *iLogClient );
- }
- iLogFilter = CLogFilter::NewL();
- // we try to filter MMS events
- iLogFilter->SetEventType(KLogMmsEventTypeUid);
- }
-
-MmsTestBed::~MmsTestBed()
- {
- delete iLogView;
- delete iLogFilter;
- delete iLogClient;
- delete iLogEvent;
- delete iSettings;
- delete iMmsHeaders;
- if(iTimer)
- {
- iTimer->Cancel();
- delete iTimer;
- }
- //delete iMsvEntrySelection;
- delete iMmsClient;
- delete iClientMtmRegistry;
- //delete iClientMtmRegistry;
- delete iSession;
- delete iWait;
- }
-
-void MmsTestBed::setConnectionLocal(bool value)
- {
- //value = true for global off, local on
- //value = false for global on, local off
- iSettings->LoadSettingsL();
- iSettings->SetLocalMode( value );
- iSettings->SaveSettingsL();
- }
-
-void MmsTestBed::fromOutboxToMmsc()
- {
- CMsvEntry* cEntry = NULL;
-
- // Get List of services
- cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
- CleanupStack::PushL(cEntry);
- // Get all mms messages of outbox
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL(
- KUidMsgTypeMultimedia);
- CleanupStack::PushL(selection);
-
- // Change state to "KMsvSendStateUnknown" in case the entry has been suspended earlier
- for (TInt i = 0; i < selection->Count(); ++i)
- {
- cEntry->SetEntryL(selection->At(i));
- TMsvEntry entry = cEntry->Entry();
- entry.SetReadOnly(EFalse);
- entry.SetSendingState(KMsvSendStateUnknown);
- cEntry->ChangeL(entry);
- }
-
- selection->InsertL(0, iServiceId);
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack(parameters);
-
- op = iSession->TransferCommandL(*selection, EMmsSend, paramPack,
- iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending)
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if (iWait->iStatus.Int() != KErrNone)
- {
- //DEBUG(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- CleanupStack::PopAndDestroy(); //cEntry
- }
-
-void MmsTestBed::fromMmscToInbox()
- {
- CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
- CleanupStack::PushL(msvEntrySelection);
-
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- msvEntrySelection->InsertL(0, iServiceId);
- }
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack(parameters);
-
- op = iMmsClient->InvokeAsyncFunctionL(EMmsReceive, *msvEntrySelection,
- paramPack, iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending)
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if (iWait->iStatus.Int() != KErrNone)
- {
- //DEBUG(_L("Testbed tried to receive, return status %d"),iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); //msvEntrySelection
- }
-
-void MmsTestBed::findDefaultL()
- {
- iSettings->LoadSettingsL();
- iDefaultServiceId = iSettings->Service();
- }
-
-void MmsTestBed::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
- TAny* aArg2, TAny* /*aArg3*/)
- {
- iEvent = aEvent;
- if (aEvent == EMsvGeneralError)
- {
- return;
- }
- TMsvId parentId = KMsvNullIndexEntryId;
- if (aArg2 != NULL)
- {
- parentId = *(TMsvId*) aArg2;
- }
-
- CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
- TMsvEntry tEntry;
- TMsvId service;
- TInt error = KErrNone;
- error = iSession->GetEntry(selection->At(0), service, tEntry);
-
- CMsvEntry* cEntry = NULL;
- switch (aEvent)
- {
- case EMsvEntriesCreated:
- {
- if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
- {
- // emit signal for new entry into INBOX
- emit entryCreatedInInbox(tEntry.Id());
- }
- else if (parentId == KMsvDraftEntryIdValue)
- {
- // emit signal for new entry into Draft
- emit entryCreatedInDraft(tEntry.Id());
- }
- else if (parentId == iServiceId)
- {
- // emit signal for new Entry into SERVICE
- }
- else
- {
- // do nothing
- }
- }
- break;
- case EMsvEntriesChanged:
- {
- TMsvId id;
- CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
- if (selection == NULL)
- {
- // no selection, cannot handle
- return;
- }
- id = selection->At(0);
- //DEBUG Entry changed"));
- if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
- {
-/*
- cEntry = iSession->GetEntryL( parentId );
- CleanupStack::PushL( cEntry );
- TRAPD (error, cEntry->SetEntryL( id ));
- if ( error != KErrNone )
- {
- CleanupStack::PopAndDestroy(); // cEntry
- return;
- }
- TMsvEntry tEntry = cEntry->Entry();
- if ( tEntry.Visible() )
- {
- // generate fake delivery report
- CMsvStore* store = cEntry->ReadStoreL();
- CleanupStack::PushL( store );
- CMmsHeaders* mmsHeaders = CMmsHeaders::NewL( iSettings->MmsVersion() );
- CleanupStack::PushL( mmsHeaders );
- mmsHeaders->RestoreL( *store );
- iEncodeBuffer->ResizeL( 0 );
- generateDeliveryReport( mmsHeaders );
- CleanupStack::PopAndDestroy( 2 ); // mmsHeaders, store
- }
- CleanupStack::PopAndDestroy(); // cEntry
-*/
- }
- }
- break;
- case EMsvEntriesDeleted:
- {
- //emit signal for entry deleted
- }
- break;
- case EMsvEntriesMoved:
- {
- if (parentId == KMsvGlobalOutBoxIndexEntryIdValue)
- {
- // entry moved to outbox
- emit entryMovedToOutbox(tEntry.Id());
- }
- else if (parentId == KMsvSentEntryIdValue)
- {
- // entry moved to sent folder
- emit entryMovedToSent(tEntry.Id());
- }
- else
- {
- // do nothing
- }
- }
- break;
- default:
- break;
- }
- }
-
-void MmsTestBed::createMmsService()
- {
- CMmsSettings * settings = CMmsSettings::NewL();
- CleanupStack::PushL( settings );
- settings->CreateNewServiceL( *iSession );
- CleanupStack::PopAndDestroy(); // settings
- return;
- }
-
-void MmsTestBed::cleanup()
- {
- TMsvId entryToBeKilled;
- // Get access to root index
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
-
- entryToBeKilled = iSettings->Service();
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- while (entryToBeKilled != KMsvNullIndexEntryId)
- {
- // delete child of root entry
- deleteEntry(entryToBeKilled, *cEntry);
- entryToBeKilled = iSettings->Service();
- }
-
- CleanupStack::PopAndDestroy(); // cEntry
- // We deleted everything!
- iDefaultServiceId = KMsvNullIndexEntryId;
- iServiceId = KMsvNullIndexEntryId;
- }
-
-void MmsTestBed::deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry)
- {
- aClientEntry.DeleteL(aEntryId);
- }
-
-void MmsTestBed::cleanupAndCreateNewService()
- {
- cleanup();
- // all old service entries have been destroyed, create a new one
- createMmsService();
- }
-
-void MmsTestBed::testFile(TFileName& aFilePath, TInt aCommand /* = 0 */, TMsvId aBox /* = KMsvGlobalOutBoxIndexEntryId */ )
- {
- // update settings in mmsclient
- iMmsClient->RestoreSettingsL();
- iSettings->CopyL( iMmsClient->MmsSettings() );
-
- RFileReadStream readStream;
- readStream.PushL();
-// TMsvId id = KMsvNullIndexEntryId;
- CBufFlat* encodeBuffer = NULL;
- CMmsEncode* encoder = NULL;
-
- // Open the file
- TInt err = readStream.Open(iFs, aFilePath, EFileShareReadersOnly );
- if (err != KErrNone) User::Leave( err );
-
- TInt retCode = 0;
- CMmsReadFile* readFile = NULL;
- readFile = CMmsReadFile::NewL( iFs, readStream );
- CleanupStack::PushL( readFile );
-
- TInt messageCounter = 0;
- CMsvEntry* cEntry = NULL;
-
- while(!retCode)
- {
- // READ MESSAGE TO BUFFERS
- iMmsHeaders->Reset(iSettings);
- // put in some message type just for fun (testing...)
- iMmsHeaders->SetMessageType( KMmsMessageTypeForwardReq );
- retCode = readFile->CompleteTestL( messageCounter++, *iMmsHeaders );
- if(readFile->iMessageType == ETestNewMessage)
- {
- // CREATE MESSAGE ENTRY
- switch ( aCommand )
- {
- case ECreateToInbox:
- case ECreateNotification:
- cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
- break;
- case ECreateToSentItems:
- cEntry = iSession->GetEntryL(KMsvSentEntryId);
- break;
- case ECreateToDrafts:
- cEntry = iSession->GetEntryL(KMsvDraftEntryId);
- break;
- case ECreateHeadersFromFile:
- // here we just encode headers, no message entry
- // the entry is fake.
- break;
- case ECreateMMBoxViewConf:
- if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
- {
- // entry is not created for the description items
- // they become attachments
- cEntry = iSession->GetEntryL(KMsvDraftEntryId);
- }
- break;
- default:
- cEntry = iSession->GetEntryL(aBox);
- break;
- }
-
- // if we are just playing with headers we have no entry
- if ( aCommand != ECreateHeadersFromFile && aCommand != ECreateMMBoxViewConf )
- {
- CleanupStack::PushL(cEntry);
- iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
-
- // CREATE MESSAGE
- iMmsClient->CreateMessageL(iServiceId);
- }
- else if ( aCommand == ECreateMMBoxViewConf )
- {
- if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
- {
- CleanupStack::PushL(cEntry);
- iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
-
- // CREATE MESSAGE
- iMmsClient->CreateMessageL(iServiceId);
- }
- else
- {
- encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
- CleanupStack::PushL( encodeBuffer );
- encoder = CMmsEncode::NewL( iFs );
- CleanupStack::PushL( encoder );
-
- // encode headers to a binary file
- encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
-
- iFilename = KMmsMMBoxDescriptionDirectory;
- TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
-
- CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
- encodeBuffer = NULL;
- encoder = NULL;
- }
- }
- else
- {
- encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
- CleanupStack::PushL( encodeBuffer );
- encoder = CMmsEncode::NewL( iFs );
- CleanupStack::PushL( encoder );
-
- // encode headers to a binary file
- encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
-
- iFilename = KMmsDumpDirectory;
- TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
-
- CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
- encodeBuffer = NULL;
- encoder = NULL;
- }
- }
-
- if ( aCommand != ECreateHeadersFromFile &&
- ( aCommand != ECreateMMBoxViewConf || iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf ) )
- {
- if(readFile->iMessageType == ETestSettings)
- {
- TMsvId ServiceId = iMmsClient->DefaultServiceL();
- iMmsClient->RestoreSettingsL();
- iSettings->CopyL( iMmsClient->MmsSettings() );
- }
-
- TMemoryInfoV1Buf memory;
- UserHal::MemoryInfo( memory );
- TInt available = memory().iFreeRamInBytes;
-// TMmsLogger::Log(_L("Free memory before CreateMessageL %d"), available );
-
- TRAP (err, readFile->CreateMessageL(iMmsClient, iMmsHeaders));
-
- available = memory().iFreeRamInBytes;
-// TMmsLogger::Log(_L("Free memory after CreateMessageL %d"), available );
-
- if(readFile->iMessageType == ETestNewMessage)
- {
- TMsvEntry tEntry = iMmsClient->Entry().Entry();
- TMsvId id = tEntry.Id();
- if ( err == KErrNone )
- {
- // SAVE MESSAGE
- iMmsClient->SaveMessageL();
-
- // If we are creating a MMBox View confirmation,
- // we add all binary files from KMmsMMBoxDirectory
- // as attachments.
-
- if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
- {
- addMMBoxDescriptions();
- }
-
- // reload the entry in case mms client put something into it
- // MESSAGE MUST BE SET VISIBLE
- tEntry = iMmsClient->Entry().Entry();
- if ( iMmsClient->MessageClass() == EMmsClassAdvertisement )
- {
- tEntry.iMtmData1 |= KMmsMessageAdvertisement;
- }
- else if ( iMmsClient->MessageClass() == EMmsClassInformational )
- {
- tEntry.iMtmData1 |= KMmsMessageInformational;
- }
- tEntry.iMtmData1 &= ~KMmsMessageMobileTerminated;
-
- // Test: Set all as editor oriented - except notifications!
- if ( aCommand == ECreateNotification )
- {
- tEntry.iMtm = KUidMsgMMSNotification;
- }
- else
- {
- tEntry.iMtmData1 |= KMmsMessageEditorOriented;
- }
- if ( aCommand == ECreateToInbox )
- {
- tEntry.iMtmData1 |= KMmsMessageMobileTerminated;
- tEntry.SetReadOnly( ETrue );
- tEntry.SetNew( ETrue );
- tEntry.SetUnread( ETrue );
- }
- else if ( aCommand == ECreateToSentItems )
- {
- tEntry.SetReadOnly( ETrue );
- }
- tEntry.SetVisible( ETrue );
- tEntry.SetInPreparation( EFalse );
- TTime now;
- now.UniversalTime();
- tEntry.iDate = now;
- TMsvId entryId = tEntry.Id();
- iMmsClient->Entry().ChangeL( tEntry );
- if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
- {
- // Encode to the directory that is used to fetch MMBox view
- iFilename.Copy( KMmsMMBoxDirectory );
- encodeMessageFromDrafts();
- cEntry->SetEntryL( KMsvDraftEntryId );
- cEntry->DeleteL( entryId );
- }
- }
- else
- {
- //TMmsLogger::Log(_L("CreateMessageL left with error %d"), err );
- iSession->RemoveEntry(id);
- err = KErrNone; // clear error
- }
- CleanupStack::PopAndDestroy(); // cEntry
- cEntry = NULL;
- }
- if(readFile->iMessageType == ETestSettings)
- {
- iMmsClient->SetSettingsL( *iSettings );
- iMmsClient->StoreSettingsL();
- }
- }
- }
-
- CleanupStack::PopAndDestroy(); //readFile
-
- readStream.Close();
- readStream.Pop();
-
- /*
- iMmsClient->SwitchCurrentEntryL(id);
- */
- }
-
-void MmsTestBed::addMMBoxDescriptions()
- {
- // add the contents of KMmsMMBoxDescriptionDirectory as attachments
- CDir* fileList = NULL;
- TInt i = 0; // general counter
- TInt error = KErrNone;
- iCurrentPath = KMmsMMBoxDescriptionDirectory;
-
- iFs.SetSessionPath(iCurrentPath);
-
- TFindFile finder( iFs );
- error = finder.FindWildByPath( KWild, NULL, fileList );
- CleanupStack::PushL( fileList );
- TInt fileCounter = 0;
-
- if ( error == KErrNone )
- {
- fileCounter = fileList->Count();
- }
-
- TEntry entry;
-
- if ( error == KErrNone )
- {
- for ( i = 0; i < fileCounter; ++i )
- {
- // Reset inactivity timer to keep viewServer from crashing
- User::ResetInactivityTime();
- entry = (*fileList)[i]; // name is entry.iName
- iFilename.Copy( iCurrentPath );
- iFilename.Append( entry.iName );
- TPtrC ptr;
- ptr.Set( iFilename );
- iWait->iStatus = KErrNone;
- iMmsClient->AddAttachmentL( ptr, KMmsMimeType, 0, iWait->iStatus );
-
- iWait->Start();
- // The descriptions are cleared after being used
- iFs.Delete( ptr);
- }
- }
-
- iMmsClient->SaveMessageL(); // just in case somthing must be updated
- CleanupStack::PopAndDestroy(); // fileList
- fileList = NULL;
- }
-
-void MmsTestBed::encodeMessageFromDrafts()
- {
- CMmsEncode* encoder = CMmsEncode::NewL( iFs );
- CleanupStack::PushL( encoder );
- // encode a message iMmsClientPoints to
- iMmsClient->LoadMessageL();
- CMsvStore* store = iMmsClient->Entry().ReadStoreL();
- CleanupStack::PushL( store );
- iMmsHeaders->RestoreL( *store );
- CleanupStack::PopAndDestroy(); // store
- store = NULL;
- iWait->iStatus = KErrNone;
-
-// caller sets the directory
-// iFilename = KMmsMessageDumpDirectory;
-
- CMmsClientEntry* entryWrapper = CMmsClientEntry::NewL( iFs, iMmsClient->Entry(), iServiceId );
- CleanupStack::PushL( entryWrapper );
- iEncodeBuffer->ResizeL(0);
- encoder->StartL( *entryWrapper, *iMmsHeaders, *iEncodeBuffer, iWait->iStatus );
- iWait->Start();
- if ( iWait->iStatus == KErrNone )
- {
- TMmsTestUtils::Dump( *iEncodeBuffer, iFilename, iParse, iFs );
- }
- iEncodeBuffer->ResizeL(0);
- CleanupStack::PopAndDestroy(); // entryWrapper
- CleanupStack::PopAndDestroy(); // encoder
- }
-
-void MmsTestBed::deleteNotifications()
- {
- TMsvId mmsFolderId = KMsvNullIndexEntryId;
- mmsFolderId = findMMSFolder();
-
- CMsvEntry* cEntry = NULL;
- // delete all messages from the specified box
- cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
-
- if ( mmsFolderId != KMsvNullIndexEntryId )
- {
- cEntry->SetEntryL(mmsFolderId);
-
- // show invisible entries
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PushL(msvEntrySelection);
-
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- if (msvEntrySelection->Count() > 0)
- {
- CMsvOperation* op = iSession->TransferCommandL(
- *msvEntrySelection,
- EMmsDeleteEntries,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- CleanupStack::PopAndDestroy(); // op
- }
-
- // These cannot be deleted unless we have the a server mtm
- // corresponding to this mtm type.
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- CleanupStack::PopAndDestroy(); //msvEntrySelection
- msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgMMSNotification );
- CleanupStack::PushL(msvEntrySelection);
-
- if (msvEntrySelection->Count() > 0)
- {
- CMsvOperation* op = iSession->TransferCommandL(
- *msvEntrySelection,
- EMmsDeleteEntries,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- CleanupStack::PopAndDestroy(); // op
- }
-
- CleanupStack::PopAndDestroy(); //msvEntrySelection
-
- CleanupStack::PopAndDestroy(); //cEntry
- }
- }
-
-TMsvId MmsTestBed::findMMSFolder()
- {
- return iSettings->NotificationFolder();
- }
-
-void MmsTestBed::restoreFactorySettings()
- {
- iMmsClient->RestoreSettingsL();
- iSettings->CopyL( iMmsClient->MmsSettings() );
- // do not reset access point
- TInt accessPoint = iSettings->AccessPoint( 0 );
- iSettings->RestoreFactorySettingsL( iMmsClient->Session(), EMmsFactorySettingsLevelDeep );
- TInt count = iSettings->AccessPointCount();
- TInt i = 0;
- for ( i = count - 1; i >= 0; --i )
- {
- iSettings->DeleteAccessPointL( i );
- }
- // restore the original access point
- if ( accessPoint > 0 )
- {
- // a negative access point is an error (most likely "KErrNotFound")
- iSettings->AddAccessPointL( accessPoint, 0 );
- }
- iMmsClient->SetSettingsL( *iSettings );
- iMmsClient->StoreSettingsL();
- }
-
-void MmsTestBed::setFetchingState( TMmsReceivingMode aState )
- {
- iMmsClient->RestoreSettingsL();
- iSettings->CopyL( iMmsClient->MmsSettings() );
-
- iSettings->SetReceivingModeHome( aState );
-
- iMmsClient->SetSettingsL( *iSettings );
- iMmsClient->StoreSettingsL();
- }
-
-void MmsTestBed::sendFromFile()
- {
- CMsvOperation * op = NULL;
-
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
- CleanupStack::PushL( cEntry );
-
- CMsvEntrySelection* selection = NULL;
- selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PopAndDestroy(); // cEntry
- CleanupStack::PushL( selection );
-
- TRAPD (error, op = iMmsClient->SendL(*selection, iWait->iStatus));
- if ( error != KErrNone )
- {
- CleanupStack::PopAndDestroy(); // selection
- delete op;
- return;
- }
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(2); // op, selection
- }
-
-void MmsTestBed::sendOneByOne()
- {
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
- CleanupStack::PushL( cEntry );
-
- CMsvEntrySelection* selection = NULL;
- selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PushL( selection );
-
- CMsvEntrySelection* shortSelection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( shortSelection );
-
- TInt i;
-
- for ( i = 0; i < selection->Count(); ++i )
- {
- shortSelection->Reset();
- shortSelection->AppendL( selection->At( i ) );
-
- CMsvOperation * op = NULL;
-
- TTime now;
- now.UniversalTime();
-
- TRAPD (error, op = iMmsClient->SendL(*shortSelection, iWait->iStatus, now ));
- if ( error != KErrNone )
- {
- delete op;
- CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
- return;
- }
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
-
- }
- CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
- }
-
-void MmsTestBed::sendNotifications()
- {
- // Only send one notification!!
-
- TInt error = KErrNone;
-
- if (! TMmsTestUtils::IsFile(iCurrentFile, iFs) )
- {
- //Not a file
- return;
- }
- TMsvId mmsFolder = findMMSFolder();
-
- TEntry entry;
-
-
- // now I think we have a filename
- TEntry orgEntry;
- TUint size = 0;
- error = iFs.Entry( iCurrentFile, orgEntry );
- size = orgEntry.iSize;
-
- //TMmsLogger::Log(_L("- notification %S "), &iCurrentFile);
- if ( size == 0 )
- {
- //empty file
- //TMmsLogger::Log(_L("- empty file"));
- return;
- }
-
- if ( iEncodeBuffer == NULL )
- {
- iEncodeBuffer = CBufFlat::NewL( size );
- }
- else
- {
- iEncodeBuffer->ResizeL( 0 );
- iEncodeBuffer->ResizeL( size );
- }
-
- RFile inFile;
- error = inFile.Open( iFs, iCurrentFile, EFileShareReadersOnly );
- TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
- if ( error == KErrNone )
- {
- error = inFile.Read( ptr, size );
- inFile.Close();
- }
- else
- {
- //Error
- //TMmsLogger::Log(_L("- can't read file"));
- return;
- }
-
- TUint8 byte;
- TUint position = 0;
- TUint32 uintvar = 0;
-
- if ( size > 2 )
- {
- iEncodeBuffer->Read( 1, &byte, 1 );
- if ( byte == 6 ) // PUSH PDU
- {
- // try to find out length of header
- position = 2;
- iEncodeBuffer->Read( position, &byte, 1);
-
- while ( byte & 0x80 && position < size )
- {
- uintvar += ( byte & 0x7f );
- uintvar <<= 7;
- position++;
- iEncodeBuffer->Read( position, &byte, 1 );
- }
-
- // add last byte without shift
- uintvar += byte;
- position++;
- }
- }
-
- position += uintvar;
-
- if ( position < size )
- {
- ptr = iEncodeBuffer->Ptr( position );
- size = ptr.Length();
- }
-
- if ( size == 0 )
- {
- //no MMS stuff
- //TMmsLogger::Log(_L("- no MMS stuff"));
- return;
- }
-
- TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
-
- // Now we have streamed our data into this entry.
- // Now we have an entry that says: local service, MMS MTM
- CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( selection );
- if ( entryId != KMsvNullIndexEntryId )
- {
- selection->AppendL( entryId );
- }
- else
- {
- selection->AppendL( iDefaultServiceId );
- }
-
- TWatcherParameters parameters; // initialized to zero
- parameters.iWatcherId = RThread().Id();
- parameters.iDataPointer = &ptr;
- TWatcherParametersBuf paramPack( parameters );
-
- CMsvOperation * op = NULL;
-
- op = iSession->TransferCommandL(
- *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- User::After(1000000);
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::copyDrafts()
- {
- CMsvEntry* cEntry = NULL;
-// Copies contents of sent folder to drafts for retrying sending.
-
- cEntry = iSession->GetEntryL(KMsvSentEntryId);
- CleanupStack::PushL(cEntry);
- // Get all mms messages in drafts
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
-
- TMsvLocalOperationProgress progress;
- cEntry->CopyL( *selection, KMsvDraftEntryId, progress );
-
- TInt i = 0;
- for ( i = 0; i < selection->Count(); ++i )
- {
- cEntry->SetEntryL( selection->At( i ) );
- TMsvEntry entry = cEntry->Entry();
- entry.SetReadOnly( EFalse );
- cEntry->ChangeL( entry );
- }
-
- CleanupStack::PopAndDestroy(2); // selection, cEntry
- }
-
-void MmsTestBed::garbageCollection(TUint32 aReason)
- {
- CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( selection );
- selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
-
- TMMSGarbageCollectionParameters parameters; // initialized to zero
- parameters.iReasonFlags = aReason;
- TMMSGarbageCollectionParametersBuf paramPack( parameters );
- op = iSession->TransferCommandL(
- *selection, EMmsGarbageCollection, paramPack, iWait->iStatus );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::messageVariation()
- {
- CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( selection );
- selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
-
- op = iSession->TransferCommandL(
- *selection, EMmsMessageGeneration, TPtrC8(), iWait->iStatus );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::cancelSendScheduling()
- {
- CMsvEntry* cEntry = NULL;
- setFetchingState( EMmsReceivingPostpone );
- testFile( iCurrentFile );
- scheduledSend(KMsvGlobalOutBoxIndexEntryIdValue, 10000); // long delay so that we have time to cancel
- deleteSendSchedule();
-
- cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
- cEntry->SetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
- if (iMsvEntrySelection != NULL)
- {
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- }
- iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PopAndDestroy();
- }
-
-void MmsTestBed::scheduledSend(TMsvId aBoxId, TInt aDelay /* = 5 */)
- {
- CMsvEntry* cEntry = NULL;
- TCommandParameters parameters;
- parameters.iInitialDelay = aDelay;
- TCommandParametersBuf paramPack( parameters );
-
- cEntry = iSession->GetEntryL(aBoxId);
- CleanupStack::PushL(cEntry);
- // Get all mms messages of outbox
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
-// selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsScheduledSend,
- *selection,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(2); // cEntry, selection
- }
-
-void MmsTestBed::deleteSendSchedule()
- {
- CMsvEntry* cEntry = NULL;
-
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
- CleanupStack::PushL(cEntry);
- // Get all mms messages of outbox
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
- selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsDeleteSchedule,
- *selection,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(2); // cEntry, selection
- }
-
-void MmsTestBed::cancelFetchScheduling()
- {
- TMsvId mmsFolder = findMMSFolder();
- CMsvEntry* cEntry = NULL;
- setFetchingState( EMmsReceivingPostpone );
- testFile( iCurrentFile );
- fromOutboxToMmsc(); // immediate send (EMmsSend)
-
- // Wait until notification has arrived - may take a while in global mode
- TInt i = 0;
- while ( TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) == 0
- && i < 2000 )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- i++;
- if ( (i/100) * 100 == i )
- {
- //TMmsLogger::Log(_L("%d:th wait cycle"), i );
- }
- CActiveScheduler::Start();
- }
- iTimer->Cancel();
-
- fetchForced( 10000 ); // delay to allow cancelling
- deleteFetchSchedule();
-
- cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
- cEntry->SetEntryL(mmsFolder);
- if (iMsvEntrySelection != NULL)
- {
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- }
- iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PopAndDestroy(); // cEntry
- }
-
-void MmsTestBed::fetchForced(TInt aDelay /* = 5 */)
- {
- TCommandParameters parameters;
- parameters.iInitialDelay = aDelay;
- TCommandParametersBuf paramPack( parameters );
-
- CMsvEntrySelection* selection = new CMsvEntrySelection;
- CleanupStack::PushL( selection );
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- selection->InsertL(0, iServiceId);
- }
- else
- {
- selection->InsertL(0, iDefaultServiceId);
- }
-
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsScheduledReceiveForced,
- *selection,
- paramPack,
- iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::deleteFetchSchedule()
- {
- CMsvEntry* cEntry = NULL;
-
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- TMsvId mmsFolderId = KMsvNullIndexEntryId;
- mmsFolderId = findMMSFolder();
- cEntry = iSession->GetEntryL( mmsFolderId );
- CleanupStack::PushL(cEntry);
- // Get all notifications
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
- selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsDeleteSchedule,
- *selection,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(2); // cEntry, selection
- }
-
-void MmsTestBed::doAFetchCycle()
- {
- // Sends a message from iCurrentFile and lets it come back
- TMsvId mmsFolder = findMMSFolder();
- testFile( iCurrentFile );
- fromOutboxToMmsc(); // immediate send (EMmsSend)
- // fetching will start automatically
-
- TInt i = 0;
- while ( TMmsTestUtils::CountChildrenL( KMsvGlobalInBoxIndexEntryId, iMsvEntrySelection, *iSession ) == 0
- && i < 2000
- && TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) > 0 )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- i++;
- if ( (i/100) * 100 == i )
- {
- //TMmsLogger::Log(_L("%d:th wait cycle"), i );
- }
- CActiveScheduler::Start();
- }
- iTimer->Cancel();
- }
-
-bool MmsTestBed::checkLogClient()
- {
- if ( iLogClient == NULL )
- {
- TRAP_IGNORE( iLogClient = CLogClient::NewL( iFs ) );
- }
- return ( iLogClient != NULL );
- }
-
-int MmsTestBed::getLogEntries()
- {
- TInt count = 0;
- if ( !iLogView )
- {
- return 0;
- }
-
- if ( iLogView->SetFilterL( *iLogFilter, iWait->iStatus ) )
- {
- // should complete with KErrNone
- iWait->Start();
- if ( iWait->iStatus.Int() == KErrNone )
- {
- count = iLogView->CountL();
- }
- }
- return count;
- }
-
-void MmsTestBed::createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry)
- {
- CMsvOperation* opert = aClientEntry.CreateL(aNewEntry, iWait->iStatus);
- iWait->Start();
- if (!opert->iStatus.Int()==KErrNone)
- {
- // what should we do? panic?
- }
-
- TPckgBuf<TMsvLocalOperationProgress> package;
- package.Copy(opert->ProgressL());
- *(TMsvId*)&aNewEntry = package().iId;
-
- delete opert; opert=NULL;
- }
-
-void MmsTestBed::cleanOutbox()
- {
- TMmsTestUtils::CleanBoxL(KMsvGlobalOutBoxIndexEntryId, *iSession);
- }
-
-void MmsTestBed::cleanInbox()
- {
- TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
- }
-
-void MmsTestBed::cleanSent()
- {
- TMmsTestUtils::CleanBoxL(KMsvSentEntryId, *iSession);
- }
-
-void MmsTestBed::cleanDrafts()
- {
- TMmsTestUtils::CleanBoxL(KMsvDraftEntryId, *iSession);
- }
-
-void MmsTestBed::cleanAll()
- {
- cleanInbox();
- cleanOutbox();
- cleanSent();
- cleanDrafts();
- TMmsTestUtils::CleanBoxL( iSettings->MMBoxFolder(), *iSession );
- deleteNotifications();
- }
-
-void MmsTestBed::reply()
- {
- // The first message from inbox is replied to
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
- CleanupStack::PushL(cEntry);
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- if ( iMsvEntrySelection->Count() > 0 )
- {
- TMsvId originalEntry = iMsvEntrySelection->At(0);
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription;
- CMsvOperation * op = NULL;
- op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Create reply, return status %d"), iWait->iStatus.Int());
- }
- else
- {
- TMsvId newEntry = KMsvNullIndexEntryId;
- TPckgBuf<TMsvId> package;
- package.Copy(op->ProgressL());
- newEntry = package();
- if ( newEntry != KMsvNullIndexEntryId )
- {
- cEntry->SetEntryL( newEntry );
- TMsvEntry entry = cEntry->Entry();
- entry.SetInPreparation( EFalse );
- entry.SetVisible( ETrue );
- cEntry->ChangeL(entry);
- }
- }
- CleanupStack::PopAndDestroy(); // op
- }
- CleanupStack::PopAndDestroy(); // cEntry
- }
-
-void MmsTestBed::replyToAll()
- {
- // The first message from inbox is replied to
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
- CleanupStack::PushL(cEntry);
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
-
- if ( iMsvEntrySelection->Count() > 0 )
- {
- TMsvId originalEntry = iMsvEntrySelection->At(0);
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
- KMsvMessagePartRecipient;
- CMsvOperation * op = NULL;
- op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Create reply to all, return status %d"), iWait->iStatus.Int());
- }
- else
- {
- TMsvId newEntry = KMsvNullIndexEntryId;
- TPckgBuf<TMsvId> package;
- package.Copy(op->ProgressL());
- newEntry = package();
- if ( newEntry != KMsvNullIndexEntryId )
- {
- cEntry->SetEntryL( newEntry );
- TMsvEntry entry = cEntry->Entry();
- entry.SetInPreparation( EFalse );
- entry.SetVisible( ETrue );
- cEntry->ChangeL(entry);
- }
- }
- CleanupStack::PopAndDestroy(); // op
- }
- CleanupStack::PopAndDestroy(); // cEntry
- }
-
-void MmsTestBed::forward()
- {
- // The first message from inbox is forwarded
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
- CleanupStack::PushL(cEntry);
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
-
- if ( iMsvEntrySelection->Count() > 0 )
- {
- TMsvId originalEntry = iMsvEntrySelection->At(0);
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
- KMsvMessagePartRecipient | KMsvMessagePartAttachments;
- CMsvOperation * op = NULL;
- op = iMmsClient->ForwardL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Create forward, return status %d"), iWait->iStatus.Int());
- }
- else
- {
- TMsvId newEntry = KMsvNullIndexEntryId;
- TPckgBuf<TMsvId> package;
- package.Copy(op->ProgressL());
- newEntry = package();
- if ( newEntry != KMsvNullIndexEntryId )
- {
- iMmsClient->SwitchCurrentEntryL( newEntry );
- // Add a sender: 0601234567
- iMmsClient->LoadMessageL();
- iMmsClient->SetSenderL( KMmsSender );
- iMmsClient->SaveMessageL();
- cEntry->SetEntryL( newEntry );
- TMsvEntry entry = cEntry->Entry();
- entry.SetInPreparation( EFalse );
- entry.SetVisible( ETrue );
- cEntry->ChangeL(entry);
- }
- }
- CleanupStack::PopAndDestroy(); // op
- }
- CleanupStack::PopAndDestroy(); // cEntry
- }
-
-void MmsTestBed::sendReadReport()
- {
- // TURN READ REPORTS ON (until available from menu)
- iSettings->LoadSettingsL();
- iSettings->SetReadReplyReportSendingAllowed( ETrue );
- iSettings->SaveSettingsL();
- iMmsClient->RestoreSettingsL();
-
-
- // Read report is sent for the first message in inbox
- CMsvEntry* cEntry = iSession->GetEntryL( KMsvGlobalInBoxIndexEntryId );
- CleanupStack::PushL(cEntry);
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
-
- if ( iMsvEntrySelection->Count() == 0 )
- {
- return;
- }
- TMsvId originalEntry = iMsvEntrySelection->At( 0 );
-
- // new test using Client MTM
- CMsvOperation * op = NULL;
- op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy( op );
- op = NULL;
-
- // Try sending the read report to current entry
-
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy( op );
- op = NULL;
-
-/*
- cEntry->SetEntryL( originalEntry );
- iMmsHeaders->Reset();
- CMsvStore* store = cEntry->ReadStoreL();
- CleanupStack::PushL( store );
- iMmsHeaders->RestoreL( *store );
- CleanupStack::PopAndDestroy( store );
- store = NULL;
- HBufC8* messageId = HBufC8::NewL( iMmsHeaders->MessageId().Length() );
- CleanupStack::PushL( messageId );
- messageId->Des().Copy( iMmsHeaders->MessageId() );
-
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- iMmsClient->LoadMessageL();
-
- iMmsHeaders->Reset();
- iMmsHeaders->SetMessageType( KMmsMessageTypeReadRecInd );
- // Message id cannot be accessed via MMS Client MTM!
-
- iMmsHeaders->SetMessageIdL( messageId->Des() );
- CleanupStack::PopAndDestroy( messageId );
-
- iMmsHeaders->AddTypedAddresseeL( iMmsClient->Sender(), EMsvRecipientTo );
- // sender must be insert-address-token because we don't know our number
- TTime now;
- now.UniversalTime();
-
- _LIT( K1970, "19700000:000000.000000" ); // 1-Jan 1970 0:00:00
-
- TTime y1970( K1970 );
- TTimeIntervalMicroSeconds interval;
- // we can't use "seconds from" as it only returns a
- // 32 bit signed integer. If fails in 2038.
- // "microseconds from" returns a 64 bit signed integer
- interval = now.MicroSecondsFrom( y1970 );
- // date in iMmsHeaders() in seconds from 1.1.1970.
- iMmsHeaders->SetDate( (interval.Int64() ) / KMmsMillion );
- iMmsHeaders->SetReadStatus( KMmsReadStatusRead );
-
- TMsvId mmsFolderId = KMsvNullIndexEntryId;
- mmsFolderId = FindMMSFolderL();
-
- cEntry->SetEntryL( mmsFolderId );
-
- TMsvEntry entry;
- entry.iType = KUidMsvMessageEntry;
- entry.iMtm = KUidMsgTypeMultimedia;
- entry.SetVisible( ETrue );
- entry.SetInPreparation( EFalse );
- entry.iServiceId = KMsvLocalServiceIndexEntryId;
- entry.iRelatedId = iDefaultServiceId;
- entry.iMtmData1 = KMmsMessageReadRecInd;
- cEntry->CreateL( entry );
- TMsvId entryId = entry.Id();
-
- cEntry->SetEntryL( entryId );
-
- store = cEntry->EditStoreL();
- CleanupStack::PushL( store );
- iMmsHeaders->StoreL( *store );
- store->CommitL();
- CleanupStack::PopAndDestroy( store );
- store = NULL;
-
- CMsvEntrySelection* selection = new ( ELeave ) CMsvEntrySelection;
- CleanupStack::PushL( selection );
- selection->InsertL(0, entryId);
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- op = iSession->TransferCommandL(*selection,EMmsScheduledReadReport,paramPack,iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy( op );
- CleanupStack::PopAndDestroy( selection );
-*/
- CleanupStack::PopAndDestroy( cEntry );
- }
-
-int MmsTestBed::fromOutboxToMmscWithMemoryFailure()
- {
- TInt error = KErrNone;
- TInt messageCount = 0;
- TInt failureCount = 0;
- do {
- CMsvEntry* cEntry = NULL;
-
- // Get List of services
- cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
- CleanupStack::PushL(cEntry);
- // Get all mms messages of outbox
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
- failureCount++;
- // These are failures that fail in Message server.
- if ( failureCount >= 63 && failureCount <= 64 )
- {
- failureCount = 65;
- }
- cEntry->SetEntryL( iServiceId );
- TMsvEntry entry = cEntry->Entry();
- entry.iMtmData3 &= 0x0000000FF;
- entry.iMtmData3 |= failureCount << 8;
- cEntry->ChangeL( entry );
-
- selection->InsertL(0, iServiceId);
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- TRAP (error, op = iSession->TransferCommandL(*selection,EMmsSend,paramPack,iWait->iStatus));
-
- if ( error == KErrNone )
- {
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- error = iWait->iStatus.Int();
- if ( iWait->iStatus.Int() != KErrNoMemory )
- {
- //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
- }
- }
-
- CleanupStack::PopAndDestroy(); // op
- }
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // selection
- CleanupStack::PopAndDestroy(); // cEntry
- selection = NULL;
- cEntry = NULL;
- cEntry = iSession->GetEntryL( KMsvGlobalOutBoxIndexEntryIdValue );
- CleanupStack::PushL(cEntry);
- selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- messageCount = selection->Count();
- delete selection;
- selection = 0;
- CleanupStack::PopAndDestroy(); //cEntry
- }
- while ( error == KErrNoMemory || messageCount > 0 );
- return failureCount;
- }
-
-int MmsTestBed::fromMmscToInboxWithMemoryFailure()
- {
- TInt error = KErrNone;
- TInt failureCount = 0;
- TInt messageCount = 0;
- TMsvId mmsFolderId = KMsvNullIndexEntryId;
- mmsFolderId = findMMSFolder();
-
- do {
- // Inbox must be cleaned if failure makes message to be fetched more than once.
- // should not happen, but this test is quite stressful, and perfect result
- // cannot be guaranteed.
- // What is expected:
- // 1. Program does not crash
- // 2. After sufficient number of retries the message is fetched and notification deleted.
- TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
- CMsvEntry* cEntry = NULL;
- CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
- CleanupStack::PushL(msvEntrySelection);
-
- cEntry = iSession->GetEntryL(iServiceId);
- CleanupStack::PushL(cEntry);
-
- failureCount++;
- // These are failures that fail in Message server.
- if ( failureCount >= 63 && failureCount <= 64 )
- {
- failureCount = 65;
- }
- cEntry->SetEntryL( iServiceId );
-
- TMsvEntry entry = cEntry->Entry();
- entry.iMtmData3 &= 0x0000000FF;
- entry.iMtmData3 |= failureCount << 8;
- cEntry->ChangeL( entry );
-
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- msvEntrySelection->InsertL(0, iServiceId);
- }
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- TRAP (error, op = iMmsClient->InvokeAsyncFunctionL(
- EMmsReceiveForced,
- *msvEntrySelection,
- paramPack,
- iWait->iStatus) );
-
- if ( error == KErrNone )
- {
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- error = iWait->iStatus.Int();
- if ( iWait->iStatus.Int() != KErrNoMemory )
- {
- //TMmsLogger::Log(_L("Testbed tried to receive, return status %d"), iWait->iStatus.Int());
- }
- }
-
- CleanupStack::PopAndDestroy(); // op
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // msvEntrySelection
- CleanupStack::PopAndDestroy(); // cEntry
- msvEntrySelection = NULL;
- cEntry = NULL;
- cEntry = iSession->GetEntryL( mmsFolderId );
- CleanupStack::PushL(cEntry);
- msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- messageCount = msvEntrySelection->Count();
- delete msvEntrySelection;
- msvEntrySelection = 0;
- CleanupStack::PopAndDestroy(); //cEntry
- }
- while ( error == KErrNoMemory || messageCount > 0 );
- if ( error != KErrNoMemory && error != KErrNone )
- {
- //TMmsLogger::Log(_L("Memory failure loop ended with %d"), error);
- }
- return failureCount;
- }
-
-void MmsTestBed::sendViaClient()
- {
- CMsvEntry* cEntry = NULL;
-
- cEntry = iSession->GetEntryL(KMsvDraftEntryId);
- CleanupStack::PushL(cEntry);
- // Get all mms messages in drafts
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
-
- CMsvOperation * op = NULL;
- TTime now;
- now.UniversalTime();
- op = iMmsClient->SendL( *selection, iWait->iStatus, now );
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(2); // cEntry, selection
- }
-
-void MmsTestBed::scheduledFetch(TInt aDelay /* = 5 */)
- {
- TCommandParameters parameters;
- parameters.iInitialDelay = aDelay;
- TCommandParametersBuf paramPack( parameters );
-
- CMsvEntrySelection* selection = new CMsvEntrySelection;
- CleanupStack::PushL( selection );
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- selection->InsertL(0, iServiceId);
- }
- else
- {
- selection->InsertL(0, iDefaultServiceId);
- }
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsScheduledReceive,
- *selection,
- paramPack,
- iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::fetchForcedImmediate()
- {
- TCommandParameters parameters;
- TCommandParametersBuf paramPack( parameters );
-
- CMsvEntrySelection* selection = new CMsvEntrySelection;
- CleanupStack::PushL( selection );
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- selection->InsertL(0, iServiceId);
- }
- else
- {
- selection->InsertL(0, iDefaultServiceId);
- }
-
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsReceiveForced,
- *selection,
- paramPack,
- iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::getEventType()
- {
- if ( !checkLogClient() )
- {
- return; // not available
- }
-
- CLogEventType* eventType = CLogEventType::NewL();
- CleanupStack::PushL( eventType );
- eventType->SetUid(iLogEvent->EventType());
- iLogClient->GetEventType( *eventType, iWait->iStatus );
-
- iWait->Start();
- CleanupStack::PopAndDestroy(); // eventType
- }
-
-void MmsTestBed::addEventType()
- {
- if ( !checkLogClient() )
- {
- return; // not available
- }
-
- CLogEventType* eventType = CLogEventType::NewL();
- CleanupStack::PushL( eventType );
- eventType->SetUid(iLogEvent->EventType());
- eventType->SetDescription(_L("Multimedia Message") );
- eventType->SetLoggingEnabled( ETrue );
-
-// iWait->iStatus = KRequestPending;
- iLogClient->AddEventType( *eventType, iWait->iStatus );
- iWait->Start();
- CleanupStack::PopAndDestroy(); // eventType
- }
-
-void MmsTestBed::deleteEventType()
- {
- if ( !checkLogClient() )
- {
- return; // not available
- }
-// iWait->iStatus = KRequestPending;
- iLogClient->DeleteEventType( iLogEvent->EventType(), iWait->iStatus );
- iWait->Start();
- }
-
-void MmsTestBed::cleanLog()
- {
- TInt count = 0;
-
- count = getLogEntries();
-
- TInt i;
- for ( i = 0; i < count; ++i )
- {
- // when a view is created, it will be positioned on the first event
-// iWait->iStatus = KRequestPending;
- iLogClient->DeleteEvent(iLogView->Event().Id(), iWait->iStatus);
- iWait->Start();
-
- if ( iLogView->NextL( iWait->iStatus ) )
- {
- // should complete with KErrNone
- iWait->Start();
- if ( iWait->iStatus.Int() != KErrNone )
- {
- // could not get next event!
- break;
- }
- }
- else
- {
- break; // no more events!
- }
- }
- }
-
-void MmsTestBed::setOnline(bool value)
- {
- //value = true for online mode
- //value = false for offline mode
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KCRUidCoreApplicationUIs ) );
- if( retval == KErrNone )
- {
- repository->Set( KCoreAppUIsNetworkConnectionAllowed, value );
- delete repository;
- }
- }
-
-void MmsTestBed::generateDeliveryReport( CMmsHeaders* aMmsHeaders )
- {
- iEncodeBuffer->ResizeL( 1024 );
-
- TInt position = 0;
-
- // encode message type
- iEncodeBuffer->Write( position, &KMmsAssignedMessageType, 1 );
- position++;
- iEncodeBuffer->Write( position, &KMmsMessageTypeDeliveryInd, 1 );
- position++;
-
- // version
- iEncodeBuffer->Write( position, &KMmsAssignedMmsVersion, 1 );
- position++;
-
- TUint8 version = aMmsHeaders->MmsVersion() | 0x80; // current version as short integer
- iEncodeBuffer->Write( position, &version, 1 );
- position++;
-
- // message id from the headers
- // At least once MMSC did not send us the message id!
- // if message id is missing, we cannot match the entry!
- // This only a fake. Real delivery reports should always
- // contain the message id.
- if ( aMmsHeaders->MessageId().Length() > 0 )
- {
- iEncodeBuffer->Write( position, &KMmsAssignedMessageId, 1 );
- position++;
- iEncodeBuffer->Write( position, &(aMmsHeaders->MessageId()[0]), aMmsHeaders->MessageId().Length() );
- position += aMmsHeaders->MessageId().Length();
- iEncodeBuffer->Write( position, &KMmsNull, 1 );
- position++;
- }
-
- // To is taken from the headers
- iEncodeBuffer->Write( position, &KMmsAssignedTo, 1 );
- position++;
-
- TPtrC recipient;
- if ( aMmsHeaders->ToRecipients().MdcaCount() > 0 &&
- aMmsHeaders->ToRecipients()[0].Length() > 0 )
- {
- recipient.Set( aMmsHeaders->ToRecipients()[0] );
- }
- else if( aMmsHeaders->CcRecipients().MdcaCount() > 0 &&
- aMmsHeaders->CcRecipients()[0].Length() > 0 )
- {
- recipient.Set( aMmsHeaders->CcRecipients()[0] );
- }
- else if( aMmsHeaders->BccRecipients().MdcaCount() > 0 &&
- aMmsHeaders->BccRecipients()[0].Length() > 0 )
- {
- recipient.Set( aMmsHeaders->BccRecipients()[0] );
- }
- else
- {
- recipient.Set( _L("Jasso-Kissa@jii.fi") );
- }
-
- TMmsAddressType addressType = EMmsAddressTypeUnknown;
-
- if ( recipient.Find( KMiuMau ) != KErrNotFound )
- {
- addressType = EMmsAddressTypeEmail;
- }
- else
- {
- addressType = EMmsAddressTypeMobile;
- }
-
- TUint8 character;
- TInt i;
- if ( addressType == EMmsAddressTypeEmail )
- {
- // email address - ASCII ONLY - THIS IS JUST A TEST!
-
- for ( i = 0; i < recipient.Length(); ++i )
- {
- character = TUint8( recipient[i] & 0xff );
- iEncodeBuffer->Write( position, &character, 1 );
- position++;
- }
- iEncodeBuffer->Write( position, &KMmsNull, 1 );
- position++;
-
- }
- else
- {
- // must be a phone number
- // We expect for now that the format is correct as is
- // All legal characters present in a phone number are ASCII
-
- TInt i;
- for ( i = 0; i < recipient.Length(); ++i )
- {
- character = TUint8( recipient[i] & 0xff );
- iEncodeBuffer->Write( position, &character, 1 );
- position++;
- }
- iEncodeBuffer->Write( position, KMmsPlmn, KMmsPlmnLength );
- position += KMmsPlmnLength;
- iEncodeBuffer->Write( position, &KMmsNull, 1 );
- position++;
- }
-
- // date
- iEncodeBuffer->Write( position, &KMmsAssignedDate, 1 );
- position++;
-
- TLocale locale;
- locale.Refresh();
- TInt64 UtcDate;
- TTimeIntervalSeconds universalTimeOffset( locale.UniversalTimeOffset() );
-
- TTime now;
- now.UniversalTime();
- UtcDate = ( now.MicroSecondsFrom( TTime( KMmsYear1970String ) ).Int64() ) / 1000000 ;
-
- UtcDate -= universalTimeOffset.Int();
-
- if ( locale.QueryHomeHasDaylightSavingOn() )
- {
- TTimeIntervalSeconds daylightSaving( 60 * 60 );
- UtcDate -= daylightSaving.Int();
- }
-
- TUint8 len; // number of bytes we will need
- len = 0;
- TUint8 array[8];
-
- TInt64 temp = UtcDate;
-
- for (i = 7; i >= 0; --i)
- {
- array[i] = TInt8( ( I64INT( temp ) ) & 0xFF );
- I64LSR( temp, 8 );
- }
-
- len = 8;
- i = 0;
- while( ( array[i]== 0 ) && ( i < 8 ) )
- {
- i++;
- len--;
- }
-
- // a zero should be coded as short integer.
- // However, if there is a valid reason to code a zero as a long integer,
- // we allow it. The caller should know what he is doing.
- if ( len == 0 )
- {
- len = 1;
- }
- // write short length
- iEncodeBuffer->Write( position, &len, 1 );
- position++;
- // write as many bytes as were non-zero
- iEncodeBuffer->Write( position, &(array[8 - len] ), len );
- position+= len;
- // status
- iEncodeBuffer->Write( position, &KMmsAssignedStatus, 1 );
- position++;
- iEncodeBuffer->Write( position, &KMmsMessageStatusRetrieved, 1 );
- position++;
- // DONE!!!
- iEncodeBuffer->ResizeL( position );
- return;
- }
-
-void MmsTestBed::sendDeliveryReport()
- {
- if ( iEncodeBuffer->Size() == 0 )
- {
- //No delivery report
- return;
- }
-
-
- TMsvId mmsFolder = findMMSFolder();
- CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( selection );
-
- TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
- TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
-
- // Now we have streamed our data into this entry.
- // Now we have an entry that says: local service, MMS MTM
-
- if ( entryId != KMsvNullIndexEntryId )
- {
- selection->AppendL( entryId );
- }
- else
- {
- selection->AppendL( iDefaultServiceId );
- }
-
- TWatcherParameters parameters; // initialized to zero
- parameters.iWatcherId = RThread().Id();
- parameters.iDataPointer = &ptr;
- TWatcherParametersBuf paramPack( parameters );
-
- CMsvOperation * op = NULL;
-
-// iWait->iStatus = KRequestPending;
- op = iSession->TransferCommandL(
- *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/src/mmsteststaticutils.cpp Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,528 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#include <f32file.h>
-#include <centralrepository.h>
-#include <apparc.h>
-#include <msvapi.h>
-#include <msvids.h>
-
-#include "mmsteststaticutils.h"
-#include "mmsconst.h"
-#include <MmsEnginePrivateCRKeys.h>
-#include "mmssettings.h"
-#include <mmsheaders.h>
-#include "mmsservercommon.h"
-#include <mmsencode.h>
-
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-TMmsJoinedArrays::TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2)
-: iArray1(aArray1), iArray2(aArray2)
- {
- }
-
-TInt TMmsJoinedArrays::MdcaCount() const
- {
- TInt count=0;
- if (iArray1)
- count += iArray1->MdcaCount();
- if (iArray2)
- count += iArray2->MdcaCount();
- return count;
- }
-
-TPtrC16 TMmsJoinedArrays::MdcaPoint(TInt aIndex) const
- {
- if (iArray1)
- {
- if (aIndex < iArray1->MdcaCount())
- return iArray1->MdcaPoint(aIndex);
- else
- aIndex -= iArray1->MdcaCount();
- }
- return iArray2->MdcaPoint(aIndex);
- }
-
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-TMmsTestUtils::TMmsTestUtils()
- {
-
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-HBufC* TMmsTestUtils::ReadContactFromFileL( TDesC& aFileName, RFs& aFs )
- {
- RFile file;
- TInt error = KErrNone;
-
- TInt textBufferSize = 256;
- HBufC* textBuffer = HBufC::NewL( textBufferSize );
- TPtr textPtr = textBuffer->Des();
- TFileText textFile;
-
- error = file.Open( aFs, aFileName,
- EFileRead|EFileShareReadersOnly );
-
- if ( error == KErrNone )
- {
- textFile.Set( file );
- error = textFile.Seek( ESeekStart );
- }
-
- if ( error == KErrNone )
- {
- error = textFile.Read( textPtr );
- }
-
- file.Close();
-
- if ( textBuffer->Des().Find( &KMmsByteOrderMark, 1 ) == 0 )
- {
- textBuffer->Des().Copy( textBuffer->Des().Mid( 1 ) );
- }
-
- return textBuffer;
- }
-
-//----------------------------------------------------------------------------------------
-// turn on detailed logging while decoding a message
-//----------------------------------------------------------------------------------------
-//
-void TMmsTestUtils::DecodeLoggingOnL()
- {
- // CenRep for decodelogging
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
- if( retval == KErrNone )
- {
- // Best effort - if cannot access repository, no can do
- TInt temp = 1;
- repository->Set( KMmsEngineDecodeLog, temp );
- delete repository;
- }
- }
-
-//----------------------------------------------------------------------------------------
-// turn off detailed logging while decoding a message
-//----------------------------------------------------------------------------------------
-//
-void TMmsTestUtils::DecodeLoggingOffL()
- {
- // CenRep for decodelogging
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
- if( retval == KErrNone )
- {
- // Best effort - if cannot access repository, no can do
- TInt temp = 0;
- repository->Set( KMmsEngineDecodeLog, temp );
- delete repository;
- }
-
- }
-
-//----------------------------------------------------------------------------------------
-// turn on binary dump of incoming messages
-//----------------------------------------------------------------------------------------
-//
-void TMmsTestUtils::BinaryDumpOnL()
- {
- // CenRep for binarydump setting
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
- if( retval == KErrNone )
- {
- // Best effort - if cannot access repository, no can do
- TInt temp = 1;
- repository->Set( KMmsEngineBinaryDump, temp );
- delete repository;
- }
-
- }
-
-//----------------------------------------------------------------------------------------
-// turn off binary dump of incoming messages
-//----------------------------------------------------------------------------------------
-//
-void TMmsTestUtils::BinaryDumpOffL()
- {
- // CenRep for binarydump setting
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
- if( retval == KErrNone )
- {
- // Best effort - if cannot access repository, no can do
- TInt temp = 0;
- repository->Set( KMmsEngineBinaryDump, temp );
- delete repository;
- }
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-void TMmsTestUtils::CleanDirectoryL( RFs& aFs )
- {
- // Delete the files in the directory
- CFileMan* fileMan = CFileMan::NewL( aFs );
- CleanupStack::PushL( fileMan );
- fileMan->RmDir( KMmsDefaultLocalModeDir );
- fileMan->RmDir( KMmsMMBoxDirectory );
- fileMan->RmDir( KMmsMMBoxDescriptionDirectory );
- CleanupStack::PopAndDestroy(); // fileManager
- // we don't want to throw these away!
- aFs.MkDirAll( KMmsDefaultLocalModeDir );
- aFs.MkDirAll( KMmsMMBoxDirectory );
- aFs.MkDirAll( KMmsMMBoxDescriptionDirectory );
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-void TMmsTestUtils::Dump( CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs )
- {
- TInt error = KErrNone;
- aFs.MkDirAll( aFilename );
- TUint att;
- if ( aFs.Att( aFilename, att ) == KErrNone )
- {
- _LIT( KRelated, "dump.mms");
- aParse.Set( aFilename, &KRelated, NULL );
- aFilename = aParse.FullName();
- error = CApaApplication::GenerateFileName( aFs, aFilename );
- if ( error == KErrNone )
- {
- RFile file;
- error = file.Create( aFs, aFilename, EFileWrite | EFileShareExclusive );
- // for message id generation
- aParse.Set( aFilename, NULL, NULL );
- if ( error == KErrNone )
- {
- // the data is supposed to be in the encode buffer
- TPtr8 ptr = aBuffer.Ptr( 0 );
- file.Write( ptr );
- file.Flush();
- }
-
- // done - close files
- file.Close();
- }
- }
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-void TMmsTestUtils::CleanBoxL(TMsvId aBoxId, CMsvSession& aSession)
- {
- CMsvEntry* cEntry = NULL;
- // delete all messages from the specified box
- cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
- cEntry->SetEntryL(aBoxId);
- // show invisible entries
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PushL(msvEntrySelection);
-
- CMsvEntrySelection* selection = NULL;
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- selection = cEntry->ChildrenWithMtmL(KUidMsgMMSNotification);
- CleanupStack::PushL( selection );
- if ( selection->Count() > 0 )
- {
- msvEntrySelection->AppendL( selection->Back( 0 ), selection->Count() );
- }
- CleanupStack::PopAndDestroy(); // selection
-
- int i;
- for (i = 0; i < msvEntrySelection->Count(); ++i)
- {
- CMsvEntry* entry = aSession.GetEntryL( msvEntrySelection->At(i) );
- CleanupStack::PushL( entry );
- TMsvEntry tEntry = entry->Entry();
- tEntry.SetReadOnly(EFalse);
- entry->ChangeL(tEntry);
- cEntry->DeleteL( msvEntrySelection->At(i) );
- CleanupStack::PopAndDestroy( entry );
- }
-
- CleanupStack::PopAndDestroy(msvEntrySelection);
- CleanupStack::PopAndDestroy(cEntry);
- }
-
-//----------------------------------------------------------------------------------------
-// turn on logging email recipients
-//----------------------------------------------------------------------------------------
-void TMmsTestUtils::EmailLoggingOnL()
- {
- // CenRep for binarydump setting
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
- if( retval == KErrNone )
- {
- TInt temp = 1;
- repository->Set( KMmsEngineLogEmailRecipients, temp );
- delete repository;
- }
-
- }
-
-//----------------------------------------------------------------------------------------
-// turn off logging email recipients
-//----------------------------------------------------------------------------------------
-void TMmsTestUtils::EmailLoggingOffL()
- {
- // CenRep for binarydump setting
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
- if( retval == KErrNone )
- {
- TInt temp = 0;
- repository->Set( KMmsEngineLogEmailRecipients, temp );
- delete repository;
- }
-
- }
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TInt TMmsTestUtils::CountChildrenL(TMsvId aBoxId, CMsvEntrySelection*& aMsvEntrySelection, CMsvSession& aSession, TUid aMessageType )
- {
- CMsvEntry* cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
- cEntry->SetEntryL(aBoxId);
- if (aMsvEntrySelection != NULL)
- {
- delete aMsvEntrySelection;
- aMsvEntrySelection = NULL;
- }
- aMsvEntrySelection = cEntry->ChildrenWithMtmL(aMessageType);
- CleanupStack::PopAndDestroy(); // cEntry
- return aMsvEntrySelection->Count();
- }
-
-
-// -----------------------------------------------------------------------------
-// CreateFolderEntryL
-//
-// -----------------------------------------------------------------------------
-//
-void TMmsTestUtils::CreateFolderEntryL(
- CMsvSession& aSession,
- TMsvId aParentFolder,
- const TDesC& aFolderName,
- TMsvId& aFolderId )
- {
- aFolderId = KMsvNullIndexEntryId;
- CMsvEntry* cEntry = aSession.GetEntryL( aParentFolder );
- CleanupStack::PushL( cEntry );
-
- // Create a new folder.
-
- TMsvEntry entry;
- entry.iType = KUidMsvFolderEntry;
- entry.iMtm = KUidMsvLocalServiceMtm;
- entry.iDetails.Set( aFolderName );
- entry.SetVisible( EFalse );
- entry.SetInPreparation( EFalse );
- entry.iServiceId = KMsvLocalServiceIndexEntryId;
- cEntry->CreateL( entry );
- aFolderId = entry.Id();
- CleanupStack::PopAndDestroy( cEntry );
-
- }
-
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TMsvId TMmsTestUtils::CreateNotificationEntryL(
- TMsvId aNotificationFolder,
- TMsvId aServiceId,
- CBufFlat* aEncodeBuffer,
- CMsvSession& aSession )
- {
- TMsvId entryId = KMsvNullIndexEntryId;
- if ( aNotificationFolder == KMsvNullIndexEntryId )
- {
- // no folder no entry
- return entryId;
- }
-
- CMsvEntry* cEntry = aSession.GetEntryL( aNotificationFolder );
- CleanupStack::PushL(cEntry);
-
- TMsvEntry entry;
- entry.iType = KUidMsvMessageEntry;
- entry.iMtm = KUidMsgTypeMultimedia;
- entry.SetVisible( ETrue );
- // If we want to put data here, InPreparation must be set to true first
- entry.SetInPreparation( EFalse );
- entry.iServiceId = KMsvLocalServiceIndexEntryId;
- entry.iRelatedId = aServiceId;
- entry.iMtmData2 = KMmsNotificationBinary;
- cEntry->CreateL( entry );
- entryId = entry.Id();
-
- //
- // Stream
- // 1) length of the data as 32 bit integer
- // 2) pushed message data
- // into created entry's stream
- //
- cEntry->SetEntryL( entryId );
- CMsvStore* store = cEntry->EditStoreL();
- CleanupStack::PushL( store ); // ***
- RMsvWriteStream outs;
- outs.AssignLC( *store, KUidBinaryNotificationStream ); // ***
- TPtrC8 ptr = aEncodeBuffer->Ptr( 0 );
- outs.WriteUint32L( ptr.Length() );
- outs.WriteL( ptr );
- outs.CommitL();
- outs.Close();
- store->CommitL();
-
- CleanupStack::PopAndDestroy( &outs ); // close outs
- CleanupStack::PopAndDestroy( store );
- CleanupStack::PopAndDestroy( cEntry );
-
- return entryId;
-
- }
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-void TMmsTestUtils::FormNotification(
- TDesC8& aUrl,
- TInt aSize,
- CMmsHeaders& aMmsHeaders,
- CMmsEncode& aMmsEncoder,
- CBufFlat* aEncodeBuffer )
- {
- // for test purposes aUrl will contain the filename.
-
- // Reset sets the default encapsulation version
- // The default version has been set from MmsSettings in NewL
- aMmsHeaders.Reset();
-
- // construct the notification into iMmsHeaders, and call encode
-
- aMmsHeaders.SetMessageType( KMmsMessageTypeMNotificationInd );
-
- TTime currentTime;
- currentTime.UniversalTime();
- currentTime.Int64();
-
- TPtrC8 tid;
- TBufC8<KMMSMAXTIDLENGTH> target;
- TInt random = 0;
-
- // we don't generate a true random TID: We generate the
- // TID from the URL so that if we generate a notification
- // twice from the same file, we get the same TID and the
- // same URL. This way we can test the pruning function in
- // server MTM
-
- TInt i;
- for ( i = 0; i < aUrl.Length(); ++i )
- {
- random += aUrl[ i ];
- }
-
- target.Des().Num( random );
- tid.Set( target.Des() );
- aMmsHeaders.SetTidL( tid );
-
- aMmsHeaders.SetMessageClass( EMmsClassPersonal );
- aMmsHeaders.SetMessageSize( aSize );
- const TInt KTenHours = 10 * 60 * 60; // 10 hours relative expiry
- aMmsHeaders.SetExpiryInterval( KTenHours );
- aMmsHeaders.SetContentLocationL( aUrl );
-
- aMmsEncoder.EncodeHeadersL( aMmsHeaders, *aEncodeBuffer );
-
- }
-
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TBool TMmsTestUtils::IsFile(const TDesC& aFileName, RFs& aFs)
- {
- //Is the name a file?
- if (IsDrive(aFileName))
- return EFalse;
- return !(IsDir(aFileName, aFs));
- }
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TBool TMmsTestUtils::IsDir(const TDesC& aFileName, RFs& aFs)
- {
- //Is the name a directory?
- TEntry entry;
- TInt err = aFs.Entry(aFileName, entry);
- if (err)
- return EFalse;
- else
- return entry.IsDir();
- }
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TBool TMmsTestUtils::IsDrive(const TDesC& aFileName)
- {
- //horrible little function to figure if the path is just a drive
- TBool retVal = EFalse;
- if (aFileName.Length()==3) //eg "c:\"
- {
- if ((aFileName[1] == ':') && (aFileName[2] == '\\'))
- retVal=ETrue;
- }
- else if (aFileName.Length()==2) //eg "c:"
- {
- if (aFileName[1] == ':')
- retVal=ETrue;
- }
- return retVal;
- }
-
-// end of file
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/src/mmstestuitimer.cpp Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#include "mmstestuitimer.h"
-
-
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CTestUiTimer::CTestUiTimer(): CTimer( 5 )
- {
- period = KPeriod;
- }
-
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::ConstructL()
- {
- CTimer::ConstructL();
- CActiveScheduler::Add(this);
- }
-
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CTestUiTimer* CTestUiTimer::NewL()
- {
- CTestUiTimer* self = new(ELeave) CTestUiTimer();
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CTestUiTimer::~CTestUiTimer()
- {
- }
-
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::IssueRequest()
- {
- // No operation to cancel if this function is called
- iObject = NULL;
- After(period);
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::TimeoutOperation( CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds )
- {
- iObject = aObject;
- TTimeIntervalMicroSeconds32 timeout = aTimeoutInSeconds.Int() * 1000000;
- After( timeout );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::DoCancel()
- {
- CTimer::DoCancel();
- if ( iObject )
- {
- iObject->Cancel();
- iObject = NULL;
- }
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::RunL()
- {
- if ( iObject )
- {
- // If we timeout while holding an active object, we cancel it
- iObject->Cancel();
- iObject = NULL;
- }
- else
- {
- CActiveScheduler::Stop();
- }
- }
-
-// ======== GLOBAL FUNCTIONS ========
-
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/group/testmmsplugin.pro Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-QT += testlib
-QT -= gui
-
-TEMPLATE = lib
-TARGET = test-mms-plugin
-
-INCLUDEPATH += ../inc
-INCLUDEPATH += ../../../inc
-#INCLUDEPATH += ../../../../inc
-
-INCLUDEPATH += ../../../../../../../../inc
-INCLUDEPATH += ../../../../../../inc
-INCLUDEPATH += ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc
-INCLUDEPATH += ../../../../../msgutils/unidatautils/unidatamodel/inc
-INCLUDEPATH += ../../../../../msgutils/unieditorutils/editorgenutils/inc
-INCLUDEPATH += ../../../../../msgutils/s60qconversions/inc
-INCLUDEPATH += ../../../../../../../../mmsengine/mmsmessage/inc
-INCLUDEPATH += ../../../../../../../../mmsengine/inc
-INCLUDEPATH += ../../mmstestbed/inc
-INCLUDEPATH +=
-INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
-
-DEFINES += BUILD_TEST_DLL
-
-CONFIG += hb plugin
-
-SOURCES += \
- ../src/testmmsplugin.cpp \
- ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin.cpp \
- ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin_p.cpp
-
-
-# Input
-HEADERS += \
- ../inc/testmmsplugin.h \
- ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin.h \
- ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin_p.h
-
-
-SYMBIAN_PLATFORMS = WINSCW ARMV5
- symbian {
- TARGET.CAPABILITY = CAP_GENERAL_DLL
- TARGET.EPOCSTACKSIZE = 0x8000
- TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
- TARGET.EPOCALLOWDLLDATA = 1
- }
-
- LIBS += -leuser \
- -lconvergedmessageutils \
- -ls60qconversions \
- -lMsgMedia \
- -leikctl \
- -leditorgenutils \
- -lcone \
- -leikcoctl \
- -leikcore \
- -leikdlg \
- -lmsgs \
- -letext \
- -lmmsserversettings \
- -lgsmu \
- -lmmsgenutils \
- -lefsrv \
- -lestor \
- -lsmcm \
- -lCommonEngine \
- -lbafl \
- -lCdlEngine \
- -lFeatMgr \
- -lapmime \
- -lapgrfx \
- -lcharconv \
- -lInetProtUtil \
- -lsmildtd \
- -lxmldom \
- -lxmlparser \
- -lcone \
- -lQtCore \
- -letel \
- -lmmsmessage \
- -lcommdb \
- -lcommsdat \
- -letelmm \
- -lunidatamodelloader \
- -lunidatamodel \
- -lavkon \
- -leikcoctl \
- -leikctl \
- -lform \
- -luiklaf\
- -lxqutils\
- -lmmstestbed
-
-
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/inc/testmmsplugin.h Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description: - Main test class for Msgnotification -indicator plugin,
- * -notification dialog plugin
- */
-
-#ifndef TEST_MMS_PLUGIN_H
-#define TEST_MMS_PLUGIN_H
-
-#ifdef BUILD_TEST_DLL
-#define TEST_EXPORT Q_DECL_EXPORT
-#else
-#define TEST_EXPORT Q_DECL_IMPORT
-#endif
-
-#include <QObject>
-#include <e32const.h>
-
-class UniEditorMmsPlugin;
-class ConvergedMessage;
-class MmsTestBed;
-class QSignalSpy;
-
-class TEST_EXPORT TestMmsPlugin: public QObject
- {
- Q_OBJECT
-
-private slots:
-
- /**
- * Called by framework,its called before the 1st test function is executed.
- */
-
- void initTestCase();
-
- /**
- * Called by framework,its called before each test function is executed.
- */
-
- void init();
-
- /**
- * Test Sending MMS
- */
-
- void testSendMMS();
-
- /**
- * Test receiving MMS
- */
-
- void testMmsReceived();
-
- /**
- * Called by framework,its called after each test function is executed.
- */
-
- void cleanup();
-
- /**
- * Called by framework,its called after the last test function is executed.
- */
-
- void cleanupTestCase();
-
-private:
-
- QSignalSpy *spy_draft;
- QSignalSpy *spy_outbox;
- QSignalSpy *spy_sent;
-
- UniEditorMmsPlugin* msgPlugin;
- int mmsId;
- MmsTestBed* mmstestbed;
-
- };
-#endif //TEST_MMS_PLUGIN_H
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/inc/testmmsplugin.ini Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-//this file is used to provide predefined set of input data.
-
-const char TEST_MSG_RECIEPIENT[] = "+919000";
-const char TEST_MSG_FROM2[] = "999";
-const char TEST_MSG_SUBJECT[] = "Message Subject";
-const char TEST_SERVICE_NAME_MMS[] = "messaging.mserver.testservice.MMS";
-const char TEST_SENDER[] = "+918888";
-const char TEST_ATTACHMENT[] = "c:\\sample.txt";
-const char TEST_ATTACHMENT4[] = "c:\\SmileyFace.gif";
-const char TEST_ATTACHMENT5[] = "c:\\sample.txt";
-const char TEST_CC[] = "DummyCCAddress";
-const char TEST_BCC[] = "DummyBCCAddress";
\ No newline at end of file
Binary file messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/mms.rsc has changed
Binary file messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/not.rsc has changed
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/plugin_commonU.def Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-; ==============================================================================
-; Generated by qmake (2.01a) (Qt 4.6.3) on: 2010-06-21T15:39:25
-; This file is generated by qmake and should not be modified by the
-; user.
-; Name : plugin_commonU.def
-; Part of : test-mms-plugin
-; Description : Fixes common plugin symbols to known ordinals
-; Version :
-;
-; ==============================================================================
-
-
-EXPORTS
- qt_plugin_query_verification_data @ 1 NONAME
- qt_plugin_instance @ 2 NONAME
- ?qt_metacast@TestMmsPlugin@@UAEPAXPBD@Z @ 3 NONAME ; void * TestMmsPlugin::qt_metacast(char const *)
- ?init@TestMmsPlugin@@AAEXXZ @ 4 NONAME ; void TestMmsPlugin::init(void)
- ?staticMetaObject@TestMmsPlugin@@2UQMetaObject@@B @ 5 NONAME ; struct QMetaObject const TestMmsPlugin::staticMetaObject
- ?tr@TestMmsPlugin@@SA?AVQString@@PBD0H@Z @ 6 NONAME ; class QString TestMmsPlugin::tr(char const *, char const *, int)
- ?initTestCase@TestMmsPlugin@@AAEXXZ @ 7 NONAME ; void TestMmsPlugin::initTestCase(void)
- ?cleanup@TestMmsPlugin@@AAEXXZ @ 8 NONAME ; void TestMmsPlugin::cleanup(void)
- ?trUtf8@TestMmsPlugin@@SA?AVQString@@PBD0H@Z @ 9 NONAME ; class QString TestMmsPlugin::trUtf8(char const *, char const *, int)
- ?qt_metacall@TestMmsPlugin@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 10 NONAME ; int TestMmsPlugin::qt_metacall(enum QMetaObject::Call, int, void * *)
- ?testMmsReceived@TestMmsPlugin@@AAEXXZ @ 11 NONAME ; void TestMmsPlugin::testMmsReceived(void)
- ?testSendMMS@TestMmsPlugin@@AAEXXZ @ 12 NONAME ; void TestMmsPlugin::testSendMMS(void)
- ?trUtf8@TestMmsPlugin@@SA?AVQString@@PBD0@Z @ 13 NONAME ; class QString TestMmsPlugin::trUtf8(char const *, char const *)
- ?tr@TestMmsPlugin@@SA?AVQString@@PBD0@Z @ 14 NONAME ; class QString TestMmsPlugin::tr(char const *, char const *)
- ?metaObject@TestMmsPlugin@@UBEPBUQMetaObject@@XZ @ 15 NONAME ; struct QMetaObject const * TestMmsPlugin::metaObject(void) const
- ?getStaticMetaObject@TestMmsPlugin@@SAABUQMetaObject@@XZ @ 16 NONAME ; struct QMetaObject const & TestMmsPlugin::getStaticMetaObject(void)
- ?cleanupTestCase@TestMmsPlugin@@AAEXXZ @ 17 NONAME ; void TestMmsPlugin::cleanupTestCase(void)
-
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/src/testmmsplugin.cpp Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,183 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description: - Main test class for Msgnotification -indicator plugin,
- * -notification dialog plugin
- */
-
-#include "testmmsplugin.h"
-#include <QtTest/QtTest>
-#include "debugtraces.h"
-#include <QTimer>
-#include <QSignalSpy>
-#include "convergedmessage.h"
-#include "convergedmessageid.h"
-#include "unieditormmsplugin.h"
-#include "mmstestbed.h"
-#include "testmmsplugin.ini"
-#include <QSignalSpy>
-
-
-//---------------------------------------------------------------
-// TestMmsPlugin::initTestCase
-//---------------------------------------------------------------
-
-void TestMmsPlugin::initTestCase()
-{
- qRegisterMetaType<long int> ("long int");
- msgPlugin = new UniEditorMmsPlugin();
- QVERIFY(msgPlugin != 0);
- mmsId = -1;
- mmstestbed = new MmsTestBed;
- QVERIFY(mmstestbed != 0);
- if(!mmstestbed)
- {
- QSKIP("Mmstestbed creation failed", SkipAll);
- }
-
- spy_draft = new QSignalSpy(mmstestbed,SIGNAL(entryCreatedInDraft(long int)));
- spy_outbox = new QSignalSpy(mmstestbed,SIGNAL(entryMovedToOutbox(long int)));
- spy_sent = new QSignalSpy(mmstestbed,SIGNAL(entryMovedToSent(long int)));
-
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::init
-//---------------------------------------------------------------
-
-void TestMmsPlugin::init()
-{
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::testSendMMS
-//---------------------------------------------------------------
-
-void TestMmsPlugin::testSendMMS()
-{
-
- qRegisterMetaType<long int> ("long int");
- QString service = TEST_SERVICE_NAME_MMS;
-
- QString subject = TEST_MSG_SUBJECT;
- qint64 timeStamp = QDateTime::currentDateTime().toTime_t();
-
- QString sender(TEST_SENDER);
- ConvergedMessageAddress address(sender);
- ConvergedMessageAttachmentList attachmentList;
-
- QString attachment2Path = TEST_ATTACHMENT4;
- ConvergedMessageAttachment* attachment2 =
- new ConvergedMessageAttachment(attachment2Path, ConvergedMessageAttachment::EAttachment);
-
- QString attachmentPath = TEST_ATTACHMENT5;
- ConvergedMessageAttachment* attachment =
- new ConvergedMessageAttachment(attachmentPath, ConvergedMessageAttachment::EAttachment);
-
- attachmentList.append(attachment);
- attachmentList.append(attachment2);
- ConvergedMessage msg;
- msg.setMessageType(ConvergedMessage::Mms);
- msg.setSubject(subject);
- msg.setTimeStamp(timeStamp);
- msg.addToRecipient(address);
- msg.addAttachments(attachmentList);
- msg.setPriority(ConvergedMessage::Normal);
- //Adding alias
- ConvergedMessageAddress address1;
- address1.setAlias(QString(TEST_MSG_RECIEPIENT));
- msg.addToRecipient(address1);
-
- //Adding CC Address
- QString ccAddress(TEST_CC);
- ConvergedMessageAddress ccAdd(ccAddress);
- msg.addCcRecipient(ccAdd);
-
- //Adding BCC Address
- QString bccAddress(TEST_BCC);
- ConvergedMessageAddress bccAdd(bccAddress);
- msg.addBccRecipient(bccAdd);
-
- mmstestbed->cleanAll();
- mmstestbed->setConnectionLocal(true);
- long int id = msgPlugin->convertTo(&msg);
-
- QVERIFY(id != 0);
- msgPlugin->send(id);
- QTest::qWait(5000);
- long int idRec;
-
- if( 1 == spy_draft->count())
- {
- void * temp = const_cast<void*>(spy_draft->at(0).at(0).data());
- idRec = *reinterpret_cast< long int(*)>(temp);
- QDEBUG_WRITE("passed: spy_draft.count");
- }
- else
- {
- QFAIL("testSendReceiveMMS: Failed to create message in Draft");
- mmstestbed->setConnectionLocal(false);
- return;
- }
- if( 1 == spy_outbox->count())
- {
- mmstestbed->fromOutboxToMmsc();
- QDEBUG_WRITE("passed: spy_outbox.count");
- }
- else
- {
- QFAIL("testSendReceiveMMS: Failed to move message to Outbox");
- mmstestbed->setConnectionLocal(false);
- return;
- }
-
- if( 1 == spy_sent->count())
- {
- void * temp = const_cast<void*>(spy_sent->at(0).at(0).data());
- long int sentmsgid = *reinterpret_cast< long int(*)>(temp);
- QCOMPARE(sentmsgid, idRec);
- mmstestbed->fromMmscToInbox();
- QDEBUG_WRITE("passed: spy_sent.count");
- }
- else
- {
- QFAIL("testSendReceiveMMS: Failed to move message to Sent folder");
- mmstestbed->setConnectionLocal(false);
- return;
- }
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::testMmsReceived
-//---------------------------------------------------------------
-void TestMmsPlugin::testMmsReceived()
-{
- QTest::qWait(5000);
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::cleanup
-//---------------------------------------------------------------
-void TestMmsPlugin::cleanup()
-{
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::cleanupTestCase
-//---------------------------------------------------------------
-void TestMmsPlugin::cleanupTestCase()
-{
- delete msgPlugin;
- delete mmstestbed;
-}
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/tsrc.pro Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,25 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = subdirs
+
+CONFIG += symbian_test
+
+#Sub .pro files
+SUBDIRS += unittest_mmsplugin/unittest_mmsplugin.pro
+
+# Platforms
+SYMBIAN_PLATFORMS = DEFAULT
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/inc/mmsreadfile.h Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,471 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#ifndef MMSREADFILE_H
+#define MMSREADFILE_H
+
+// INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+#include <f32file.h>
+#include <msvstd.h>
+
+// forward references
+class CMmsAttaStructure;
+class CMmsHeaders;
+class CEikonEnv;
+class CMmsClientMtm;
+
+// Out-of-range value for any MMS header with assigned number
+// Used in coverage tests to get coverage for "default" branches
+// in "case" statements.
+const TInt KMmsTestIllegalValue = 255;
+
+//
+// TEST KEY WORDS
+// Extended to include all MMS headers to allow generation of arbitrary PDUs
+// Content type header cannot be separately defined,
+// it will always be "multipat/mixed" or "multipart/related"
+_LIT8( KTestEndOfFile, "EOF" );
+_LIT8( KTestNewMessage, "MESSAGE BEGIN" );
+//------------------------------------------------
+_LIT8( KTestMessageType, "MESSAGE-TYPE" ); //X-Mms-Message-Type
+_LIT8( KTestDate, "DATE" ); // Date
+_LIT8( KTestFrom, "FROM" ); // From
+_LIT8( KTestTo, "TO" ); // To
+_LIT8( KTestCc, "CC" ); // Cc
+_LIT8( KTestBcc, "BCC" ); // Bcc
+_LIT8( KTestSubject, "SUBJECT" ); // Subject
+_LIT8( KTestExpiryRel, "EXPIRY-REL" ); // X-Mms-Expiry, relative
+_LIT8( KTestExpiryAbs, "EXPIRY-ABS" ); // X-Mms-Expiry, absolute
+_LIT8( KTestDeliveryTimeRel, "DELIVERY-TIME-REL" ); // X-Mms-Delivery-Time, relative
+_LIT8( KTestDeliveryTimeAbs, "DELIVERY-TIME-ABS" ); // X-Mms-Delivery-Time, absolute
+_LIT8( KTestPriority, "PRIORITY" ); // X-Mms-Priority
+_LIT8( KTestSenderVisibility, "SENDER-VISIBILITY" ); // X-Mms-Sender-Visibility
+_LIT8( KTestDeliveryReport, "DELIVERY-REPORT" ); // X-Mms-Delivery-Report
+_LIT8( KTestReadReply, "READ-REPLY" ); // X-Mms-Read-Report
+// ---------------------------------------------------
+_LIT8( KTestNewAttachment, "ATTACHMENT" );
+_LIT8( KTestAttachmentType, "ATTACHMENTTYPE" );
+_LIT8( KTestAttachmentName, "ATTACHMENTNAME" );
+_LIT8( KTestAttachmentContLoc, "ATTACHMENTCONTLOC" );
+_LIT8( KTestAttachmentCharset, "ATTACHMENTCHARSET" );
+_LIT8( KTestAttachmentCid, "ATTACHMENTCID" );
+_LIT8( KTestAttachmentRoot, "ATTACHMENTROOT" );
+// content-type and x-type parameters for attachments
+// should appear in name-value pairs.
+// Test program is not responsible for verifying illegal scripts
+_LIT8( KTestAttContTypeParamName, "ContTypeParamName" );
+_LIT8( KTestAttContTypeParamValue, "ContTypeParamValue" );
+_LIT8( KTestAttXTypeParamName, "X-TypeParamName" );
+_LIT8( KTestAttXTypeParamValue, "X-TypeParamValue" );
+// -----------------------------------------------------
+_LIT8( KTestMessageClass, "MESSAGE-CLASS" ); // X-Mms-Message-Class
+_LIT8( KTestDelivRepSendAllow, "DELIV-REP-SEND-ALLOW" ); // X-Mms-Report-Allowed
+_LIT8( KTestAcceptAdvertis, "ACCEPT-ADVERTISEMENTS" );
+_LIT8( KTestRetryCount, "RETRY-COUNT" );
+_LIT8( KTestRetryInterval, "RETRY-INTERVAL" );
+// -------------------------------------------------
+_LIT8( KTestAlias, "ALIAS" );
+_LIT8( KTestFromAlias, "FROMALIAS" );
+_LIT8( KTestToAlias, "TOALIAS" );
+_LIT8( KTestCcAlias, "CCALIAS" );
+_LIT8( KTestBccAlias, "BCCALIAS" );
+// -------------------------------------------------
+// more Message headers to allow testing all possible PDUs and
+// MMS 1.1 headers
+_LIT8( KTestReplyCharging, "REPLY-CHARGING" ); // X-Mms-Reply-Charging
+_LIT8( KTestReplyChargAbs, "REPLY-CHARG-DEADLINE-ABS" ); // X-Mms-Reply-Charging, absolute
+_LIT8( KTestReplyChargRel, "REPLY-CHARG-DEADLINE-REL" ); // X-Mms-Reply-Charging, relative
+_LIT8( KTestReplyChargSize, "REPLY-CHARG-SIZE" ); // X-Mms-Reply-Charging-Size (octets)
+_LIT8( KTestReplyChargID, "REPLY-CHARGING-ID" ); // X-Mms-Reply-Charging-ID
+_LIT8( KTestTID, "TID" );
+_LIT8( KTestContentLocation, "CONTLOC" ); // X-Mms-Content-Location
+// The following three must appear as triplets.
+// index must be first, address and date may appear in any order
+_LIT8( KTestPreviouslySentIndex, "PREVIOUSINDEX" ); // forwarded count for X-Mms-PreviouslySent headers
+_LIT8( KTestPreviouslySentBy, "PREV-SENT-BY" ); // X-Mms-Previously-Sent-By
+_LIT8( KTestPreviouslySentDate, "PREV-SENT-DATE" ); // X-Mms-Previously-Sent-Date
+//---
+_LIT8( KTestMessageId, "MESSAGE-ID" ); // Message-ID
+_LIT8( KTestMessageSize, "MESSAGE-SIZE" ); // X-Mms-Message-Size (octets)
+_LIT8( KTestVersion, "MMS-VERSION" ); // X-MMS-Version (hex:, 10 = 1.0, 11 = 1.1 etc. )
+_LIT8( KTestReadStatus, "READ-STATUS" ); // X-Mms-Read-Status
+_LIT8( KTestResponseStatus, "RESPONSE-STATUS" ); // X-Mms-Response-Status
+_LIT8( KTestResponseText, "RESPONSE-TEXT" ); // X-Mms-Response-Text
+_LIT8( KTestRetrieveStatus, "RETRIEVE-STATUS" ); // X-Mms-Retrieve-Status
+_LIT8( KTestRetrieveText, "RETRIEVE-TEXT" ); // X-Mms-Retrieve-Text
+_LIT8( KTestStatus, "STATUS" ); // X-Mms-Status
+// -------------------------------------------------
+// MMS 1.2 headers
+_LIT8( KTestAttribute, "ATTRIBUTE" ); // X-Mms-Attribute
+// The value should be one of the following:
+// BCC, CC, CONTENT, CONTENT-TYPE, DATE, DELIVERY-REPORT, DELIVERY-TIME-ABS,
+// EXPIRY-ABS, FROM, MESSAGE-CLASS, MESSAGE-ID, MESSAGE-SIZE, PRIORITY,
+// READ-REPLY, SUBJECT, TO, REPLY-CHARGING, REPLY-CHARGING-ID,
+// REPLY-CHARG-DEADLINE-ABS, REPLY-CHARG-SIZE, PREV-SENT-BY,
+// PREV-SENT-DATE, ADDITIONAL-HEADERS
+_LIT8( KTestDistributionIndicator, "DISTRIBUTION-INDICATOR" ); // X-Mms-Distribution-Indicator
+_LIT8( KTestLimit, "LIMIT" ); // X-Mms-Limit
+_LIT8( KTestMessageQuota, "MESSAGE-QUOTA" ); // X-Mms-Mbox-Quota, message number
+_LIT8( KTestSizeQuota, "SIZE-QUOTA" ); // X-Mms-Mbox-Quota, size quota
+_LIT8( KTestMessageTotal, "MESSAGE-TOTAL" ); // X-Mms-Mbox-Totals, message number
+_LIT8( KTestSizeTotal, "SIZE-TOTAL" ); // X-Mms-Mbox-Totals, total size
+_LIT8( KTestMessageCount, "MESSAGE-COUNT" ); // X-Mms-Message-Count
+_LIT8( KTestAddKeyword, "ADD-KEYWORD" ); // X-Mms-MM-Flags
+_LIT8( KTestRemoveKeyword, "REMOVE-KEYWORD" ); // X-Mms-MM-Flags
+_LIT8( KTestFilterKeyword, "FILTER-KEYWORD" ); // X-Mms-MM-FLags
+_LIT8( KTestMMState, "MESSAGE-STATE" ); // X-Mms-MM-State
+_LIT8( KTestQuota, "QUOTA" ); // X-Mms-Quotas
+_LIT8( KTestStart, "START" ); // X-Mms-Start
+_LIT8( KTestStore, "STORE" ); // X-Mms-Store
+_LIT8( KTestStored, "STORED" ); // X-Mms-Stored
+_LIT8( KTestStoreStatus, "STORE-STATUS" ); // X-Mms-Store-Status
+_LIT8( KTestStoreStatusText, "STORE-STATUS-TEXT" ); // X-Mms-Store-Status-Text
+_LIT8( KTestTotals, "TOTALS" ); // X-Mms-Totals
+// Delete confirmation header structure
+// This consists of index, content location, response status and response status text.
+// All three values are not always necessary for each index, but at least content-location
+// and response status should be present.
+// The index retains its value until a new index is encountered.
+_LIT8( KTestDeleteInfoIndex, "DELETESTATUSINDEX" ); // index for next delete info fields
+// This header must precede content-location, response-status and response-text fields
+// in a delete confirmation. Index retains its value until a new index is encountered.
+
+// Element descriptor header not implemented
+
+// Application id headers
+// These will officially be supported in MMS encapsulation version 1.3
+// Java has non-standard support even earlier
+
+_LIT8( KTestApplicId, "APPLIC-ID" ); // X-Mms-Applic-ID
+_LIT8( KTestReplyApplicId, "REPLY-APPLIC-ID" ); // X-Mms-Reply-Applic-ID
+_LIT8( KTestApplicInfo, "AUX-APPLIC-INFO" ); // X-Mms-Aux-Applic-Info
+
+// Since Encapsulation 1.3
+_LIT8( KTestContentClass, "CONTENT-CLASS" ); // X-Mms-Content-Class
+_LIT8( KTestDrmContent, "DRM-CONTENT" ); // X-Mms-DRM-Content
+_LIT8( KTestAdaptationAllowed, "ADAPTATION-ALLOWED" ); // X-Mms-Adaptation-Allowed
+_LIT8( KTestRecommendedRetrievalMode, "REC-RETRIEVAL-MODE" ); // X-Mms-Recommended-Retrieval-Mode
+_LIT8( KTestRecRetrievalModeText, "REC-RETR-MODE-TEXT" ); // X-Mms-Recommended-Retrieval-Mode-Text
+_LIT8( KTestReplaceId, "REPLACE-ID" ); // X-Mms-Replace-ID
+_LIT8( KTestStatusText, "STATUS-TEXT" ); // X-Mms-Status-Text
+_LIT8( KTestCancelId, "CANCEL-ID" ); // X-Mms-Cancel-ID
+_LIT8( KTestCancelStatus, "CANCEL-STATUS" ); // X-Mms-Cancel-Status
+
+// DATA TYPES
+#define aSet 1
+#define aReset 0
+#define PartCount 100
+#define MaxAttaCount 10
+#define DefaultBufLen 256
+#define MaxRecipients 5
+
+// status returned by ReadRow
+enum TTestReadStatus
+ {
+ ETestUnknown,
+ ETestNewMessage,
+ ETestNewAttachment,
+ ETestEof, // End of file
+ ETestMessageType,
+ ETestDate,
+ ETestFrom,
+ ETestTo,
+ ETestCc,
+ ETestBcc,
+ ETestAlias,
+ ETestFromAlias,
+ ETestToAlias,
+ ETestCcAlias,
+ ETestBccAlias,
+ ETestSubject,
+ ETestExpiryRel,
+ ETestExpiryAbs,
+ ETestDeliveryTimeRel,
+ ETestDeliveryTimeAbs,
+ ETestPriority,
+ ETestSenderVisibility,
+ ETestDeliveryReport,
+ ETestReadReply,
+ ETestAttachmentType,
+// ETestAttachmentName,
+ ETestAttachmentCharset,
+ ETestAttachmentCid,
+ ETestAttachmentRoot,
+ ETestSettings,
+ ETestMessageClass,
+ ETestDelivReportSendAllow,
+ ETestSingleMessageClass,
+ ETestReplyCharging,
+ ETestReplyChargAbs,
+ ETestReplyChargRel,
+ ETestReplyChargSize,
+ ETestReplyChargID,
+ ETestTID,
+ ETestContentLocation,
+ ETestPreviouslySentIndex,
+ ETestPreviouslySentBy,
+ ETestPreviouslySentDate,
+ ETestMessageId,
+ ETestMessageSize,
+ ETestVersion,
+ ETestReadStatus,
+ ETestResponseStatus,
+ ETestResponseText,
+ ETestRetrieveStatus,
+ ETestRetrieveText,
+ ETestStatus,
+ ETestAttribute,
+ ETestDistributionIndicator,
+ ETestLimit,
+ ETestMessageQuota,
+ ETestSizeQuota,
+ ETestMessageTotal,
+ ETestSizeTotal,
+ ETestMessageCount,
+ ETestAddKeyword,
+ ETestRemoveKeyword,
+ ETestFilterKeyword,
+ ETestMMState,
+ ETestQuota,
+ ETestStart,
+ ETestStore,
+ ETestStored,
+ ETestStoreStatus,
+ ETestStoreStatusText,
+ ETestTotals,
+ ETestDeleteInfoIndex,
+ ETestApplicId,
+ ETestReplyApplicId,
+ ETestApplicInfo,
+ ETestContentClass,
+ ETestDrmContent,
+ ETestAdaptationAllowed,
+ ETestRecommendedRetrievalMode,
+ ETestRecRetrievalModeText,
+ ETestReplaceId,
+ ETestStatusText,
+ ETestCancelId,
+ ETestCancelStatus,
+ ETestAttaRecommendedName,
+ ETestAttachmentContLoc,
+ ETestAttContTypeParamName,
+ ETestAttContTypeParamValue,
+ ETestAttXTypeParamName,
+ ETestAttXTypeParamValue
+
+ };
+
+// VALUE KEYWORDS
+_LIT( KPersonal, "Personal" );
+_LIT( KAdvertisement, "Advertisement" );
+_LIT( KInformational, "Informational" );
+_LIT( KAuto, "Auto" );
+_LIT( KLow, "Low" );
+_LIT( KNormal, "Normal" );
+_LIT( KHigh, "High" );
+_LIT( KHide, "Hide" );
+_LIT( KShow, "Show" );
+_LIT( KYes, "Yes" );
+_LIT( KNo, "No" );
+_LIT( KOn, "On" );
+_LIT( KOff, "Off" );
+_LIT( KDeferred, "Deferred" );
+_LIT( KExpired, "Expired" );
+_LIT( KRetrieved, "Retrieved" );
+_LIT( KRejected, "Rejected" );
+_LIT( KUnrecognized, "Unrecognized" );
+_LIT( KIndeterminate, "Indeterminate" );
+_LIT( KForwarded, "Forwarded" );
+_LIT( KUnreachable, "Unreachable" );
+_LIT( KDraft, "Draft");
+_LIT( KSent, "Sent" );
+_LIT( KNew, "New" );
+// X-Mms-Message-Type
+_LIT( KSendReq, "SendReq" );
+_LIT( KSendConf, "SendConf" );
+_LIT( KNotifInd, "NotifInd" );
+_LIT( KNotifResp, "NotifResp" );
+_LIT( KRetrConf, "RetrConf" );
+_LIT( KAckInd, "AckInd" );
+_LIT( KDelInd, "DelInd" );
+_LIT( KReadReqInd, "ReadReqInd" );
+_LIT( KReadOrigInd, "ReadOrigInd" );
+_LIT( KForwardRec, "ForwardReq" );
+_LIT( KForwardConf, "ForwardConf" );
+_LIT( KMBoxStoreReq, "MBoxStoreReq" );
+_LIT( KMBoxStoreConf, "MBoxStoreConf" );
+_LIT( KMBoxViewReq, "MBoxViewReq" );
+_LIT( KMBoxViewConf, "MBoxViewConf" );
+_LIT( KMBoxUploadReq, "MBoxUploadReq" );
+_LIT( KMBoxUploadConf, "MBoxUploadConf" );
+_LIT( KMBoxDeleteReq, "MBoxDeleteReq" );
+_LIT( KMBoxDeleteConf, "MBoxDeleteConf" );
+_LIT( KMBoxDescr, "MBoxDescr" );
+_LIT( KDeleteReq, "DeleteReq" );
+_LIT( KDeleteConf, "DeleteConf" );
+_LIT( KCancelReq, "CancelReq" );
+_LIT( KCancelResp, "CancelConf" );
+// X-Mms-Read-Status
+_LIT( KRead, "Read" );
+_LIT( KDelNotRead, "DeletedNotRead" );
+// X-Mms-Reply-Charging
+_LIT( KRequested, "Requested" );
+_LIT( KReqTextOnly, "ReqTextOnly" );
+_LIT( KAccepted, "Accepted" );
+_LIT( KAccTextOnly, "AccTextOnly" );
+// X-Mms-Cancel-Status (only receival of request, not actual cancellation)
+_LIT( KCancelSuccessful, "CancelSuccess" );
+_LIT( KCancelCorrupted, "CancelCorrupted" );
+// X-Mms-Content-Class
+_LIT( KText, "Text" );
+_LIT( KImageBasic, "ImageBasic" );
+_LIT( KImageRich, "ImageRich" );
+_LIT( KVideoBasic, "VideoBasic" );
+_LIT( KVideoRich, "VideoRich" );
+_LIT( KMegaPixel, "MegaPixel" );
+_LIT( KContentBasic, "ContentBasic" );
+_LIT( KContentRich, "ContentRich" );
+// X-Mms-Recommended-Retrieval-Mode
+_LIT( KManual, "Manual" );
+
+//X-Mms-ResponseStatus
+// legacy values
+_LIT( KOk, "OK" );
+_LIT( KErrUnspecified, "Unspecified" );
+_LIT( KErrServiceDenied, "ServiceDenied" );
+_LIT( KErrMessageFormatCorrupt, "FormatCorrupt" );
+_LIT( KErrAddressUnresolved, "AddressUnresolved" );
+_LIT( KErrMessageNotFound, "MessageNotFound" );
+_LIT( KErrNetworkProblem, "NetworkProblem" );
+_LIT( KErrContentNotAccepted, "ContentNotAccepted" );
+_LIT( KErrUnsupportedMessage, "UnsupportedMessage" );
+// values since 1.1 (and 1.2)
+_LIT( KErrTransient, "TransientFailure" );
+_LIT( KErrTransientAddressUnresolved, "TransientAddressUnresolved" );
+_LIT( KErrTransientNotFound, "TransientMessageNotFound" );
+_LIT( KErrTransientNetworkproblem, "TransientNetworkProblem" );
+_LIT( KErrTransientPartialSuccess, "PartialSuccess" );
+_LIT( KErrPermanent, "PermanentFailure" );
+_LIT( KErrPermanentServiceDenied, "PermanentServiceDenied" );
+_LIT( KErrPermanentMessageFormatCorrupt, "PermanentFormatCorrupt" );
+_LIT( KErrPermanentAddressUnresolved, "PermanentAddressUnresolved" );
+_LIT( KErrPermanentNotFound, "PermanentMessageNotFound" );
+_LIT( KErrPermanentContentNotAccepted, "PermanentContentNotAccepted" );
+_LIT( KErrReplyChargingLimitNotMet, "ReplyChargingLimitNotMet" );
+_LIT( KErrReplyChargingRequestNotAccepted, "ReplyChargingRequestNotAccepted" );
+_LIT( KErrReplyChargingForwardingDenied, "ReplyChargingForwardingDenied" );
+_LIT( KErrReplyChargingNotSupported, "ReplyChargingNotSupported" );
+_LIT( KErrAddressHidingNotSupported, "AddressHidingNotSupported" );
+_LIT( KErrPermanentLackOfPrepaid, "PermanentLackOfPrepaid" );
+//X-Mms-RetrieveStatus (one extra value)
+_LIT( KErrRetrieveContentUnsupported, "PermanentContentUnsupported" );
+//X-Mms-Store-Status (one extra value)
+_LIT( KErrMMBoxFull, "MMBoxFull" );
+
+_LIT8( KTestContent, "Content" ); // For attribute list only
+_LIT8( KTestAdditionalHeaders, "ADDITIONAL-HEADERS" ); // For attribute list only
+_LIT8( KTestDeliveryTime, "DELIVERY-TIME"); // for attribute list only
+_LIT8( KTestExpiry, "EXPIRY"); // for attribute list only
+_LIT8( KTestReplyCharg, "REPLY-CHARG-DEADLINE" ); // for attribute list only
+_LIT8( KTestContentType, "CONTENT-TYPE" ); // for attribute list only
+
+/**
+* CMmsReadFile
+*/
+NONSHARABLE_CLASS( CMmsReadFile ):public CBase
+ {
+ public: // Constructors and destructor
+
+ static CMmsReadFile* NewL(RFs& aFs, RFileReadStream& aReadStream ); // Two-phased constructor.
+ virtual ~CMmsReadFile(); // Destructor
+
+ public: // New functions
+
+ TInt CompleteTestL(TInt aMessageCounter, CMmsHeaders& aMmsHeaders);
+ TTestReadStatus ReadRowL();
+ void CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders );
+ TInt FindAlias(TPtrC alias);
+ void SetAttaStructure( TBool aOldAttaStructure = EFalse );
+
+ protected: // Functions from base classes
+
+ private:
+
+ CMmsReadFile(); // C++ default constructor.
+ // By default constructor is private.
+ void ConstructL( RFs& aFs, RFileReadStream& aReadStream );
+ void Reset();
+
+ public: // data
+ TInt iMessageType;
+
+
+ private: // Data
+
+ RFs iFs;
+ RFileReadStream* iReader;
+ TBuf<DefaultBufLen> iValueBuffer;
+ CDesCArray* iAliasArray; // aliases
+ HBufC8* iByteBuffer;
+ TTime iDate;
+ CArrayPtrFlat<CMmsAttaStructure>* iAttaStructures;
+ TInt iAttaCount;
+ TInt iAttaRoot;
+ TInt iAliasCount;
+ TInt iNextMessageType;
+ TParse iParse;
+ TFileName iFilename;
+
+ protected: // Data
+ private: // Data
+
+ // CArrayFixFlat <TestMessage>* iMessages;
+
+ public: // Friend classes
+ protected: // Friend classes
+ private: // Friend classes
+
+ };
+
+
+NONSHARABLE_CLASS( CMmsAttaStructure ):public CBase
+ {
+ public: // Constructors and destructor
+ static CMmsAttaStructure* NewL(); // Two-phased constructor.
+ virtual ~CMmsAttaStructure(); // Destructor
+ private:
+ CMmsAttaStructure(); // C++ default constructor.
+ // By default constructor is private.
+ void ConstructL();
+
+ public: // Data
+ HBufC8* iAtta;
+ HBufC8* iAttaName; // content location
+ HBufC8* iAttaType;
+ HBufC8* iAttaCid;
+ TInt iAttaCharset;
+ HBufC* iAttaRecommendedName; // recommended filename
+ CDesC8ArrayFlat* iContentTypeParams; // zero or more "parameter"
+ CDesC8ArrayFlat* iXTypeParams; // zero or more X-Type "parameters"
+
+ };
+
+
+#endif // MMSREADFILE_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/inc/mmstestbed.h Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#ifndef MMSTESTBED_H
+#define MMSTESTBED_H
+
+#ifdef BUILD_MMSTESTBED_DLL
+#define MMSTESTBED_EXPORT Q_DECL_EXPORT
+#else
+#define MMSTESTBED_EXPORT Q_DECL_IMPORT
+#endif
+
+#include <QObject>
+#include <QString>
+
+#include <msvids.h> //for consts like KMsvNullIndexEntryIdValue
+#include <MSVAPI.H>
+#include <MTCLREG.H>
+#include <mmsclient.h>
+//#include <mmsservercommon.h>
+
+class CTestUiTimer;
+class CMsvSession;
+class CMmsClientMtm;
+class CMmsSettings;
+class CMmsHeaders;
+class CLogEvent;
+class CLogViewEvent;
+class CLogFilter;
+class CLogClient;
+
+class MMSTESTBED_EXPORT MmsTestBed : public QObject, public MMsvSessionObserver
+ {
+ Q_OBJECT
+
+public:
+ /**
+ *
+ */
+ MmsTestBed();
+ ~MmsTestBed();
+ void setConnectionLocal(bool value);
+ void fromOutboxToMmsc();
+ void fromMmscToInbox();
+ /**
+ * cleanup MMS service
+ */
+ void cleanupAndCreateNewService();
+ void deleteNotifications();
+ void restoreFactorySettings();
+ void setFetchingState( TMmsReceivingMode aState );
+ void sendFromFile();
+ void sendOneByOne();
+ void sendNotifications();
+ void copyDrafts();
+ void garbageCollection(TUint32 aReason = 0x00000001); //0x00000001 == KMmsReasonBoot
+ void messageVariation();
+ void cancelSendScheduling();
+ void scheduledSend(TMsvId aBoxId, TInt aDelay = 5);
+ void deleteSendSchedule();
+ void cancelFetchScheduling();
+ void fetchForced(TInt aDelay = 5);
+ void deleteFetchSchedule();
+ void doAFetchCycle();
+ void createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry);
+ void cleanOutbox();
+ void cleanInbox();
+ void cleanSent();
+ void cleanDrafts();
+ void cleanAll();
+ void reply();
+ void replyToAll();
+ void forward();
+ void sendReadReport(); // send a read report
+ int fromOutboxToMmscWithMemoryFailure(); // returns memory failure count
+ int fromMmscToInboxWithMemoryFailure(); // returns memory failure count
+ void sendViaClient();
+ void scheduledFetch(TInt aDelay = 5);
+ void fetchForcedImmediate();
+ void getEventType();
+ void addEventType();
+ void deleteEventType();
+ void cleanLog();
+ void setOnline(bool value);
+ void generateDeliveryReport( CMmsHeaders* aMmsHeaders );
+ void sendDeliveryReport();
+
+signals:
+ void entryCreatedInDraft(long int id);
+ void entryMovedToOutbox(long int id);
+ void entryMovedToSent(long int id);
+ void entryCreatedInInbox(long int id);
+
+protected:
+ /**
+ * From MMsvSessionObserver
+ */
+ void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
+ TAny* aArg2, TAny* aArg3);
+
+private:
+ void findDefaultL();
+ void createMmsService();
+ void cleanup();
+ void deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry);
+ void testFile(TFileName& aFilePath, TInt aCommand = 0, TMsvId aBox = KMsvGlobalOutBoxIndexEntryId);
+ void addMMBoxDescriptions();
+ void encodeMessageFromDrafts();
+ TMsvId findMMSFolder();
+ bool checkLogClient();
+ int getLogEntries();
+
+private:
+ //data
+ CTestUiTimer* iTimer;
+ CMsvOperationActiveSchedulerWait* iWait;
+ CMsvSession* iSession;
+ CClientMtmRegistry* iClientMtmRegistry;
+ CMmsClientMtm* iMmsClient;
+ CMmsSettings* iSettings;
+ CMmsHeaders* iMmsHeaders;
+ TMsvId iServiceId;
+ TMsvId iDefaultServiceId;
+ TMsvSessionEvent iEvent;
+ RFs iFs;
+ TFileName iFilename;
+ TFileName iCurrentFile;
+ TFileName iCurrentPath;
+ TParse iParse; // parse buffer as member to save stack space
+ CBufFlat* iEncodeBuffer;
+ CMsvEntrySelection* iMsvEntrySelection;
+ CLogEvent* iLogEvent;
+ CLogClient* iLogClient;
+ CLogViewEvent* iLogView;
+ CLogFilter* iLogFilter;
+ };
+
+#endif // MMSTESTBED_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/inc/mmstestbed.hrh Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#include <bldvariant.hrh>
+
+
+#ifndef MMSTESTBED_HRH
+#define MMSTESTBED_HRH
+
+enum
+{
+ EAppMainOk = 1,
+ EAppMainCancel,
+ //
+ EMenufrmCmdCascadeTest,
+ ECleanup,
+ ECleanOutbox,
+ ESaveSettings,
+ ELoadSettings,
+ ECleanInbox,
+ EShowIn,
+ EShowOut,
+ EOutToMMSC,
+ EMMSCToIn,
+ ESendScheduled,
+ EReceiveScheduled,
+ EShowSent,
+ ECleanSent,
+ EStartMyNotifier,
+ EGetEventType,
+ EAddEventType,
+ EDeleteEventType,
+ EViewLog,
+ ECleanLog,
+ EShowWapAccessPoints,
+ ESelectWapAccessPoint,
+ EShowConnectionMode,
+ EShowIAP,
+ EConnectToIAP,
+ EDeleteSendSchedule,
+ EDeleteReceiveSchedule,
+ EDeleteNotifications,
+ ERestoreFactorySettings,
+ ECreateFromFile,
+ EShowNotifications,
+ ESendDeliveryReport,
+ EShowDrafts,
+ ECleanDrafts,
+ ECleanAll,
+ EFetchingDeferred,
+ EFetchingOn,
+ ESendFromFile,
+ ESwitchToLocal,
+ ESwitchToGlobal,
+ EDecodeLoggingOn,
+ EDecodeLoggingOff,
+ EBinaryDumpOn,
+ EBinaryDumpOff,
+ ESendNotification,
+ ECreateToInbox,
+ ECreateToSentItems,
+ ESendFromDrafts,
+ EFindMMSFolder,
+ ESendOneByOne,
+ ECreateToDrafts,
+ ESendViaClient,
+ ESendMemFail,
+ EFetchMemFail,
+ EReceiveForced,
+ ECreateHeadersFromFile,
+ ESwitchToOffline,
+ ESwitchToOnline,
+ ECopyDrafts,
+ ECreateNotification,
+ EReply,
+ EReplyToAll,
+ EForward,
+ EFetchingManual,
+ EFirstBoot,
+ ENoFirstBoot,
+ EFindNetworkStatus,
+ ESendReadReport,
+ ECreateMMBoxViewConf,
+ EGetMMBoxView,
+ ECleanMMBox,
+ EShowMMBox
+};
+
+#define ETestLabel1 1
+#define ETestLabel2 2
+#define ETestLabel3 3
+#define ETestLabel4 4
+
+#define EServiceList 2
+
+
+enum TTestBedDlgCtrlIds
+ {
+ ETestEditField = 1
+ };
+
+enum TEditServiceControls
+ {
+ EFolderLabel = 1,
+ EEditUri
+// EEditServiceFolder,
+// ENameLabel,
+// EEditServiceName,
+// ENumberLabel,
+// EEditServiceNumber
+ };
+
+enum
+ {
+ EFsViewDialogId = 1
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/inc/mmsteststaticutils.h Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#ifndef MMSTESTSTATICUTILS_H
+#define MMSTESTSTATICUTILS_H
+
+#include <e32std.h>
+#include <msvstd.h>
+#include <badesca.h>
+
+#include "mmsconst.h"
+
+class RFs;
+class CMsvSession;
+class CMmsEncode;
+class CMmsHeaders;
+
+#ifdef __WINS__
+_LIT( KRootPath, "c:\\" );
+#else
+// This is removable disk.
+// drive letter should not be hard coded, must be investigated further
+// We use c: for a while for the tests (to be cahnged later)
+_LIT( KRootPath, "c:\\" );
+//_LIT( KRootPath, "e:\\" );
+#endif
+
+// directory where mmbox descriptions are created
+_LIT( KMmsMMBoxDescriptionDirectory, "C:\\mmsmmboxdescriptions\\");
+// directory where created headers are dumped
+_LIT( KMmsDumpDirectory, "C:\\mmsdump\\");
+// content type of MMS PDUs
+_LIT8( KMmsMimeType, "application/vnd.wap.mms-message" );
+
+_LIT( KWild, "*" );
+
+
+/**
+ * joined array structure
+ *
+ */
+NONSHARABLE_CLASS( TMmsJoinedArrays ): public MDesCArray
+ {
+public:
+ TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2);
+ TInt MdcaCount() const;
+ TPtrC16 MdcaPoint(TInt aIndex) const;
+private:
+ CDesCArray* const & iArray1;
+ CDesCArray* const & iArray2;
+ };
+
+/**
+ * static utility functions
+ *
+ */
+class TMmsTestUtils
+ {
+
+public:
+
+ /**
+ *
+ */
+ TMmsTestUtils();
+
+ /**
+ * read phone number for sending messages
+ *
+ * @param aFileName full path for filename
+ * @param aFs file system handle
+ * @return allocated pointer containing the name
+ * The caller must delete the pointer when no longer needed
+ */
+ static HBufC* ReadContactFromFileL( TDesC& aFileName, RFs& aFs );
+
+ static void DecodeLoggingOnL();
+ static void DecodeLoggingOffL();
+ static void BinaryDumpOnL();
+ static void BinaryDumpOffL();
+
+ /**
+ * Clean all temporary directories used in local mode.
+ * Does not delete the directories, only the contents
+ *
+ * @param aFs file system handle
+ */
+ static void CleanDirectoryL( RFs& aFs );
+
+ /**
+ * Dump a binary message
+ *
+ * @param aBuffer buffer containing the binary message
+ * @param aFilename full path of the directory whenre the dump goes
+ * @param aParse reference to parser (to save stack space)
+ * @param aFs file system handle
+ */
+ static void Dump(
+ CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs );
+
+ /**
+ * Delete all MMS messages and notifications from a given folder
+ *
+ * @param aBoxId folder id
+ * @param aSession Messaging server session
+ */
+ static void CleanBoxL(TMsvId aBoxId, CMsvSession& aSession);
+
+ /**
+ * turn on logging messages sent to email addresses
+ */
+ static void EmailLoggingOnL();
+
+ /**
+ * turn off logging messages sent to email addresses
+ */
+ static void EmailLoggingOffL();
+
+ /**
+ * load list of children into selection and return count
+ *
+ * @param aBoxId folder id
+ * @param aMsvEntrySelection reference to a pointer that will contain the list of child ids
+ * caller is responsible of deleting the pointer afterwards.
+ * Pointer may be NULL at entry, and a new pointer will be allocated
+ * @param aSession messge server session
+ * @param aMessageType child MTM type, default is multimedia message
+ * @return number of entries in selection
+ */
+ static TInt CountChildrenL(
+ TMsvId aBoxId,
+ CMsvEntrySelection*& aMsvEntrySelection,
+ CMsvSession& aSession,
+ TUid aMessageType = KUidMsgTypeMultimedia);
+
+ /**
+ * Create a folder entry
+ *
+ * @param aSession messge server session
+ * @param aParentFolder the parent folder
+ * @param aFolderName name of the folder
+ * @param aFolderId will contain the if of the new folder if creation was successful
+ */
+ static void CreateFolderEntryL(
+ CMsvSession& aSession,
+ TMsvId aParentFolder,
+ const TDesC& aFolderName,
+ TMsvId& aFolderId );
+
+ /**
+ * Create an MMS notification from data in buffer
+ * @param aNotificationFolder mms notification folder (target folder)
+ * @param aServiceId id of MMS service
+ * @param aEncodeBuffer buffer that contains the data
+ * @param aSession message server session
+ * @return id of the created notification
+ */
+ static TMsvId CreateNotificationEntryL(
+ TMsvId aNotificationFolder,
+ TMsvId aServiceId,
+ CBufFlat* aEncodeBuffer,
+ CMsvSession& aSession );
+
+ /**
+ * Encode an MMS notification into buffer
+ * @param aUrl url of the notification for local messages a filepath
+ * @param aSize size of the message
+ * @param aMmsHeaders MMS headers structure for creating the notification
+ * @param aMmsEncoder reference to CMmsEncode class
+ * @param aEncodeBuffer flat buffer that will contain the encoded notification
+ */
+ static void FormNotification(
+ TDesC8& aUrl,
+ TInt aSize,
+ CMmsHeaders& aMmsHeaders,
+ CMmsEncode& aMmsEncoder,
+ CBufFlat* aEncodeBuffer );
+
+
+ static TBool IsDrive(const TDesC& aFileName);
+ static TBool IsDir(const TDesC& aFileName, RFs& aFs);
+ static TBool IsFile(const TDesC& aFileName, RFs& aFs);
+
+
+private:
+
+ };
+
+
+#endif // MMSTESTSTATICUTILS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/inc/mmstestuitimer.h Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#ifndef C_TESTUITIMER_H
+#define C_TESTUITIMER_H
+
+
+#include <e32base.h>
+
+#define KPeriod 10000 // period of timer
+
+/**
+ * timer for test programs
+ */
+NONSHARABLE_CLASS( CTestUiTimer ): public CTimer
+ {
+public:
+
+ static CTestUiTimer* NewL();
+ virtual ~CTestUiTimer();
+
+ void RunL();
+ void DoCancel();
+ void ConstructL();
+ void IssueRequest();
+ void TimeoutOperation(CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds);
+
+private:
+ CTestUiTimer();
+
+public:
+ TTimeIntervalMicroSeconds32 period;
+
+private: // data
+ CActive* iObject;
+ };
+
+#endif // C_TESTUITIMER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/mmstestbed.pro Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,97 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+QT += testlib
+QT -= gui
+
+TEMPLATE = lib
+
+CONFIG += hb
+#CONFIG += qtestlib
+CONFIG += symbian_test
+TARGET = mmstestbed
+
+INCLUDEPATH += .
+INCLUDEPATH += inc
+INCLUDEPATH += ../../../inc
+
+INCLUDEPATH += ../../../../../../mmsengine/inc
+INCLUDEPATH += ../../../../../../mmsengine/mmsserver/inc
+INCLUDEPATH += ../../../../../../mmsengine/mmsmessage/inc
+INCLUDEPATH += ../../../../../../mmsengine/mmscodec/inc
+INCLUDEPATH += ../../../../../../inc
+INCLUDEPATH += ../../../../../../mmsengine/mmsengine/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/mmscodec/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/mmshttptransport/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/mmsmessage/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/mmsconninit/inc
+#INCLUDEPATH += ../../../../mmsengine/mmscodec/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/mmsserver/inc
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+DEFINES += BUILD_MMSTESTBED_DLL
+
+SOURCES += src/mmstestbed.cpp \
+ src/mmsteststaticutils.cpp \
+ src/mmsreadfile.cpp \
+ src/mmstestuitimer.cpp
+
+HEADERS += inc/mmstestbed.h \
+ inc/mmsteststaticutils.h \
+ inc/mmsreadfile.h \
+ inc/mmstestuitimer.h \
+ inc/mmstestbed.hrh
+
+SYMBIAN_PLATFORMS = WINSCW ARMV5
+
+defBlock = \
+ "$${LITERAL_HASH}if defined(EABI)" \
+ "DEFFILE eabi/mmstestbedu.def" \
+ "$${LITERAL_HASH}else" \
+ "DEFFILE bwins/mmstestbedu.def" \
+ "$${LITERAL_HASH}endif"
+
+
+symbian {
+ TARGET.UID3 = 0xE5c588a1
+ TARGET.CAPABILITY = CAP_GENERAL_DLL
+ TARGET.EPOCSTACKSIZE = 0x8000
+ TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
+ TARGET.EPOCALLOWDLLDATA = 1
+ VENDORID = VID_DEFAULT
+ }
+
+# Build.inf rules
+BLD_INF_RULES.prj_exports += \
+ "$${LITERAL_HASH}include <platform_paths.hrh>"
+
+LIBS += -lmsgs \
+ -lmmsmessage \
+ -lmmsconninit \
+ -lmmscodec \
+ -lmmsserversettings \
+ -lcentralrepository \
+ -lapparc \
+ -lbafl \
+ -lefsrv \
+ -lesock \
+ -lestor \
+ -leuser \
+ -llogcli \
+ -llogwrap \
+ -lapgrfx \
+ -lapmime
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/src/mmsreadfile.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,1799 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <badesca.h>
+#include <e32def.h>
+#include <s32file.h>
+#include <msvids.h>
+#include <mtmdef.h>
+//#include <eikenv.h>
+#include <apgcli.h>
+#include <CMsvMimeHeaders.h>
+#include <AknNoteWrappers.h>
+
+#include <mmsservercommon.h>
+#include "mmsconst.h"
+#include "mmsclient.h"
+#include "mmsheaders.h"
+#include "mmsreadfile.h"
+#include "mmsmmboxviewheaders.h"
+#include "mmsmmboxmessageheaders.h"
+#include "mmsmmboxflags.h"
+#include "mmssettings.h"
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+const TInt KMmsGranularity = 8;
+_LIT( K1970, "19700000:000000.000000" ); // 1-Jan 1970 0:00:00
+
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// ==================== LOCAL FUNCTIONS ====================
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+CMmsReadFile::CMmsReadFile()
+ {
+ // all member variables in a class derived from CBase
+ // are automatically set to 0.
+ }
+
+
+//
+void CMmsReadFile::ConstructL(RFs& aFs, RFileReadStream& aReadStream )
+ {
+ // iRowBuffer = HBufC8::NewMaxL( 500 ); // Max row length!!!!
+ iFs = aFs;
+ iReader = &aReadStream;
+ iByteBuffer = HBufC8::NewL( DefaultBufLen );
+ iAliasArray = new ( ELeave ) CDesCArrayFlat( KMmsGranularity );
+ iAttaStructures = new ( ELeave ) CArrayPtrFlat<CMmsAttaStructure>( KMmsGranularity );
+ Reset();
+ }
+
+// Two-phased constructor.
+CMmsReadFile* CMmsReadFile::NewL(RFs& aFs, RFileReadStream& aReadStream )
+ {
+ CMmsReadFile* self = new ( ELeave ) CMmsReadFile();
+ CleanupStack::PushL( self );
+ self->ConstructL( aFs, aReadStream );
+ CleanupStack::Pop();
+ return self;
+ }
+
+
+// Destructor
+CMmsReadFile::~CMmsReadFile()
+ {
+ Reset(); // resets and destroys all array data
+ if (iAliasArray != NULL) iAliasArray->Reset();
+ delete iByteBuffer;
+ delete iAliasArray;
+ delete iAttaStructures;
+ }
+
+void CMmsReadFile::Reset()
+ {
+ // reset all arrays
+ if (iAttaStructures != NULL) iAttaStructures->ResetAndDestroy();
+ iAttaCount = 0;
+ iAttaRoot = 0;
+ }
+
+// ---------------------------------------------------------
+// CMmsReadFile()::CompleteTest
+// ---------------------------------------------------------
+//
+TInt CMmsReadFile::CompleteTestL( TInt aMessageCounter, CMmsHeaders& aMmsHeaders )
+{
+ Reset(); // new message
+
+ TUint32 val;
+ TUint limit = 1000000;
+ TUint sizeLimit = 1000 * 1024; //max message size 1000 kB!
+ TUint allLimit = 999999;
+ TInt error;
+ TRadix radix = EDecimal;
+ TLex16 lex;
+ TTestReadStatus readStatus = ETestUnknown;
+ CMmsAttaStructure* oneAtta = NULL;
+ TInt index;
+ TTime y1970( K1970 );
+ TTimeIntervalMicroSeconds interval;
+ TTime date;
+ TInt order = 0;
+ TInt16 shortInteger = 0;
+
+ //iso luuppi, joka kiertää ja lukee kunnes EOF tule vastaan
+ //Big Loop, which passes around and read until the EOF
+
+ iMessageType = iNextMessageType;
+ while(readStatus != ETestEof)
+ {
+ readStatus = ReadRowL();
+ if ( readStatus == ETestEof )
+ {
+ return(-1);
+ }
+ if ( readStatus == ETestUnknown )
+ {
+ // A line containing only comments, or an unknown tag
+ // As using the scripts to test settings is no longer supported,
+ // any old keywords used to test CMmsSettings class are ignored
+ continue;
+ }
+ if( readStatus == ETestNewMessage )
+ {
+ iNextMessageType = readStatus;
+ if(aMessageCounter++)
+ {
+ return(NULL);
+ }
+ else
+ {
+ iMessageType = iNextMessageType;
+ continue;
+ }
+ }
+ if ( iMessageType == ETestNewMessage)
+ {
+ switch(readStatus)
+ {
+ case ETestFrom:
+ aMmsHeaders.SetSenderL( iValueBuffer );
+ break;
+ case ETestFromAlias:
+ index = FindAlias(iValueBuffer);
+ if(index >= 0)
+ {
+ aMmsHeaders.SetSenderL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ) );
+ }
+ break;
+ case ETestTo:
+ aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientTo );
+ break;
+ case ETestToAlias:
+ index = FindAlias(iValueBuffer);
+ if(index >= 0)
+ {
+ aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsTo );
+ }
+ break;
+ case ETestCc:
+ aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientCc );
+ break;
+ case ETestCcAlias:
+ index = FindAlias(iValueBuffer);
+ if(index >= 0)
+ {
+ aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsCc );
+ }
+ break;
+ case ETestBcc:
+ aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientBcc );
+ break;
+ case ETestBccAlias:
+ index = FindAlias(iValueBuffer);
+ if(index >= 0)
+ {
+ aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsBcc );
+ }
+ break;
+ case ETestSubject:
+ aMmsHeaders.SetSubjectL( iValueBuffer );
+ break;
+ case ETestExpiryRel:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetExpiryInterval( val );
+ }
+ break;
+ case ETestExpiryAbs:
+ error = iDate.Set(iValueBuffer);
+ interval = iDate.MicroSecondsFrom( y1970 );
+ // expiry date in seconds from 1.1.1970.
+ aMmsHeaders.SetExpiryDate( (interval.Int64())/1000000 );
+ break;
+ case ETestDeliveryTimeRel:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetDeliveryTimeInterval( val );
+ }
+ break;
+ case ETestDeliveryTimeAbs:
+ error = iDate.Set(iValueBuffer);
+ interval = iDate.MicroSecondsFrom( y1970 );
+ aMmsHeaders.SetDeliveryDate( (interval.Int64())/1000000 );
+ break;
+ case ETestDate:
+ error = iDate.Set(iValueBuffer);
+ interval = iDate.MicroSecondsFrom( y1970 );
+ aMmsHeaders.SetDate( (interval.Int64())/1000000 );
+ case ETestPriority:
+ val = 0;
+ if ((iValueBuffer.CompareF(KLow)) == 0)
+ {
+ val = EMmsPriorityLow;
+ }
+ else if ((iValueBuffer.CompareF(KNormal)) == 0)
+ {
+ val = EMmsPriorityNormal;
+ }
+ else if ((iValueBuffer.CompareF(KHigh)) == 0)
+ {
+ val = EMmsPriorityHigh;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetMessagePriority( val );
+ break;
+ case ETestSenderVisibility:
+ val = 0;
+ if ((iValueBuffer.CompareF(KHide)) == 0)
+ {
+ val = EMmsSenderVisibilityHide;
+ }
+ else if ((iValueBuffer.CompareF(KShow)) == 0)
+ {
+ val = EMmsSenderVisibilityShow;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetSenderVisibility( val );
+ break;
+ case ETestDeliveryReport:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = EMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = EMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetDeliveryReport( val );
+ break;
+ case ETestDelivReportSendAllow:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = EMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = EMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetReportAllowed( val );
+ break;
+
+ case ETestReadReply:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = EMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = EMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetReadReply( val );
+ break;
+ case ETestNewAttachment:
+ oneAtta = CMmsAttaStructure::NewL();
+ iAttaStructures->AppendL(oneAtta);
+ oneAtta->iAtta->Des().Copy( iValueBuffer );
+ iAttaCount++;
+ break;
+ case ETestAttachmentType:
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaType->Des().Copy( iValueBuffer );
+ }
+ break;
+ case ETestAttachmentContLoc:
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaName->Des().Copy( iValueBuffer );
+ }
+ break;
+ case ETestAttaRecommendedName:
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaRecommendedName->Des().Copy( iValueBuffer );
+ }
+ break;
+ case ETestAttachmentCharset:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaCharset = val;
+ }
+ }
+ break;
+ case ETestAttachmentCid:
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaCid->Des().Copy(iValueBuffer);
+ }
+ break;
+ case ETestAttContTypeParamName:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if (oneAtta != NULL)
+ {
+ oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
+ }
+ break;
+ case ETestAttContTypeParamValue:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if (oneAtta != NULL)
+ {
+ oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
+ }
+ break;
+ case ETestAttXTypeParamName:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if (oneAtta != NULL)
+ {
+ oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
+ }
+ break;
+ case ETestAttXTypeParamValue:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if (oneAtta != NULL)
+ {
+ oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
+ }
+ break;
+ case ETestAttachmentRoot:
+ iAttaRoot = iAttaCount;
+ break;
+ case ETestAlias:
+ // all aliases are global even if they appear
+ // in the middle of a message
+ iAliasArray->AppendL( iValueBuffer );
+ iAliasCount++;
+ break;
+ case ETestMessageClass: // should be handled!
+ val = EMmsClassPersonal;
+ if ((iValueBuffer.CompareF(KPersonal)) == 0)
+ {
+ val = EMmsClassPersonal;
+ }
+ else if ((iValueBuffer.CompareF(KAdvertisement)) == 0)
+ {
+ val = EMmsClassAdvertisement;
+ }
+ else if ((iValueBuffer.CompareF(KInformational)) == 0)
+ {
+ val = EMmsClassInformational;
+ }
+ else if ((iValueBuffer.CompareF(KAuto)) == 0)
+ {
+ val = EMmsClassAuto;
+ }
+ else
+ {
+ val = (TMmsMessageClass)KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetMessageClass( val );
+ break;
+ case ETestReplyCharging:
+ val = 0;
+ if ((iValueBuffer.CompareF(KRequested)) == 0)
+ {
+ val = KMmsReplyChargingRequested;
+ }
+ else if ((iValueBuffer.CompareF(KReqTextOnly)) == 0)
+ {
+ val = KMmsReplyChargingRequestedTextOnly;
+ }
+ else if ((iValueBuffer.CompareF(KAccepted)) == 0)
+ {
+ val = KMmsReplyChargingAccepted;
+ }
+ else if ((iValueBuffer.CompareF(KAccTextOnly)) == 0)
+ {
+ val = KMmsReplyChargingAcceptedTextOnly;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetReplyCharging( val );
+ break;
+ case ETestReplyChargAbs:
+ error = date.Set(iValueBuffer);
+ if ( error == KErrNone )
+ {
+ interval = date.MicroSecondsFrom( y1970 );
+ aMmsHeaders.SetReplyChargingDate( (interval.Int64())/1000000 );
+ }
+ break;
+ case ETestReplyChargRel:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetReplyChargingInterval( val );
+ }
+ break;
+ case ETestReplyChargSize:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,sizeLimit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetReplyChargingSize( val );
+ }
+ break;
+ case ETestReplyChargID:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetReplyChargingIdL( iByteBuffer->Des() );
+ break;
+ case ETestTID:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetTidL( iByteBuffer->Des() );
+ break;
+ case ETestContentLocation:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
+ aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf ||
+ aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteReq )
+ {
+ aMmsHeaders.MMBoxMessageHeadersL().ContentLocationList().AppendL( iByteBuffer->Des() );
+ }
+ else if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
+ {
+ aMmsHeaders.InsertDeleteContentLocationL( order, iByteBuffer->Des() );
+ }
+ else
+ {
+ aMmsHeaders.SetContentLocationL( iByteBuffer->Des() );
+ }
+ break;
+ case ETestPreviouslySentIndex:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ order = val;
+ break;
+ case ETestPreviouslySentBy:
+ aMmsHeaders.InsertPreviouslySentByL( order, iValueBuffer );
+ break;
+ case ETestPreviouslySentDate:
+ error = date.Set(iValueBuffer);
+ if ( error == KErrNone )
+ {
+ interval = date.MicroSecondsFrom( y1970 );
+ aMmsHeaders.InsertPreviouslySentDateL( order, (interval.Int64())/1000000 );
+ }
+ break;
+ case ETestMessageId:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetMessageIdL( iByteBuffer->Des() );
+ break;
+ case ETestMessageSize:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,sizeLimit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetMessageSize( val );
+ }
+ break;
+ case ETestVersion:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,EHex,limit);
+ shortInteger = TInt16( val );
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetMmsVersion( shortInteger );
+ }
+ break;
+ case ETestReadStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KRead)) == 0)
+ {
+ val = KMmsReadStatusRead;
+ }
+ else if ((iValueBuffer.CompareF(KDelNotRead)) == 0)
+ {
+ val = KMmsReadStatusDeletedWithoutBeingRead;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetReadStatus( val );
+ break;
+ case ETestResponseStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KOk)) == 0)
+ {
+ val = KMmsStatusOk;
+ }
+ else if ((iValueBuffer.CompareF(KErrUnspecified)) == 0)
+ {
+ val = KMmsErrorUnspecified;
+ }
+ else if ((iValueBuffer.CompareF(KErrServiceDenied)) == 0)
+ {
+ val = KMmsErrorServiceDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrMessageFormatCorrupt)) == 0)
+ {
+ val = KMmsErrorMessageFormatCorrupt;
+ }
+ else if ((iValueBuffer.CompareF(KErrAddressUnresolved)) == 0)
+ {
+ val = KMmsErrorSendingAddressUnresolved;
+ }
+ else if ((iValueBuffer.CompareF(KErrMessageNotFound)) == 0)
+ {
+ val = KMmsErrorMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrNetworkProblem)) == 0)
+ {
+ val = KMmsErrorNetworkProblem;
+ }
+ else if ((iValueBuffer.CompareF(KErrContentNotAccepted)) == 0)
+ {
+ val = KMmsErrorNoContentAccepted;
+ }
+ else if ((iValueBuffer.CompareF(KErrUnsupportedMessage)) == 0)
+ {
+ val = KMmsErrorUnsupportedMessage;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
+ {
+ val = KMmsErrorTransientFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientAddressUnresolved)) == 0)
+ {
+ val = KMmsErrorTransientSendingAddressUnresolved;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
+ {
+ val = KMmsErrorTransientMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
+ {
+ val = KMmsErrorTransientNetworkProblem;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
+ {
+ val = KMmsErrorPermanentFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
+ {
+ val = KMmsErrorPermanentServiceDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
+ {
+ val = KMmsErrorPermanentMessageFormatCorrupt;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentAddressUnresolved)) == 0)
+ {
+ val = KMmsErrorPermanentSendingAddressUnresolved;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
+ {
+ val = KMmsErrorPermanentMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentContentNotAccepted)) == 0)
+ {
+ val = KMmsErrorPermanentContentNotAccepted;
+ }
+ else if ((iValueBuffer.CompareF(KErrReplyChargingLimitNotMet)) == 0)
+ {
+ val = KMmsErrorPermanentReplyChargingLimitationsNotMet;
+ }
+ else if ((iValueBuffer.CompareF(KErrReplyChargingRequestNotAccepted)) == 0)
+ {
+ val = KMmsErrorPermanentReplyChargingRequestNotAccepted;
+ }
+ else if ((iValueBuffer.CompareF(KErrReplyChargingForwardingDenied)) == 0)
+ {
+ val = KMmsErrorPermanentReplyChargingForwardingDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrReplyChargingNotSupported)) == 0)
+ {
+ val = KMmsErrorPermanentReplyChargingNotSupported;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientPartialSuccess)) == 0)
+ {
+ val = KMmsErrorTransientPartialSuccess;
+ }
+ else if ((iValueBuffer.CompareF(KErrAddressHidingNotSupported)) == 0)
+ {
+ val = KMmsErrorPermanentAddressHidingNotSupported;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
+ {
+ aMmsHeaders.InsertDeleteStatusL( order, val );
+ }
+ else
+ {
+ aMmsHeaders.SetResponseStatus( val );
+ }
+ break;
+ case ETestResponseText:
+ if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
+ {
+ aMmsHeaders.InsertDeleteResponseTextL( order, iValueBuffer );
+ }
+ else
+ {
+ aMmsHeaders.SetResponseTextL( iValueBuffer );
+ }
+ break;
+ case ETestRetrieveStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KOk)) == 0)
+ {
+ val = KMmsStatusOk;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
+ {
+ val = KMmsErrorTransientFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
+ {
+ val = KMmsErrorReceiveTransientMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
+ {
+ val = KMmsErrorReceiveTransientNetworkProblem;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
+ {
+ val = KMmsErrorPermanentFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
+ {
+ val = KMmsErrorPermanentServiceDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
+ {
+ val = KMmsErrorReceivePermanentMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrRetrieveContentUnsupported)) == 0)
+ {
+ val = KMmsErrorReceivePermanentContentUnsupported;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetResponseStatus( val );
+ break;
+ case ETestRetrieveText:
+ aMmsHeaders.SetResponseTextL( iValueBuffer );
+ break;
+ case ETestStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KDeferred)) == 0)
+ {
+ val = KMmsMessageStatusDeferred;
+ }
+ else if ((iValueBuffer.CompareF(KExpired)) == 0)
+ {
+ val = KMmsMessageStatusExpired;
+ }
+ else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
+ {
+ val = KMmsMessageStatusRetrieved;
+ }
+ else if ((iValueBuffer.CompareF(KRejected)) == 0)
+ {
+ val = KMmsMessageStatusRejected;
+ }
+ else if ((iValueBuffer.CompareF(KUnrecognized)) == 0)
+ {
+ val = KMmsMessageStatusUnrecognized;
+ }
+ else if ((iValueBuffer.CompareF(KIndeterminate)) == 0)
+ {
+ val = KMmsMessageStatusIndeterminate;
+ }
+ else if ((iValueBuffer.CompareF(KForwarded)) == 0)
+ {
+ val = KMmsMessageStatusForwarded;
+ }
+ else if ((iValueBuffer.CompareF(KUnreachable)) == 0)
+ {
+ val = KMmsMessageStatusUnreachable;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetStatus( val );
+ break;
+ case ETestMessageType:
+ val = 0;
+ if ((iValueBuffer.CompareF(KSendReq)) == 0)
+ {
+ val = KMmsMessageTypeMSendReq;
+ }
+ else if ((iValueBuffer.CompareF(KSendConf)) == 0)
+ {
+ val = KMmsMessageTypeMSendConf;
+ }
+ else if ((iValueBuffer.CompareF(KNotifInd)) == 0)
+ {
+ val = KMmsMessageTypeMNotificationInd;
+ }
+ else if ((iValueBuffer.CompareF(KNotifResp)) == 0)
+ {
+ val = KMmsMessageTypeMNotifyRespInd;
+ }
+ else if ((iValueBuffer.CompareF(KRetrConf)) == 0)
+ {
+ val = KMmsMessageTypeMRetrieveConf;
+ }
+ else if ((iValueBuffer.CompareF(KAckInd)) == 0)
+ {
+ val = KMmsMessageTypeAcknowledgeInd;
+ }
+ else if ((iValueBuffer.CompareF(KDelInd)) == 0)
+ {
+ val = KMmsMessageTypeDeliveryInd;
+ }
+ else if ((iValueBuffer.CompareF(KReadReqInd)) == 0)
+ {
+ val = KMmsMessageTypeReadRecInd;
+ }
+ else if ((iValueBuffer.CompareF(KReadOrigInd)) == 0)
+ {
+ val = KMmsMessageTypeReadOrigInd;
+ }
+ else if ((iValueBuffer.CompareF(KForwardRec)) == 0)
+ {
+ val = KMmsMessageTypeForwardReq;
+ }
+ else if ((iValueBuffer.CompareF(KForwardConf)) == 0)
+ {
+ val = KMmsMessageTypeForwardConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxStoreReq)) == 0)
+ {
+ val = KMmsMessageTypeMboxStoreReq;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxStoreConf)) == 0)
+ {
+ val = KMmsMessageTypeMboxStoreConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxViewReq)) == 0)
+ {
+ val = KMmsMessageTypeMboxViewReq;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxViewConf)) == 0)
+ {
+ val = KMmsMessageTypeMboxViewConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxUploadReq)) == 0)
+ {
+ val = KMmsMessageTypeMBoxUploadReq;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxUploadConf)) == 0)
+ {
+ val = KMmsMessageTypeMBoxUploadConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxDeleteReq)) == 0)
+ {
+ val = KMmsMessageTypeMBoxDeleteReq;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxDeleteConf)) == 0)
+ {
+ val = KMmsMessageTypeMBoxDeleteConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxDescr)) == 0)
+ {
+ val = KMmsMessageTypeMBoxDescr;
+ }
+ else if ((iValueBuffer.CompareF(KDeleteReq)) == 0)
+ {
+ val = KMmsMessageTypeDeleteReq;
+ }
+ else if ((iValueBuffer.CompareF(KDeleteConf)) == 0)
+ {
+ val = KMmsMessageTypeDeleteConf;
+ }
+ else if ((iValueBuffer.CompareF(KCancelReq)) == 0)
+ {
+ val = KMmsMessageTypeCancelReq;
+ }
+ else if ((iValueBuffer.CompareF(KCancelResp)) == 0)
+ {
+ val = KMmsMessageTypeCancelConf;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetMessageType( val );
+ break;
+ case ETestAttribute:
+ val = 0;
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if ((iByteBuffer->Des().CompareF(KTestBcc)) == 0)
+ {
+ val = KMmsAssignedBcc;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestCc)) == 0)
+ {
+ val = KMmsAssignedCc;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestContent)) == 0)
+ {
+ val = KMmsAssignedContent;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestContentType)) == 0)
+ {
+ val = KMmsAssignedContentType;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestDate)) == 0)
+ {
+ val = KMmsAssignedDate;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestDeliveryReport)) == 0)
+ {
+ val = KMmsAssignedDeliveryReport;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestDeliveryTime)) == 0)
+ {
+ val = KMmsAssignedDeliveryTime;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestExpiry)) == 0)
+ {
+ val = KMmsAssignedExpiry;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestFrom)) == 0)
+ {
+ val = KMmsAssignedFrom;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestMessageClass)) == 0)
+ {
+ val = KMmsAssignedMessageClass;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestMessageId)) == 0)
+ {
+ val = KMmsAssignedMessageId;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestMessageSize)) == 0)
+ {
+ val = KMmsAssignedMessageSize;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestPriority)) == 0)
+ {
+ val = KMmsAssignedPriority;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReadReply)) == 0)
+ {
+ val = KMmsAssignedReadReply;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestSubject)) == 0)
+ {
+ val = KMmsAssignedSubject;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestTo)) == 0)
+ {
+ val = KMmsAssignedTo;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReplyCharging)) == 0)
+ {
+ val = KMmsAssignedReplyCharging;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReplyChargID)) == 0)
+ {
+ val = KMmsAssignedReplyChargingID;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReplyCharg)) == 0)
+ {
+ val = KMmsAssignedReplyChargingDeadline;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReplyChargSize)) == 0)
+ {
+ val = KMmsAssignedReplyChargingSize;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentBy)) == 0)
+ {
+ val = KMmsAssignedPreviouslySentBy;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentDate)) == 0)
+ {
+ val = KMmsAssignedPreviouslySentDate;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestAdditionalHeaders)) == 0)
+ {
+ val = KMmsAssignedAdditionalHeaders;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxViewHeadersL().AttributeArray().InsertInOrder(val);
+ break;
+ case ETestDistributionIndicator:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetDistributionIndicator( val );
+ break;
+ case ETestLimit:
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if( error == KErrNone )
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(val);
+ }
+ break;
+ case ETestMessageQuota:
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(val);
+ }
+ break;
+ case ETestSizeQuota:
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(val);
+ }
+ break;
+ case ETestMessageTotal:
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(val);
+ }
+ break;
+ case ETestSizeTotal:
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(val);
+ }
+ break;
+ case ETestMessageCount:
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(val);
+ }
+ break;
+ case ETestAddKeyword:
+ aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsAddToken, iValueBuffer);
+ break;
+ case ETestRemoveKeyword:
+ aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsRemoveToken, iValueBuffer);
+ break;
+ case ETestFilterKeyword:
+ aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsFilterToken, iValueBuffer);
+ break;
+ case ETestMMState:
+ val = 0;
+ if ((iValueBuffer.CompareF(KDraft)) == 0)
+ {
+ val = KMmsDraft;
+ }
+ else if ((iValueBuffer.CompareF(KSent)) == 0)
+ {
+ val = KMmsSent;
+ }
+ else if ((iValueBuffer.CompareF(KNew)) == 0)
+ {
+ val = KMmsNew;
+ }
+ else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
+ {
+ val = KMmsRetrieved;
+ }
+ else if ((iValueBuffer.CompareF(KForwarded)) == 0)
+ {
+ val = KMmsForwarded;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
+ aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ aMmsHeaders.MMBoxViewHeadersL().MMStateArray().InsertInOrder( val );
+ }
+ else
+ {
+ aMmsHeaders.MMBoxMessageHeadersL().SetMMState( val );
+ }
+ break;
+ case ETestQuota:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsQuotas( val );
+ break;
+ case ETestStart:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsStart(val);
+ }
+ break;
+ case ETestStore:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxMessageHeadersL().SetMmsStore( val );
+ break;
+ case ETestStored:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxMessageHeadersL().SetMmsStored( val );
+ break;
+ case ETestStoreStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KOk)) == 0)
+ {
+ val = KMmsStatusOk;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
+ {
+ val = KMmsErrorTransientFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
+ {
+ val = KMmsErrorStoreStatusTransientNetworkProblem;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
+ {
+ val = KMmsErrorPermanentFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
+ {
+ val = KMmsErrorPermanentServiceDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
+ {
+ val = KMmsErrorPermanentMessageFormatCorrupt;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
+ {
+ val = KMmsErrorStoreStatusPermanentMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrMMBoxFull)) == 0)
+ {
+ val = KMmsErrorStoreStatusPermanentMmboxFull;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatus( val );
+ break;
+ case ETestStoreStatusText:
+ aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatusTextL( iValueBuffer );
+ break;
+ case ETestTotals:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsTotals( val );
+ break;
+
+ case ETestDeleteInfoIndex:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ order = val;
+ break;
+
+ case ETestApplicId:
+ aMmsHeaders.SetApplicIdL( iValueBuffer );
+ break;
+ case ETestReplyApplicId:
+ aMmsHeaders.SetReplyApplicIdL( iValueBuffer );
+ break;
+ case ETestApplicInfo:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetAuxApplicInfoL( iByteBuffer->Des() );
+ break;
+ case ETestContentClass:
+ val = 0;
+ if ((iValueBuffer.CompareF(KText)) == 0)
+ {
+ val = KMmsContentClassText;
+ }
+ else if ((iValueBuffer.CompareF(KImageBasic)) == 0)
+ {
+ val = KMmsContentClassImageBasic;
+ }
+ else if ((iValueBuffer.CompareF(KImageRich)) == 0)
+ {
+ val = KMmsContentClassImageRich;
+ }
+ else if ((iValueBuffer.CompareF(KVideoBasic)) == 0)
+ {
+ val = KMmsContentClassVideoBasic;
+ }
+ else if ((iValueBuffer.CompareF(KVideoRich)) == 0)
+ {
+ val = KMmsContentClassVideoRich;
+ }
+ else if ((iValueBuffer.CompareF(KMegaPixel)) == 0)
+ {
+ val = KMmsContentClassMegaPixel;
+ }
+ else if ((iValueBuffer.CompareF(KContentBasic)) == 0)
+ {
+ val = KMmsContentClassContentBasic;
+ }
+ else if ((iValueBuffer.CompareF(KContentRich)) == 0)
+ {
+ val = KMmsContentClassContentRich;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetContentClass( val );
+ break;
+ case ETestDrmContent:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetDrmContent( val );
+ break;
+ case ETestAdaptationAllowed:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetAdaptationAllowed( val );
+ break;
+ case ETestRecommendedRetrievalMode:
+ val = 0;
+ if ((iValueBuffer.CompareF(KManual)) == 0)
+ {
+ val = KMmsRecommendedRetrievalModeManual;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetRecommendedRetrievalMode( val );
+ break;
+ case ETestRecRetrievalModeText:
+ aMmsHeaders.SetRecommendedRetrievalModeTextL( iValueBuffer );
+ break;
+ case ETestReplaceId:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
+ break;
+ case ETestStatusText:
+ aMmsHeaders.SetResponseTextL( iValueBuffer );
+ break;
+ case ETestCancelId:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
+ break;
+ case ETestCancelStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KCancelSuccessful)) == 0)
+ {
+ val = KMmsCancelRequestSuccessfullyReceived;
+ }
+ else if ((iValueBuffer.CompareF(KCancelCorrupted)) == 0)
+ {
+ val = KMmsCancelRequestCorrupted;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetCancelStatus( val );
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ switch(readStatus)
+ {
+ case ETestAlias:
+ iAliasArray->AppendL( iValueBuffer );
+ iAliasCount++;
+ break;
+
+ default:
+ break;
+ }
+
+ }
+ }
+ return(-1);
+}
+
+// ---------------------------------------------------------
+// CMmsReadFile()::ReadRowL
+// ---------------------------------------------------------
+//
+TTestReadStatus CMmsReadFile::ReadRowL()
+ {
+
+ TBuf8<DefaultBufLen> RowBuffer;
+ TBuf8<32> KeyBuffer;
+
+ // READ ONE ROW AND DROP CR+LF FROM THE END OF LINE
+ TChar delim( 10 );
+ iReader->ReadL( RowBuffer, delim);
+ TInt length = RowBuffer.Length();
+ if ( RowBuffer.Length() < 2 )
+ {
+ return ETestEof;
+ }
+ RowBuffer.Delete(length - 2,2);
+
+ // DROP POSSIBLE COMMENT OUT
+ TInt pos = RowBuffer.Locate( ';' );
+ if ( pos >= 0 ) RowBuffer.Delete( pos, length-pos-2 );
+
+ if ( RowBuffer.Length() == 0 )
+ {
+ // the line contained only comment
+ return ETestUnknown;
+ }
+
+ // First split the row (:)
+ pos = RowBuffer.Locate( ':' );
+ if (pos > 0)
+ {
+ TPtrC8 p = RowBuffer.Mid( pos+1 );
+ length = p.Length();
+ iValueBuffer.Zero();
+ for (TInt i=0; i < length; ++i)
+ {
+ iValueBuffer.Append(p[i]);
+ }
+ iValueBuffer.Trim();
+ TPtrC8 pp = RowBuffer.Left(pos);
+ KeyBuffer.CopyUC(pp);
+ KeyBuffer.Trim();
+ }
+ // TRY TO FIND CORRECT TAG
+ if ((KeyBuffer.CompareF(KTestNewMessage)) == 0) return(ETestNewMessage);
+ if ((KeyBuffer.CompareF(KTestMessageType)) == 0) return ETestMessageType;
+ if ((KeyBuffer.CompareF(KTestDate)) == 0) return ETestDate;
+ if ((KeyBuffer.CompareF(KTestFrom)) == 0) return ETestFrom;
+ if ((KeyBuffer.CompareF(KTestTo)) == 0) return ETestTo;
+ if ((KeyBuffer.CompareF(KTestCc)) == 0) return ETestCc;
+ if ((KeyBuffer.CompareF(KTestBcc)) == 0) return ETestBcc;
+ if ((KeyBuffer.CompareF(KTestSubject)) == 0) return ETestSubject;
+ if ((KeyBuffer.CompareF(KTestExpiryRel)) == 0) return ETestExpiryRel;
+ if ((KeyBuffer.CompareF(KTestExpiryAbs)) == 0) return ETestExpiryAbs;
+ if ((KeyBuffer.CompareF(KTestDeliveryTimeRel)) == 0) return ETestDeliveryTimeRel;
+ if ((KeyBuffer.CompareF(KTestDeliveryTimeAbs)) == 0) return ETestDeliveryTimeAbs;
+ if ((KeyBuffer.CompareF(KTestPriority)) == 0) return ETestPriority;
+ if ((KeyBuffer.CompareF(KTestSenderVisibility)) == 0) return ETestSenderVisibility;
+ if ((KeyBuffer.CompareF(KTestDeliveryReport)) == 0) return ETestDeliveryReport;
+ if ((KeyBuffer.CompareF(KTestReadReply)) == 0) return ETestReadReply;
+ if ((KeyBuffer.CompareF(KTestNewAttachment)) == 0) return ETestNewAttachment;
+ if ((KeyBuffer.CompareF(KTestAttachmentName)) == 0) return ETestAttaRecommendedName;
+ if ((KeyBuffer.CompareF(KTestAttachmentContLoc)) == 0) return ETestAttachmentContLoc;
+ if ((KeyBuffer.CompareF(KTestAttachmentType)) == 0) return ETestAttachmentType;
+ if ((KeyBuffer.CompareF(KTestAttachmentCharset)) == 0) return ETestAttachmentCharset;
+ if ((KeyBuffer.CompareF(KTestAttachmentCid)) == 0) return ETestAttachmentCid;
+ if ((KeyBuffer.CompareF(KTestAttachmentRoot)) == 0) return ETestAttachmentRoot;
+ if ((KeyBuffer.CompareF(KTestEndOfFile)) == 0) return ETestEof;
+ if ((KeyBuffer.CompareF(KTestMessageClass)) == 0) return ETestMessageClass;
+ if ((KeyBuffer.CompareF(KTestDelivRepSendAllow)) == 0) return ETestDelivReportSendAllow;
+ if ((KeyBuffer.CompareF(KTestAlias)) == 0 ) return ETestAlias;
+ if ((KeyBuffer.CompareF(KTestFromAlias)) == 0 ) return ETestFromAlias;
+ if ((KeyBuffer.CompareF(KTestToAlias)) == 0 ) return ETestToAlias;
+ if ((KeyBuffer.CompareF(KTestCcAlias)) == 0 ) return ETestCcAlias;
+ if ((KeyBuffer.CompareF(KTestBccAlias)) == 0 ) return ETestBccAlias;
+ if ((KeyBuffer.CompareF(KTestReplyCharging)) == 0 ) return ETestReplyCharging;
+ if ((KeyBuffer.CompareF(KTestReplyChargAbs)) == 0 ) return ETestReplyChargAbs;
+ if ((KeyBuffer.CompareF(KTestReplyChargRel)) == 0 ) return ETestReplyChargRel;
+ if ((KeyBuffer.CompareF(KTestReplyChargSize)) == 0 ) return ETestReplyChargSize;
+ if ((KeyBuffer.CompareF(KTestReplyChargID)) == 0 ) return ETestReplyChargID;
+ if ((KeyBuffer.CompareF(KTestTID)) == 0 ) return ETestTID;
+ if ((KeyBuffer.CompareF(KTestContentLocation)) == 0 ) return ETestContentLocation;
+ if ((KeyBuffer.CompareF(KTestPreviouslySentIndex)) == 0 ) return ETestPreviouslySentIndex;
+ if ((KeyBuffer.CompareF(KTestPreviouslySentBy)) == 0 ) return ETestPreviouslySentBy;
+ if ((KeyBuffer.CompareF(KTestPreviouslySentDate)) == 0 ) return ETestPreviouslySentDate;
+ if ((KeyBuffer.CompareF(KTestMessageId)) == 0 ) return ETestMessageId;
+ if ((KeyBuffer.CompareF(KTestMessageSize)) == 0 ) return ETestMessageSize;
+ if ((KeyBuffer.CompareF(KTestVersion)) == 0 ) return ETestVersion;
+ if ((KeyBuffer.CompareF(KTestReadStatus)) == 0 ) return ETestReadStatus;
+ if ((KeyBuffer.CompareF(KTestResponseStatus)) == 0 ) return ETestResponseStatus;
+ if ((KeyBuffer.CompareF(KTestResponseText)) == 0 ) return ETestResponseText;
+ if ((KeyBuffer.CompareF(KTestRetrieveStatus)) == 0 ) return ETestRetrieveStatus;
+ if ((KeyBuffer.CompareF(KTestRetrieveText)) == 0 ) return ETestRetrieveText;
+ if ((KeyBuffer.CompareF(KTestStatus)) == 0 ) return ETestStatus;
+ if ((KeyBuffer.CompareF(KTestAttribute)) == 0 ) return ETestAttribute;
+ if ((KeyBuffer.CompareF(KTestDistributionIndicator)) == 0 ) return ETestDistributionIndicator;
+ if ((KeyBuffer.CompareF(KTestLimit)) == 0 ) return ETestLimit;
+ if ((KeyBuffer.CompareF(KTestMessageQuota)) == 0 ) return ETestMessageQuota;
+ if ((KeyBuffer.CompareF(KTestSizeQuota)) == 0 ) return ETestSizeQuota;
+ if ((KeyBuffer.CompareF(KTestMessageTotal)) == 0 ) return ETestMessageTotal;
+ if ((KeyBuffer.CompareF(KTestSizeTotal)) == 0 ) return ETestSizeTotal;
+ if ((KeyBuffer.CompareF(KTestMessageCount)) == 0 ) return ETestMessageCount;
+ if ((KeyBuffer.CompareF(KTestAddKeyword)) == 0 ) return ETestAddKeyword;
+ if ((KeyBuffer.CompareF(KTestRemoveKeyword)) == 0 ) return ETestRemoveKeyword;
+ if ((KeyBuffer.CompareF(KTestFilterKeyword)) == 0 ) return ETestFilterKeyword;
+ if ((KeyBuffer.CompareF(KTestMMState)) == 0 ) return ETestMMState;
+ if ((KeyBuffer.CompareF(KTestQuota)) == 0 ) return ETestQuota;
+ if ((KeyBuffer.CompareF(KTestStart)) == 0 ) return ETestStart;
+ if ((KeyBuffer.CompareF(KTestStore)) == 0 ) return ETestStore;
+ if ((KeyBuffer.CompareF(KTestStored)) == 0 ) return ETestStored;
+ if ((KeyBuffer.CompareF(KTestStoreStatus)) == 0 ) return ETestStoreStatus;
+ if ((KeyBuffer.CompareF(KTestStoreStatusText)) == 0 ) return ETestStoreStatusText;
+ if ((KeyBuffer.CompareF(KTestTotals)) == 0 ) return ETestTotals;
+ if ((KeyBuffer.CompareF(KTestDeleteInfoIndex)) == 0 ) return ETestDeleteInfoIndex;
+ if ((KeyBuffer.CompareF(KTestApplicId)) == 0 ) return ETestApplicId;
+ if ((KeyBuffer.CompareF(KTestReplyApplicId)) == 0 ) return ETestReplyApplicId;
+ if ((KeyBuffer.CompareF(KTestApplicInfo)) == 0 ) return ETestApplicInfo;
+ if ((KeyBuffer.CompareF(KTestContentClass)) == 0 ) return ETestContentClass;
+ if ((KeyBuffer.CompareF(KTestDrmContent)) == 0 ) return ETestDrmContent;
+ if ((KeyBuffer.CompareF(KTestAdaptationAllowed)) == 0 ) return ETestAdaptationAllowed;
+ if ((KeyBuffer.CompareF(KTestRecommendedRetrievalMode)) == 0 ) return ETestRecommendedRetrievalMode;
+ if ((KeyBuffer.CompareF(KTestRecRetrievalModeText)) == 0 ) return ETestRecRetrievalModeText;
+ if ((KeyBuffer.CompareF(KTestReplaceId)) == 0 ) return ETestReplaceId;
+ if ((KeyBuffer.CompareF(KTestStatusText)) == 0 ) return ETestStatusText;
+ if ((KeyBuffer.CompareF(KTestCancelId)) == 0 ) return ETestCancelId;
+ if ((KeyBuffer.CompareF(KTestCancelStatus)) == 0 ) return ETestCancelStatus;
+ if ((KeyBuffer.CompareF(KTestAttContTypeParamName)) == 0 ) return ETestAttContTypeParamName;
+ if ((KeyBuffer.CompareF(KTestAttContTypeParamValue)) == 0 ) return ETestAttContTypeParamValue;
+ if ((KeyBuffer.CompareF(KTestAttXTypeParamName)) == 0 ) return ETestAttXTypeParamName;
+ if ((KeyBuffer.CompareF(KTestAttXTypeParamValue)) == 0 ) return ETestAttXTypeParamValue;
+ return ETestUnknown;
+ }
+
+// ---------------------------------------------------------
+// CMmsReadFile()::CreateMessageL
+// program build a message from given parts
+// ---------------------------------------------------------
+//
+void CMmsReadFile::CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders )
+ {
+
+ // Reset inactivity timer to keem viewServer from crashing
+ User::ResetInactivityTime();
+
+ TInt i;
+ TInt error = KErrNone;
+ RFile attaFile;
+ _LIT8(KLeftAngle, "<");
+ _LIT8(KRightAngle, ">");
+ // we can't use "seconds from" as it only returns a
+ // 32 bit signed integer. If fails in 2038.
+ // "microseconds from" returns a 64 bit signed integer
+
+ CMsvStore* store = aMmsClient->Entry().EditStoreL();
+ CleanupStack::PushL(store);
+ aMmsHeaders->StoreL(*store);
+ store->CommitL();
+ CleanupStack::PopAndDestroy( store );
+ store = NULL;
+
+ aMmsClient->LoadMessageL(); // read store is needed to do this
+
+ store = aMmsClient->Entry().EditStoreL();
+ CleanupStack::PushL(store);
+ CMsvAttachment* attaInfo = NULL;
+ TMsvAttachmentId attaId = 0;
+
+ for ( i=0; i < iAttaStructures->Count(); ++i)
+ {
+ attaId = KMsvNullIndexEntryId;
+ iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
+
+ error = attaFile.Open( iFs, iFilename, EFileShareReadersOnly | EFileRead );
+ User::LeaveIfError( error );
+
+ CleanupClosePushL(attaFile);
+
+ CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
+ CleanupStack::PushL( mimeHeaders );
+ TPtrC8 contentType = iAttaStructures->At(i)->iAttaType->Des();
+
+ TDataRecognitionResult result;
+ result.Reset(); // make sure that it is cleared
+
+ if(iAttaStructures->At(i)->iAttaCid->Length())
+ {
+ TPtr8 attaCID = iAttaStructures->At(i)->iAttaCid->Des();
+ if (attaCID.Find(KLeftAngle) == 0 &&
+ attaCID.Find(KRightAngle) == attaCID.Length()-1 )
+ {
+ // remove angle brackets from cid
+ attaCID = attaCID.Mid(1,attaCID.Length()-2);
+ }
+ mimeHeaders->SetContentIdL(attaCID);
+ }
+
+ if (iAttaStructures->At(i)->iAttaCharset)
+ {
+ mimeHeaders->SetMimeCharset(iAttaStructures->At(i)->iAttaCharset);
+ }
+
+ if (iAttaStructures->At(i)->iAttaName->Length())
+ {
+ iFilename.Copy(iAttaStructures->At(i)->iAttaName->Des());
+ }
+ iParse.Set( iFilename, NULL, NULL );
+ iFilename.Copy( iParse.NameAndExt() );
+
+ mimeHeaders->SetContentLocationL( iFilename );
+
+ // if Mime type has not been set, use RapaRecognizer
+ if ( iAttaStructures->At(i)->iAttaType->Length() == 0 && iFilename.Length() > 0)
+ {
+ // TO BE IMPLEMENTED
+
+ RApaLsSession lsSession;
+
+ if ( lsSession.Connect() == KErrNone )
+ {
+ CleanupClosePushL( lsSession );
+
+ iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
+ if ( lsSession.RecognizeData( iFilename, TPtrC8(), result ) == KErrNone )
+ {
+ // Check confidence level. Recognization must be at least
+ // "EProbable". We don't accept the result if it is "EPossible"
+ // or "EUnlikely" or "ENotRecognized"!
+
+ if ( result.iConfidence < CApaDataRecognizerType::EProbable )
+ {
+ result.Reset(); // clear buffer and try again with longer buffer
+ }
+
+ TPtrC8 mimeBuf8 = result.iDataType.Des8();
+
+ if ( mimeBuf8.Length() == 0 )
+ {
+ // Open file buffer and try again..
+
+ TInt bufSize = 0;
+ (void)lsSession.GetMaxDataBufSize( bufSize ); // ignore errors
+ if ( bufSize <= 0 )
+ {
+ bufSize = 30;
+ }
+ HBufC8* buf = HBufC8::NewLC( bufSize );
+ TPtr8 des = buf->Des();
+
+ RFile file;
+ TInt err=file.Open( iFs, iFilename, EFileShareReadersOnly );
+ if ( err == KErrNone )
+ {
+ err = file.Read( des );
+ file.Close();
+ if ( err == KErrNone )
+ {
+ if ( ( lsSession.RecognizeData( iFilename, des, result ) ) == KErrNone )
+ {
+ mimeBuf8.Set( result.iDataType.Des8() );
+ }
+ }
+
+ }
+ CleanupStack::PopAndDestroy(); // buf
+ }
+ if ( mimeBuf8.Length() > 0 &&
+ result.iConfidence >= CApaDataRecognizerType::EProbable )
+ {
+ contentType.Set( result.iDataType.Des8() );
+ }
+ }
+ CleanupStack::PopAndDestroy(1); // lssession
+ }
+ }
+
+ if ( contentType.Length() > 0 )
+ {
+ TInt position = contentType.Find( KMmsSlash8 );
+ if ( position >= 0 )
+ {
+ mimeHeaders->SetContentTypeL( contentType.Left( position ) );
+ }
+ if ( position < contentType.Length() - 1 )
+ {
+ mimeHeaders->SetContentSubTypeL( contentType.Mid( position + 1 ) );
+ }
+// CreateAttachment2L sets the content type to attaInfo
+// attaInfo->SetMimeTypeL( contentType );
+ }
+
+ if (iAttaStructures->At(i)->iAttaRecommendedName->Length())
+ {
+ iFilename.Copy(iAttaStructures->At(i)->iAttaRecommendedName->Des());
+ iParse.Set( iFilename, NULL, NULL );
+ iFilename.Copy( iParse.NameAndExt() );
+ mimeHeaders->SetSuggestedFilenameL( iFilename );
+ }
+
+ TInt j = 0;
+ for ( j = 0; j < iAttaStructures->At(i)->iContentTypeParams->MdcaCount(); ++j )
+ {
+ mimeHeaders->ContentTypeParams().AppendL( iAttaStructures->At(i)->iContentTypeParams->MdcaPoint( j ) );
+ }
+ for ( j = 0; j < iAttaStructures->At(i)->iXTypeParams->MdcaCount(); ++j )
+ {
+ mimeHeaders->XTypeParams().AppendL( iAttaStructures->At(i)->iXTypeParams->MdcaPoint( j ) );
+ }
+
+ attaInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
+ // attaInfo does not go onto cleaunpstack because ownership will
+ // be transferred to attachment manager.
+
+ aMmsClient->CreateAttachment2L(
+ *store,
+ attaFile,
+ contentType,
+ *mimeHeaders,
+ attaInfo,
+ attaId);
+ attaInfo = NULL; // ownership transferred
+
+ CleanupStack::PopAndDestroy(); // mimeHeaders
+ CleanupStack::PopAndDestroy(); // attaFile.Close()
+
+ if ( iAttaRoot > 0 && iAttaRoot == ( i + 1 ) )
+ {
+ aMmsClient->SetMessageRootL( attaId );
+ }
+ }
+
+ store->CommitL();
+ CleanupStack::PopAndDestroy(); // store
+
+ // This frees all memory and resets all values
+ Reset();
+ // Reset inactivity timer to keem viewServer from crashing
+ User::ResetInactivityTime();
+ }
+
+
+// ---------------------------------------------------------
+// CMmsReadFile()::FindAlias
+// program build a message from given parts
+// ---------------------------------------------------------
+//
+TInt CMmsReadFile::FindAlias( TPtrC aAlias )
+ {
+ TBuf<DefaultBufLen> abuf;
+ for( TInt i=0; i < iAliasCount; ++i )
+ {
+ abuf.Copy( iAliasArray->MdcaPoint(i) );
+ abuf.SetLength( abuf.Locate('=') );
+ if( ( abuf.CompareF( aAlias ) ) == 0 ) return( i );
+ }
+ return( -1 );
+ }
+
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+CMmsAttaStructure::CMmsAttaStructure()
+ {
+ iAtta = NULL;
+ iAttaType = NULL;
+ iAttaName = NULL;
+ iAttaCid = NULL;
+ iAttaRecommendedName = NULL;
+ }
+
+
+//
+void CMmsAttaStructure::ConstructL()
+ {
+ iAtta = HBufC8::NewL(DefaultBufLen);
+ iAttaType = HBufC8::NewL(DefaultBufLen);
+ iAttaName = HBufC8::NewL(DefaultBufLen);
+ iAttaCid = HBufC8::NewL(DefaultBufLen);
+ iAttaRecommendedName = HBufC::NewL(DefaultBufLen);
+ iAttaCharset = 0;
+ iXTypeParams = new(ELeave) CDesC8ArrayFlat(4);
+ iContentTypeParams = new(ELeave) CDesC8ArrayFlat(4);
+
+ }
+
+// Two-phased constructor.
+CMmsAttaStructure* CMmsAttaStructure::NewL()
+ {
+ CMmsAttaStructure* self = new ( ELeave ) CMmsAttaStructure;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// Destructor
+CMmsAttaStructure::~CMmsAttaStructure()
+ {
+ delete iAtta;
+ delete iAttaName;
+ delete iAttaType;
+ delete iAttaCid;
+ delete iAttaRecommendedName;
+ if ( iContentTypeParams )
+ {
+ iContentTypeParams->Reset();
+ }
+ delete iContentTypeParams;
+ if ( iXTypeParams )
+ {
+ iXTypeParams->Reset();
+ }
+ delete iXTypeParams;
+ }
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/src/mmstestbed.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,2357 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#include <mtmdef.h>
+#include <CoreApplicationUIsSDKCRKeys.h>
+#include <mmsheaders.h>
+#include <mmscmds.h>
+#include <mmsencode.h>
+#include <mmscliententry.h>
+#include <logwrap.h>
+#include <logcli.h>
+#include <logview.h>
+#include "mmssettings.h" //use mmssettings.h instead of cmmssettings.h
+#include "mmstestbed.h"
+#include "mmsreadfile.h"
+#include "mmstestuitimer.h"
+#include "mmsteststaticutils.h"
+#include "mmstestbed.hrh"
+
+//constants
+_LIT( KMmsSender, "0601234567" );
+
+MmsTestBed::MmsTestBed()
+ {
+ //start the timer
+ iTimer = CTestUiTimer::NewL();
+ iTimer->Cancel();
+
+ iWait = CMsvOperationActiveSchedulerWait::NewLC();
+ // don't leave iWait on cleanup stack
+ CleanupStack::Pop();
+
+ //open msvsession
+ iSession = CMsvSession::OpenSyncL(*this);
+ //create client registry
+ iClientMtmRegistry = CClientMtmRegistry::NewL(*iSession);
+ //create client mtm
+ iMmsClient = (CMmsClientMtm *) iClientMtmRegistry->NewMtmL(
+ KUidMsgTypeMultimedia);
+
+ User::LeaveIfError( iFs.Connect() );
+ iFs.SetSessionPath( KRootPath );
+ iSettings = CMmsSettings::NewL();
+ iMmsHeaders = CMmsHeaders::NewL(iSettings->MmsVersion());
+ findDefaultL();
+ iServiceId = iDefaultServiceId;
+
+ //validate the settings
+ iSettings->ValidateSettings();
+
+ iLogEvent = CLogEvent::NewL();
+ iLogEvent->SetEventType(KLogMmsEventTypeUid);
+ iLogClient = NULL; // we test soon if this is available
+ iLogView = NULL; // needs log client
+ if ( checkLogClient() )
+ {
+ // first we generate a general view of all events
+ // we'll set the filter when we update the view
+ iLogView = CLogViewEvent::NewL( *iLogClient );
+ }
+ iLogFilter = CLogFilter::NewL();
+ // we try to filter MMS events
+ iLogFilter->SetEventType(KLogMmsEventTypeUid);
+ }
+
+MmsTestBed::~MmsTestBed()
+ {
+ delete iLogView;
+ delete iLogFilter;
+ delete iLogClient;
+ delete iLogEvent;
+ delete iSettings;
+ delete iMmsHeaders;
+ if(iTimer)
+ {
+ iTimer->Cancel();
+ delete iTimer;
+ }
+ //delete iMsvEntrySelection;
+ delete iMmsClient;
+ delete iClientMtmRegistry;
+ //delete iClientMtmRegistry;
+ delete iSession;
+ delete iWait;
+ }
+
+void MmsTestBed::setConnectionLocal(bool value)
+ {
+ //value = true for global off, local on
+ //value = false for global on, local off
+ iSettings->LoadSettingsL();
+ iSettings->SetLocalMode( value );
+ iSettings->SaveSettingsL();
+ }
+
+void MmsTestBed::fromOutboxToMmsc()
+ {
+ CMsvEntry* cEntry = NULL;
+
+ // Get List of services
+ cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages of outbox
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL(
+ KUidMsgTypeMultimedia);
+ CleanupStack::PushL(selection);
+
+ // Change state to "KMsvSendStateUnknown" in case the entry has been suspended earlier
+ for (TInt i = 0; i < selection->Count(); ++i)
+ {
+ cEntry->SetEntryL(selection->At(i));
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetReadOnly(EFalse);
+ entry.SetSendingState(KMsvSendStateUnknown);
+ cEntry->ChangeL(entry);
+ }
+
+ selection->InsertL(0, iServiceId);
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack(parameters);
+
+ op = iSession->TransferCommandL(*selection, EMmsSend, paramPack,
+ iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending)
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if (iWait->iStatus.Int() != KErrNone)
+ {
+ //DEBUG(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ CleanupStack::PopAndDestroy(); //cEntry
+ }
+
+void MmsTestBed::fromMmscToInbox()
+ {
+ CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
+ CleanupStack::PushL(msvEntrySelection);
+
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ msvEntrySelection->InsertL(0, iServiceId);
+ }
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack(parameters);
+
+ op = iMmsClient->InvokeAsyncFunctionL(EMmsReceive, *msvEntrySelection,
+ paramPack, iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending)
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if (iWait->iStatus.Int() != KErrNone)
+ {
+ //DEBUG(_L("Testbed tried to receive, return status %d"),iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); //msvEntrySelection
+ }
+
+void MmsTestBed::findDefaultL()
+ {
+ iSettings->LoadSettingsL();
+ iDefaultServiceId = iSettings->Service();
+ }
+
+void MmsTestBed::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
+ TAny* aArg2, TAny* /*aArg3*/)
+ {
+ iEvent = aEvent;
+ if (aEvent == EMsvGeneralError)
+ {
+ return;
+ }
+ TMsvId parentId = KMsvNullIndexEntryId;
+ if (aArg2 != NULL)
+ {
+ parentId = *(TMsvId*) aArg2;
+ }
+
+ CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
+ TMsvEntry tEntry;
+ TMsvId service;
+ TInt error = KErrNone;
+ error = iSession->GetEntry(selection->At(0), service, tEntry);
+
+ CMsvEntry* cEntry = NULL;
+ switch (aEvent)
+ {
+ case EMsvEntriesCreated:
+ {
+ if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
+ {
+ // emit signal for new entry into INBOX
+ emit entryCreatedInInbox(tEntry.Id());
+ }
+ else if (parentId == KMsvDraftEntryIdValue)
+ {
+ // emit signal for new entry into Draft
+ emit entryCreatedInDraft(tEntry.Id());
+ }
+ else if (parentId == iServiceId)
+ {
+ // emit signal for new Entry into SERVICE
+ }
+ else
+ {
+ // do nothing
+ }
+ }
+ break;
+ case EMsvEntriesChanged:
+ {
+ TMsvId id;
+ CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
+ if (selection == NULL)
+ {
+ // no selection, cannot handle
+ return;
+ }
+ id = selection->At(0);
+ //DEBUG Entry changed"));
+ if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
+ {
+/*
+ cEntry = iSession->GetEntryL( parentId );
+ CleanupStack::PushL( cEntry );
+ TRAPD (error, cEntry->SetEntryL( id ));
+ if ( error != KErrNone )
+ {
+ CleanupStack::PopAndDestroy(); // cEntry
+ return;
+ }
+ TMsvEntry tEntry = cEntry->Entry();
+ if ( tEntry.Visible() )
+ {
+ // generate fake delivery report
+ CMsvStore* store = cEntry->ReadStoreL();
+ CleanupStack::PushL( store );
+ CMmsHeaders* mmsHeaders = CMmsHeaders::NewL( iSettings->MmsVersion() );
+ CleanupStack::PushL( mmsHeaders );
+ mmsHeaders->RestoreL( *store );
+ iEncodeBuffer->ResizeL( 0 );
+ generateDeliveryReport( mmsHeaders );
+ CleanupStack::PopAndDestroy( 2 ); // mmsHeaders, store
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+*/
+ }
+ }
+ break;
+ case EMsvEntriesDeleted:
+ {
+ //emit signal for entry deleted
+ }
+ break;
+ case EMsvEntriesMoved:
+ {
+ if (parentId == KMsvGlobalOutBoxIndexEntryIdValue)
+ {
+ // entry moved to outbox
+ emit entryMovedToOutbox(tEntry.Id());
+ }
+ else if (parentId == KMsvSentEntryIdValue)
+ {
+ // entry moved to sent folder
+ emit entryMovedToSent(tEntry.Id());
+ }
+ else
+ {
+ // do nothing
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+void MmsTestBed::createMmsService()
+ {
+ CMmsSettings * settings = CMmsSettings::NewL();
+ CleanupStack::PushL( settings );
+ settings->CreateNewServiceL( *iSession );
+ CleanupStack::PopAndDestroy(); // settings
+ return;
+ }
+
+void MmsTestBed::cleanup()
+ {
+ TMsvId entryToBeKilled;
+ // Get access to root index
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+
+ entryToBeKilled = iSettings->Service();
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ while (entryToBeKilled != KMsvNullIndexEntryId)
+ {
+ // delete child of root entry
+ deleteEntry(entryToBeKilled, *cEntry);
+ entryToBeKilled = iSettings->Service();
+ }
+
+ CleanupStack::PopAndDestroy(); // cEntry
+ // We deleted everything!
+ iDefaultServiceId = KMsvNullIndexEntryId;
+ iServiceId = KMsvNullIndexEntryId;
+ }
+
+void MmsTestBed::deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry)
+ {
+ aClientEntry.DeleteL(aEntryId);
+ }
+
+void MmsTestBed::cleanupAndCreateNewService()
+ {
+ cleanup();
+ // all old service entries have been destroyed, create a new one
+ createMmsService();
+ }
+
+void MmsTestBed::testFile(TFileName& aFilePath, TInt aCommand /* = 0 */, TMsvId aBox /* = KMsvGlobalOutBoxIndexEntryId */ )
+ {
+ // update settings in mmsclient
+ iMmsClient->RestoreSettingsL();
+ iSettings->CopyL( iMmsClient->MmsSettings() );
+
+ RFileReadStream readStream;
+ readStream.PushL();
+// TMsvId id = KMsvNullIndexEntryId;
+ CBufFlat* encodeBuffer = NULL;
+ CMmsEncode* encoder = NULL;
+
+ // Open the file
+ TInt err = readStream.Open(iFs, aFilePath, EFileShareReadersOnly );
+ if (err != KErrNone) User::Leave( err );
+
+ TInt retCode = 0;
+ CMmsReadFile* readFile = NULL;
+ readFile = CMmsReadFile::NewL( iFs, readStream );
+ CleanupStack::PushL( readFile );
+
+ TInt messageCounter = 0;
+ CMsvEntry* cEntry = NULL;
+
+ while(!retCode)
+ {
+ // READ MESSAGE TO BUFFERS
+ iMmsHeaders->Reset(iSettings);
+ // put in some message type just for fun (testing...)
+ iMmsHeaders->SetMessageType( KMmsMessageTypeForwardReq );
+ retCode = readFile->CompleteTestL( messageCounter++, *iMmsHeaders );
+ if(readFile->iMessageType == ETestNewMessage)
+ {
+ // CREATE MESSAGE ENTRY
+ switch ( aCommand )
+ {
+ case ECreateToInbox:
+ case ECreateNotification:
+ cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+ break;
+ case ECreateToSentItems:
+ cEntry = iSession->GetEntryL(KMsvSentEntryId);
+ break;
+ case ECreateToDrafts:
+ cEntry = iSession->GetEntryL(KMsvDraftEntryId);
+ break;
+ case ECreateHeadersFromFile:
+ // here we just encode headers, no message entry
+ // the entry is fake.
+ break;
+ case ECreateMMBoxViewConf:
+ if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ // entry is not created for the description items
+ // they become attachments
+ cEntry = iSession->GetEntryL(KMsvDraftEntryId);
+ }
+ break;
+ default:
+ cEntry = iSession->GetEntryL(aBox);
+ break;
+ }
+
+ // if we are just playing with headers we have no entry
+ if ( aCommand != ECreateHeadersFromFile && aCommand != ECreateMMBoxViewConf )
+ {
+ CleanupStack::PushL(cEntry);
+ iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
+
+ // CREATE MESSAGE
+ iMmsClient->CreateMessageL(iServiceId);
+ }
+ else if ( aCommand == ECreateMMBoxViewConf )
+ {
+ if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ CleanupStack::PushL(cEntry);
+ iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
+
+ // CREATE MESSAGE
+ iMmsClient->CreateMessageL(iServiceId);
+ }
+ else
+ {
+ encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
+ CleanupStack::PushL( encodeBuffer );
+ encoder = CMmsEncode::NewL( iFs );
+ CleanupStack::PushL( encoder );
+
+ // encode headers to a binary file
+ encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
+
+ iFilename = KMmsMMBoxDescriptionDirectory;
+ TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
+
+ CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
+ encodeBuffer = NULL;
+ encoder = NULL;
+ }
+ }
+ else
+ {
+ encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
+ CleanupStack::PushL( encodeBuffer );
+ encoder = CMmsEncode::NewL( iFs );
+ CleanupStack::PushL( encoder );
+
+ // encode headers to a binary file
+ encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
+
+ iFilename = KMmsDumpDirectory;
+ TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
+
+ CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
+ encodeBuffer = NULL;
+ encoder = NULL;
+ }
+ }
+
+ if ( aCommand != ECreateHeadersFromFile &&
+ ( aCommand != ECreateMMBoxViewConf || iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf ) )
+ {
+ if(readFile->iMessageType == ETestSettings)
+ {
+ TMsvId ServiceId = iMmsClient->DefaultServiceL();
+ iMmsClient->RestoreSettingsL();
+ iSettings->CopyL( iMmsClient->MmsSettings() );
+ }
+
+ TMemoryInfoV1Buf memory;
+ UserHal::MemoryInfo( memory );
+ TInt available = memory().iFreeRamInBytes;
+// TMmsLogger::Log(_L("Free memory before CreateMessageL %d"), available );
+
+ TRAP (err, readFile->CreateMessageL(iMmsClient, iMmsHeaders));
+
+ available = memory().iFreeRamInBytes;
+// TMmsLogger::Log(_L("Free memory after CreateMessageL %d"), available );
+
+ if(readFile->iMessageType == ETestNewMessage)
+ {
+ TMsvEntry tEntry = iMmsClient->Entry().Entry();
+ TMsvId id = tEntry.Id();
+ if ( err == KErrNone )
+ {
+ // SAVE MESSAGE
+ iMmsClient->SaveMessageL();
+
+ // If we are creating a MMBox View confirmation,
+ // we add all binary files from KMmsMMBoxDirectory
+ // as attachments.
+
+ if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ addMMBoxDescriptions();
+ }
+
+ // reload the entry in case mms client put something into it
+ // MESSAGE MUST BE SET VISIBLE
+ tEntry = iMmsClient->Entry().Entry();
+ if ( iMmsClient->MessageClass() == EMmsClassAdvertisement )
+ {
+ tEntry.iMtmData1 |= KMmsMessageAdvertisement;
+ }
+ else if ( iMmsClient->MessageClass() == EMmsClassInformational )
+ {
+ tEntry.iMtmData1 |= KMmsMessageInformational;
+ }
+ tEntry.iMtmData1 &= ~KMmsMessageMobileTerminated;
+
+ // Test: Set all as editor oriented - except notifications!
+ if ( aCommand == ECreateNotification )
+ {
+ tEntry.iMtm = KUidMsgMMSNotification;
+ }
+ else
+ {
+ tEntry.iMtmData1 |= KMmsMessageEditorOriented;
+ }
+ if ( aCommand == ECreateToInbox )
+ {
+ tEntry.iMtmData1 |= KMmsMessageMobileTerminated;
+ tEntry.SetReadOnly( ETrue );
+ tEntry.SetNew( ETrue );
+ tEntry.SetUnread( ETrue );
+ }
+ else if ( aCommand == ECreateToSentItems )
+ {
+ tEntry.SetReadOnly( ETrue );
+ }
+ tEntry.SetVisible( ETrue );
+ tEntry.SetInPreparation( EFalse );
+ TTime now;
+ now.UniversalTime();
+ tEntry.iDate = now;
+ TMsvId entryId = tEntry.Id();
+ iMmsClient->Entry().ChangeL( tEntry );
+ if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ // Encode to the directory that is used to fetch MMBox view
+ iFilename.Copy( KMmsMMBoxDirectory );
+ encodeMessageFromDrafts();
+ cEntry->SetEntryL( KMsvDraftEntryId );
+ cEntry->DeleteL( entryId );
+ }
+ }
+ else
+ {
+ //TMmsLogger::Log(_L("CreateMessageL left with error %d"), err );
+ iSession->RemoveEntry(id);
+ err = KErrNone; // clear error
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+ cEntry = NULL;
+ }
+ if(readFile->iMessageType == ETestSettings)
+ {
+ iMmsClient->SetSettingsL( *iSettings );
+ iMmsClient->StoreSettingsL();
+ }
+ }
+ }
+
+ CleanupStack::PopAndDestroy(); //readFile
+
+ readStream.Close();
+ readStream.Pop();
+
+ /*
+ iMmsClient->SwitchCurrentEntryL(id);
+ */
+ }
+
+void MmsTestBed::addMMBoxDescriptions()
+ {
+ // add the contents of KMmsMMBoxDescriptionDirectory as attachments
+ CDir* fileList = NULL;
+ TInt i = 0; // general counter
+ TInt error = KErrNone;
+ iCurrentPath = KMmsMMBoxDescriptionDirectory;
+
+ iFs.SetSessionPath(iCurrentPath);
+
+ TFindFile finder( iFs );
+ error = finder.FindWildByPath( KWild, NULL, fileList );
+ CleanupStack::PushL( fileList );
+ TInt fileCounter = 0;
+
+ if ( error == KErrNone )
+ {
+ fileCounter = fileList->Count();
+ }
+
+ TEntry entry;
+
+ if ( error == KErrNone )
+ {
+ for ( i = 0; i < fileCounter; ++i )
+ {
+ // Reset inactivity timer to keep viewServer from crashing
+ User::ResetInactivityTime();
+ entry = (*fileList)[i]; // name is entry.iName
+ iFilename.Copy( iCurrentPath );
+ iFilename.Append( entry.iName );
+ TPtrC ptr;
+ ptr.Set( iFilename );
+ iWait->iStatus = KErrNone;
+ iMmsClient->AddAttachmentL( ptr, KMmsMimeType, 0, iWait->iStatus );
+
+ iWait->Start();
+ // The descriptions are cleared after being used
+ iFs.Delete( ptr);
+ }
+ }
+
+ iMmsClient->SaveMessageL(); // just in case somthing must be updated
+ CleanupStack::PopAndDestroy(); // fileList
+ fileList = NULL;
+ }
+
+void MmsTestBed::encodeMessageFromDrafts()
+ {
+ CMmsEncode* encoder = CMmsEncode::NewL( iFs );
+ CleanupStack::PushL( encoder );
+ // encode a message iMmsClientPoints to
+ iMmsClient->LoadMessageL();
+ CMsvStore* store = iMmsClient->Entry().ReadStoreL();
+ CleanupStack::PushL( store );
+ iMmsHeaders->RestoreL( *store );
+ CleanupStack::PopAndDestroy(); // store
+ store = NULL;
+ iWait->iStatus = KErrNone;
+
+// caller sets the directory
+// iFilename = KMmsMessageDumpDirectory;
+
+ CMmsClientEntry* entryWrapper = CMmsClientEntry::NewL( iFs, iMmsClient->Entry(), iServiceId );
+ CleanupStack::PushL( entryWrapper );
+ iEncodeBuffer->ResizeL(0);
+ encoder->StartL( *entryWrapper, *iMmsHeaders, *iEncodeBuffer, iWait->iStatus );
+ iWait->Start();
+ if ( iWait->iStatus == KErrNone )
+ {
+ TMmsTestUtils::Dump( *iEncodeBuffer, iFilename, iParse, iFs );
+ }
+ iEncodeBuffer->ResizeL(0);
+ CleanupStack::PopAndDestroy(); // entryWrapper
+ CleanupStack::PopAndDestroy(); // encoder
+ }
+
+void MmsTestBed::deleteNotifications()
+ {
+ TMsvId mmsFolderId = KMsvNullIndexEntryId;
+ mmsFolderId = findMMSFolder();
+
+ CMsvEntry* cEntry = NULL;
+ // delete all messages from the specified box
+ cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+
+ if ( mmsFolderId != KMsvNullIndexEntryId )
+ {
+ cEntry->SetEntryL(mmsFolderId);
+
+ // show invisible entries
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PushL(msvEntrySelection);
+
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ if (msvEntrySelection->Count() > 0)
+ {
+ CMsvOperation* op = iSession->TransferCommandL(
+ *msvEntrySelection,
+ EMmsDeleteEntries,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ CleanupStack::PopAndDestroy(); // op
+ }
+
+ // These cannot be deleted unless we have the a server mtm
+ // corresponding to this mtm type.
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ CleanupStack::PopAndDestroy(); //msvEntrySelection
+ msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgMMSNotification );
+ CleanupStack::PushL(msvEntrySelection);
+
+ if (msvEntrySelection->Count() > 0)
+ {
+ CMsvOperation* op = iSession->TransferCommandL(
+ *msvEntrySelection,
+ EMmsDeleteEntries,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ CleanupStack::PopAndDestroy(); // op
+ }
+
+ CleanupStack::PopAndDestroy(); //msvEntrySelection
+
+ CleanupStack::PopAndDestroy(); //cEntry
+ }
+ }
+
+TMsvId MmsTestBed::findMMSFolder()
+ {
+ return iSettings->NotificationFolder();
+ }
+
+void MmsTestBed::restoreFactorySettings()
+ {
+ iMmsClient->RestoreSettingsL();
+ iSettings->CopyL( iMmsClient->MmsSettings() );
+ // do not reset access point
+ TInt accessPoint = iSettings->AccessPoint( 0 );
+ iSettings->RestoreFactorySettingsL( iMmsClient->Session(), EMmsFactorySettingsLevelDeep );
+ TInt count = iSettings->AccessPointCount();
+ TInt i = 0;
+ for ( i = count - 1; i >= 0; --i )
+ {
+ iSettings->DeleteAccessPointL( i );
+ }
+ // restore the original access point
+ if ( accessPoint > 0 )
+ {
+ // a negative access point is an error (most likely "KErrNotFound")
+ iSettings->AddAccessPointL( accessPoint, 0 );
+ }
+ iMmsClient->SetSettingsL( *iSettings );
+ iMmsClient->StoreSettingsL();
+ }
+
+void MmsTestBed::setFetchingState( TMmsReceivingMode aState )
+ {
+ iMmsClient->RestoreSettingsL();
+ iSettings->CopyL( iMmsClient->MmsSettings() );
+
+ iSettings->SetReceivingModeHome( aState );
+
+ iMmsClient->SetSettingsL( *iSettings );
+ iMmsClient->StoreSettingsL();
+ }
+
+void MmsTestBed::sendFromFile()
+ {
+ CMsvOperation * op = NULL;
+
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
+ CleanupStack::PushL( cEntry );
+
+ CMsvEntrySelection* selection = NULL;
+ selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PopAndDestroy(); // cEntry
+ CleanupStack::PushL( selection );
+
+ TRAPD (error, op = iMmsClient->SendL(*selection, iWait->iStatus));
+ if ( error != KErrNone )
+ {
+ CleanupStack::PopAndDestroy(); // selection
+ delete op;
+ return;
+ }
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(2); // op, selection
+ }
+
+void MmsTestBed::sendOneByOne()
+ {
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
+ CleanupStack::PushL( cEntry );
+
+ CMsvEntrySelection* selection = NULL;
+ selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PushL( selection );
+
+ CMsvEntrySelection* shortSelection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( shortSelection );
+
+ TInt i;
+
+ for ( i = 0; i < selection->Count(); ++i )
+ {
+ shortSelection->Reset();
+ shortSelection->AppendL( selection->At( i ) );
+
+ CMsvOperation * op = NULL;
+
+ TTime now;
+ now.UniversalTime();
+
+ TRAPD (error, op = iMmsClient->SendL(*shortSelection, iWait->iStatus, now ));
+ if ( error != KErrNone )
+ {
+ delete op;
+ CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
+ return;
+ }
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+
+ }
+ CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
+ }
+
+void MmsTestBed::sendNotifications()
+ {
+ // Only send one notification!!
+
+ TInt error = KErrNone;
+
+ if (! TMmsTestUtils::IsFile(iCurrentFile, iFs) )
+ {
+ //Not a file
+ return;
+ }
+ TMsvId mmsFolder = findMMSFolder();
+
+ TEntry entry;
+
+
+ // now I think we have a filename
+ TEntry orgEntry;
+ TUint size = 0;
+ error = iFs.Entry( iCurrentFile, orgEntry );
+ size = orgEntry.iSize;
+
+ //TMmsLogger::Log(_L("- notification %S "), &iCurrentFile);
+ if ( size == 0 )
+ {
+ //empty file
+ //TMmsLogger::Log(_L("- empty file"));
+ return;
+ }
+
+ if ( iEncodeBuffer == NULL )
+ {
+ iEncodeBuffer = CBufFlat::NewL( size );
+ }
+ else
+ {
+ iEncodeBuffer->ResizeL( 0 );
+ iEncodeBuffer->ResizeL( size );
+ }
+
+ RFile inFile;
+ error = inFile.Open( iFs, iCurrentFile, EFileShareReadersOnly );
+ TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
+ if ( error == KErrNone )
+ {
+ error = inFile.Read( ptr, size );
+ inFile.Close();
+ }
+ else
+ {
+ //Error
+ //TMmsLogger::Log(_L("- can't read file"));
+ return;
+ }
+
+ TUint8 byte;
+ TUint position = 0;
+ TUint32 uintvar = 0;
+
+ if ( size > 2 )
+ {
+ iEncodeBuffer->Read( 1, &byte, 1 );
+ if ( byte == 6 ) // PUSH PDU
+ {
+ // try to find out length of header
+ position = 2;
+ iEncodeBuffer->Read( position, &byte, 1);
+
+ while ( byte & 0x80 && position < size )
+ {
+ uintvar += ( byte & 0x7f );
+ uintvar <<= 7;
+ position++;
+ iEncodeBuffer->Read( position, &byte, 1 );
+ }
+
+ // add last byte without shift
+ uintvar += byte;
+ position++;
+ }
+ }
+
+ position += uintvar;
+
+ if ( position < size )
+ {
+ ptr = iEncodeBuffer->Ptr( position );
+ size = ptr.Length();
+ }
+
+ if ( size == 0 )
+ {
+ //no MMS stuff
+ //TMmsLogger::Log(_L("- no MMS stuff"));
+ return;
+ }
+
+ TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
+
+ // Now we have streamed our data into this entry.
+ // Now we have an entry that says: local service, MMS MTM
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ if ( entryId != KMsvNullIndexEntryId )
+ {
+ selection->AppendL( entryId );
+ }
+ else
+ {
+ selection->AppendL( iDefaultServiceId );
+ }
+
+ TWatcherParameters parameters; // initialized to zero
+ parameters.iWatcherId = RThread().Id();
+ parameters.iDataPointer = &ptr;
+ TWatcherParametersBuf paramPack( parameters );
+
+ CMsvOperation * op = NULL;
+
+ op = iSession->TransferCommandL(
+ *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ User::After(1000000);
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::copyDrafts()
+ {
+ CMsvEntry* cEntry = NULL;
+// Copies contents of sent folder to drafts for retrying sending.
+
+ cEntry = iSession->GetEntryL(KMsvSentEntryId);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages in drafts
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+
+ TMsvLocalOperationProgress progress;
+ cEntry->CopyL( *selection, KMsvDraftEntryId, progress );
+
+ TInt i = 0;
+ for ( i = 0; i < selection->Count(); ++i )
+ {
+ cEntry->SetEntryL( selection->At( i ) );
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetReadOnly( EFalse );
+ cEntry->ChangeL( entry );
+ }
+
+ CleanupStack::PopAndDestroy(2); // selection, cEntry
+ }
+
+void MmsTestBed::garbageCollection(TUint32 aReason)
+ {
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+
+ TMMSGarbageCollectionParameters parameters; // initialized to zero
+ parameters.iReasonFlags = aReason;
+ TMMSGarbageCollectionParametersBuf paramPack( parameters );
+ op = iSession->TransferCommandL(
+ *selection, EMmsGarbageCollection, paramPack, iWait->iStatus );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::messageVariation()
+ {
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+
+ op = iSession->TransferCommandL(
+ *selection, EMmsMessageGeneration, TPtrC8(), iWait->iStatus );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::cancelSendScheduling()
+ {
+ CMsvEntry* cEntry = NULL;
+ setFetchingState( EMmsReceivingPostpone );
+ testFile( iCurrentFile );
+ scheduledSend(KMsvGlobalOutBoxIndexEntryIdValue, 10000); // long delay so that we have time to cancel
+ deleteSendSchedule();
+
+ cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ cEntry->SetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+ if (iMsvEntrySelection != NULL)
+ {
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ }
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PopAndDestroy();
+ }
+
+void MmsTestBed::scheduledSend(TMsvId aBoxId, TInt aDelay /* = 5 */)
+ {
+ CMsvEntry* cEntry = NULL;
+ TCommandParameters parameters;
+ parameters.iInitialDelay = aDelay;
+ TCommandParametersBuf paramPack( parameters );
+
+ cEntry = iSession->GetEntryL(aBoxId);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages of outbox
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+// selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsScheduledSend,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(2); // cEntry, selection
+ }
+
+void MmsTestBed::deleteSendSchedule()
+ {
+ CMsvEntry* cEntry = NULL;
+
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages of outbox
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsDeleteSchedule,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(2); // cEntry, selection
+ }
+
+void MmsTestBed::cancelFetchScheduling()
+ {
+ TMsvId mmsFolder = findMMSFolder();
+ CMsvEntry* cEntry = NULL;
+ setFetchingState( EMmsReceivingPostpone );
+ testFile( iCurrentFile );
+ fromOutboxToMmsc(); // immediate send (EMmsSend)
+
+ // Wait until notification has arrived - may take a while in global mode
+ TInt i = 0;
+ while ( TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) == 0
+ && i < 2000 )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ i++;
+ if ( (i/100) * 100 == i )
+ {
+ //TMmsLogger::Log(_L("%d:th wait cycle"), i );
+ }
+ CActiveScheduler::Start();
+ }
+ iTimer->Cancel();
+
+ fetchForced( 10000 ); // delay to allow cancelling
+ deleteFetchSchedule();
+
+ cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ cEntry->SetEntryL(mmsFolder);
+ if (iMsvEntrySelection != NULL)
+ {
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ }
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PopAndDestroy(); // cEntry
+ }
+
+void MmsTestBed::fetchForced(TInt aDelay /* = 5 */)
+ {
+ TCommandParameters parameters;
+ parameters.iInitialDelay = aDelay;
+ TCommandParametersBuf paramPack( parameters );
+
+ CMsvEntrySelection* selection = new CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ selection->InsertL(0, iServiceId);
+ }
+ else
+ {
+ selection->InsertL(0, iDefaultServiceId);
+ }
+
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsScheduledReceiveForced,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::deleteFetchSchedule()
+ {
+ CMsvEntry* cEntry = NULL;
+
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ TMsvId mmsFolderId = KMsvNullIndexEntryId;
+ mmsFolderId = findMMSFolder();
+ cEntry = iSession->GetEntryL( mmsFolderId );
+ CleanupStack::PushL(cEntry);
+ // Get all notifications
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsDeleteSchedule,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(2); // cEntry, selection
+ }
+
+void MmsTestBed::doAFetchCycle()
+ {
+ // Sends a message from iCurrentFile and lets it come back
+ TMsvId mmsFolder = findMMSFolder();
+ testFile( iCurrentFile );
+ fromOutboxToMmsc(); // immediate send (EMmsSend)
+ // fetching will start automatically
+
+ TInt i = 0;
+ while ( TMmsTestUtils::CountChildrenL( KMsvGlobalInBoxIndexEntryId, iMsvEntrySelection, *iSession ) == 0
+ && i < 2000
+ && TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) > 0 )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ i++;
+ if ( (i/100) * 100 == i )
+ {
+ //TMmsLogger::Log(_L("%d:th wait cycle"), i );
+ }
+ CActiveScheduler::Start();
+ }
+ iTimer->Cancel();
+ }
+
+bool MmsTestBed::checkLogClient()
+ {
+ if ( iLogClient == NULL )
+ {
+ TRAP_IGNORE( iLogClient = CLogClient::NewL( iFs ) );
+ }
+ return ( iLogClient != NULL );
+ }
+
+int MmsTestBed::getLogEntries()
+ {
+ TInt count = 0;
+ if ( !iLogView )
+ {
+ return 0;
+ }
+
+ if ( iLogView->SetFilterL( *iLogFilter, iWait->iStatus ) )
+ {
+ // should complete with KErrNone
+ iWait->Start();
+ if ( iWait->iStatus.Int() == KErrNone )
+ {
+ count = iLogView->CountL();
+ }
+ }
+ return count;
+ }
+
+void MmsTestBed::createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry)
+ {
+ CMsvOperation* opert = aClientEntry.CreateL(aNewEntry, iWait->iStatus);
+ iWait->Start();
+ if (!opert->iStatus.Int()==KErrNone)
+ {
+ // what should we do? panic?
+ }
+
+ TPckgBuf<TMsvLocalOperationProgress> package;
+ package.Copy(opert->ProgressL());
+ *(TMsvId*)&aNewEntry = package().iId;
+
+ delete opert; opert=NULL;
+ }
+
+void MmsTestBed::cleanOutbox()
+ {
+ TMmsTestUtils::CleanBoxL(KMsvGlobalOutBoxIndexEntryId, *iSession);
+ }
+
+void MmsTestBed::cleanInbox()
+ {
+ TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
+ }
+
+void MmsTestBed::cleanSent()
+ {
+ TMmsTestUtils::CleanBoxL(KMsvSentEntryId, *iSession);
+ }
+
+void MmsTestBed::cleanDrafts()
+ {
+ TMmsTestUtils::CleanBoxL(KMsvDraftEntryId, *iSession);
+ }
+
+void MmsTestBed::cleanAll()
+ {
+ cleanInbox();
+ cleanOutbox();
+ cleanSent();
+ cleanDrafts();
+ TMmsTestUtils::CleanBoxL( iSettings->MMBoxFolder(), *iSession );
+ deleteNotifications();
+ }
+
+void MmsTestBed::reply()
+ {
+ // The first message from inbox is replied to
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ if ( iMsvEntrySelection->Count() > 0 )
+ {
+ TMsvId originalEntry = iMsvEntrySelection->At(0);
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription;
+ CMsvOperation * op = NULL;
+ op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Create reply, return status %d"), iWait->iStatus.Int());
+ }
+ else
+ {
+ TMsvId newEntry = KMsvNullIndexEntryId;
+ TPckgBuf<TMsvId> package;
+ package.Copy(op->ProgressL());
+ newEntry = package();
+ if ( newEntry != KMsvNullIndexEntryId )
+ {
+ cEntry->SetEntryL( newEntry );
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetInPreparation( EFalse );
+ entry.SetVisible( ETrue );
+ cEntry->ChangeL(entry);
+ }
+ }
+ CleanupStack::PopAndDestroy(); // op
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+ }
+
+void MmsTestBed::replyToAll()
+ {
+ // The first message from inbox is replied to
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+
+ if ( iMsvEntrySelection->Count() > 0 )
+ {
+ TMsvId originalEntry = iMsvEntrySelection->At(0);
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
+ KMsvMessagePartRecipient;
+ CMsvOperation * op = NULL;
+ op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Create reply to all, return status %d"), iWait->iStatus.Int());
+ }
+ else
+ {
+ TMsvId newEntry = KMsvNullIndexEntryId;
+ TPckgBuf<TMsvId> package;
+ package.Copy(op->ProgressL());
+ newEntry = package();
+ if ( newEntry != KMsvNullIndexEntryId )
+ {
+ cEntry->SetEntryL( newEntry );
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetInPreparation( EFalse );
+ entry.SetVisible( ETrue );
+ cEntry->ChangeL(entry);
+ }
+ }
+ CleanupStack::PopAndDestroy(); // op
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+ }
+
+void MmsTestBed::forward()
+ {
+ // The first message from inbox is forwarded
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+
+ if ( iMsvEntrySelection->Count() > 0 )
+ {
+ TMsvId originalEntry = iMsvEntrySelection->At(0);
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
+ KMsvMessagePartRecipient | KMsvMessagePartAttachments;
+ CMsvOperation * op = NULL;
+ op = iMmsClient->ForwardL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Create forward, return status %d"), iWait->iStatus.Int());
+ }
+ else
+ {
+ TMsvId newEntry = KMsvNullIndexEntryId;
+ TPckgBuf<TMsvId> package;
+ package.Copy(op->ProgressL());
+ newEntry = package();
+ if ( newEntry != KMsvNullIndexEntryId )
+ {
+ iMmsClient->SwitchCurrentEntryL( newEntry );
+ // Add a sender: 0601234567
+ iMmsClient->LoadMessageL();
+ iMmsClient->SetSenderL( KMmsSender );
+ iMmsClient->SaveMessageL();
+ cEntry->SetEntryL( newEntry );
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetInPreparation( EFalse );
+ entry.SetVisible( ETrue );
+ cEntry->ChangeL(entry);
+ }
+ }
+ CleanupStack::PopAndDestroy(); // op
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+ }
+
+void MmsTestBed::sendReadReport()
+ {
+ // TURN READ REPORTS ON (until available from menu)
+ iSettings->LoadSettingsL();
+ iSettings->SetReadReplyReportSendingAllowed( ETrue );
+ iSettings->SaveSettingsL();
+ iMmsClient->RestoreSettingsL();
+
+
+ // Read report is sent for the first message in inbox
+ CMsvEntry* cEntry = iSession->GetEntryL( KMsvGlobalInBoxIndexEntryId );
+ CleanupStack::PushL(cEntry);
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+
+ if ( iMsvEntrySelection->Count() == 0 )
+ {
+ return;
+ }
+ TMsvId originalEntry = iMsvEntrySelection->At( 0 );
+
+ // new test using Client MTM
+ CMsvOperation * op = NULL;
+ op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy( op );
+ op = NULL;
+
+ // Try sending the read report to current entry
+
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy( op );
+ op = NULL;
+
+/*
+ cEntry->SetEntryL( originalEntry );
+ iMmsHeaders->Reset();
+ CMsvStore* store = cEntry->ReadStoreL();
+ CleanupStack::PushL( store );
+ iMmsHeaders->RestoreL( *store );
+ CleanupStack::PopAndDestroy( store );
+ store = NULL;
+ HBufC8* messageId = HBufC8::NewL( iMmsHeaders->MessageId().Length() );
+ CleanupStack::PushL( messageId );
+ messageId->Des().Copy( iMmsHeaders->MessageId() );
+
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ iMmsClient->LoadMessageL();
+
+ iMmsHeaders->Reset();
+ iMmsHeaders->SetMessageType( KMmsMessageTypeReadRecInd );
+ // Message id cannot be accessed via MMS Client MTM!
+
+ iMmsHeaders->SetMessageIdL( messageId->Des() );
+ CleanupStack::PopAndDestroy( messageId );
+
+ iMmsHeaders->AddTypedAddresseeL( iMmsClient->Sender(), EMsvRecipientTo );
+ // sender must be insert-address-token because we don't know our number
+ TTime now;
+ now.UniversalTime();
+
+ _LIT( K1970, "19700000:000000.000000" ); // 1-Jan 1970 0:00:00
+
+ TTime y1970( K1970 );
+ TTimeIntervalMicroSeconds interval;
+ // we can't use "seconds from" as it only returns a
+ // 32 bit signed integer. If fails in 2038.
+ // "microseconds from" returns a 64 bit signed integer
+ interval = now.MicroSecondsFrom( y1970 );
+ // date in iMmsHeaders() in seconds from 1.1.1970.
+ iMmsHeaders->SetDate( (interval.Int64() ) / KMmsMillion );
+ iMmsHeaders->SetReadStatus( KMmsReadStatusRead );
+
+ TMsvId mmsFolderId = KMsvNullIndexEntryId;
+ mmsFolderId = FindMMSFolderL();
+
+ cEntry->SetEntryL( mmsFolderId );
+
+ TMsvEntry entry;
+ entry.iType = KUidMsvMessageEntry;
+ entry.iMtm = KUidMsgTypeMultimedia;
+ entry.SetVisible( ETrue );
+ entry.SetInPreparation( EFalse );
+ entry.iServiceId = KMsvLocalServiceIndexEntryId;
+ entry.iRelatedId = iDefaultServiceId;
+ entry.iMtmData1 = KMmsMessageReadRecInd;
+ cEntry->CreateL( entry );
+ TMsvId entryId = entry.Id();
+
+ cEntry->SetEntryL( entryId );
+
+ store = cEntry->EditStoreL();
+ CleanupStack::PushL( store );
+ iMmsHeaders->StoreL( *store );
+ store->CommitL();
+ CleanupStack::PopAndDestroy( store );
+ store = NULL;
+
+ CMsvEntrySelection* selection = new ( ELeave ) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, entryId);
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ op = iSession->TransferCommandL(*selection,EMmsScheduledReadReport,paramPack,iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy( op );
+ CleanupStack::PopAndDestroy( selection );
+*/
+ CleanupStack::PopAndDestroy( cEntry );
+ }
+
+int MmsTestBed::fromOutboxToMmscWithMemoryFailure()
+ {
+ TInt error = KErrNone;
+ TInt messageCount = 0;
+ TInt failureCount = 0;
+ do {
+ CMsvEntry* cEntry = NULL;
+
+ // Get List of services
+ cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages of outbox
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+ failureCount++;
+ // These are failures that fail in Message server.
+ if ( failureCount >= 63 && failureCount <= 64 )
+ {
+ failureCount = 65;
+ }
+ cEntry->SetEntryL( iServiceId );
+ TMsvEntry entry = cEntry->Entry();
+ entry.iMtmData3 &= 0x0000000FF;
+ entry.iMtmData3 |= failureCount << 8;
+ cEntry->ChangeL( entry );
+
+ selection->InsertL(0, iServiceId);
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ TRAP (error, op = iSession->TransferCommandL(*selection,EMmsSend,paramPack,iWait->iStatus));
+
+ if ( error == KErrNone )
+ {
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ error = iWait->iStatus.Int();
+ if ( iWait->iStatus.Int() != KErrNoMemory )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+ }
+ }
+
+ CleanupStack::PopAndDestroy(); // op
+ }
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // selection
+ CleanupStack::PopAndDestroy(); // cEntry
+ selection = NULL;
+ cEntry = NULL;
+ cEntry = iSession->GetEntryL( KMsvGlobalOutBoxIndexEntryIdValue );
+ CleanupStack::PushL(cEntry);
+ selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ messageCount = selection->Count();
+ delete selection;
+ selection = 0;
+ CleanupStack::PopAndDestroy(); //cEntry
+ }
+ while ( error == KErrNoMemory || messageCount > 0 );
+ return failureCount;
+ }
+
+int MmsTestBed::fromMmscToInboxWithMemoryFailure()
+ {
+ TInt error = KErrNone;
+ TInt failureCount = 0;
+ TInt messageCount = 0;
+ TMsvId mmsFolderId = KMsvNullIndexEntryId;
+ mmsFolderId = findMMSFolder();
+
+ do {
+ // Inbox must be cleaned if failure makes message to be fetched more than once.
+ // should not happen, but this test is quite stressful, and perfect result
+ // cannot be guaranteed.
+ // What is expected:
+ // 1. Program does not crash
+ // 2. After sufficient number of retries the message is fetched and notification deleted.
+ TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
+ CMsvEntry* cEntry = NULL;
+ CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
+ CleanupStack::PushL(msvEntrySelection);
+
+ cEntry = iSession->GetEntryL(iServiceId);
+ CleanupStack::PushL(cEntry);
+
+ failureCount++;
+ // These are failures that fail in Message server.
+ if ( failureCount >= 63 && failureCount <= 64 )
+ {
+ failureCount = 65;
+ }
+ cEntry->SetEntryL( iServiceId );
+
+ TMsvEntry entry = cEntry->Entry();
+ entry.iMtmData3 &= 0x0000000FF;
+ entry.iMtmData3 |= failureCount << 8;
+ cEntry->ChangeL( entry );
+
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ msvEntrySelection->InsertL(0, iServiceId);
+ }
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ TRAP (error, op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsReceiveForced,
+ *msvEntrySelection,
+ paramPack,
+ iWait->iStatus) );
+
+ if ( error == KErrNone )
+ {
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ error = iWait->iStatus.Int();
+ if ( iWait->iStatus.Int() != KErrNoMemory )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to receive, return status %d"), iWait->iStatus.Int());
+ }
+ }
+
+ CleanupStack::PopAndDestroy(); // op
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // msvEntrySelection
+ CleanupStack::PopAndDestroy(); // cEntry
+ msvEntrySelection = NULL;
+ cEntry = NULL;
+ cEntry = iSession->GetEntryL( mmsFolderId );
+ CleanupStack::PushL(cEntry);
+ msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ messageCount = msvEntrySelection->Count();
+ delete msvEntrySelection;
+ msvEntrySelection = 0;
+ CleanupStack::PopAndDestroy(); //cEntry
+ }
+ while ( error == KErrNoMemory || messageCount > 0 );
+ if ( error != KErrNoMemory && error != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Memory failure loop ended with %d"), error);
+ }
+ return failureCount;
+ }
+
+void MmsTestBed::sendViaClient()
+ {
+ CMsvEntry* cEntry = NULL;
+
+ cEntry = iSession->GetEntryL(KMsvDraftEntryId);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages in drafts
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+
+ CMsvOperation * op = NULL;
+ TTime now;
+ now.UniversalTime();
+ op = iMmsClient->SendL( *selection, iWait->iStatus, now );
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(2); // cEntry, selection
+ }
+
+void MmsTestBed::scheduledFetch(TInt aDelay /* = 5 */)
+ {
+ TCommandParameters parameters;
+ parameters.iInitialDelay = aDelay;
+ TCommandParametersBuf paramPack( parameters );
+
+ CMsvEntrySelection* selection = new CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ selection->InsertL(0, iServiceId);
+ }
+ else
+ {
+ selection->InsertL(0, iDefaultServiceId);
+ }
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsScheduledReceive,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::fetchForcedImmediate()
+ {
+ TCommandParameters parameters;
+ TCommandParametersBuf paramPack( parameters );
+
+ CMsvEntrySelection* selection = new CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ selection->InsertL(0, iServiceId);
+ }
+ else
+ {
+ selection->InsertL(0, iDefaultServiceId);
+ }
+
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsReceiveForced,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::getEventType()
+ {
+ if ( !checkLogClient() )
+ {
+ return; // not available
+ }
+
+ CLogEventType* eventType = CLogEventType::NewL();
+ CleanupStack::PushL( eventType );
+ eventType->SetUid(iLogEvent->EventType());
+ iLogClient->GetEventType( *eventType, iWait->iStatus );
+
+ iWait->Start();
+ CleanupStack::PopAndDestroy(); // eventType
+ }
+
+void MmsTestBed::addEventType()
+ {
+ if ( !checkLogClient() )
+ {
+ return; // not available
+ }
+
+ CLogEventType* eventType = CLogEventType::NewL();
+ CleanupStack::PushL( eventType );
+ eventType->SetUid(iLogEvent->EventType());
+ eventType->SetDescription(_L("Multimedia Message") );
+ eventType->SetLoggingEnabled( ETrue );
+
+// iWait->iStatus = KRequestPending;
+ iLogClient->AddEventType( *eventType, iWait->iStatus );
+ iWait->Start();
+ CleanupStack::PopAndDestroy(); // eventType
+ }
+
+void MmsTestBed::deleteEventType()
+ {
+ if ( !checkLogClient() )
+ {
+ return; // not available
+ }
+// iWait->iStatus = KRequestPending;
+ iLogClient->DeleteEventType( iLogEvent->EventType(), iWait->iStatus );
+ iWait->Start();
+ }
+
+void MmsTestBed::cleanLog()
+ {
+ TInt count = 0;
+
+ count = getLogEntries();
+
+ TInt i;
+ for ( i = 0; i < count; ++i )
+ {
+ // when a view is created, it will be positioned on the first event
+// iWait->iStatus = KRequestPending;
+ iLogClient->DeleteEvent(iLogView->Event().Id(), iWait->iStatus);
+ iWait->Start();
+
+ if ( iLogView->NextL( iWait->iStatus ) )
+ {
+ // should complete with KErrNone
+ iWait->Start();
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ // could not get next event!
+ break;
+ }
+ }
+ else
+ {
+ break; // no more events!
+ }
+ }
+ }
+
+void MmsTestBed::setOnline(bool value)
+ {
+ //value = true for online mode
+ //value = false for offline mode
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KCRUidCoreApplicationUIs ) );
+ if( retval == KErrNone )
+ {
+ repository->Set( KCoreAppUIsNetworkConnectionAllowed, value );
+ delete repository;
+ }
+ }
+
+void MmsTestBed::generateDeliveryReport( CMmsHeaders* aMmsHeaders )
+ {
+ iEncodeBuffer->ResizeL( 1024 );
+
+ TInt position = 0;
+
+ // encode message type
+ iEncodeBuffer->Write( position, &KMmsAssignedMessageType, 1 );
+ position++;
+ iEncodeBuffer->Write( position, &KMmsMessageTypeDeliveryInd, 1 );
+ position++;
+
+ // version
+ iEncodeBuffer->Write( position, &KMmsAssignedMmsVersion, 1 );
+ position++;
+
+ TUint8 version = aMmsHeaders->MmsVersion() | 0x80; // current version as short integer
+ iEncodeBuffer->Write( position, &version, 1 );
+ position++;
+
+ // message id from the headers
+ // At least once MMSC did not send us the message id!
+ // if message id is missing, we cannot match the entry!
+ // This only a fake. Real delivery reports should always
+ // contain the message id.
+ if ( aMmsHeaders->MessageId().Length() > 0 )
+ {
+ iEncodeBuffer->Write( position, &KMmsAssignedMessageId, 1 );
+ position++;
+ iEncodeBuffer->Write( position, &(aMmsHeaders->MessageId()[0]), aMmsHeaders->MessageId().Length() );
+ position += aMmsHeaders->MessageId().Length();
+ iEncodeBuffer->Write( position, &KMmsNull, 1 );
+ position++;
+ }
+
+ // To is taken from the headers
+ iEncodeBuffer->Write( position, &KMmsAssignedTo, 1 );
+ position++;
+
+ TPtrC recipient;
+ if ( aMmsHeaders->ToRecipients().MdcaCount() > 0 &&
+ aMmsHeaders->ToRecipients()[0].Length() > 0 )
+ {
+ recipient.Set( aMmsHeaders->ToRecipients()[0] );
+ }
+ else if( aMmsHeaders->CcRecipients().MdcaCount() > 0 &&
+ aMmsHeaders->CcRecipients()[0].Length() > 0 )
+ {
+ recipient.Set( aMmsHeaders->CcRecipients()[0] );
+ }
+ else if( aMmsHeaders->BccRecipients().MdcaCount() > 0 &&
+ aMmsHeaders->BccRecipients()[0].Length() > 0 )
+ {
+ recipient.Set( aMmsHeaders->BccRecipients()[0] );
+ }
+ else
+ {
+ recipient.Set( _L("Jasso-Kissa@jii.fi") );
+ }
+
+ TMmsAddressType addressType = EMmsAddressTypeUnknown;
+
+ if ( recipient.Find( KMiuMau ) != KErrNotFound )
+ {
+ addressType = EMmsAddressTypeEmail;
+ }
+ else
+ {
+ addressType = EMmsAddressTypeMobile;
+ }
+
+ TUint8 character;
+ TInt i;
+ if ( addressType == EMmsAddressTypeEmail )
+ {
+ // email address - ASCII ONLY - THIS IS JUST A TEST!
+
+ for ( i = 0; i < recipient.Length(); ++i )
+ {
+ character = TUint8( recipient[i] & 0xff );
+ iEncodeBuffer->Write( position, &character, 1 );
+ position++;
+ }
+ iEncodeBuffer->Write( position, &KMmsNull, 1 );
+ position++;
+
+ }
+ else
+ {
+ // must be a phone number
+ // We expect for now that the format is correct as is
+ // All legal characters present in a phone number are ASCII
+
+ TInt i;
+ for ( i = 0; i < recipient.Length(); ++i )
+ {
+ character = TUint8( recipient[i] & 0xff );
+ iEncodeBuffer->Write( position, &character, 1 );
+ position++;
+ }
+ iEncodeBuffer->Write( position, KMmsPlmn, KMmsPlmnLength );
+ position += KMmsPlmnLength;
+ iEncodeBuffer->Write( position, &KMmsNull, 1 );
+ position++;
+ }
+
+ // date
+ iEncodeBuffer->Write( position, &KMmsAssignedDate, 1 );
+ position++;
+
+ TLocale locale;
+ locale.Refresh();
+ TInt64 UtcDate;
+ TTimeIntervalSeconds universalTimeOffset( locale.UniversalTimeOffset() );
+
+ TTime now;
+ now.UniversalTime();
+ UtcDate = ( now.MicroSecondsFrom( TTime( KMmsYear1970String ) ).Int64() ) / 1000000 ;
+
+ UtcDate -= universalTimeOffset.Int();
+
+ if ( locale.QueryHomeHasDaylightSavingOn() )
+ {
+ TTimeIntervalSeconds daylightSaving( 60 * 60 );
+ UtcDate -= daylightSaving.Int();
+ }
+
+ TUint8 len; // number of bytes we will need
+ len = 0;
+ TUint8 array[8];
+
+ TInt64 temp = UtcDate;
+
+ for (i = 7; i >= 0; --i)
+ {
+ array[i] = TInt8( ( I64INT( temp ) ) & 0xFF );
+ I64LSR( temp, 8 );
+ }
+
+ len = 8;
+ i = 0;
+ while( ( array[i]== 0 ) && ( i < 8 ) )
+ {
+ i++;
+ len--;
+ }
+
+ // a zero should be coded as short integer.
+ // However, if there is a valid reason to code a zero as a long integer,
+ // we allow it. The caller should know what he is doing.
+ if ( len == 0 )
+ {
+ len = 1;
+ }
+ // write short length
+ iEncodeBuffer->Write( position, &len, 1 );
+ position++;
+ // write as many bytes as were non-zero
+ iEncodeBuffer->Write( position, &(array[8 - len] ), len );
+ position+= len;
+ // status
+ iEncodeBuffer->Write( position, &KMmsAssignedStatus, 1 );
+ position++;
+ iEncodeBuffer->Write( position, &KMmsMessageStatusRetrieved, 1 );
+ position++;
+ // DONE!!!
+ iEncodeBuffer->ResizeL( position );
+ return;
+ }
+
+void MmsTestBed::sendDeliveryReport()
+ {
+ if ( iEncodeBuffer->Size() == 0 )
+ {
+ //No delivery report
+ return;
+ }
+
+
+ TMsvId mmsFolder = findMMSFolder();
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+
+ TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
+ TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
+
+ // Now we have streamed our data into this entry.
+ // Now we have an entry that says: local service, MMS MTM
+
+ if ( entryId != KMsvNullIndexEntryId )
+ {
+ selection->AppendL( entryId );
+ }
+ else
+ {
+ selection->AppendL( iDefaultServiceId );
+ }
+
+ TWatcherParameters parameters; // initialized to zero
+ parameters.iWatcherId = RThread().Id();
+ parameters.iDataPointer = &ptr;
+ TWatcherParametersBuf paramPack( parameters );
+
+ CMsvOperation * op = NULL;
+
+// iWait->iStatus = KRequestPending;
+ op = iSession->TransferCommandL(
+ *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/src/mmsteststaticutils.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,528 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#include <f32file.h>
+#include <centralrepository.h>
+#include <apparc.h>
+#include <msvapi.h>
+#include <msvids.h>
+
+#include "mmsteststaticutils.h"
+#include "mmsconst.h"
+#include <MmsEnginePrivateCRKeys.h>
+#include "mmssettings.h"
+#include <mmsheaders.h>
+#include "mmsservercommon.h"
+#include <mmsencode.h>
+
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+TMmsJoinedArrays::TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2)
+: iArray1(aArray1), iArray2(aArray2)
+ {
+ }
+
+TInt TMmsJoinedArrays::MdcaCount() const
+ {
+ TInt count=0;
+ if (iArray1)
+ count += iArray1->MdcaCount();
+ if (iArray2)
+ count += iArray2->MdcaCount();
+ return count;
+ }
+
+TPtrC16 TMmsJoinedArrays::MdcaPoint(TInt aIndex) const
+ {
+ if (iArray1)
+ {
+ if (aIndex < iArray1->MdcaCount())
+ return iArray1->MdcaPoint(aIndex);
+ else
+ aIndex -= iArray1->MdcaCount();
+ }
+ return iArray2->MdcaPoint(aIndex);
+ }
+
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+TMmsTestUtils::TMmsTestUtils()
+ {
+
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+HBufC* TMmsTestUtils::ReadContactFromFileL( TDesC& aFileName, RFs& aFs )
+ {
+ RFile file;
+ TInt error = KErrNone;
+
+ TInt textBufferSize = 256;
+ HBufC* textBuffer = HBufC::NewL( textBufferSize );
+ TPtr textPtr = textBuffer->Des();
+ TFileText textFile;
+
+ error = file.Open( aFs, aFileName,
+ EFileRead|EFileShareReadersOnly );
+
+ if ( error == KErrNone )
+ {
+ textFile.Set( file );
+ error = textFile.Seek( ESeekStart );
+ }
+
+ if ( error == KErrNone )
+ {
+ error = textFile.Read( textPtr );
+ }
+
+ file.Close();
+
+ if ( textBuffer->Des().Find( &KMmsByteOrderMark, 1 ) == 0 )
+ {
+ textBuffer->Des().Copy( textBuffer->Des().Mid( 1 ) );
+ }
+
+ return textBuffer;
+ }
+
+//----------------------------------------------------------------------------------------
+// turn on detailed logging while decoding a message
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::DecodeLoggingOnL()
+ {
+ // CenRep for decodelogging
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+ if( retval == KErrNone )
+ {
+ // Best effort - if cannot access repository, no can do
+ TInt temp = 1;
+ repository->Set( KMmsEngineDecodeLog, temp );
+ delete repository;
+ }
+ }
+
+//----------------------------------------------------------------------------------------
+// turn off detailed logging while decoding a message
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::DecodeLoggingOffL()
+ {
+ // CenRep for decodelogging
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+ if( retval == KErrNone )
+ {
+ // Best effort - if cannot access repository, no can do
+ TInt temp = 0;
+ repository->Set( KMmsEngineDecodeLog, temp );
+ delete repository;
+ }
+
+ }
+
+//----------------------------------------------------------------------------------------
+// turn on binary dump of incoming messages
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::BinaryDumpOnL()
+ {
+ // CenRep for binarydump setting
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+ if( retval == KErrNone )
+ {
+ // Best effort - if cannot access repository, no can do
+ TInt temp = 1;
+ repository->Set( KMmsEngineBinaryDump, temp );
+ delete repository;
+ }
+
+ }
+
+//----------------------------------------------------------------------------------------
+// turn off binary dump of incoming messages
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::BinaryDumpOffL()
+ {
+ // CenRep for binarydump setting
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+ if( retval == KErrNone )
+ {
+ // Best effort - if cannot access repository, no can do
+ TInt temp = 0;
+ repository->Set( KMmsEngineBinaryDump, temp );
+ delete repository;
+ }
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+void TMmsTestUtils::CleanDirectoryL( RFs& aFs )
+ {
+ // Delete the files in the directory
+ CFileMan* fileMan = CFileMan::NewL( aFs );
+ CleanupStack::PushL( fileMan );
+ fileMan->RmDir( KMmsDefaultLocalModeDir );
+ fileMan->RmDir( KMmsMMBoxDirectory );
+ fileMan->RmDir( KMmsMMBoxDescriptionDirectory );
+ CleanupStack::PopAndDestroy(); // fileManager
+ // we don't want to throw these away!
+ aFs.MkDirAll( KMmsDefaultLocalModeDir );
+ aFs.MkDirAll( KMmsMMBoxDirectory );
+ aFs.MkDirAll( KMmsMMBoxDescriptionDirectory );
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+void TMmsTestUtils::Dump( CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs )
+ {
+ TInt error = KErrNone;
+ aFs.MkDirAll( aFilename );
+ TUint att;
+ if ( aFs.Att( aFilename, att ) == KErrNone )
+ {
+ _LIT( KRelated, "dump.mms");
+ aParse.Set( aFilename, &KRelated, NULL );
+ aFilename = aParse.FullName();
+ error = CApaApplication::GenerateFileName( aFs, aFilename );
+ if ( error == KErrNone )
+ {
+ RFile file;
+ error = file.Create( aFs, aFilename, EFileWrite | EFileShareExclusive );
+ // for message id generation
+ aParse.Set( aFilename, NULL, NULL );
+ if ( error == KErrNone )
+ {
+ // the data is supposed to be in the encode buffer
+ TPtr8 ptr = aBuffer.Ptr( 0 );
+ file.Write( ptr );
+ file.Flush();
+ }
+
+ // done - close files
+ file.Close();
+ }
+ }
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+void TMmsTestUtils::CleanBoxL(TMsvId aBoxId, CMsvSession& aSession)
+ {
+ CMsvEntry* cEntry = NULL;
+ // delete all messages from the specified box
+ cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ cEntry->SetEntryL(aBoxId);
+ // show invisible entries
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PushL(msvEntrySelection);
+
+ CMsvEntrySelection* selection = NULL;
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ selection = cEntry->ChildrenWithMtmL(KUidMsgMMSNotification);
+ CleanupStack::PushL( selection );
+ if ( selection->Count() > 0 )
+ {
+ msvEntrySelection->AppendL( selection->Back( 0 ), selection->Count() );
+ }
+ CleanupStack::PopAndDestroy(); // selection
+
+ int i;
+ for (i = 0; i < msvEntrySelection->Count(); ++i)
+ {
+ CMsvEntry* entry = aSession.GetEntryL( msvEntrySelection->At(i) );
+ CleanupStack::PushL( entry );
+ TMsvEntry tEntry = entry->Entry();
+ tEntry.SetReadOnly(EFalse);
+ entry->ChangeL(tEntry);
+ cEntry->DeleteL( msvEntrySelection->At(i) );
+ CleanupStack::PopAndDestroy( entry );
+ }
+
+ CleanupStack::PopAndDestroy(msvEntrySelection);
+ CleanupStack::PopAndDestroy(cEntry);
+ }
+
+//----------------------------------------------------------------------------------------
+// turn on logging email recipients
+//----------------------------------------------------------------------------------------
+void TMmsTestUtils::EmailLoggingOnL()
+ {
+ // CenRep for binarydump setting
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
+ if( retval == KErrNone )
+ {
+ TInt temp = 1;
+ repository->Set( KMmsEngineLogEmailRecipients, temp );
+ delete repository;
+ }
+
+ }
+
+//----------------------------------------------------------------------------------------
+// turn off logging email recipients
+//----------------------------------------------------------------------------------------
+void TMmsTestUtils::EmailLoggingOffL()
+ {
+ // CenRep for binarydump setting
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
+ if( retval == KErrNone )
+ {
+ TInt temp = 0;
+ repository->Set( KMmsEngineLogEmailRecipients, temp );
+ delete repository;
+ }
+
+ }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TInt TMmsTestUtils::CountChildrenL(TMsvId aBoxId, CMsvEntrySelection*& aMsvEntrySelection, CMsvSession& aSession, TUid aMessageType )
+ {
+ CMsvEntry* cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ cEntry->SetEntryL(aBoxId);
+ if (aMsvEntrySelection != NULL)
+ {
+ delete aMsvEntrySelection;
+ aMsvEntrySelection = NULL;
+ }
+ aMsvEntrySelection = cEntry->ChildrenWithMtmL(aMessageType);
+ CleanupStack::PopAndDestroy(); // cEntry
+ return aMsvEntrySelection->Count();
+ }
+
+
+// -----------------------------------------------------------------------------
+// CreateFolderEntryL
+//
+// -----------------------------------------------------------------------------
+//
+void TMmsTestUtils::CreateFolderEntryL(
+ CMsvSession& aSession,
+ TMsvId aParentFolder,
+ const TDesC& aFolderName,
+ TMsvId& aFolderId )
+ {
+ aFolderId = KMsvNullIndexEntryId;
+ CMsvEntry* cEntry = aSession.GetEntryL( aParentFolder );
+ CleanupStack::PushL( cEntry );
+
+ // Create a new folder.
+
+ TMsvEntry entry;
+ entry.iType = KUidMsvFolderEntry;
+ entry.iMtm = KUidMsvLocalServiceMtm;
+ entry.iDetails.Set( aFolderName );
+ entry.SetVisible( EFalse );
+ entry.SetInPreparation( EFalse );
+ entry.iServiceId = KMsvLocalServiceIndexEntryId;
+ cEntry->CreateL( entry );
+ aFolderId = entry.Id();
+ CleanupStack::PopAndDestroy( cEntry );
+
+ }
+
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TMsvId TMmsTestUtils::CreateNotificationEntryL(
+ TMsvId aNotificationFolder,
+ TMsvId aServiceId,
+ CBufFlat* aEncodeBuffer,
+ CMsvSession& aSession )
+ {
+ TMsvId entryId = KMsvNullIndexEntryId;
+ if ( aNotificationFolder == KMsvNullIndexEntryId )
+ {
+ // no folder no entry
+ return entryId;
+ }
+
+ CMsvEntry* cEntry = aSession.GetEntryL( aNotificationFolder );
+ CleanupStack::PushL(cEntry);
+
+ TMsvEntry entry;
+ entry.iType = KUidMsvMessageEntry;
+ entry.iMtm = KUidMsgTypeMultimedia;
+ entry.SetVisible( ETrue );
+ // If we want to put data here, InPreparation must be set to true first
+ entry.SetInPreparation( EFalse );
+ entry.iServiceId = KMsvLocalServiceIndexEntryId;
+ entry.iRelatedId = aServiceId;
+ entry.iMtmData2 = KMmsNotificationBinary;
+ cEntry->CreateL( entry );
+ entryId = entry.Id();
+
+ //
+ // Stream
+ // 1) length of the data as 32 bit integer
+ // 2) pushed message data
+ // into created entry's stream
+ //
+ cEntry->SetEntryL( entryId );
+ CMsvStore* store = cEntry->EditStoreL();
+ CleanupStack::PushL( store ); // ***
+ RMsvWriteStream outs;
+ outs.AssignLC( *store, KUidBinaryNotificationStream ); // ***
+ TPtrC8 ptr = aEncodeBuffer->Ptr( 0 );
+ outs.WriteUint32L( ptr.Length() );
+ outs.WriteL( ptr );
+ outs.CommitL();
+ outs.Close();
+ store->CommitL();
+
+ CleanupStack::PopAndDestroy( &outs ); // close outs
+ CleanupStack::PopAndDestroy( store );
+ CleanupStack::PopAndDestroy( cEntry );
+
+ return entryId;
+
+ }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+void TMmsTestUtils::FormNotification(
+ TDesC8& aUrl,
+ TInt aSize,
+ CMmsHeaders& aMmsHeaders,
+ CMmsEncode& aMmsEncoder,
+ CBufFlat* aEncodeBuffer )
+ {
+ // for test purposes aUrl will contain the filename.
+
+ // Reset sets the default encapsulation version
+ // The default version has been set from MmsSettings in NewL
+ aMmsHeaders.Reset();
+
+ // construct the notification into iMmsHeaders, and call encode
+
+ aMmsHeaders.SetMessageType( KMmsMessageTypeMNotificationInd );
+
+ TTime currentTime;
+ currentTime.UniversalTime();
+ currentTime.Int64();
+
+ TPtrC8 tid;
+ TBufC8<KMMSMAXTIDLENGTH> target;
+ TInt random = 0;
+
+ // we don't generate a true random TID: We generate the
+ // TID from the URL so that if we generate a notification
+ // twice from the same file, we get the same TID and the
+ // same URL. This way we can test the pruning function in
+ // server MTM
+
+ TInt i;
+ for ( i = 0; i < aUrl.Length(); ++i )
+ {
+ random += aUrl[ i ];
+ }
+
+ target.Des().Num( random );
+ tid.Set( target.Des() );
+ aMmsHeaders.SetTidL( tid );
+
+ aMmsHeaders.SetMessageClass( EMmsClassPersonal );
+ aMmsHeaders.SetMessageSize( aSize );
+ const TInt KTenHours = 10 * 60 * 60; // 10 hours relative expiry
+ aMmsHeaders.SetExpiryInterval( KTenHours );
+ aMmsHeaders.SetContentLocationL( aUrl );
+
+ aMmsEncoder.EncodeHeadersL( aMmsHeaders, *aEncodeBuffer );
+
+ }
+
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TBool TMmsTestUtils::IsFile(const TDesC& aFileName, RFs& aFs)
+ {
+ //Is the name a file?
+ if (IsDrive(aFileName))
+ return EFalse;
+ return !(IsDir(aFileName, aFs));
+ }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TBool TMmsTestUtils::IsDir(const TDesC& aFileName, RFs& aFs)
+ {
+ //Is the name a directory?
+ TEntry entry;
+ TInt err = aFs.Entry(aFileName, entry);
+ if (err)
+ return EFalse;
+ else
+ return entry.IsDir();
+ }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TBool TMmsTestUtils::IsDrive(const TDesC& aFileName)
+ {
+ //horrible little function to figure if the path is just a drive
+ TBool retVal = EFalse;
+ if (aFileName.Length()==3) //eg "c:\"
+ {
+ if ((aFileName[1] == ':') && (aFileName[2] == '\\'))
+ retVal=ETrue;
+ }
+ else if (aFileName.Length()==2) //eg "c:"
+ {
+ if (aFileName[1] == ':')
+ retVal=ETrue;
+ }
+ return retVal;
+ }
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/src/mmstestuitimer.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#include "mmstestuitimer.h"
+
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CTestUiTimer::CTestUiTimer(): CTimer( 5 )
+ {
+ period = KPeriod;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::ConstructL()
+ {
+ CTimer::ConstructL();
+ CActiveScheduler::Add(this);
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CTestUiTimer* CTestUiTimer::NewL()
+ {
+ CTestUiTimer* self = new(ELeave) CTestUiTimer();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CTestUiTimer::~CTestUiTimer()
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::IssueRequest()
+ {
+ // No operation to cancel if this function is called
+ iObject = NULL;
+ After(period);
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::TimeoutOperation( CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds )
+ {
+ iObject = aObject;
+ TTimeIntervalMicroSeconds32 timeout = aTimeoutInSeconds.Int() * 1000000;
+ After( timeout );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::DoCancel()
+ {
+ CTimer::DoCancel();
+ if ( iObject )
+ {
+ iObject->Cancel();
+ iObject = NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::RunL()
+ {
+ if ( iObject )
+ {
+ // If we timeout while holding an active object, we cancel it
+ iObject->Cancel();
+ iObject = NULL;
+ }
+ else
+ {
+ CActiveScheduler::Stop();
+ }
+ }
+
+// ======== GLOBAL FUNCTIONS ========
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/data/testmmsplugin.cfg Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,1 @@
+TestMmsPlugin
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/data/testmmsplugin.pl Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,182 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+#!/usr/bin/perl -w
+use warnings;
+use strict;
+
+my $TOTALCASES = 0;
+my $TOTALPASSED = 0;
+my $TOTALRUN = 0;
+my $TOTALFAILED = 0;
+my $TOTALSKIPPED = 0;
+
+sub parse_line
+{
+ my $line = $_[0];
+ my @parts = split (" ", $line);
+ my $passed = $parts[1];
+ my $failed = $parts[3];
+ my $skipped = $parts[5];
+
+ my $total = $passed + $failed + $skipped;
+ my $passrate = $passed * 100 / $total;
+ my $passrateround = sprintf("%.0f",$passrate);
+ my $runrate = ($total - $skipped)*100/$total;
+ my $runrateround = sprintf("%.0f",$runrate);
+
+ $TOTALCASES += $total;
+ $TOTALPASSED += $passed;
+ $TOTALRUN += ($total - $skipped);
+ $TOTALFAILED += $failed;
+ $TOTALSKIPPED += $skipped;
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$passed\n";
+ printf MYFILE "</td>\n";
+
+ if($failed > 0)
+ {
+ printf MYFILE "<td style=\"font-weight:bold;color:red\">\n";
+ printf MYFILE "$failed\n";
+ printf MYFILE "</td>\n";
+ }
+ else
+ {
+ printf MYFILE "<td>\n";
+ printf MYFILE "$failed\n";
+ printf MYFILE "</td>\n";
+ }
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$skipped\n";
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$total\n";
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "<td>\n";
+ printf MYFILE ("$passrateround %%\n");
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$runrateround %%\n";
+ printf MYFILE "</td>\n";
+
+
+}
+
+sub parse_file
+ {
+ my $pattern = "Totals";
+ my $file = $_[0];
+ open (FILE,$file);
+
+ while (my $line= <FILE>)
+ {
+ chomp ($line);
+ if ($line =~ m/$pattern/)
+ {
+ parse_line $line;
+ }
+ }
+ close(FILE);
+ }
+
+
+sub generate_report
+ {
+ open (MYFILE, '>/epoc32/winscw/c/logs/messagingtestsuite/report.html');
+ printf MYFILE "<html>\n";
+ printf MYFILE "<body>\n";
+ printf MYFILE "<head>\n";
+ printf MYFILE "<title>MsgApp Test Suite Reports</title>";
+ printf MYFILE "</head>\n";
+ printf MYFILE "<h2 align = center>Messaging101 Test Suite Report</h2>\n";
+ printf MYFILE "<table border = 2 cellpadding = 10 align = center>\n";
+ printf MYFILE "<tr style = \" background-color:lavender \">\n";
+ printf MYFILE "<th>Module</th>\n";
+ printf MYFILE "<th style = color:green>Passed</th>\n";
+ printf MYFILE "<th style = color:red>Failed</th>\n";
+ printf MYFILE "<th style = color:chocolate>Skipped</th>\n";
+ printf MYFILE "<th>Total Cases</th>\n";
+ printf MYFILE "<th>Pass Rate</th>\n";
+ printf MYFILE "<th>Run Rate</th>\n";
+ printf MYFILE "</tr>\n";
+
+
+ my @files = </epoc32/winscw/c/logs/messagingtestsuite/*.txt>;
+ foreach my $file (@files)
+ {
+ my @splitedpath = split("/",$file);
+ my $filename = $splitedpath[-1];
+ my $length = length($filename);
+ my $name = substr($filename,11,$length-15);
+ printf MYFILE "<tr>\n";
+ printf MYFILE "<td>\n";
+ printf MYFILE "<a HREF=$filename style = text-decoration:none><b>$name</b></a>\n";
+ printf MYFILE "</td>\n";
+
+ parse_file $file;
+
+ printf MYFILE "</tr>\n";
+ }
+
+ printf MYFILE "<tr style= \"font-weight:bold; color:white; background-color:gray\">\n";
+ printf MYFILE "<td>\n";
+ printf MYFILE "<b>Overall</b>\n";
+ printf MYFILE "</td>\n";
+
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$TOTALPASSED\n";
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$TOTALFAILED\n";
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$TOTALSKIPPED\n";
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$TOTALCASES\n";
+ printf MYFILE "</td>\n";
+
+ my $passrate = $TOTALPASSED*100/$TOTALCASES;
+ my $passrateround = sprintf("%.0f",$passrate);
+ printf MYFILE "<td>\n";
+ printf MYFILE "$passrateround%%\n";
+ printf MYFILE "</td>\n";
+
+ my $runrate = ($TOTALCASES - $TOTALSKIPPED)*100/$TOTALCASES;
+ my $runrateround = sprintf("%.0f",$runrate);
+ printf MYFILE "<td>\n";
+ printf MYFILE "$runrateround%%\n";
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "</tr>\n";
+
+ printf MYFILE "</table>\n";
+ printf MYFILE "</body>\n";
+ printf MYFILE "</html>\n";
+
+ close (MYFILE);
+ }
+
+
+generate_report;
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/inc/testmmsplugin.h Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: - Main test class for Msgnotification -indicator plugin,
+ * -notification dialog plugin
+ */
+
+#ifndef TEST_MMS_PLUGIN_H
+#define TEST_MMS_PLUGIN_H
+
+#ifdef BUILD_TEST_DLL
+#define TEST_EXPORT Q_DECL_EXPORT
+#else
+#define TEST_EXPORT Q_DECL_IMPORT
+#endif
+
+#include <QObject>
+#include <e32const.h>
+
+class UniEditorMmsPlugin;
+class ConvergedMessage;
+class MmsTestBed;
+class QSignalSpy;
+
+class TEST_EXPORT TestMmsPlugin: public QObject
+ {
+ Q_OBJECT
+
+private slots:
+
+ /**
+ * Called by framework,its called before the 1st test function is executed.
+ */
+
+ void initTestCase();
+
+ /**
+ * Called by framework,its called before each test function is executed.
+ */
+
+ void init();
+
+ /**
+ * Test Sending MMS
+ */
+
+ void testSendMMS();
+
+ /**
+ * Test receiving MMS
+ */
+
+ void testMmsReceived();
+
+ /**
+ * Called by framework,its called after each test function is executed.
+ */
+
+ void cleanup();
+
+ /**
+ * Called by framework,its called after the last test function is executed.
+ */
+
+ void cleanupTestCase();
+
+private:
+
+ QSignalSpy *spy_draft;
+ QSignalSpy *spy_outbox;
+ QSignalSpy *spy_sent;
+
+ UniEditorMmsPlugin* msgPlugin;
+ int mmsId;
+ MmsTestBed* mmstestbed;
+
+ };
+#endif //TEST_MMS_PLUGIN_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/inc/testmmsplugin.ini Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,12 @@
+//this file is used to provide predefined set of input data.
+
+const char TEST_MSG_RECIEPIENT[] = "+919000";
+const char TEST_MSG_FROM2[] = "999";
+const char TEST_MSG_SUBJECT[] = "Message Subject";
+const char TEST_SERVICE_NAME_MMS[] = "messaging.mserver.testservice.MMS";
+const char TEST_SENDER[] = "+918888";
+const char TEST_ATTACHMENT[] = "c:\\sample.txt";
+const char TEST_ATTACHMENT4[] = "c:\\SmileyFace.gif";
+const char TEST_ATTACHMENT5[] = "c:\\sample.txt";
+const char TEST_CC[] = "DummyCCAddress";
+const char TEST_BCC[] = "DummyBCCAddress";
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/src/testmmsplugin.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,265 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: - Main test class for Msgnotification -indicator plugin,
+ * -notification dialog plugin
+ */
+
+#include "testmmsplugin.h"
+#include <QtTest/QtTest>
+#include "debugtraces.h"
+#include <QTimer>
+#include <QSignalSpy>
+#include "convergedmessage.h"
+#include "convergedmessageid.h"
+#include "unieditormmsplugin.h"
+#include "mmstestbed.h"
+#include "testmmsplugin.ini"
+#include <QSignalSpy>
+
+
+
+//out put directory for test results.
+QString OUTPUTDIRECTORY = "c:/logs/testmmsplugin";
+//o/p directory for data to be written on temp file.
+QString TEMPDIR = "c:/logs/testmmsplugin/testdata";
+//test result O/P file name.
+QString RESULTFILE = "c:/logs/testmmsplugin/result_%1.txt";
+// folder named UID3 of testmmsplugin inside private folder.
+const QString PRIVATE_DIR("C:/private/E4c5e8b4");
+
+//factory method to create objects.
+QObject* getObject(QString className)
+{
+ if(className == "TestMmsPlugin" )
+ {
+ return new TestMmsPlugin;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+//creating o/p directory.
+void createOutPutDirectory()
+ {
+ QDir dir;
+ //o/p dir
+ dir.mkdir(OUTPUTDIRECTORY);
+ //tmp dir
+ dir.mkdir(TEMPDIR);
+ // dir inside private folder.
+ dir.mkdir(PRIVATE_DIR);
+ }
+
+//main entry point
+int main(int argc, char *argv[])
+ {
+ int ret = -1;
+ QCoreApplication app(argc, argv);
+
+ //creating output directory.
+ createOutPutDirectory();
+
+ //the configuration file.
+ QFile data("c:/testmmsplugin.cfg");
+
+ if (data.open(QFile::ReadOnly))
+ {
+ QTextStream in(&data);
+ while(!in.atEnd())
+ {
+ QStringList args;
+ QString appName = argv[0];
+ args << appName;
+
+ QString option = "-o";
+ args << option;
+
+ QString outFile = RESULTFILE;
+ QString name = in.readLine();
+ outFile = outFile.arg(name);
+ args << outFile;
+
+ QObject* tc = getObject(name);
+
+ if(tc)
+ {
+
+ ret = QTest::qExec(tc, args);
+ delete tc;
+ }
+ }
+ }
+ data.close();
+ return ret;
+ }
+
+
+
+
+
+//---------------------------------------------------------------
+// TestMmsPlugin::initTestCase
+//---------------------------------------------------------------
+
+void TestMmsPlugin::initTestCase()
+{
+ qRegisterMetaType<long int> ("long int");
+ msgPlugin = new UniEditorMmsPlugin();
+ QVERIFY(msgPlugin != 0);
+ mmsId = -1;
+ mmstestbed = new MmsTestBed;
+ QVERIFY(mmstestbed != 0);
+ if(!mmstestbed)
+ {
+ QSKIP("Mmstestbed creation failed", SkipAll);
+ }
+
+ spy_draft = new QSignalSpy(mmstestbed,SIGNAL(entryCreatedInDraft(long int)));
+ spy_outbox = new QSignalSpy(mmstestbed,SIGNAL(entryMovedToOutbox(long int)));
+ spy_sent = new QSignalSpy(mmstestbed,SIGNAL(entryMovedToSent(long int)));
+
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::init
+//---------------------------------------------------------------
+
+void TestMmsPlugin::init()
+{
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::testSendMMS
+//---------------------------------------------------------------
+
+void TestMmsPlugin::testSendMMS()
+{
+
+ qRegisterMetaType<long int> ("long int");
+ QString service = TEST_SERVICE_NAME_MMS;
+
+ QString subject = TEST_MSG_SUBJECT;
+ qint64 timeStamp = QDateTime::currentDateTime().toTime_t();
+
+ QString sender(TEST_SENDER);
+ ConvergedMessageAddress address(sender);
+ ConvergedMessageAttachmentList attachmentList;
+
+ QString attachment2Path = TEST_ATTACHMENT4;
+ ConvergedMessageAttachment* attachment2 =
+ new ConvergedMessageAttachment(attachment2Path, ConvergedMessageAttachment::EAttachment);
+
+ QString attachmentPath = TEST_ATTACHMENT5;
+ ConvergedMessageAttachment* attachment =
+ new ConvergedMessageAttachment(attachmentPath, ConvergedMessageAttachment::EAttachment);
+
+ attachmentList.append(attachment);
+ attachmentList.append(attachment2);
+ ConvergedMessage msg;
+ msg.setMessageType(ConvergedMessage::Mms);
+ msg.setSubject(subject);
+ msg.setTimeStamp(timeStamp);
+ msg.addToRecipient(address);
+ msg.addAttachments(attachmentList);
+ msg.setPriority(ConvergedMessage::Normal);
+ //Adding alias
+ ConvergedMessageAddress address1;
+ address1.setAlias(QString(TEST_MSG_RECIEPIENT));
+ msg.addToRecipient(address1);
+
+ //Adding CC Address
+ QString ccAddress(TEST_CC);
+ ConvergedMessageAddress ccAdd(ccAddress);
+ msg.addCcRecipient(ccAdd);
+
+ //Adding BCC Address
+ QString bccAddress(TEST_BCC);
+ ConvergedMessageAddress bccAdd(bccAddress);
+ msg.addBccRecipient(bccAdd);
+
+ mmstestbed->cleanAll();
+ mmstestbed->setConnectionLocal(true);
+ long int id = msgPlugin->convertTo(&msg);
+
+ QVERIFY(id != 0);
+ msgPlugin->send(id);
+ QTest::qWait(5000);
+ long int idRec;
+
+ if( 1 == spy_draft->count())
+ {
+ void * temp = const_cast<void*>(spy_draft->at(0).at(0).data());
+ idRec = *reinterpret_cast< long int(*)>(temp);
+ QDEBUG_WRITE("passed: spy_draft.count");
+ }
+ else
+ {
+ QFAIL("testSendReceiveMMS: Failed to create message in Draft");
+ mmstestbed->setConnectionLocal(false);
+ return;
+ }
+ if( 1 == spy_outbox->count())
+ {
+ mmstestbed->fromOutboxToMmsc();
+ QDEBUG_WRITE("passed: spy_outbox.count");
+ }
+ else
+ {
+ QFAIL("testSendReceiveMMS: Failed to move message to Outbox");
+ mmstestbed->setConnectionLocal(false);
+ return;
+ }
+
+ if( 1 == spy_sent->count())
+ {
+ void * temp = const_cast<void*>(spy_sent->at(0).at(0).data());
+ long int sentmsgid = *reinterpret_cast< long int(*)>(temp);
+ QCOMPARE(sentmsgid, idRec);
+ mmstestbed->fromMmscToInbox();
+ QDEBUG_WRITE("passed: spy_sent.count");
+ }
+ else
+ {
+ QFAIL("testSendReceiveMMS: Failed to move message to Sent folder");
+ mmstestbed->setConnectionLocal(false);
+ return;
+ }
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::testMmsReceived
+//---------------------------------------------------------------
+void TestMmsPlugin::testMmsReceived()
+{
+ QTest::qWait(5000);
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::cleanup
+//---------------------------------------------------------------
+void TestMmsPlugin::cleanup()
+{
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::cleanupTestCase
+//---------------------------------------------------------------
+void TestMmsPlugin::cleanupTestCase()
+{
+ delete msgPlugin;
+ delete mmstestbed;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsgplugin/testmmsplugin.pro Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,164 @@
+
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+QT += testlib
+QT -= gui
+
+CONFIG += hb
+CONFIG += symbian_test
+
+TEMPLATE = app
+TARGET = testmmsplugin
+
+INCLUDEPATH += inc
+INCLUDEPATH += ../../inc
+INCLUDEPATH += ../../../../../../../../inc
+INCLUDEPATH += ../../../../../../inc
+INCLUDEPATH += ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc
+INCLUDEPATH += ../../../../../msgutils/unidatautils/unidatamodel/inc
+INCLUDEPATH += ../../../../../msgutils/unieditorutils/editorgenutils/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/mmsmessage/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/inc
+INCLUDEPATH += ../mmstestbed/inc
+INCLUDEPATH +=
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+DEFINES += BUILD_TEST_DLL
+
+SOURCES += \
+ src/testmmsplugin.cpp \
+ ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin.cpp \
+ ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin_p.cpp
+
+
+# Input
+HEADERS += \
+ inc/testmmsplugin.h \
+ ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin.h \
+ ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin_p.h
+
+
+SYMBIAN_PLATFORMS = WINSCW ARMV5
+
+symbian {
+ TARGET.UID3 = 0xE7232a7c
+ TARGET.CAPABILITY = CAP_GENERAL_DLL
+ TARGET.EPOCSTACKSIZE = 0x8000
+ TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
+ TARGET.EPOCALLOWDLLDATA = 1
+ VENDORID = VID_DEFAULT
+ BLD_INF_RULES.prj_exports += "data/testmmsplugin.cfg c:/testmmsplugin.cfg"
+ BLD_INF_RULES.prj_exports += "data/testmmsplugin.pl c:/testmmsplugin.pl"
+ }
+
+ LIBS += -leuser \
+ -lcsserverclientapi \
+ -lcsutils \
+ -lconvergedmessageutils \
+ -lMsgMedia \
+ -leikctl \
+ -leditorgenutils \
+ -lcone \
+ -leikcoctl \
+ -leikcore \
+ -leikdlg \
+ -lmsgs \
+ -letext \
+ -lmmsserversettings \
+ -lgsmu \
+ -lmmsgenutils \
+ -lefsrv \
+ -lestor \
+ -lsmcm \
+ -lCommonEngine \
+ -lbafl \
+ -lCdlEngine \
+ -lFeatMgr \
+ -lapmime \
+ -lapgrfx \
+ -lcharconv \
+ -lInetProtUtil \
+ -lsmildtd \
+ -lxmldom \
+ -lxmlparser \
+ -lcone \
+ -lQtCore \
+ -letel \
+ -lmmsmessage \
+ -lcommdb \
+ -lcommsdat \
+ -letelmm \
+ -lunidatamodelloader \
+ -lunidatamodel \
+ -lavkon \
+ -leikcoctl \
+ -leikctl \
+ -lform \
+ -luiklaf\
+ -lxqutils\
+ -lmmstestbed\
+ -lmsginit \
+ -lmsgs \
+ -letext \
+ -lsmcm \
+ -lmmsmessage \
+ -lmmsserversettings \
+ -lmmscli \
+ -lxqservice \
+ -lQtContacts \
+ -lQtVersit \
+ -lunidatamodelloader \
+ -lxqsettingsmanager \
+ -apgrfx.lib \
+ -lxqutils \
+ -lws32 \
+ -lapgrfx \
+ -lxqsystemtoneservice
+
+
+
+packageheader = "$${LITERAL_HASH}{\"QTestLibCVsClientServerTest\"},(0xE7232a7c),1,0,0,TYPE=SA"
+
+vendorinfo = \
+ "; Localised Vendor name" \
+ "%{\"Nokia\"}" \
+ "; Unique Vendor name" \
+ ":\"Nokia\""
+
+dependencyinfo = \
+ "; Default HW/platform dependencies" \
+ "[0x101F7961],0,0,0,{\"S60ProductID\"}" \
+ "[0x2001E61C],4,6,3,{"Qt"}
+
+default_deployment.pkg_prerules = packageheader \
+ vendorinfo \
+ dependencyinfo
+
+#Copy the dependent DLL
+symbian: {
+ addCfg.sources = ./data/testmmsplugin.cfg
+ addCfg.path = C:/
+ DEPLOYMENT += addCfg
+
+ addPl.sources = ./data/testmmsplugin.pl
+ addPl.path = C:/
+ DEPLOYMENT += addPl
+
+ addFiles.sources = mmstestbed.dll
+ addFiles.path = /sys/bin
+ DEPLOYMENT += addFiles
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/unittest_mmsplugin.pro Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,28 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = subdirs
+
+CONFIG += symbian_test
+CONFIG += ordered
+
+#Sub .pro files
+SUBDIRS += mmstestbed/mmstestbed.pro
+SUBDIRS += testmmsgplugin/testmmsplugin.pro
+
+
+# Platforms
+SYMBIAN_PLATFORMS = DEFAULT
\ No newline at end of file
--- a/messagingapp/msgservices/msgserviceapp/src/msgservicewindow.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgservices/msgserviceapp/src/msgservicewindow.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -41,7 +41,7 @@
mViewManager(NULL)
{
// create stote handler
- mStoreHandler = new MsgStoreHandler();
+ QT_TRAP_THROWING( mStoreHandler = new MsgStoreHandler());
// create view manager
mViewManager = new MsgServiceViewManager(mStoreHandler,this);
--- a/messagingapp/msgservices/msgserviceapp/src/msgstorehandler.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgservices/msgserviceapp/src/msgstorehandler.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -30,7 +30,7 @@
MsgStoreHandler::MsgStoreHandler():
iMsvSession(NULL)
{
- TRAP_IGNORE(InitL());
+ InitL();
}
//----------------------------------------------------------------------------
--- a/messagingapp/msgsettings/bwins/msginitu.def Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgsettings/bwins/msginitu.def Sun Jul 25 18:59:19 2010 +0530
@@ -1,5 +1,6 @@
EXPORTS
?NewL@CMsgSimOperation@@SAPAV1@AAVMSimOperationObserver@@@Z @ 1 NONAME ; class CMsgSimOperation * CMsgSimOperation::NewL(class MSimOperationObserver &)
- ??0MsgSimNumDetector@@QAE@XZ @ 2 NONAME ; MsgSimNumDetector::MsgSimNumDetector(void)
- ??1MsgSimNumDetector@@QAE@XZ @ 3 NONAME ; MsgSimNumDetector::~MsgSimNumDetector(void)
+ ??_EMsgSimNumDetector@@UAE@I@Z @ 2 NONAME ; MsgSimNumDetector::~MsgSimNumDetector(unsigned int)
+ ??0MsgSimNumDetector@@QAE@XZ @ 3 NONAME ; MsgSimNumDetector::MsgSimNumDetector(void)
+ ??1MsgSimNumDetector@@UAE@XZ @ 4 NONAME ; MsgSimNumDetector::~MsgSimNumDetector(void)
--- a/messagingapp/msgsettings/eabi/msginitu.def Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgsettings/eabi/msginitu.def Sun Jul 25 18:59:19 2010 +0530
@@ -2,6 +2,9 @@
_ZN16CMsgSimOperation4NewLER21MSimOperationObserver @ 1 NONAME
_ZN17MsgSimNumDetectorC1Ev @ 2 NONAME
_ZN17MsgSimNumDetectorC2Ev @ 3 NONAME
- _ZN17MsgSimNumDetectorD1Ev @ 4 NONAME
- _ZN17MsgSimNumDetectorD2Ev @ 5 NONAME
+ _ZN17MsgSimNumDetectorD0Ev @ 4 NONAME
+ _ZN17MsgSimNumDetectorD1Ev @ 5 NONAME
+ _ZN17MsgSimNumDetectorD2Ev @ 6 NONAME
+ _ZTI17MsgSimNumDetector @ 7 NONAME
+ _ZTV17MsgSimNumDetector @ 8 NONAME
--- a/messagingapp/msgsettings/msginit/inc/coutboxobserver.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgsettings/msginit/inc/coutboxobserver.h Sun Jul 25 18:59:19 2010 +0530
@@ -65,7 +65,7 @@
/**
* The messaging server sends notifications of changes in the
- * observed entry to CNcnOutboxObserver by calling this method.
+ * observed entry to COutboxObserver by calling this method.
*/
void
HandleEntryEventL(TMsvEntryEvent aEvent, TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/);
--- a/messagingapp/msgsettings/msginit/inc/msgsimnumberdetector.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgsettings/msginit/inc/msgsimnumberdetector.h Sun Jul 25 18:59:19 2010 +0530
@@ -36,7 +36,7 @@
* MsgSimOperation
*
*/
-class MSGINIT_DLL_EXPORT MsgSimNumDetector
+class MSGINIT_DLL_EXPORT MsgSimNumDetector :public QObject
{
public:
@@ -57,7 +57,7 @@
};
-class MsgSimNumDetectorPrivate : public MSimOperationObserver
+class MsgSimNumDetectorPrivate : public CBase, public MSimOperationObserver
{
public:
--- a/messagingapp/msgsettings/msginit/src/msgsimnumberdetector.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgsettings/msginit/src/msgsimnumberdetector.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -29,7 +29,7 @@
MsgSimNumDetector::MsgSimNumDetector()
{
QDEBUG_WRITE("MsgSimNumDetector::MsgSimNumDetector : Enter")
- d_ptr = new MsgSimNumDetectorPrivate();
+ QT_TRAP_THROWING(d_ptr = new MsgSimNumDetectorPrivate());
QDEBUG_WRITE("MsgSimNumDetector::MsgSimNumDetector : Exit")
}
@@ -51,7 +51,7 @@
{
QDEBUG_WRITE("MsgSimNumDetectorPrivate::MsgSimNumDetectorPrivate : Enter")
- TRAP_IGNORE(initL());
+ initL();
QDEBUG_WRITE("MsgSimNumDetectorPrivate::MsgSimNumDetectorPrivate : Exit")
--- a/messagingapp/msgsettings/msginit/src/simscnumberdetector.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgsettings/msginit/src/simscnumberdetector.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -69,6 +69,7 @@
// initialise
iMsvSession = CMsvSession::OpenSyncL(*this);
+ // Observes the OUTBOX for any offline messages...
iOutBoxObserver = COutboxObserver::NewL();
// Create the SMS Service
--- a/messagingapp/msgsettings/settingsview/inc/mmssettingprivate.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgsettings/settingsview/inc/mmssettingprivate.h Sun Jul 25 18:59:19 2010 +0530
@@ -28,7 +28,7 @@
* The settings will be stored in the central repository.
*/
-class MmsSettingsPrivate
+class MmsSettingsPrivate : public CBase
{
public:
@@ -42,19 +42,19 @@
*/
~MmsSettingsPrivate();
- void setMMSRetrieval(MsgSettingEngine::MmsRetrieval aRetrieval);
+ void setMMSRetrievalL(MsgSettingEngine::MmsRetrieval aRetrieval);
- void setAnonymousMessages(TBool aAnonymous);
+ void setAnonymousMessagesL(TBool aAnonymous);
- void setReceiveMMSAdverts(TBool aReceiveAdvert);
+ void setReceiveMMSAdvertsL(TBool aReceiveAdvert);
- void advanceMmsSettings(MsgSettingEngine::MmsRetrieval& aRetrieval,
+ void advanceMmsSettingsL(MsgSettingEngine::MmsRetrieval& aRetrieval,
TBool& aAnonymousStatus, TBool& aMmsAdvertsStatus);
- void getAllAccessPoints(RPointerArray<HBufC>& aAccessPoints,
+ void getAllAccessPointsL(RPointerArray<HBufC>& aAccessPoints,
TInt& aDefaultIndex);
- void setMMSAccesspoint(TInt& aDefaultIndex);
+ void setMMSAccesspointL(TInt& aDefaultIndex);
private:
--- a/messagingapp/msgsettings/settingsview/inc/msgsettingengine.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgsettings/settingsview/inc/msgsettingengine.h Sun Jul 25 18:59:19 2010 +0530
@@ -62,13 +62,6 @@
~MsgSettingEngine();
/**
- * for basic message settings
- * set the status of service messages
- * @param serviceMessages bool true or false
- */
- void setReceiveSerivceMessages(bool serviceMessages);
-
- /**
* set the character encoding
* @param encoding specifying encoding type
*/
@@ -77,11 +70,9 @@
/**
* returns settings delivery report status
* and character encoding
- * @param receiveServiceMessages for getting status service messages
* @param encoding for char encoding
*/
- void settingsServiceMessagesAndCharEncoding(
- bool& receiveServiceMessages,
+ void settingsCharEncoding(
MsgSettingEngine::CharacterEncoding& encoding);
/**
--- a/messagingapp/msgsettings/settingsview/inc/msgsettingsform.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgsettings/settingsview/inc/msgsettingsform.h Sun Jul 25 18:59:19 2010 +0530
@@ -46,7 +46,6 @@
void expandGroup(HbDataFormModelItem* group,bool expand);
private slots:
- void onPressedServiceMessages();
void onPressedCustomButton();
void changeCharEncoding(int index);
void changeAccessPoint(int index);
--- a/messagingapp/msgsettings/settingsview/inc/smssettingsprivate.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgsettings/settingsview/inc/smssettingsprivate.h Sun Jul 25 18:59:19 2010 +0530
@@ -37,25 +37,17 @@
~SmsSettingsPrivate();
/**
- * sets the status of service messages
- * @param serviceMessages status true or false
- */
- void setReceiveSerivceMessages(TBool serviceMessages);
-
- /**
* set the character encoding
* @param status true or false
*/
- void setCharacterEncoding(TBool status);
+ void setCharacterEncodingL(TBool status);
/**
* get the status of deliver report and
* character encoding
- * @param report status of delivery report
* @param statusEncoding charcter encoding
*/
- void settingsServiceMessagesAndCharEncoding(TBool& report,
- TBool& statusEncoding);
+ void settingsCharEncodingL(TBool& statusEncoding);
/**
* get all the sms service names and
@@ -63,14 +55,14 @@
* @param accessPoints array of access names
* @param defaultIndex, default set index
*/
- void getAllSMSMessageCenter(RPointerArray<HBufC>& accessPoints,
+ void getAllSMSMessageCenterL(RPointerArray<HBufC>& accessPoints,
int &defaultIndex);
/**
* set the default index
* @param index default index
*/
- void setSMSMessageCenter(int index);
+ void setSMSMessageCenterL(int index);
/**
* edit the sms service address
@@ -78,20 +70,20 @@
* @param name sms service name
* @param index value to modify
*/
- void editSMSServiceCentre(HBufC* address, HBufC* name, TInt index);
+ void editSMSServiceCentreL(HBufC* address, HBufC* name, TInt index);
/**
* add a new sms service address
* @param address service address number
* @param name service name
*/
- void addSmsMessageCenter(HBufC* address, HBufC* name);
+ void addSmsMessageCenterL(HBufC* address, HBufC* name);
/**
* delete sms service address
* @param aDeleteIndex refers to the index to delete
*/
- void deleteSmsMessageCenter(TInt aDeleteIndex);
+ void deleteSmsMessageCenterL(TInt aDeleteIndex);
/**
@@ -100,7 +92,7 @@
* @param centerNumber address of the service
* @param centerName name of the service
*/
- void smsCenterNameAndNumber(int index, HBufC** centerNumber,
+ void smsCenterNameAndNumberL(int index, HBufC** centerNumber,
HBufC** centerName);
private:
--- a/messagingapp/msgsettings/settingsview/src/mmssettingsprivate.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgsettings/settingsview/src/mmssettingsprivate.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -127,7 +127,7 @@
CleanupStack::PopAndDestroy(3); // settings
}
-void MmsSettingsPrivate::setMMSRetrieval(MsgSettingEngine::MmsRetrieval aRetrieval)
+void MmsSettingsPrivate::setMMSRetrievalL(MsgSettingEngine::MmsRetrieval aRetrieval)
{
CEventHandler* pObserver = new (ELeave) CEventHandler();
CleanupStack::PushL(pObserver);
@@ -196,7 +196,7 @@
CleanupStack::PopAndDestroy(5);
}
-void MmsSettingsPrivate::setAnonymousMessages(TBool aAnonymous)
+void MmsSettingsPrivate::setAnonymousMessagesL(TBool aAnonymous)
{
CMmsAccount* mMmsAccount = CMmsAccount::NewL();
CleanupStack::PushL(mMmsAccount);
@@ -214,7 +214,7 @@
CleanupStack::PopAndDestroy(2);
}
-void MmsSettingsPrivate::setReceiveMMSAdverts(TBool aReceiveAdvert)
+void MmsSettingsPrivate::setReceiveMMSAdvertsL(TBool aReceiveAdvert)
{
CMmsAccount* mMmsAccount = CMmsAccount::NewL();
CleanupStack::PushL(mMmsAccount);
@@ -232,7 +232,7 @@
CleanupStack::PopAndDestroy(2);
}
-void MmsSettingsPrivate::advanceMmsSettings(
+void MmsSettingsPrivate::advanceMmsSettingsL(
MsgSettingEngine::MmsRetrieval& aRetrieval,
TBool& aAnonymousStatus,
TBool& aMmsAdvertsStatus)
@@ -286,7 +286,7 @@
// SmsSettings::iAPSelector
// @see header
//---------------------------------------------------------------
-void MmsSettingsPrivate::getAllAccessPoints(
+void MmsSettingsPrivate::getAllAccessPointsL(
RPointerArray<HBufC>& aAccessPoints,
TInt& aDefaultIndex)
{
@@ -368,7 +368,7 @@
// MmsSettingsPrivate::setMMSAccesspoint
// @see header
//---------------------------------------------------------------
-void MmsSettingsPrivate::setMMSAccesspoint(TInt& aDefaultIndex)
+void MmsSettingsPrivate::setMMSAccesspointL(TInt& aDefaultIndex)
{
#ifdef _DEBUG_TRACES_
qDebug() << "Enter MmsSettingsPrivate::setMMSAccesspoint: Index="
--- a/messagingapp/msgsettings/settingsview/src/msgsettingengine.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgsettings/settingsview/src/msgsettingengine.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -32,8 +32,8 @@
#endif
- dptr_smsSettings = SmsSettingsPrivate::NewL();
- dptr_mmsSettings = MmsSettingsPrivate::NewL();
+ QT_TRAP_THROWING(dptr_smsSettings = SmsSettingsPrivate::NewL());
+ QT_TRAP_THROWING(dptr_mmsSettings = MmsSettingsPrivate::NewL());
#ifdef _DEBUG_TRACES_
qDebug() << "Exit MsgSettingEngine::MsgSettingEngine";
@@ -59,17 +59,6 @@
}
/**
- * for basic message settings
- * set the service messages status
- * @param serviceMessages bool true or false
- */
-void MsgSettingEngine::setReceiveSerivceMessages(bool serviceMessages)
-{
- dptr_smsSettings->setReceiveSerivceMessages(serviceMessages);
-
-}
-
-/**
* set the character encoding
* @param encoding specifying encoding type
*/
@@ -86,7 +75,7 @@
{
flag = ETrue;
}
- dptr_smsSettings->setCharacterEncoding(flag);
+ QT_TRAP_THROWING(dptr_smsSettings->setCharacterEncodingL(flag));
#ifdef _DEBUG_TRACES_
qDebug() << "MsgSettingEngine::setCharacterEncoding";
@@ -97,21 +86,16 @@
/**
* returns settings delivery report status
* and character encoding
- * @param receiveServiceMessages for getting receive service messages
* @param encoding for char encoding
*/
-void MsgSettingEngine::settingsServiceMessagesAndCharEncoding(
- bool& receiveServiceMessages,
+void MsgSettingEngine::settingsCharEncoding(
MsgSettingEngine::CharacterEncoding& encoding )
{
QDEBUG_WRITE("settingsServiceMessagesAndCharEncoding");
TBool encoding1;
- TBool receiveServiceMessages1;
-
- dptr_smsSettings->settingsServiceMessagesAndCharEncoding(
- receiveServiceMessages1,
- encoding1);
+
+ QT_TRAP_THROWING(dptr_smsSettings->settingsCharEncodingL(encoding1));
if (encoding1)
{
@@ -120,10 +104,6 @@
else
encoding = MsgSettingEngine::ReducedSupport;
- //TODO remove hardcoding later
- //receiveServiceMessages = (bool)receiveServiceMessages1;
- receiveServiceMessages = true;
-
return;
}
@@ -138,7 +118,7 @@
#endif
- dptr_mmsSettings->setMMSRetrieval(retrieval);
+ QT_TRAP_THROWING(dptr_mmsSettings->setMMSRetrievalL(retrieval));
#ifdef _DEBUG_TRACES_
qDebug() << "Exit setMMSRetrieval";
@@ -157,7 +137,7 @@
#endif
- dptr_mmsSettings->setAnonymousMessages(status);
+ QT_TRAP_THROWING (dptr_mmsSettings->setAnonymousMessagesL(status));
#ifdef _DEBUG_TRACES_
qDebug() << "Exit setAnonymousMessages";
@@ -176,7 +156,7 @@
#endif
- dptr_mmsSettings->setReceiveMMSAdverts(status);
+ QT_TRAP_THROWING(dptr_mmsSettings->setReceiveMMSAdvertsL(status));
#ifdef _DEBUG_TRACES_
qDebug() << "Exit setReceiveMMSAdverts";
@@ -202,9 +182,9 @@
TBool anonymous_Status;
TBool mmsAdverts_Status;
- dptr_mmsSettings->advanceMmsSettings(retrieval,
+ QT_TRAP_THROWING(dptr_mmsSettings->advanceMmsSettingsL(retrieval,
anonymous_Status,
- mmsAdverts_Status);
+ mmsAdverts_Status));
anonymousStatus = (bool) anonymous_Status;
mmsAdvertsStatus = (bool) mmsAdverts_Status;
@@ -232,7 +212,7 @@
RPointerArray<HBufC> accessPoints;
//= new(ELeave)RPointerArray<HBufC>();
- dptr_mmsSettings->getAllAccessPoints(accessPoints, defaultIndex);
+ QT_TRAP_THROWING( dptr_mmsSettings->getAllAccessPointsL(accessPoints, defaultIndex));
for (int i = 0; i < accessPoints.Count(); i++)
{
@@ -264,7 +244,7 @@
#endif
- dptr_mmsSettings->setMMSAccesspoint(index);
+ QT_TRAP_THROWING(dptr_mmsSettings->setMMSAccesspointL(index));
#ifdef _DEBUG_TRACES_
qDebug() << "Exit setMMSAccesspoint ";
@@ -287,7 +267,7 @@
RPointerArray<HBufC> accessPoints;
- dptr_smsSettings->getAllSMSMessageCenter(accessPoints, defaultIndex);
+ QT_TRAP_THROWING(dptr_smsSettings->getAllSMSMessageCenterL(accessPoints, defaultIndex));
for (int i = 0; i < accessPoints.Count(); i++)
{
@@ -319,7 +299,7 @@
#endif
- dptr_smsSettings->setSMSMessageCenter(index);
+ QT_TRAP_THROWING(dptr_smsSettings->setSMSMessageCenterL(index));
#ifdef _DEBUG_TRACES_
qDebug() << "Exit setSMSMessageCenter ";
@@ -344,7 +324,7 @@
HBufC* d_addr = XQConversions::qStringToS60Desc(centreNumber);
HBufC* d_name = XQConversions::qStringToS60Desc(centreName);
- dptr_smsSettings->editSMSServiceCentre(d_addr, d_name, index);
+ QT_TRAP_THROWING(dptr_smsSettings->editSMSServiceCentreL(d_addr, d_name, index));
delete d_addr;
delete d_name;
@@ -371,7 +351,7 @@
HBufC* d_addr = XQConversions::qStringToS60Desc(centreNumber);
HBufC* d_name = XQConversions::qStringToS60Desc(centreName);
- dptr_smsSettings->addSmsMessageCenter(d_addr, d_name);
+ QT_TRAP_THROWING(dptr_smsSettings->addSmsMessageCenterL(d_addr, d_name));
delete d_addr;
delete d_name;
@@ -387,7 +367,7 @@
*/
void MsgSettingEngine::deleteSmsMessageCenter(int deleteIndex)
{
- dptr_smsSettings->deleteSmsMessageCenter(deleteIndex);
+ QT_TRAP_THROWING( dptr_smsSettings->deleteSmsMessageCenterL(deleteIndex));
}
/**
@@ -407,7 +387,7 @@
HBufC* d_addr;
HBufC* d_name;
- dptr_smsSettings->smsCenterNameAndNumber(index, &d_addr, &d_name);
+ QT_TRAP_THROWING( dptr_smsSettings->smsCenterNameAndNumberL(index, &d_addr, &d_name));
centreNumber = XQConversions::s60DescToQString(d_addr->Des());
centreName = XQConversions::s60DescToQString(d_name->Des());
--- a/messagingapp/msgsettings/settingsview/src/msgsettingsform.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgsettings/settingsview/src/msgsettingsform.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -27,7 +27,7 @@
//Localized constants
#define LOC_RECEIVING_SERVICE_MESSAGES hbTrId("txt_messaging_setlabel_receiving_service_messages")
-#define LOC_ON hbTrId("txt_messaging_setlabel_val_on")
+
#define LOC_OFF hbTrId("txt_messaging_setlabel_val_off")
#define LOC_REDUCED_SUPPORT hbTrId("txt_messaging_setlabel_val_reduced_support")
#define LOC_FULL_SUPPORT hbTrId("txt_messaging_setlabel_val_full_support")
@@ -83,11 +83,7 @@
MsgSettingEngine::CharacterEncoding charEncoding =
MsgSettingEngine::ReducedSupport;
- bool receiveServiceMessages = false;
-
- mSettingEngine->settingsServiceMessagesAndCharEncoding(
- receiveServiceMessages,
- charEncoding);
+ mSettingEngine->settingsCharEncoding(charEncoding);
// 1. Character encoding
HbDataFormModelItem *characterEncoding =
@@ -109,29 +105,7 @@
this,
SLOT(changeCharEncoding(int)));
- //2. receiving service messages
- QStringList serviceMessagesList;
- serviceMessagesList << LOC_OFF << LOC_ON;
-
- index = int (receiveServiceMessages);
- int otherIndex = (receiveServiceMessages + 1) % serviceMessagesList.count();
-
- HbDataFormModelItem *serviceMessagesItem =
- new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem,
- LOC_RECEIVING_SERVICE_MESSAGES,
- 0);
-
- serviceMessagesItem->setContentWidgetData("items", serviceMessagesList);
- serviceMessagesItem->setContentWidgetData("currentIndex", index);
-
- settingsModel->appendDataFormItem(serviceMessagesItem,
- settingsModel->invisibleRootItem());
- this->addConnection(serviceMessagesItem,
- SIGNAL(clicked()),
- this,
- SLOT(onPressedServiceMessages()));
-
- // 3. MMS Settings
+ // 2. MMS Settings
HbDataFormModelItem* mmsGroup =
new HbDataFormModelItem(HbDataFormModelItem::GroupItem,
LOC_MMS_SETTINGS,
@@ -381,26 +355,6 @@
SLOT(onPressedCustomButton()));
}
-void MsgSettingsForm::onPressedServiceMessages()
-{
- HbPushButton *btn = qobject_cast<HbPushButton *> (sender());
-
- if (btn)
- {
- QString btnText = btn->text();
-
- //check if the button pressed was On or Off
- if (LOC_OFF == btnText)
- {
- mSettingEngine->setReceiveSerivceMessages(false);
- }
- else
- {
- mSettingEngine->setReceiveSerivceMessages(true);
- }
- }
-}
-
void MsgSettingsForm::changeCharEncoding(int index)
{
//set the character encoding
@@ -443,11 +397,11 @@
//check if the button pressed was Yes or NO
if (LOC_MMS_NO == btnText)
{
- mSettingEngine->setReceiveMMSAdverts(true);
+ mSettingEngine->setReceiveMMSAdverts(false);
}
else
{
- mSettingEngine->setReceiveMMSAdverts(false);
+ mSettingEngine->setReceiveMMSAdverts(true);
}
}
}
--- a/messagingapp/msgsettings/settingsview/src/msgsmscentersettingsform.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgsettings/settingsview/src/msgsmscentersettingsform.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -32,8 +32,8 @@
//Localized constants
#define LOC_SMS_CENTRE_NAME hbTrId("txt_messaging_setlabel_message_centre_name")
#define LOC_SMS_CENTRE_NUMBER hbTrId("txt_messaging_setlabel_message_centre_number")
-#define LOC_DELETE hbTrId("txt_messaging_button_delete_message_centre")
-#define LOC_SMS_CENTRE_DELETE hbTrId("txt_messaging_dialog_delete_message_centre")
+#define LOC_SMS_CENTRE_DELETE_BUTTON hbTrId("txt_messaging_button_delete_message_centre")
+#define LOC_SMS_CENTRE_DELETE_DIALOG hbTrId("txt_messaging_dialog_delete_message_centre")
#define LOC_MESSAGE_CENTER_SAVED hbTrId("txt_messaging_dpopinfo_message_centre_saved")
MsgSMSCenterSettingsForm::MsgSMSCenterSettingsForm(int view,
@@ -115,7 +115,7 @@
QString(""),
settingsmodel->invisibleRootItem());
- deleteMessageCentre->setContentWidgetData("text",LOC_DELETE);
+ deleteMessageCentre->setContentWidgetData("text",LOC_SMS_CENTRE_DELETE_BUTTON);
this->addConnection(deleteMessageCentre,SIGNAL(clicked()),
this,SLOT(onPressedCustomButton()));
}
@@ -186,7 +186,7 @@
void MsgSMSCenterSettingsForm::onPressedCustomButton()
{
- HbMessageBox::question(LOC_SMS_CENTRE_DELETE, this,
+ HbMessageBox::question(LOC_SMS_CENTRE_DELETE_DIALOG, this,
SLOT(onDialogDeleteMsgCentre(HbAction*)),
HbMessageBox::Delete | HbMessageBox::Cancel);
}
--- a/messagingapp/msgsettings/settingsview/src/smssettingsprivate.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgsettings/settingsview/src/smssettingsprivate.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -62,22 +62,7 @@
//do nothing
}
-void SmsSettingsPrivate::setReceiveSerivceMessages(
- TBool serviceMessages)
-{
- CSmsAccount* smsAccount = CSmsAccount::NewLC();
- CSmsSettings* smsSettings = CSmsSettings::NewLC();
-
- smsAccount->LoadSettingsL(*smsSettings);
-
- //TODO set the receive message part
-
- smsAccount->SaveSettingsL(*smsSettings);
-
- CleanupStack::PopAndDestroy(2);
-}
-
-void SmsSettingsPrivate::setCharacterEncoding(TBool status)
+void SmsSettingsPrivate::setCharacterEncodingL(TBool status)
{
CSmsAccount* smsAccount = CSmsAccount::NewLC();
CSmsSettings* smsSettings = CSmsSettings::NewLC();
@@ -98,17 +83,13 @@
CleanupStack::PopAndDestroy(2);
}
-void SmsSettingsPrivate::settingsServiceMessagesAndCharEncoding(
- TBool& report,
- TBool& statusEncoding)
+void SmsSettingsPrivate::settingsCharEncodingL(TBool& statusEncoding)
{
CSmsAccount* smsAccount = CSmsAccount::NewLC();
CSmsSettings* smsSettings = CSmsSettings::NewLC();
smsAccount->LoadSettingsL(*smsSettings);
- //TODO: service messages read
-
TSmsDataCodingScheme::TSmsAlphabet charSet = smsSettings->CharacterSet();
statusEncoding = ETrue;
@@ -119,7 +100,7 @@
CleanupStack::PopAndDestroy(2);
}
-void SmsSettingsPrivate::getAllSMSMessageCenter(
+void SmsSettingsPrivate::getAllSMSMessageCenterL(
RPointerArray<HBufC>& accessPoints,
TInt &defaultIndex)
{
@@ -144,7 +125,7 @@
return;
}
-void SmsSettingsPrivate::setSMSMessageCenter(int index)
+void SmsSettingsPrivate::setSMSMessageCenterL(int index)
{
CSmsAccount* smsAccount = CSmsAccount::NewLC();
CSmsSettings* smsSettings = CSmsSettings::NewLC();
@@ -156,7 +137,7 @@
CleanupStack::PopAndDestroy(2);
}
-void SmsSettingsPrivate::editSMSServiceCentre(HBufC* address, HBufC* name,
+void SmsSettingsPrivate::editSMSServiceCentreL(HBufC* address, HBufC* name,
TInt index)
{
CSmsAccount* smsAccount = CSmsAccount::NewLC();
@@ -188,7 +169,7 @@
CleanupStack::PopAndDestroy(2);
}
-void SmsSettingsPrivate::addSmsMessageCenter(HBufC* address, HBufC* name)
+void SmsSettingsPrivate::addSmsMessageCenterL(HBufC* address, HBufC* name)
{
CSmsAccount* smsAccount = CSmsAccount::NewLC();
CSmsSettings* smsSettings = CSmsSettings::NewLC();
@@ -208,7 +189,7 @@
CleanupStack::PopAndDestroy(2);
}
-void SmsSettingsPrivate::deleteSmsMessageCenter(TInt aDeleteIndex)
+void SmsSettingsPrivate::deleteSmsMessageCenterL(TInt aDeleteIndex)
{
CSmsAccount* smsAccount = CSmsAccount::NewLC();
CSmsSettings* smsSettings = CSmsSettings::NewLC();
@@ -231,7 +212,7 @@
CleanupStack::PopAndDestroy(2);
}
-void SmsSettingsPrivate::smsCenterNameAndNumber(int index,
+void SmsSettingsPrivate::smsCenterNameAndNumberL(int index,
HBufC** centerNumber,
HBufC** centerName)
{
--- a/messagingapp/msgui/appengine/inc/conversationchangehandler.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/appengine/inc/conversationchangehandler.h Sun Jul 25 18:59:19 2010 +0530
@@ -82,10 +82,18 @@
*
* @param aConversationEntryList List of conversation entries
* returned by server.
+ * @param aTotalCount total number of conversation entries
*/
void ConversationsL(
- RPointerArray<CCsConversationEntry>& aConversationEntryList);
+ RPointerArray<CCsConversationEntry>& aConversationEntryList,
+ TInt& aTotalCount);
+
+ /**
+ * ResetValuesForNewConversation
+ * Resets the values of flags, and indexes for a new conversation
+ */
+ void ResetValuesForNewConversation();
public://MCsConversationChangeObserver
/**
@@ -134,7 +142,13 @@
* Handles Conversations received from server and updates into model
*/
void HandleConversationsL();
-
+
+ /**
+ * Fetch remaning conversations from Server Cache
+ * @param aCount - count of conversations added to entry list
+ */
+ void FetchRemainingConversations(TInt aCount);
+
private:
// Data
@@ -145,6 +159,7 @@
{
EInit = 500,
EInitialCache,
+ EFetchMoreConversations,
EListenToEvents
};
@@ -167,6 +182,11 @@
TInt mCurrentIndex;
/**
+ * Total count of conversation entries in the Conversation
+ * Own
+ */
+ TInt mTotalCount;
+ /**
* ConversationsModel Object
* Not Own.
*/
--- a/messagingapp/msgui/appengine/inc/conversationmsgstorehandler.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/appengine/inc/conversationmsgstorehandler.h Sun Jul 25 18:59:19 2010 +0530
@@ -32,7 +32,7 @@
class CMmsNotificationClientMtm;
-class ConversationMsgStoreHandler: public MMsvSessionObserver
+class ConversationMsgStoreHandler: public CBase, public MMsvSessionObserver
{
public:
--- a/messagingapp/msgui/appengine/inc/conversationsengine_p.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/appengine/inc/conversationsengine_p.h Sun Jul 25 18:59:19 2010 +0530
@@ -151,9 +151,15 @@
CCsClientConversation* getConversationFromConversationIdL(TInt aConversationId);
/**
- * Starts fetching remaing conversations
+ * Starts fetching rest of the conversations
*/
void fetchMoreConversations();
+
+ /**
+ * Starts fetching remaing conversations
+ * @param aCount - count of conversation entries
+ */
+ void fetchRemainingConversations(TInt& aCount);
/**
@@ -202,7 +208,8 @@
*/
void Conversations(
- RPointerArray<CCsConversationEntry>& aConversationEntryList);
+ RPointerArray<CCsConversationEntry>& aConversationEntryList,
+ TInt& totalCount);
private:
--- a/messagingapp/msgui/appengine/inc/conversationsmodel.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/appengine/inc/conversationsmodel.h Sun Jul 25 18:59:19 2010 +0530
@@ -172,6 +172,13 @@
* @return true/false
*/
bool validateMsgForForward(qint32 messageId);
+
+ /*
+ * Handle Vcard messages
+ * @param item, QStandardItem
+ * @param msgId
+ */
+ void handleVCard(QStandardItem& item, int msgId);
private:
--- a/messagingapp/msgui/appengine/src/conversationchangehandler.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/appengine/src/conversationchangehandler.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -61,9 +61,10 @@
// ---------------------------------------------------------------------------
//
void ConversationsChangeHandler::ConversationsL(RPointerArray<
- CCsConversationEntry>& aConversationEntryList)
+ CCsConversationEntry>& aConversationEntryList, TInt& aTotalCount)
{
- mConversationEntryList.ResetAndDestroy();
+
+ mTotalCount = aTotalCount;
for (TInt i = 0; i < aConversationEntryList.Count(); ++i)
{
@@ -72,8 +73,6 @@
}
if (aConversationEntryList.Count() > 0)
{
- mFirstWindowCached = EFalse;
- mCurrentIndex = 0;
mCurrentState = EInitialCache;
IssueRequest();
}
@@ -84,6 +83,20 @@
mCurrentState = EListenToEvents;
}
}
+// ---------------------------------------------------------------------------
+// This is for resetting the values before initiating a request
+// for fetching entries for a new conversation
+// ---------------------------------------------------------------------------
+//
+void ConversationsChangeHandler::ResetValuesForNewConversation()
+{
+ mConvEnginePrivate->registerForConversationUpdatesL();
+ mCurrentIndex = 0;
+ mFirstWindowCached = EFalse;
+ mConversationEntryList.ResetAndDestroy();
+
+
+}
// ---------------------------------------------------------------------------
// Handling addition of new conversation entry from the server
@@ -147,6 +160,9 @@
case EInitialCache:
HandleConversationsL();
break;
+ case EFetchMoreConversations:
+ FetchRemainingConversations(mConversationEntryList.Count());
+ break;
}
}
@@ -202,6 +218,15 @@
return;
}
IssueRequest();
+ return;
+ }
+ //if more entries have to be fetched , issue a request,
+ // else listen for events.
+ if(mCurrentIndex < mTotalCount )
+ {
+ //fetch more
+ mCurrentState = EFetchMoreConversations;
+ IssueRequest();
}
else
{
@@ -211,12 +236,20 @@
mFirstWindowCached = ETrue;
}
mConversationEntryList.ResetAndDestroy();
- mConvEnginePrivate->registerForConversationUpdatesL();
mCurrentState = EListenToEvents;
}
}
// ---------------------------------------------------------------------------
+// Fetches remaining conversations from the server
+// ---------------------------------------------------------------------------
+//
+void ConversationsChangeHandler::FetchRemainingConversations(TInt aTotalCount)
+{
+ mConvEnginePrivate->fetchRemainingConversations(aTotalCount);
+
+}
+// ---------------------------------------------------------------------------
// Starts fetching remaining conversations
// ---------------------------------------------------------------------------
//
--- a/messagingapp/msgui/appengine/src/conversationsengine.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/appengine/src/conversationsengine.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -47,14 +47,15 @@
ConversationsEngine::ConversationsEngine(QObject* parent):
QObject(parent), mDraftsModel(NULL)
{
- mConversationMsgStoreHandler = new ConversationMsgStoreHandler;
+ QT_TRAP_THROWING(mConversationMsgStoreHandler = new ConversationMsgStoreHandler);
+
mConversationsSummaryModel = new ConversationsSummaryModel(this);
mConversationsModel = new ConversationsModel(mConversationMsgStoreHandler,
this);
- d_ptr = new ConversationsEnginePrivate(mConversationMsgStoreHandler,
+ QT_TRAP_THROWING( d_ptr = new ConversationsEnginePrivate(mConversationMsgStoreHandler,
mConversationsSummaryModel,
- mConversationsModel);
+ mConversationsModel));
connect (mConversationsModel,
SIGNAL(conversationViewEmpty()),
@@ -170,6 +171,7 @@
{
int error;
TRAP(error, d_ptr->deleteAllDraftMessagesL());
+ qt_symbian_throwIfError(error);
}
//---------------------------------------------------------------
@@ -227,7 +229,9 @@
int error;
CCsClientConversation* clientConv = NULL;
TRAP(error, clientConv = d_ptr->getConversationFromConversationIdL(conversationId));
-
+
+ qt_symbian_throwIfError(error);
+
HBufC *name = clientConv->GetDisplayName();
if (name && name->Length())
{
@@ -329,7 +333,7 @@
int newConversationId)
{
//also register for subscription now
- d_ptr->registerAgainForConversationUpdatesL(newConversationId);
+ QT_TRAP_THROWING(d_ptr->registerAgainForConversationUpdatesL(newConversationId));
}
//---------------------------------------------------------------
--- a/messagingapp/msgui/appengine/src/conversationsengine_p.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/appengine/src/conversationsengine_p.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -28,6 +28,12 @@
#include "conversationlistchangehandler.h"
#include "debugtraces.h"
+
+//CONSTANTS
+/**
+ *Max number of conversation that can be exchanged in IPC call
+ */
+const TInt KMaxConversationIPCLimit = 250;
//---------------------------------------------------------------
// ConversationsEnginePrivate::ConversationsEnginePrivate
// @see header
@@ -128,8 +134,11 @@
CleanupStack::PushL(entry);
mClientConv->SetConversationEntryL(entry);
CleanupStack::PopAndDestroy(entry);
+ // Reset the values in change handler before initiating a request
+ mConvChangeHandler->ResetValuesForNewConversation();
+
//Get the conversations for new conversationId
- mServer->GetConversationsL(mClientConv);
+ mServer->GetConversationsL(mClientConv,0,KMaxConversationIPCLimit);
QCRITICAL_WRITE("ConversationsEnginePrivate::getConversationsL end.");
}
@@ -310,14 +319,15 @@
// @see header
//---------------------------------------------------------------
void ConversationsEnginePrivate::Conversations(
- RPointerArray<CCsConversationEntry>& aConversationEntryList)
+ RPointerArray<CCsConversationEntry>& aConversationEntryList,
+ TInt& aTotalCount)
{
int error;
if (mClientConv)
{
QCRITICAL_WRITE("ConversationsEnginePrivate::Conversations start.");
- TRAP(error,mConvChangeHandler->ConversationsL(aConversationEntryList));
+ TRAP(error,mConvChangeHandler->ConversationsL(aConversationEntryList,aTotalCount));
QCRITICAL_WRITE("ConversationsEnginePrivate::Conversations end.");
}
@@ -337,6 +347,21 @@
}
//---------------------------------------------------------------
+// ConversationsEngine::fetchRemainingConversations
+// @see header
+//---------------------------------------------------------------
+void ConversationsEnginePrivate::fetchRemainingConversations(TInt& aCount)
+ {
+ if ( mServer && mClientConv )
+ {
+
+ // Get conversations from server
+ mServer->GetConversationsL(mClientConv,
+ (aCount - 1),
+ KMaxConversationIPCLimit);
+ }
+ }
+//---------------------------------------------------------------
// ConversationsEnginePrivate::resendMessage()
// @see header
//---------------------------------------------------------------
--- a/messagingapp/msgui/appengine/src/conversationsmodel.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/appengine/src/conversationsmodel.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -47,6 +47,9 @@
//selecet preview-icon query
_LIT(KSelectPreviewIconStmt,"SELECT message_id, preview_icon FROM conversation_messages WHERE message_id = :message_id ");
+//selecet vcard-path query
+_LIT(KSelectVCardStmt,"SELECT message_id, msg_processingstate, preview_path FROM conversation_messages WHERE message_id = :message_id ");
+
// preview-cache max cost (items)
const int CACHE_COST = 50;
//Preview thumbnail size
@@ -706,51 +709,36 @@
//---------------------------------------------------------------
void ConversationsModel::handleBlueToothMessages(QStandardItem& item,
const CCsConversationEntry& entry)
-{
- int msgSubType = ConversationsEngineUtility::messageSubType(entry.GetType());
- if (msgSubType == ConvergedMessage::VCard)
- {
- iBioMsgPlugin->setMessageId(entry.EntryId());
-
- if (iBioMsgPlugin->attachmentCount() > 0)
- {
- UniMessageInfoList attList = iBioMsgPlugin->attachmentList();
- QString attachmentPath = attList[0]->path();
-
- //get display-name and set as bodytext
- QString displayName = MsgContactHandler::getVCardDisplayName(attachmentPath);
- item.setData(displayName, BodyText);
- // clear attachement list : its allocated at data model
- while (!attList.isEmpty())
- {
- delete attList.takeFirst();
- }
-
- }
- }
+ {
+ int msgSubType = ConversationsEngineUtility::messageSubType(
+ entry.GetType());
+
+ if (msgSubType == ConvergedMessage::VCard)
+ {
+ handleVCard(item, entry.EntryId());
+ }
+ else
+ {
+ QString description = XQConversions::s60DescToQString(
+ *(entry.Description()));
- else
- {
- QString description = XQConversions::s60DescToQString(*(entry.Description()));
-
- if (msgSubType == ConvergedMessage::VCal) // "vCalendar"
- {
- //message sub-type
- item.setData(ConvergedMessage::VCal, MessageSubType);
- }
- else
- {
- //message sub-type
- item.setData(ConvergedMessage::None, MessageSubType);
- }
- //for BT messages we show filenames for all other (except vcard) messages
- //get filename and set as body
- QFileInfo fileinfo(description);
- QString filename = fileinfo.fileName();
- item.setData(filename, BodyText);
- }
-
-}
+ if (msgSubType == ConvergedMessage::VCal) // "vCalendar"
+ {
+ //message sub-type
+ item.setData(ConvergedMessage::VCal, MessageSubType);
+ }
+ else
+ {
+ //message sub-type
+ item.setData(ConvergedMessage::None, MessageSubType);
+ }
+ //for BT messages we show filenames for all other (except vcard) messages
+ //get filename and set as body
+ QFileInfo fileinfo(description);
+ QString filename = fileinfo.fileName();
+ item.setData(filename, BodyText);
+ }
+ }
//---------------------------------------------------------------
// ConversationsModel::handleBioMessages
@@ -758,30 +746,16 @@
//---------------------------------------------------------------
void ConversationsModel::handleBioMessages(QStandardItem& item, const CCsConversationEntry& entry)
{
- iBioMsgPlugin->setMessageId(entry.EntryId());
int msgSubType = ConversationsEngineUtility::messageSubType(entry.GetType());
- if (ConvergedMessage::VCard == msgSubType) {
- if (iBioMsgPlugin->attachmentCount() > 0) {
- UniMessageInfoList attList = iBioMsgPlugin->attachmentList();
- QString attachmentPath = attList[0]->path();
-
- //get display-name and set as bodytext
- QString displayName =
- MsgContactHandler::getVCardDisplayName(
- attachmentPath);
- item.setData(displayName, BodyText);
- item.setData(attachmentPath, Attachments);
-
- // clear attachement list : its allocated at data model
- while (!attList.isEmpty()) {
- delete attList.takeFirst();
- }
+ if (ConvergedMessage::VCard == msgSubType)
+ {
+ handleVCard(item, entry.EntryId());
}
- }
else if (ConvergedMessage::VCal == msgSubType) {
//not supported
}
else if (ConvergedMessage::RingingTone == msgSubType) {
+ iBioMsgPlugin->setMessageId(entry.EntryId());
if (iBioMsgPlugin->attachmentCount() > 0) {
UniMessageInfoList attList = iBioMsgPlugin->attachmentList();
QString attachmentPath = attList[0]->path();
@@ -962,6 +936,113 @@
}
//---------------------------------------------------------------
+// ConversationsModel::handleVCard()
+// @see header
+//---------------------------------------------------------------
+void ConversationsModel::handleVCard(QStandardItem& item, int msgId)
+ {
+ //sql query to get vcard-path from DB
+ bool vCardParsed = false;
+
+ if (iSqlDbOpen)
+ {
+ RSqlStatement sqlSelectVcardStmt;
+ TInt err = sqlSelectVcardStmt.Prepare(iSqlDb, KSelectVCardStmt);
+
+ QCRITICAL_WRITE_FORMAT("Error from Prepare()", err)
+
+ if (err == KErrNone)
+ {
+ //msg_id
+ TInt msgIdIndex = sqlSelectVcardStmt.ParameterIndex(
+ _L(":message_id"));
+ sqlSelectVcardStmt.BindInt(msgIdIndex, msgId);
+ // state
+ TInt msgProcessingStateIndex = sqlSelectVcardStmt.ColumnIndex(
+ _L("msg_processingstate"));
+
+ // get vacrd-path from DB
+ err = sqlSelectVcardStmt.Next();
+ QCRITICAL_WRITE_FORMAT("Error from Next()", err)
+
+ if (err == KSqlAtRow)
+ {
+ int msgProcessingState = 0;
+ msgProcessingState = sqlSelectVcardStmt.ColumnInt(
+ msgProcessingStateIndex);
+ if (msgProcessingState == EPreviewMsgProcessed)
+ {
+ //path-index
+ TInt previewPathIndex = sqlSelectVcardStmt.ColumnIndex(
+ _L("preview_path"));
+
+ //Get vcard-path data from path-index
+ RSqlColumnReadStream stream;
+ err = stream.ColumnBinary(sqlSelectVcardStmt,
+ previewPathIndex);
+
+ QCRITICAL_WRITE_FORMAT("Error from ColumnBinary()", err)
+
+ if (err == KErrNone)
+ {
+ RBuf vCardPathBuffer;
+ vCardPathBuffer.Create(sqlSelectVcardStmt.ColumnSize(
+ previewPathIndex));
+ sqlSelectVcardStmt.ColumnText(previewPathIndex,
+ vCardPathBuffer);
+
+ //set inside attachments
+ QString attachmentPath(
+ XQConversions::s60DescToQString(
+ vCardPathBuffer));
+ item.setData(attachmentPath, Attachments);
+
+ //get display-name and set as bodytext
+ QString displayName =
+ MsgContactHandler::getVCardDisplayName(
+ attachmentPath);
+ item.setData(displayName, BodyText);
+
+ vCardPathBuffer.Close();
+ vCardParsed = true;
+
+ QCRITICAL_WRITE("vcard parsing complete.")
+
+ }
+ //close stream
+ stream.Close();
+ }
+ }
+ }
+ sqlSelectVcardStmt.Close();
+ }
+
+ // fallback, if not parsed in DB, parse from store
+ if (!vCardParsed)
+ {
+ iBioMsgPlugin->setMessageId(msgId);
+
+ if (iBioMsgPlugin->attachmentCount() > 0)
+ {
+ UniMessageInfoList attList = iBioMsgPlugin->attachmentList();
+ QString attachmentPath = attList[0]->path();
+
+ //get display-name and set as bodytext
+ QString displayName = MsgContactHandler::getVCardDisplayName(
+ attachmentPath);
+ item.setData(displayName, BodyText);
+ item.setData(attachmentPath, Attachments);
+
+ // clear attachement list : its allocated at data model
+ while (!attList.isEmpty())
+ {
+ delete attList.takeFirst();
+ }
+ }
+ }
+ }
+
+//---------------------------------------------------------------
// ConversationsModel::clearModel()
// @see header
//---------------------------------------------------------------
@@ -971,6 +1052,10 @@
previewIconCache.clear();
}
+//---------------------------------------------------------------
+// ConversationsModel::emitConversationViewEmpty()
+// @see header
+//---------------------------------------------------------------
void ConversationsModel:: emitConversationViewEmpty()
{
emit conversationViewEmpty();
--- a/messagingapp/msgui/appengine/tsrc/testconversationengine/inc/testconversationnotifier.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/appengine/tsrc/testconversationengine/inc/testconversationnotifier.h Sun Jul 25 18:59:19 2010 +0530
@@ -51,7 +51,7 @@
void RemoveCachingStatusNotifier();
- void SendListResultUpdate(RPointerArray<CCsConversationEntry>& aConversationEntryList);
+ void SendListResultUpdate(RPointerArray<CCsConversationEntry>& aConversationEntryList,TInt& aTotalCount);
void UpdateConversationEntryModify(CCsConversationEntry& aConversationEntry);
--- a/messagingapp/msgui/appengine/tsrc/testconversationengine/src/testccsrequesthandler.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/appengine/tsrc/testconversationengine/src/testccsrequesthandler.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -330,7 +330,9 @@
// convresation view.
// -----------------------------------------------------------------------------
EXPORT_C void CCSRequestHandler::GetConversationsL(
- CCsClientConversation* aClientConversation)
+ CCsClientConversation* aClientConversation,
+ TInt /*aKnownIndex*/,
+ TInt /*aPageSize*/)
{
// check if the aclientconversation is null then return
if ( !aClientConversation)
@@ -492,7 +494,9 @@
// -----------------------------------------------------------------------------
// CCSRequestHandler::GetMessagingHistoryL()
// -----------------------------------------------------------------------------
-EXPORT_C void CCSRequestHandler::GetMessagingHistoryL(TInt /*aContactId*/)
+EXPORT_C void CCSRequestHandler::GetMessagingHistoryL(TInt /*aContactId*/,
+ TInt /*aKnownIndex*/,
+ TInt /*aPageSize*/)
{
}
--- a/messagingapp/msgui/appengine/tsrc/testconversationengine/src/testconversationenginestub.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/appengine/tsrc/testconversationengine/src/testconversationenginestub.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -225,8 +225,9 @@
void TestConversationEngineStub::UpdateConversationList()
{
TInt error;
- TRAP(error, PrepareConversationListL(iConversationID, 5, iUnReadCount));
- iNotifier->SendListResultUpdate(iConversationEntryList);
+ TInt totalCount = 5;
+ TRAP(error, PrepareConversationListL(iConversationID, totalCount, iUnReadCount));
+ iNotifier->SendListResultUpdate(iConversationEntryList,totalCount);
}
void TestConversationEngineStub::UpdateConvEntry(TInt aConversationId)
--- a/messagingapp/msgui/appengine/tsrc/testconversationengine/src/testconversationnotifier.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/appengine/tsrc/testconversationengine/src/testconversationnotifier.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -79,12 +79,13 @@
void TestConversationNotifier
::SendListResultUpdate(RPointerArray<CCsConversationEntry>&
- aConversationEntryList)
+ aConversationEntryList,
+ TInt& aTotalCount)
{
// Pass the results to the observer
if ( iResultsObserver )
{
- iResultsObserver->Conversations(aConversationEntryList);
+ iResultsObserver->Conversations(aConversationEntryList,aTotalCount);
}
}
--- a/messagingapp/msgui/bwins/unifiedvieweru.def Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/bwins/unifiedvieweru.def Sun Jul 25 18:59:19 2010 +0530
@@ -8,9 +8,9 @@
?resizeEvent@UnifiedViewer@@MAEXPAVQGraphicsSceneResizeEvent@@@Z @ 7 NONAME ; void UnifiedViewer::resizeEvent(class QGraphicsSceneResizeEvent *)
?handleFwdAction@UnifiedViewer@@QAEXXZ @ 8 NONAME ; void UnifiedViewer::handleFwdAction(void)
?qt_metacast@UnifiedViewer@@UAEPAXPBD@Z @ 9 NONAME ; void * UnifiedViewer::qt_metacast(char const *)
- ?createToolBar@UnifiedViewer@@AAEXXZ @ 10 NONAME ; void UnifiedViewer::createToolBar(void)
- ??1UnifiedViewer@@UAE@XZ @ 11 NONAME ; UnifiedViewer::~UnifiedViewer(void)
- ?onDialogDeleteMsg@UnifiedViewer@@AAEXPAVHbAction@@@Z @ 12 NONAME ; void UnifiedViewer::onDialogDeleteMsg(class HbAction *)
+ ?onDialogDeleteMsg@UnifiedViewer@@AAEXH@Z @ 10 NONAME ; void UnifiedViewer::onDialogDeleteMsg(int)
+ ?createToolBar@UnifiedViewer@@AAEXXZ @ 11 NONAME ; void UnifiedViewer::createToolBar(void)
+ ??1UnifiedViewer@@UAE@XZ @ 12 NONAME ; UnifiedViewer::~UnifiedViewer(void)
??_EUnifiedViewer@@UAE@I@Z @ 13 NONAME ; UnifiedViewer::~UnifiedViewer(unsigned int)
?qt_metacall@UnifiedViewer@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 14 NONAME ; int UnifiedViewer::qt_metacall(enum QMetaObject::Call, int, void * *)
?tr@UnifiedViewer@@SA?AVQString@@PBD0@Z @ 15 NONAME ; class QString UnifiedViewer::tr(char const *, char const *)
--- a/messagingapp/msgui/conversationview/src/msgconversationbaseview.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/conversationview/src/msgconversationbaseview.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -20,7 +20,7 @@
// SYSTEM INCLUDES
#include <QGraphicsLinearLayout>
#include <HbMainWindow>
-#include <HbNotificationDialog>
+#include <HbDeviceNotificationDialog>
#include <xqaiwrequest.h>
#include <xqappmgr.h>
@@ -162,13 +162,12 @@
int MsgConversationBaseView::saveContentToDrafts()
{
int msgId = INVALID_MSGID;
- bool result = false;
if (mConversationId >= 0) {
msgId = mConversationView->saveContentToDrafts();
}
if (msgId != INVALID_MSGID) {
- HbNotificationDialog::launchDialog(LOC_SAVED_TO_DRAFTS);
+ HbDeviceNotificationDialog::notification("", LOC_SAVED_TO_DRAFTS);
}
return msgId;
}
--- a/messagingapp/msgui/conversationview/src/msgconversationviewitem.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/conversationview/src/msgconversationviewitem.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -51,7 +51,7 @@
#define LOC_BUSINESS_CARD hbTrId("txt_messaging_list_business_card")
#define LOC_CALENDAR_EVENT hbTrId("txt_messaging_list_calendar_event")
#define LOC_UNSUPPORTED_MSG_TYPE hbTrId("txt_messaging_list_listview_unsupported_message_type")
-#define LOC_RESEND_AT hbTrId("Resend at ")
+#define LOC_RESEND_AT hbTrId("txt_messaging_list_resend_at_time")
//---------------------------------------------------------------
// MsgConversationViewItem::MsgConversationViewItem
@@ -581,6 +581,7 @@
//---------------------------------------------------------------
void MsgConversationViewItem::orientationchanged(Qt::Orientation orientation)
{
+ Q_UNUSED(orientation)
QDEBUG_WRITE("MsgConversationViewItem:orientationchanged start.")
repolish();
--- a/messagingapp/msgui/conversationview/src/msgconversationwidget.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/conversationview/src/msgconversationwidget.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -660,6 +660,7 @@
//---------------------------------------------------------------
void MsgConversationWidget::orientationchanged(Qt::Orientation orientation)
{
+ Q_UNUSED(orientation)
QDEBUG_WRITE("MsgConversationWidget:orientationchanged start.")
repolish();
--- a/messagingapp/msgui/conversationview/src/msgeditorwidget.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/conversationview/src/msgeditorwidget.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -117,8 +117,8 @@
BACKGROUND_FRAME);
//Create editor utils object
- mEditorUtils = new UniEditorGenUtils();
-
+ QT_TRAP_THROWING(mEditorUtils = new UniEditorGenUtils());
+
FOCUSITEM = mSendButton;
@@ -341,21 +341,21 @@
mPluginInterface =
mPluginLoader->getUniEditorPlugin(ConvergedMessage::Sms);
- CSmsSettings* settings = CSmsSettings::NewLC();
- CSmsAccount* account = CSmsAccount::NewLC();
- account->LoadSettingsL( *settings );
+ QT_TRAP_THROWING( CSmsSettings* settings = CSmsSettings::NewLC();
+ CSmsAccount* account = CSmsAccount::NewLC();
+ account->LoadSettingsL( *settings );
- if( settings->CharacterSet() == TSmsDataCodingScheme::ESmsAlphabetUCS2)
- {
- mCharSupportType = TUniSendingSettings::EUniCharSupportFull;
- }
- else
- {
- mCharSupportType = TUniSendingSettings::EUniCharSupportReduced;
- }
+ if( settings->CharacterSet() == TSmsDataCodingScheme::ESmsAlphabetUCS2)
+ {
+ mCharSupportType = TUniSendingSettings::EUniCharSupportFull;
+ }
+ else
+ {
+ mCharSupportType = TUniSendingSettings::EUniCharSupportReduced;
+ }
- CleanupStack::PopAndDestroy( account );
- CleanupStack::PopAndDestroy( settings );
+ CleanupStack::PopAndDestroy( account );
+ CleanupStack::PopAndDestroy( settings ));
//Set the mPrevBuffer to NULL initially
mPrevBuffer = QString();
--- a/messagingapp/msgui/eabi/unifiedvieweru.def Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/eabi/unifiedvieweru.def Sun Jul 25 18:59:19 2010 +0530
@@ -10,7 +10,7 @@
_ZN13UnifiedViewer15populateContentEibi @ 9 NONAME
_ZN13UnifiedViewer16staticMetaObjectE @ 10 NONAME DATA 16
_ZN13UnifiedViewer17handleReplyActionEv @ 11 NONAME
- _ZN13UnifiedViewer17onDialogDeleteMsgEP8HbAction @ 12 NONAME
+ _ZN13UnifiedViewer17onDialogDeleteMsgEi @ 12 NONAME
_ZN13UnifiedViewer18handleDeleteActionEv @ 13 NONAME
_ZN13UnifiedViewer19getStaticMetaObjectEv @ 14 NONAME
_ZN13UnifiedViewer20handleReplyAllActionEv @ 15 NONAME
--- a/messagingapp/msgui/msgapp/inc/msglistviewitem.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/msgapp/inc/msglistviewitem.h Sun Jul 25 18:59:19 2010 +0530
@@ -34,7 +34,7 @@
class MsgListViewItem : public HbListViewItem
{
Q_OBJECT
- Q_PROPERTY(bool unReadMsg READ hasUnReadMsg WRITE setHasUnReadMsg)
+ Q_PROPERTY(bool unReadMsg READ hasUnReadMsg WRITE setHasUnReadMsg)
public:
/**
@@ -71,7 +71,15 @@
* Returns the value of mUnReadMsg
* @return bool
*/
- bool hasUnReadMsg();
+ bool hasUnReadMsg();
+
+private slots:
+
+ /*
+ * Handler for orientation changed
+ * @param orientation Qt::Orientation
+ */
+ void orientationchanged(Qt::Orientation orientation);
private:
@@ -91,6 +99,16 @@
* Sets the preview text and timestamp.
*/
void setTimestampAndPreviewText();
+
+ /*
+ * set Unread Count and frame
+ */
+ void setUnreadCountStatus();
+
+ /*
+ * set common indicator (icon/unread count)
+ */
+ void setCommonIndicator(const QString& string);
private:
/**
@@ -130,7 +148,7 @@
/**
* To display the presence indication
*/
- HbIconItem* mPresenceIndicatorItem;
+ HbIconItem* mMsgCommonIndicatorItem;
};
--- a/messagingapp/msgui/msgapp/resources/xml/msglistviewitem.css Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/msgapp/resources/xml/msglistviewitem.css Sun Jul 25 18:59:19 2010 +0530
@@ -69,16 +69,6 @@
text-line-count-max:2;
}
-MsgListViewItem::unreadCount[layoutName="custom"]:portrait {
- right:var(hb-param-margin-gene-middle-horizontal);
- size-policy-horizontal: fixed;
- text-align: right;
- font-variant: primary;
- text-height: var(hb-param-text-height-primary);
- text-line-count-min:1;
- text-line-count-max:1;
-}
-
MsgListViewItem[unReadMsg="true"]::timeLabel[layoutName="custom"]:portrait {
right:var(hb-param-margin-gene-right);
bottom:var(hb-param-margin-gene-bottom);
@@ -103,8 +93,18 @@
text-line-count-max:1;
}
-MsgListViewItem::presenceIndicator[layoutName="custom"]:portrait {
- right: var(hb-param-margin-gene-right);
+MsgListViewItem::unreadCount[layoutName="custom"]:portrait {
+ right:var(hb-param-margin-gene-right);
+ size-policy-horizontal: fixed;
+ min-width: 5un;
+ text-align: right;
+ font-variant: primary;
+ text-height: var(hb-param-text-height-primary);
+ text-line-count-min:1;
+ text-line-count-max:1;
+}
+
+MsgListViewItem::msgCommonIndicator[layoutName="custom"]:portrait {
size-policy-horizontal: fixed;
size-policy-vertical: fixed;
pref-width: var(hb-param-graphic-size-secondary);
@@ -112,7 +112,9 @@
aspect-ratio: ignore;
}
+
/*Landscape mode*/
+
MsgListViewItem::newMsgIndicator[layoutName="custom"]:landscape {
left:-var(hb-param-margin-view-left);
size-policy-horizontal: fixed;
@@ -167,6 +169,7 @@
MsgListViewItem::unreadCount[layoutName="custom"]:landscape {
right:var(hb-param-margin-gene-middle-horizontal);
size-policy-horizontal: fixed;
+ min-width: 5un;
text-align: right;
font-variant: primary;
text-height: var(hb-param-text-height-primary);
@@ -174,8 +177,7 @@
text-line-count-max:1;
}
-MsgListViewItem::presenceIndicator[layoutName="custom"]:landscape {
- right: var(hb-param-margin-gene-middle-horizontal);
+MsgListViewItem::msgCommonIndicator[layoutName="custom"]:landscape {
size-policy-horizontal: fixed;
size-policy-vertical: fixed;
pref-width: var(hb-param-graphic-size-secondary);
--- a/messagingapp/msgui/msgapp/resources/xml/msglistviewitem.widgetml Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/msgapp/resources/xml/msglistviewitem.widgetml Sun Jul 25 18:59:19 2010 +0530
@@ -13,12 +13,11 @@
<meshitem src="previewLabel" srcEdge="LEFT" dst="newMsgIndicator" dstEdge="RIGHT" />
<meshitem src="previewLabel" srcEdge="RIGHT" dst="timeLabel" dstEdge="LEFT" />
- <meshitem src="unreadCount" srcEdge="TOP" dst="addressLabel" dstEdge="TOP" />
- <meshitem src="unreadCount" srcEdge="RIGHT" dst="presenceIndicator" dstEdge="LEFT" />
- <meshitem src="unreadCount" srcEdge="BOTTOM" dst="addressLabel" dstEdge="BOTTOM" />
-
- <meshitem src="presenceIndicator" srcEdge="CENTERV" dst="addressLabel" dstEdge="CENTERV" />
- <meshitem src="presenceIndicator" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+ <meshitem src="unreadCount" srcEdge="CENTERV" dst="addressLabel" dstEdge="CENTERV" />
+ <meshitem src="unreadCount" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+
+ <meshitem src="msgCommonIndicator" srcEdge="CENTERV" dst="addressLabel" dstEdge="CENTERV" />
+ <meshitem src="msgCommonIndicator" srcEdge="RIGHT" dst="unreadCount" dstEdge="RIGHT" />
<meshitem src="timeLabel" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
<meshitem src="timeLabel" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
@@ -32,12 +31,12 @@
<meshitem src="addressLabel" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
<meshitem src="addressLabel" srcEdge="RIGHT" dst="unreadCount" dstEdge="LEFT" />
- <meshitem src="unreadCount" srcEdge="RIGHT" dst="presenceIndicator" dstEdge="LEFT" />
+ <meshitem src="unreadCount" srcEdge="RIGHT" dst="" dstEdge="CENTERH" />
<meshitem src="unreadCount" srcEdge="CENTERV" dst="addressLabel" dstEdge="CENTERV" />
- <meshitem src="presenceIndicator" srcEdge="RIGHT" dst="" dstEdge="CENTERH" />
- <meshitem src="presenceIndicator" srcEdge="CENTERV" dst="addressLabel" dstEdge="CENTERV" />
-
+ <meshitem src="msgCommonIndicator" srcEdge="CENTERV" dst="addressLabel" dstEdge="CENTERV" />
+ <meshitem src="msgCommonIndicator" srcEdge="RIGHT" dst="unreadCount" dstEdge="RIGHT" />
+
<meshitem src="previewLabel" srcEdge="LEFT" dst="" dstEdge="CENTERH" />
<meshitem src="previewLabel" srcEdge="RIGHT" dst="timeLabel" dstEdge="LEFT" />
<meshitem src="previewLabel" srcEdge="CENTERV" dst="addressLabel" dstEdge="CENTERV" />
--- a/messagingapp/msgui/msgapp/resources/xml/msglistviewitem_color.css Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/msgapp/resources/xml/msglistviewitem_color.css Sun Jul 25 18:59:19 2010 +0530
@@ -47,7 +47,7 @@
color: var(qtc_list_item_pressed);
}
-MsgListViewItem::presenceIndicator {
+MsgListViewItem::msgCommonIndicator {
color: var(qtc_list_item_title_normal);
}
--- a/messagingapp/msgui/msgapp/src/draftslistview.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/msgapp/src/draftslistview.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -65,7 +65,7 @@
// Confirmation note
#define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message")
-#define LOC_DELETE_ALL_DRAFTS hbTrId("txt_messaging_dialog_delate_all_drafts")
+#define LOC_DELETE_ALL_DRAFTS hbTrId("txt_messaging_dialog_delete_all_drafts")
//---------------------------------------------------------------
// DraftsListView::DraftsListView
--- a/messagingapp/msgui/msgapp/src/msglistview.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/msgapp/src/msglistview.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -66,7 +66,6 @@
#define LOC_SETTINGS hbTrId("txt_messaging_opt_settings")
#define LOC_TB_VIEW_EXTN hbTrId("txt_messaging_button_view")
-#define LOC_TB_NEW_MESSAGE hbTrId("txt_messaging_button_new_message")
#define LOC_TB_EXTN_DRAFTS hbTrId("txt_messaging_button_drafts")
#define LOC_TB_EXTN_CONVERSATIONS hbTrId("txt_messaging_button_conversations")
--- a/messagingapp/msgui/msgapp/src/msglistviewitem.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/msgapp/src/msglistviewitem.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -27,6 +27,7 @@
#include <HbIconItem>
#include <QCoreApplication>
#include <HbEvent>
+#include <HbInstance>
#include "msgcommondefines.h"
#include "conversationsengine.h"
@@ -38,7 +39,7 @@
#define LOC_RINGING_TONE hbTrId("txt_messaging_dpopinfo_ringing_tone")
#define LOC_MSG_SEND_FAILED hbTrId("txt_messaging_list_message_sending_failed")
#define LOC_MSG_OUTGOING hbTrId("txt_messaging_list_outgoing_message")
-#define LOC_MSG_RESEND_AT hbTrId("Resend at ")
+#define LOC_MSG_RESEND_AT hbTrId("txt_messaging_list_listview_resend_at_time")
#define LOC_BUSINESS_CARD hbTrId("txt_messaging_list_business_card")
#define LOC_CALENDAR_EVENT hbTrId("txt_messaging_list_calendar_event")
#define LOC_UNSUPPORTED_MSG_TYPE hbTrId("txt_messaging_list_unsupported_message_type")
@@ -61,7 +62,7 @@
mTimestampItem(NULL),
mPreviewLabelItem(NULL),
mUnreadCountItem(NULL),
- mPresenceIndicatorItem(NULL)
+ mMsgCommonIndicatorItem(NULL)
{
}
@@ -99,35 +100,6 @@
}
mAddressLabelItem->setText(contactName);
- // Unread message count
- int unreadCount = modelIndex().data(UnreadCount).toInt();
-
- if (unreadCount > 0)
- {
- QString unRead(tr("(%n)", "", unreadCount));
- mUnreadCountItem->setText(unRead);
- if(!mUnReadMsg)
- {
- mUnReadMsg = true;
- mNewMsgIndicatorItem->frameDrawer().setFrameGraphicsName(NEW_ITEM_FRAME);
- repolish();
- // Needed for colour group changes to be visible
- QCoreApplication::postEvent(this, new HbEvent(HbEvent::ThemeChanged));
- }
- }
- else
- {
- mUnreadCountItem->setText(QString());
- if(mUnReadMsg)
- {
- mUnReadMsg = false;
- mNewMsgIndicatorItem->frameDrawer().setFrameGraphicsName(QString());
- repolish();
- // Needed for colour group changes to be visible
- QCoreApplication::postEvent(this, new HbEvent(HbEvent::ThemeChanged));
- }
- }
-
HbListViewItem::updateChildItems();
}
@@ -151,8 +123,8 @@
HbStyle::setItemName(mPreviewLabelItem, "previewLabel");
}
if (!mUnreadCountItem) {
- mUnreadCountItem = new HbTextItem(this);
- HbStyle::setItemName(mUnreadCountItem, "unreadCount");
+ mUnreadCountItem = new HbTextItem(this);
+ HbStyle::setItemName(mUnreadCountItem, "unreadCount");
}
if (!mNewMsgIndicatorItem) {
mNewMsgIndicatorItem = new HbFrameItem(this);
@@ -160,11 +132,19 @@
mNewMsgIndicatorItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical);
}
- if (!mPresenceIndicatorItem) {
- mPresenceIndicatorItem = new HbIconItem(this);
- HbStyle::setItemName(mPresenceIndicatorItem, "presenceIndicator");
+ if (!mMsgCommonIndicatorItem) {
+ mMsgCommonIndicatorItem = new HbIconItem(this);
+ HbStyle::setItemName(mMsgCommonIndicatorItem, "msgCommonIndicator");
}
+ mUnreadCountItem->hide();
+ mMsgCommonIndicatorItem->hide();
+
+ HbMainWindow *mainWindow = hbInstance->allMainWindows()[0];
+
+ connect(mainWindow, SIGNAL(orientationChanged(Qt::Orientation)), this,
+ SLOT(orientationchanged(Qt::Orientation)), Qt::UniqueConnection);
}
+
//---------------------------------------------------------------
// MsgListViewItem::defaultPreviewText
// @see header
@@ -193,8 +173,6 @@
else {
previewText = LOC_UNSUPPORTED_MSG_TYPE;
}
-
- mPresenceIndicatorItem->setVisible(false);
}
else if (msgType == ConvergedMessage::BT) {
@@ -206,14 +184,12 @@
else {
previewText = bodyText;
}
-
- mPresenceIndicatorItem->setIconName(BT_ICON);
- mPresenceIndicatorItem->setVisible(true);
+
+ setCommonIndicator(BT_ICON);
}
else {
// All message types except BIO & BT.
previewText = modelIndex().data(BodyText).toString();
- mPresenceIndicatorItem->setVisible(false);
}
return previewText;
}
@@ -243,17 +219,22 @@
int msgDirection = modelIndex().data(Direction).toInt();
QString previewText;
if (ConvergedMessage::Incoming == msgDirection) {
- previewText = defaultPreviewText(msgType, msgSubType);
+ if( ConvergedMessage::BT != msgType)
+ {
+ setUnreadCountStatus();
+ }
+ previewText = defaultPreviewText(msgType, msgSubType);
}
else if (msgDirection == ConvergedMessage::Outgoing) {
-
+
+ setUnreadCountStatus();
+
switch (sendState) {
case ConvergedMessage::Resend:
{
previewText = LOC_MSG_RESEND_AT + dateString;
- dateString = QString();
- mPresenceIndicatorItem->setIconName(MSG_OUTGOING_ICON);
- mPresenceIndicatorItem->setVisible(true);
+ dateString = QString();
+ setCommonIndicator(MSG_OUTGOING_ICON);
break;
}
case ConvergedMessage::Sending:
@@ -261,21 +242,24 @@
case ConvergedMessage::Scheduled:
case ConvergedMessage::Waiting:
{
- previewText = QString(LOC_MSG_OUTGOING);
- mPresenceIndicatorItem->setIconName(MSG_OUTGOING_ICON);
- mPresenceIndicatorItem->setVisible(true);
+ previewText = QString(LOC_MSG_OUTGOING);
+ setCommonIndicator(MSG_OUTGOING_ICON);
break;
}
case ConvergedMessage::Failed:
{
previewText = QString(LOC_MSG_SEND_FAILED);
- mPresenceIndicatorItem->setIconName(MSG_FAILED_ICON);
- mPresenceIndicatorItem->setVisible(true);
+ setCommonIndicator(MSG_FAILED_ICON);
break;
}
default:
{
- // Successful case
+ // Successful case
+ if( ConvergedMessage::BT != msgType)
+ {
+ setUnreadCountStatus();
+ }
+
previewText = defaultPreviewText(msgType, msgSubType);
break;
}
@@ -317,4 +301,68 @@
return mUnReadMsg;
}
+//---------------------------------------------------------------
+// MsgListViewItem::setUnreadCountStatus
+// @see header file
+//---------------------------------------------------------------
+void MsgListViewItem::setUnreadCountStatus()
+ {
+ // Unread message count
+ int unreadCount = modelIndex().data(UnreadCount).toInt();
+
+ if (unreadCount > 0)
+ {
+ QString unRead(tr("(%n)", "", unreadCount));
+
+ mMsgCommonIndicatorItem->hide();
+ mUnreadCountItem->setText(unRead);
+ mUnreadCountItem->show();
+
+ if (!mUnReadMsg)
+ {
+ mUnReadMsg = true;
+ mNewMsgIndicatorItem->frameDrawer().setFrameGraphicsName(
+ NEW_ITEM_FRAME);
+ repolish();
+ // Needed for colour group changes to be visible
+ QCoreApplication::postEvent(this, new HbEvent(
+ HbEvent::ThemeChanged));
+ }
+ }
+ else
+ {
+ if (mUnReadMsg)
+ {
+ mUnReadMsg = false;
+ mNewMsgIndicatorItem->frameDrawer().setFrameGraphicsName(
+ QString());
+ repolish();
+ // Needed for colour group changes to be visible
+ QCoreApplication::postEvent(this, new HbEvent(
+ HbEvent::ThemeChanged));
+ }
+ }
+ }
+
+//---------------------------------------------------------------
+// MsgListViewItem::setCommonIndicator
+// @see header file
+//---------------------------------------------------------------
+void MsgListViewItem::setCommonIndicator(const QString& string)
+ {
+ mUnreadCountItem->hide();
+ mMsgCommonIndicatorItem->setIconName(string);
+ mMsgCommonIndicatorItem->show();
+ }
+
+//---------------------------------------------------------------
+// MsgListViewItem::orientationchanged
+// @see header file
+//---------------------------------------------------------------
+void MsgListViewItem::orientationchanged(Qt::Orientation orientation)
+{
+ Q_UNUSED(orientation)
+ repolish();
+}
+
//EOF
--- a/messagingapp/msgui/msgapp/src/msgviewmanager.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/msgapp/src/msgviewmanager.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -560,7 +560,7 @@
mMainWindow->addView(mListView);
}
- mMainWindow->setCurrentView(mListView);
+ mMainWindow->setCurrentView(mListView,true,Hb::ViewSwitchSequential);
}
void MsgViewManager::switchToCv(const QVariantList& data)
@@ -587,6 +587,10 @@
//delete UniEditor
if (mUniEditor)
{
+ // Save to drafts if CV is launched via service
+ if (mPreviousView == MsgBaseView::SERVICE) {
+ mUniEditor->saveContentToDrafts();
+ }
appendViewToBeDeleted(mUniEditor);
mUniEditor = NULL;
}
@@ -627,7 +631,7 @@
// this case comes when a message is deleted from
// Unified viewer set curent view as conversation view
// and return
- mMainWindow->setCurrentView(mConversationView);
+ mMainWindow->setCurrentView(mConversationView,true,Hb::ViewSwitchSequential);
// publish already opened conversation's id
mConversationView->setPSCVId(true);
@@ -655,7 +659,7 @@
}
mConversationView->openConversation(conversationId);
- mMainWindow->setCurrentView(mConversationView);
+ mMainWindow->setCurrentView(mConversationView,true,Hb::ViewSwitchSequential);
QCRITICAL_WRITE("MsgViewManager::switchToCv end.");
}
@@ -681,7 +685,7 @@
mMainWindow->addView(mDraftsListView);
}
- mMainWindow->setCurrentView(mDraftsListView);
+ mMainWindow->setCurrentView(mDraftsListView,true,Hb::ViewSwitchSequential);
}
void MsgViewManager::switchToUniEditor(const QVariantList& data)
@@ -755,7 +759,7 @@
}
}
- mMainWindow->setCurrentView(mUniEditor);
+ mMainWindow->setCurrentView(mUniEditor,true,Hb::ViewSwitchSequential);
QCRITICAL_WRITE("MsgViewManager::switchToUniEditor end.");
}
@@ -770,6 +774,12 @@
return;
}
+ if (mUniEditor)
+ {
+ appendViewToBeDeleted(mUniEditor);
+ mUniEditor = NULL;
+ }
+
//Clear the old viewer data
mViewerData.clear();
@@ -804,7 +814,7 @@
mConversationView->setPSCVId(false);
}
- mMainWindow->setCurrentView(mUniViewer);
+ mMainWindow->setCurrentView(mUniViewer,true,Hb::ViewSwitchSequential);
}
void MsgViewManager::switchToMsgSettings(const QVariantList& data)
{
@@ -868,28 +878,28 @@
case MsgBaseView::CLV:
{
if (mListView)
- mMainWindow->setCurrentView(mListView);
+ mMainWindow->setCurrentView(mListView,true,Hb::ViewSwitchSequential);
break;
}
case MsgBaseView::CV:
{
if (mConversationView)
- mMainWindow->setCurrentView(mConversationView);
+ mMainWindow->setCurrentView(mConversationView,true,Hb::ViewSwitchSequential);
break;
}
case MsgBaseView::DLV:
{
if (mDraftsListView)
- mMainWindow->setCurrentView(mDraftsListView);
+ mMainWindow->setCurrentView(mDraftsListView,true,Hb::ViewSwitchSequential);
break;
}
case MsgBaseView::UNIEDITOR:
{
if (mServiceRequest) {
- mMainWindow->setCurrentView(mUniEditor);
+ mMainWindow->setCurrentView(mUniEditor,true,Hb::ViewSwitchSequential);
}
else {
- mMainWindow->setCurrentView(mUniEditor);
+ mMainWindow->setCurrentView(mUniEditor,true,Hb::ViewSwitchSequential);
}
break;
}
@@ -958,7 +968,7 @@
}
mUniViewer->populateContent(msgId, true, -1);
- mMainWindow->setCurrentView(mUniViewer);
+ mMainWindow->setCurrentView(mUniViewer,true,Hb::ViewSwitchSequential);
}
// ----------------------------------------------------------------------------
@@ -1144,7 +1154,7 @@
}
mMainWindow->addView(mAudioFetcherView);
- mMainWindow->setCurrentView(mAudioFetcherView);
+ mMainWindow->setCurrentView(mAudioFetcherView,true,Hb::ViewSwitchSequential);
}
// ----------------------------------------------------------------------------
@@ -1203,7 +1213,8 @@
// set the current view
mCurrentView = MsgBaseView::UNIEDITOR;
- mMainWindow->setCurrentView(mUniEditor);
+ mPreviousView =MsgBaseView::CLV;
+ mMainWindow->setCurrentView(mUniEditor,true,Hb::ViewSwitchSequential);
}
// ----------------------------------------------------------------------------
--- a/messagingapp/msgui/msgaudiofetcher/inc/msgaudioselectionengine.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/msgaudiofetcher/inc/msgaudioselectionengine.h Sun Jul 25 18:59:19 2010 +0530
@@ -27,7 +27,6 @@
#include <mdccommon.h>
#include <mdeitem.h>
#include <mdeobject.h>
-#include <e32base.h>
#include <QObject>
#include <QStringList>
@@ -36,8 +35,7 @@
/**
* This class is used for quering tones from mde.
*/
-class MsgAudioSelectionEngine : public QObject,
- public CBase,
+class MsgAudioSelectionEngine : public QObject,
public MMdESessionObserver,
public MMdEQueryObserver,
public MMdEObjectObserver,
--- a/messagingapp/msgui/msgaudiofetcher/src/msgaudiofetcherview.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/msgaudiofetcher/src/msgaudiofetcherview.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -25,6 +25,8 @@
#include "msgaudiofetcherwidget.h"
#include "convergedmessage.h"
+#define LOC_SELECT_SOUND hbTrId("txt_messaging_title_select_a_sound")
+
MsgAudioFetcherView::MsgAudioFetcherView(const QVariantList& data) :
message(NULL)
{
@@ -70,7 +72,7 @@
mToolBarRightAction = new HbAction(this);
mToolBarRightAction->setObjectName("rightAction");
//TODO: need localized string
- mToolBarRightAction->setText(hbTrId("Select"));
+ mToolBarRightAction->setText(LOC_SELECT_SOUND);
mToolBarRightAction->setEnabled(false);
toolBar()->addAction(mToolBarRightAction);
--- a/messagingapp/msgui/msgaudiofetcher/src/msgaudioselectionengine.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/msgaudiofetcher/src/msgaudioselectionengine.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -29,7 +29,7 @@
// CONSTANTS
_LIT( KAmrMime, "audio/amr" );
-MsgAudioSelectionEngine::MsgAudioSelectionEngine()
+MsgAudioSelectionEngine::MsgAudioSelectionEngine():iQuery(NULL)
{
}
@@ -43,7 +43,7 @@
void MsgAudioSelectionEngine::CreateMetaDataSession()
{
- TRAP_IGNORE(iSession = CMdESession::NewL(*this));
+ QT_TRAP_THROWING(iSession = CMdESession::NewL(*this));
}
@@ -100,7 +100,7 @@
if (iSessionOpen)
{
TUint32 notificationType = ENotifyAdd | ENotifyModify | ENotifyRemove;
- User::LeaveIfNull(iSession);
+ q_check_ptr(iSession);
CMdENamespaceDef& defNS = iSession->GetDefaultNamespaceDefL();
iSession->AddObjectObserverL(*this, 0, notificationType, &defNS);
iSession->AddObjectPresentObserverL(*this);
@@ -201,13 +201,13 @@
{
if (!iSession || !iSessionOpen)
{
- User::Leave(KErrDisconnected);
+ qt_symbian_throwIfError (KErrDisconnected);
}
}
CMdEPropertyDef& MsgAudioSelectionEngine::PropertyDefL(TInt aAttr)
{
- User::LeaveIfNull(iSession);
+ q_check_ptr(iSession);
return PropertyDefL(iSession, aAttr);
}
@@ -253,7 +253,7 @@
}
else
{
- User::Leave(KErrNotSupported);
+ qt_symbian_throwIfError(KErrNotSupported);
}
return objectDef.GetPropertyDefL(MdeConstants::Object::KTitleProperty);
--- a/messagingapp/msgui/msguiutils/src/mmsconformancecheck.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/msguiutils/src/mmsconformancecheck.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -90,7 +90,7 @@
HBufC* filePath = XQConversions::qStringToS60Desc(file);
if (filePath)
{
- CleanupStack::PushL(filePath);
+ QT_TRAP_THROWING(CleanupStack::PushL(filePath);
CMmsConformance* mmsConformance = CMmsConformance::NewL();
mmsConformance->CheckCharacterSet(EFalse);
@@ -173,7 +173,7 @@
return EInsertNotSupported;
}
- delete info;
+ delete info);
}
QDEBUG_WRITE("MmsConformanceCheck::CheckModeForInsert end");
return EInsertSuccess;
--- a/messagingapp/msgui/msguiutils/src/msgsendutil.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/msguiutils/src/msgsendutil.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -33,7 +33,7 @@
{
// Load Plugins for send
mPluginLoader = new UniEditorPluginLoader(this);
- mUniEditorGenUtils = new UniEditorGenUtils();
+ QT_TRAP_THROWING(mUniEditorGenUtils = new UniEditorGenUtils());
}
//---------------------------------------------------------------
--- a/messagingapp/msgui/unifiededitor/src/msgunieditoraddress.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditoraddress.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -29,6 +29,7 @@
#include <HbNotificationDialog>
#include <commonphoneparser.h> // Common phone number validity checker
#include <xqconversions.h>
+#include <HbEditorInterface>
// USER INCLUDES
#include "debugtraces.h"
@@ -79,6 +80,10 @@
this, SLOT(onContentsChanged(const QString&)));
mAddressEdit->setInputMethodHints(Qt::ImhPreferNumbers);
+
+ //To allow only latin char(s) in address fields.
+ HbEditorInterface editorInterface(mAddressEdit);
+ editorInterface.setInputConstraints(HbEditorConstraintLatinAlphabetOnly);
}
MsgUnifiedEditorAddress::~MsgUnifiedEditorAddress()
--- a/messagingapp/msgui/unifiededitor/src/msgunieditorattachment.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditorattachment.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -78,7 +78,10 @@
int at_size = 0;
TMsgMediaType mediaType = EMsgMediaUnknown;
- UniEditorGenUtils* genUtils = new UniEditorGenUtils;
+
+ UniEditorGenUtils* genUtils = NULL;
+ QT_TRAP_THROWING(genUtils = new UniEditorGenUtils);
+
TRAP_IGNORE(genUtils->getFileInfoL(mPath,at_size,
mMimeType,mediaType));
TRAP_IGNORE(mMaxSmsSize = genUtils->MaxSmsMsgSizeL());
--- a/messagingapp/msgui/unifiededitor/src/msgunieditorbody.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditorbody.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -545,11 +545,14 @@
if( mImageSize || mTextEdit->toPlainText().size() ||
mAudioSize || mVideoSize )
{
- UniEditorGenUtils* uniEditorGenUtils = new UniEditorGenUtils;
+
+ UniEditorGenUtils* genUtils = NULL;
+ QT_TRAP_THROWING(genUtils = new UniEditorGenUtils);
+
bodysize += mImageSize + mAudioSize + mVideoSize +
- uniEditorGenUtils->UTF8Size(mTextEdit->toPlainText()) +
+ genUtils->UTF8Size(mTextEdit->toPlainText()) +
KEstimatedMimeHeaderSize + KEstimatedMmsSmilHeaderSize;
- delete uniEditorGenUtils;
+ delete genUtils;
}
return bodysize;
}
--- a/messagingapp/msgui/unifiededitor/src/msgunieditormonitor.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditormonitor.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -52,9 +52,9 @@
MsgUnifiedEditorMonitor::MsgUnifiedEditorMonitor(QObject* parent) :
QObject(parent),
mSkipNote(false)
-{
- init();
- mUniEditorGenUtils = new UniEditorGenUtils;
+{
+ mUniEditorGenUtils = q_check_ptr( new UniEditorGenUtils);
+ init();
}
//---------------------------------------------------------------
@@ -78,18 +78,14 @@
mSubjectSize = 0;
mMsgCurrAddressCount = 0;
- UniEditorGenUtils* uniEditorGenUtils = new UniEditorGenUtils;
-
mMaxMmsSize = KDefaultMaxSize;
- TRAP_IGNORE(mMaxMmsSize = uniEditorGenUtils->MaxMmsMsgSizeL());
+ TRAP_IGNORE(mMaxMmsSize = mUniEditorGenUtils->MaxMmsMsgSizeL());
mMaxSmsRecipients = KDefaultSmsRecipients;
- TRAP_IGNORE(mMaxSmsRecipients = uniEditorGenUtils->MaxSmsRecipientsL());
+ TRAP_IGNORE(mMaxSmsRecipients = mUniEditorGenUtils->MaxSmsRecipientsL());
mMaxMmsRecipients = KDefaultMmsRecipients;
- TRAP_IGNORE(mMaxMmsRecipients = uniEditorGenUtils->MaxMmsRecipientsL());
-
- delete uniEditorGenUtils;
+ TRAP_IGNORE(mMaxMmsRecipients = mUniEditorGenUtils->MaxMmsRecipientsL());
}
//---------------------------------------------------------------
@@ -211,7 +207,7 @@
dlg->setFocusPolicy(Qt::NoFocus);
dlg->setDismissPolicy(HbPopup::TapAnywhere);
dlg->setAttribute(Qt::WA_DeleteOnClose, true);
- dlg->setText(text);
+ dlg->setTitle(text);
dlg->show();
}
// reset skip note flag
--- a/messagingapp/msgui/unifiededitor/src/msgunieditorsubject.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditorsubject.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -51,7 +51,7 @@
mSubjectEdit->setMinRows(1);
mSubjectEdit->setMaxRows(10);
- mGenUtils = new UniEditorGenUtils();
+ QT_TRAP_THROWING( mGenUtils = new UniEditorGenUtils());
connect(mSubjectEdit, SIGNAL(contentsChanged(const QString&)),
this, SLOT(onContentsChanged(const QString&)));
--- a/messagingapp/msgui/unifiededitor/src/msgunieditorview.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditorview.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -35,6 +35,7 @@
#include <HbListViewItem>
#include <HbListWidgetItem>
#include <HbNotificationDialog>
+#include <HbDeviceNotificationDialog>
#include <HbMessageBox>
#include <HbAbstractVkbHost>
#include <HbMainWindow>
@@ -87,9 +88,9 @@
#define LOC_BCC hbTrId("txt_messaging_formlabel_bcc")
//attach options
-#define LOC_PHOTO hbTrId("txt_messaging_button_photo")
-#define LOC_SOUND hbTrId("txt_messaging_button_sound")
-#define LOC_BUSINESS_CARD hbTrId("txt_messaging_button_business_card")
+#define LOC_PHOTO hbTrId("txt_messaging_opt_attach_sub_photo")
+#define LOC_SOUND hbTrId("txt_messaging_opt_attach_sub_sound")
+#define LOC_BUSINESS_CARD hbTrId("txt_messaging_opt_sub_business_card")
//options menu.
#define LOC_ADD_SUBJECT hbTrId("txt_messaging_opt_add_subject")
@@ -103,7 +104,7 @@
#define LOC_LOW hbTrId("txt_messaging_opt_attach_sub_low")
//group box
-#define LOC_OTHER_RECIPIENTS(n) hbTrId("txt_messaging_group_title_ln_other_recipients",n)
+#define LOC_OTHER_RECIPIENTS(n) hbTrId("txt_messaging_title_ln_other_recipients",n)
#define LOC_OTHER_RECIPIENTS_EXPAND hbTrId("txt_messaging_title_other_recipients")
//saved to draft note
@@ -434,7 +435,10 @@
QString mimeType;
TMsgMediaType mediaType = EMsgMediaUnknown;
QString filePath = messageDetails->attachments().at(i)->filePath();
- UniEditorGenUtils* genUtils = new UniEditorGenUtils;
+
+ UniEditorGenUtils* genUtils = NULL;
+ QT_TRAP_THROWING(genUtils = new UniEditorGenUtils);
+
TRAP_IGNORE(genUtils->getFileInfoL(filePath,imageSize,
mimeType,mediaType));
delete genUtils;
@@ -513,7 +517,8 @@
messageDetails.attachments();
int attachmentCount = attachmentList.count();
- UniEditorGenUtils* genUtils = new UniEditorGenUtils;
+ UniEditorGenUtils* genUtils = NULL;
+ QT_TRAP_THROWING(genUtils = new UniEditorGenUtils);
QStringList pendingAttList;
for( int i=0; i < attachmentCount; i++ )
@@ -1182,7 +1187,7 @@
if(res)
{
- HbNotificationDialog::launchDialog(LOC_SAVED_TO_DRAFTS);
+ HbDeviceNotificationDialog::notification("", LOC_SAVED_TO_DRAFTS);
}
return msgId;
}
--- a/messagingapp/msgui/unifiedviewer/inc/unifiedviewer.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/unifiedviewer/inc/unifiedviewer.h Sun Jul 25 18:59:19 2010 +0530
@@ -106,9 +106,9 @@
/**
* This slot is called when delete message dialog is launched.
- * @param action selected action (yes or no).
+ * @param val selected action value.
*/
- void onDialogDeleteMsg(HbAction* action);
+ void onDialogDeleteMsg(int val);
/**
* Handle reply
--- a/messagingapp/msgui/unifiedviewer/inc/univieweraddresswidget.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/unifiedviewer/inc/univieweraddresswidget.h Sun Jul 25 18:59:19 2010 +0530
@@ -75,8 +75,9 @@
/**
* short tap handler.
* @param anchor anchor at cursor position.
+ * @param pos tap position.
*/
- void shortTapAction(QString anchor);
+ void shortTapAction(QString anchor,const QPointF& pos);
/** Helper method to get contact id against phone number or e-mail id.
* @param value phone number or email id.
@@ -87,6 +88,12 @@
const QString& fieldName,
const QString& fieldType);
+ /**
+ * Helper method to populate menu items.
+ * @param contextMenu menu to be populated.
+ * @param data, highlighted number.
+ */
+ void populateMenu(HbMenu* contextMenu, const QString& data);
private slots:
--- a/messagingapp/msgui/unifiedviewer/inc/univiewerfeeder_p.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/unifiedviewer/inc/univiewerfeeder_p.h Sun Jul 25 18:59:19 2010 +0530
@@ -188,11 +188,6 @@
private:
/**
- * Fetches message details from the store.
- */
- void fetchDetailsL();
-
- /**
* initialise the symbian constructions.
*/
void initL(qint32 msgId);
--- a/messagingapp/msgui/unifiedviewer/src/unifiedviewer.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/unifiedviewer/src/unifiedviewer.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -48,6 +48,7 @@
//LOCALIZED CONSTANTS
#define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message")
+#define LOC_DELETE_SHARED_MESSAGE hbTrId("txt_messaging_dialog_same_message_exists_in_multip")
//----------------------------------------------------------------------------
// UnifiedViewer::UnifiedViewer
@@ -234,8 +235,18 @@
//---------------------------------------------------------------
void UnifiedViewer::handleDeleteAction()
{
- HbMessageBox::question(LOC_DELETE_MESSAGE,this,
- SLOT(onDialogDeleteMsg(HbAction*)),
+ QString txt = LOC_DELETE_MESSAGE;
+
+ //if mms and out going. check for sharing
+ if((mViewFeeder->msgType() == KSenduiMtmMmsUidValue) && (!mViewFeeder->isIncoming()))
+ {
+ if(mViewFeeder->recipientCount() > 1 )
+ {
+ txt = LOC_DELETE_SHARED_MESSAGE;
+ }
+ }
+
+ HbMessageBox::question(txt,this,SLOT(onDialogDeleteMsg(int)),
HbMessageBox::Delete | HbMessageBox::Cancel);
}
@@ -270,10 +281,9 @@
// UnifiedViewer::onDialogDeleteMsg
// @see header file
//---------------------------------------------------------------
-void UnifiedViewer::onDialogDeleteMsg(HbAction* action)
+void UnifiedViewer::onDialogDeleteMsg(int val)
{
- HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
- if (action == dlg->actions().at(0)) {
+ if (val == HbMessageBox::Delete) {
QList<int> msgIdList;
msgIdList << mMessageId;
--- a/messagingapp/msgui/unifiedviewer/src/univieweraddresswidget.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/unifiedviewer/src/univieweraddresswidget.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -43,7 +43,7 @@
const QString SPACE(" ");
//localization
-#define LOC_OPEN_CONTACT_INFO hbTrId("txt_messaging_menu_open_contact_info")
+#define LOC_CONTACT_INFO hbTrId("txt_messaging_menu_contact_info")
#define LOC_CALL hbTrId("txt_common_menu_call_verb")
#define LOC_SEND_MESSAGE hbTrId("txt_common_menu_send_message")
#define LOC_SAVE_TO_CONTACTS hbTrId("txt_common_menu_save_to_contacts")
@@ -123,7 +123,7 @@
//do short tap action.
if (!anchor.isEmpty() && !this->textCursor().hasSelection())
{
- shortTapAction(anchor);
+ shortTapAction(anchor,tap->scenePosition());
}
}
break;
@@ -349,34 +349,73 @@
if(!anchor.isEmpty() && !this->textCursor().hasSelection())
{
-
- HbAction* action = NULL;
+ populateMenu(contextMenu,anchor);
+ }
+}
- action = contextMenu->addAction(LOC_OPEN_CONTACT_INFO, this, SLOT(openContactInfo()));
- action->setData(anchor);
-
- action = contextMenu->addAction(LOC_CALL, this, SLOT(call()));
- action->setData(anchor);
+void UniViewerAddressWidget::populateMenu(HbMenu* contextMenu,const QString& data)
+{
+ HbAction* action = NULL;
- action = contextMenu->addAction(LOC_SEND_MESSAGE, this, SLOT(sendMessage()));
- action->setData(anchor);
-
+ int contactId = MsgContactHandler::resolveContactDisplayName(
+ data,
+ QContactPhoneNumber::DefinitionName,
+ QContactPhoneNumber::FieldNumber);
+
+ if(contactId > 0)
+ {
+ action = contextMenu->addAction(LOC_CONTACT_INFO, this, SLOT(openContactInfo()));
+ action->setData(data);
+ }
+ else
+ {
action = contextMenu->addAction(LOC_SAVE_TO_CONTACTS, this, SLOT(saveToContacts()));
- action->setData(anchor);
-
- action = contextMenu->addAction(LOC_COPY, this, SLOT(copyToClipboard()));
- action->setData(anchor);
-
+ action->setData(data);
}
- connect(contextMenu,SIGNAL(aboutToClose()),this,SLOT(menuClosed()));
+ action = contextMenu->addAction(LOC_CALL, this, SLOT(call()));
+ action->setData(data);
+
+ action = contextMenu->addAction(LOC_SEND_MESSAGE, this, SLOT(sendMessage()));
+ action->setData(data);
+
+ action = contextMenu->addAction(LOC_COPY, this, SLOT(copyToClipboard()));
+ action->setData(data);
+
+ connect(contextMenu,SIGNAL(aboutToClose()),this,SLOT(menuClosed()));
}
-void UniViewerAddressWidget::shortTapAction(QString anchor)
+void UniViewerAddressWidget::shortTapAction(QString anchor,const QPointF& pos)
{
HbAction action;
action.setData(anchor);
- connect(&action,SIGNAL(triggered()),this,SLOT(openContactInfo()));
+
+
+ int contactId = MsgContactHandler::resolveContactDisplayName(
+ anchor,
+ QContactPhoneNumber::DefinitionName,
+ QContactPhoneNumber::FieldNumber);
+
+ if(contactId > 0 )
+ {
+ //if resolved conatct open contact card
+ connect(&action,SIGNAL(triggered()),this,SLOT(openContactInfo()));
+ }
+ else
+ {
+ //unresolved contact show popup.
+ highlightText(true);
+
+ HbMenu* contextMenu = new HbMenu();
+ contextMenu->setDismissPolicy(HbPopup::TapAnywhere);
+ contextMenu->setAttribute(Qt::WA_DeleteOnClose, true);
+ contextMenu->setPreferredPos(pos);
+
+ populateMenu(contextMenu,anchor);
+
+ contextMenu->show();
+ }
+
action.trigger();
}
@@ -509,7 +548,7 @@
void UniViewerAddressWidget::saveToContacts()
{
- //handler for save to contacts.
+ openContactInfo();
}
void UniViewerAddressWidget::sendMessage()
--- a/messagingapp/msgui/unifiedviewer/src/univiewerfeeder_p.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/unifiedviewer/src/univiewerfeeder_p.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -74,15 +74,6 @@
}
// ---------------------------------------------------------------------------
-// UniViewerFeederPrivate::fetchDetails
-// Fetches message details from the store
-// ---------------------------------------------------------------------------
-void UniViewerFeederPrivate::fetchDetails()
-{
- TRAP_IGNORE(fetchDetailsL());
-}
-
-// ---------------------------------------------------------------------------
// UniViewerFeederPrivate::msgType
// Returns the message type.
// ---------------------------------------------------------------------------
@@ -153,7 +144,7 @@
// UniViewerFeederPrivate::fetchDetailsL
// Fetches message details from the store.
// ---------------------------------------------------------------------------
-void UniViewerFeederPrivate::fetchDetailsL()
+void UniViewerFeederPrivate::fetchDetails()
{
QDEBUG_WRITE("UniViewerFeederPrivate fetchDetailsL : SMS start");
if (msgType() == KSenduiMtmSmsUidValue || (msgType() == KSenduiMtmBioUidValue
--- a/messagingapp/msgui/unifiedviewer/src/univiewerheadercontainer.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/unifiedviewer/src/univiewerheadercontainer.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -31,7 +31,7 @@
#include "nativemessageconsts.h"
// LOCALIZATION
-#define LOC_SEND_FAILED hbTrId("txt_messaging_formlabel_sending_failed")
+#define LOC_SEND_FAILED hbTrId("txt_messaging_list_message_sending_failed")
// LOCAL CONSTANTS
const QString ADDR_LIST_SEPARATOR(", ");
--- a/messagingapp/msgui/unifiedviewer/src/univiewerutils.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/unifiedviewer/src/univiewerutils.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -57,13 +57,12 @@
//---------------------------------------------------------------
void UniViewerUtils::launchContentViewer(const QString &mimeType, const QString &filePath)
{
- if (mimeType.contains(IMAGE_MIMETYPE) || mimeType.contains(AUDIO_MIMETYPE) ||
- mimeType.contains(VIDEO_MIMETYPE)) {
+ if (mimeType.contains(VCARD_MIMETYPE, Qt::CaseInsensitive)) {
+ MsgContactsUtil::launchVCardViewer(filePath);
+ }
+ else {
launchViaSharableFile(filePath);
}
- else if (mimeType.contains(VCARD_MIMETYPE, Qt::CaseInsensitive)) {
- MsgContactsUtil::launchVCardViewer(filePath);
- }
}
//---------------------------------------------------------------
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/inc/mmsreadfile.h Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,471 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#ifndef MMSREADFILE_H
-#define MMSREADFILE_H
-
-// INCLUDES
-#include <e32base.h>
-#include <badesca.h>
-#include <f32file.h>
-#include <msvstd.h>
-
-// forward references
-class CMmsAttaStructure;
-class CMmsHeaders;
-class CEikonEnv;
-class CMmsClientMtm;
-
-// Out-of-range value for any MMS header with assigned number
-// Used in coverage tests to get coverage for "default" branches
-// in "case" statements.
-const TInt KMmsTestIllegalValue = 255;
-
-//
-// TEST KEY WORDS
-// Extended to include all MMS headers to allow generation of arbitrary PDUs
-// Content type header cannot be separately defined,
-// it will always be "multipat/mixed" or "multipart/related"
-_LIT8( KTestEndOfFile, "EOF" );
-_LIT8( KTestNewMessage, "MESSAGE BEGIN" );
-//------------------------------------------------
-_LIT8( KTestMessageType, "MESSAGE-TYPE" ); //X-Mms-Message-Type
-_LIT8( KTestDate, "DATE" ); // Date
-_LIT8( KTestFrom, "FROM" ); // From
-_LIT8( KTestTo, "TO" ); // To
-_LIT8( KTestCc, "CC" ); // Cc
-_LIT8( KTestBcc, "BCC" ); // Bcc
-_LIT8( KTestSubject, "SUBJECT" ); // Subject
-_LIT8( KTestExpiryRel, "EXPIRY-REL" ); // X-Mms-Expiry, relative
-_LIT8( KTestExpiryAbs, "EXPIRY-ABS" ); // X-Mms-Expiry, absolute
-_LIT8( KTestDeliveryTimeRel, "DELIVERY-TIME-REL" ); // X-Mms-Delivery-Time, relative
-_LIT8( KTestDeliveryTimeAbs, "DELIVERY-TIME-ABS" ); // X-Mms-Delivery-Time, absolute
-_LIT8( KTestPriority, "PRIORITY" ); // X-Mms-Priority
-_LIT8( KTestSenderVisibility, "SENDER-VISIBILITY" ); // X-Mms-Sender-Visibility
-_LIT8( KTestDeliveryReport, "DELIVERY-REPORT" ); // X-Mms-Delivery-Report
-_LIT8( KTestReadReply, "READ-REPLY" ); // X-Mms-Read-Report
-// ---------------------------------------------------
-_LIT8( KTestNewAttachment, "ATTACHMENT" );
-_LIT8( KTestAttachmentType, "ATTACHMENTTYPE" );
-_LIT8( KTestAttachmentName, "ATTACHMENTNAME" );
-_LIT8( KTestAttachmentContLoc, "ATTACHMENTCONTLOC" );
-_LIT8( KTestAttachmentCharset, "ATTACHMENTCHARSET" );
-_LIT8( KTestAttachmentCid, "ATTACHMENTCID" );
-_LIT8( KTestAttachmentRoot, "ATTACHMENTROOT" );
-// content-type and x-type parameters for attachments
-// should appear in name-value pairs.
-// Test program is not responsible for verifying illegal scripts
-_LIT8( KTestAttContTypeParamName, "ContTypeParamName" );
-_LIT8( KTestAttContTypeParamValue, "ContTypeParamValue" );
-_LIT8( KTestAttXTypeParamName, "X-TypeParamName" );
-_LIT8( KTestAttXTypeParamValue, "X-TypeParamValue" );
-// -----------------------------------------------------
-_LIT8( KTestMessageClass, "MESSAGE-CLASS" ); // X-Mms-Message-Class
-_LIT8( KTestDelivRepSendAllow, "DELIV-REP-SEND-ALLOW" ); // X-Mms-Report-Allowed
-_LIT8( KTestAcceptAdvertis, "ACCEPT-ADVERTISEMENTS" );
-_LIT8( KTestRetryCount, "RETRY-COUNT" );
-_LIT8( KTestRetryInterval, "RETRY-INTERVAL" );
-// -------------------------------------------------
-_LIT8( KTestAlias, "ALIAS" );
-_LIT8( KTestFromAlias, "FROMALIAS" );
-_LIT8( KTestToAlias, "TOALIAS" );
-_LIT8( KTestCcAlias, "CCALIAS" );
-_LIT8( KTestBccAlias, "BCCALIAS" );
-// -------------------------------------------------
-// more Message headers to allow testing all possible PDUs and
-// MMS 1.1 headers
-_LIT8( KTestReplyCharging, "REPLY-CHARGING" ); // X-Mms-Reply-Charging
-_LIT8( KTestReplyChargAbs, "REPLY-CHARG-DEADLINE-ABS" ); // X-Mms-Reply-Charging, absolute
-_LIT8( KTestReplyChargRel, "REPLY-CHARG-DEADLINE-REL" ); // X-Mms-Reply-Charging, relative
-_LIT8( KTestReplyChargSize, "REPLY-CHARG-SIZE" ); // X-Mms-Reply-Charging-Size (octets)
-_LIT8( KTestReplyChargID, "REPLY-CHARGING-ID" ); // X-Mms-Reply-Charging-ID
-_LIT8( KTestTID, "TID" );
-_LIT8( KTestContentLocation, "CONTLOC" ); // X-Mms-Content-Location
-// The following three must appear as triplets.
-// index must be first, address and date may appear in any order
-_LIT8( KTestPreviouslySentIndex, "PREVIOUSINDEX" ); // forwarded count for X-Mms-PreviouslySent headers
-_LIT8( KTestPreviouslySentBy, "PREV-SENT-BY" ); // X-Mms-Previously-Sent-By
-_LIT8( KTestPreviouslySentDate, "PREV-SENT-DATE" ); // X-Mms-Previously-Sent-Date
-//---
-_LIT8( KTestMessageId, "MESSAGE-ID" ); // Message-ID
-_LIT8( KTestMessageSize, "MESSAGE-SIZE" ); // X-Mms-Message-Size (octets)
-_LIT8( KTestVersion, "MMS-VERSION" ); // X-MMS-Version (hex:, 10 = 1.0, 11 = 1.1 etc. )
-_LIT8( KTestReadStatus, "READ-STATUS" ); // X-Mms-Read-Status
-_LIT8( KTestResponseStatus, "RESPONSE-STATUS" ); // X-Mms-Response-Status
-_LIT8( KTestResponseText, "RESPONSE-TEXT" ); // X-Mms-Response-Text
-_LIT8( KTestRetrieveStatus, "RETRIEVE-STATUS" ); // X-Mms-Retrieve-Status
-_LIT8( KTestRetrieveText, "RETRIEVE-TEXT" ); // X-Mms-Retrieve-Text
-_LIT8( KTestStatus, "STATUS" ); // X-Mms-Status
-// -------------------------------------------------
-// MMS 1.2 headers
-_LIT8( KTestAttribute, "ATTRIBUTE" ); // X-Mms-Attribute
-// The value should be one of the following:
-// BCC, CC, CONTENT, CONTENT-TYPE, DATE, DELIVERY-REPORT, DELIVERY-TIME-ABS,
-// EXPIRY-ABS, FROM, MESSAGE-CLASS, MESSAGE-ID, MESSAGE-SIZE, PRIORITY,
-// READ-REPLY, SUBJECT, TO, REPLY-CHARGING, REPLY-CHARGING-ID,
-// REPLY-CHARG-DEADLINE-ABS, REPLY-CHARG-SIZE, PREV-SENT-BY,
-// PREV-SENT-DATE, ADDITIONAL-HEADERS
-_LIT8( KTestDistributionIndicator, "DISTRIBUTION-INDICATOR" ); // X-Mms-Distribution-Indicator
-_LIT8( KTestLimit, "LIMIT" ); // X-Mms-Limit
-_LIT8( KTestMessageQuota, "MESSAGE-QUOTA" ); // X-Mms-Mbox-Quota, message number
-_LIT8( KTestSizeQuota, "SIZE-QUOTA" ); // X-Mms-Mbox-Quota, size quota
-_LIT8( KTestMessageTotal, "MESSAGE-TOTAL" ); // X-Mms-Mbox-Totals, message number
-_LIT8( KTestSizeTotal, "SIZE-TOTAL" ); // X-Mms-Mbox-Totals, total size
-_LIT8( KTestMessageCount, "MESSAGE-COUNT" ); // X-Mms-Message-Count
-_LIT8( KTestAddKeyword, "ADD-KEYWORD" ); // X-Mms-MM-Flags
-_LIT8( KTestRemoveKeyword, "REMOVE-KEYWORD" ); // X-Mms-MM-Flags
-_LIT8( KTestFilterKeyword, "FILTER-KEYWORD" ); // X-Mms-MM-FLags
-_LIT8( KTestMMState, "MESSAGE-STATE" ); // X-Mms-MM-State
-_LIT8( KTestQuota, "QUOTA" ); // X-Mms-Quotas
-_LIT8( KTestStart, "START" ); // X-Mms-Start
-_LIT8( KTestStore, "STORE" ); // X-Mms-Store
-_LIT8( KTestStored, "STORED" ); // X-Mms-Stored
-_LIT8( KTestStoreStatus, "STORE-STATUS" ); // X-Mms-Store-Status
-_LIT8( KTestStoreStatusText, "STORE-STATUS-TEXT" ); // X-Mms-Store-Status-Text
-_LIT8( KTestTotals, "TOTALS" ); // X-Mms-Totals
-// Delete confirmation header structure
-// This consists of index, content location, response status and response status text.
-// All three values are not always necessary for each index, but at least content-location
-// and response status should be present.
-// The index retains its value until a new index is encountered.
-_LIT8( KTestDeleteInfoIndex, "DELETESTATUSINDEX" ); // index for next delete info fields
-// This header must precede content-location, response-status and response-text fields
-// in a delete confirmation. Index retains its value until a new index is encountered.
-
-// Element descriptor header not implemented
-
-// Application id headers
-// These will officially be supported in MMS encapsulation version 1.3
-// Java has non-standard support even earlier
-
-_LIT8( KTestApplicId, "APPLIC-ID" ); // X-Mms-Applic-ID
-_LIT8( KTestReplyApplicId, "REPLY-APPLIC-ID" ); // X-Mms-Reply-Applic-ID
-_LIT8( KTestApplicInfo, "AUX-APPLIC-INFO" ); // X-Mms-Aux-Applic-Info
-
-// Since Encapsulation 1.3
-_LIT8( KTestContentClass, "CONTENT-CLASS" ); // X-Mms-Content-Class
-_LIT8( KTestDrmContent, "DRM-CONTENT" ); // X-Mms-DRM-Content
-_LIT8( KTestAdaptationAllowed, "ADAPTATION-ALLOWED" ); // X-Mms-Adaptation-Allowed
-_LIT8( KTestRecommendedRetrievalMode, "REC-RETRIEVAL-MODE" ); // X-Mms-Recommended-Retrieval-Mode
-_LIT8( KTestRecRetrievalModeText, "REC-RETR-MODE-TEXT" ); // X-Mms-Recommended-Retrieval-Mode-Text
-_LIT8( KTestReplaceId, "REPLACE-ID" ); // X-Mms-Replace-ID
-_LIT8( KTestStatusText, "STATUS-TEXT" ); // X-Mms-Status-Text
-_LIT8( KTestCancelId, "CANCEL-ID" ); // X-Mms-Cancel-ID
-_LIT8( KTestCancelStatus, "CANCEL-STATUS" ); // X-Mms-Cancel-Status
-
-// DATA TYPES
-#define aSet 1
-#define aReset 0
-#define PartCount 100
-#define MaxAttaCount 10
-#define DefaultBufLen 256
-#define MaxRecipients 5
-
-// status returned by ReadRow
-enum TTestReadStatus
- {
- ETestUnknown,
- ETestNewMessage,
- ETestNewAttachment,
- ETestEof, // End of file
- ETestMessageType,
- ETestDate,
- ETestFrom,
- ETestTo,
- ETestCc,
- ETestBcc,
- ETestAlias,
- ETestFromAlias,
- ETestToAlias,
- ETestCcAlias,
- ETestBccAlias,
- ETestSubject,
- ETestExpiryRel,
- ETestExpiryAbs,
- ETestDeliveryTimeRel,
- ETestDeliveryTimeAbs,
- ETestPriority,
- ETestSenderVisibility,
- ETestDeliveryReport,
- ETestReadReply,
- ETestAttachmentType,
-// ETestAttachmentName,
- ETestAttachmentCharset,
- ETestAttachmentCid,
- ETestAttachmentRoot,
- ETestSettings,
- ETestMessageClass,
- ETestDelivReportSendAllow,
- ETestSingleMessageClass,
- ETestReplyCharging,
- ETestReplyChargAbs,
- ETestReplyChargRel,
- ETestReplyChargSize,
- ETestReplyChargID,
- ETestTID,
- ETestContentLocation,
- ETestPreviouslySentIndex,
- ETestPreviouslySentBy,
- ETestPreviouslySentDate,
- ETestMessageId,
- ETestMessageSize,
- ETestVersion,
- ETestReadStatus,
- ETestResponseStatus,
- ETestResponseText,
- ETestRetrieveStatus,
- ETestRetrieveText,
- ETestStatus,
- ETestAttribute,
- ETestDistributionIndicator,
- ETestLimit,
- ETestMessageQuota,
- ETestSizeQuota,
- ETestMessageTotal,
- ETestSizeTotal,
- ETestMessageCount,
- ETestAddKeyword,
- ETestRemoveKeyword,
- ETestFilterKeyword,
- ETestMMState,
- ETestQuota,
- ETestStart,
- ETestStore,
- ETestStored,
- ETestStoreStatus,
- ETestStoreStatusText,
- ETestTotals,
- ETestDeleteInfoIndex,
- ETestApplicId,
- ETestReplyApplicId,
- ETestApplicInfo,
- ETestContentClass,
- ETestDrmContent,
- ETestAdaptationAllowed,
- ETestRecommendedRetrievalMode,
- ETestRecRetrievalModeText,
- ETestReplaceId,
- ETestStatusText,
- ETestCancelId,
- ETestCancelStatus,
- ETestAttaRecommendedName,
- ETestAttachmentContLoc,
- ETestAttContTypeParamName,
- ETestAttContTypeParamValue,
- ETestAttXTypeParamName,
- ETestAttXTypeParamValue
-
- };
-
-// VALUE KEYWORDS
-_LIT( KPersonal, "Personal" );
-_LIT( KAdvertisement, "Advertisement" );
-_LIT( KInformational, "Informational" );
-_LIT( KAuto, "Auto" );
-_LIT( KLow, "Low" );
-_LIT( KNormal, "Normal" );
-_LIT( KHigh, "High" );
-_LIT( KHide, "Hide" );
-_LIT( KShow, "Show" );
-_LIT( KYes, "Yes" );
-_LIT( KNo, "No" );
-_LIT( KOn, "On" );
-_LIT( KOff, "Off" );
-_LIT( KDeferred, "Deferred" );
-_LIT( KExpired, "Expired" );
-_LIT( KRetrieved, "Retrieved" );
-_LIT( KRejected, "Rejected" );
-_LIT( KUnrecognized, "Unrecognized" );
-_LIT( KIndeterminate, "Indeterminate" );
-_LIT( KForwarded, "Forwarded" );
-_LIT( KUnreachable, "Unreachable" );
-_LIT( KDraft, "Draft");
-_LIT( KSent, "Sent" );
-_LIT( KNew, "New" );
-// X-Mms-Message-Type
-_LIT( KSendReq, "SendReq" );
-_LIT( KSendConf, "SendConf" );
-_LIT( KNotifInd, "NotifInd" );
-_LIT( KNotifResp, "NotifResp" );
-_LIT( KRetrConf, "RetrConf" );
-_LIT( KAckInd, "AckInd" );
-_LIT( KDelInd, "DelInd" );
-_LIT( KReadReqInd, "ReadReqInd" );
-_LIT( KReadOrigInd, "ReadOrigInd" );
-_LIT( KForwardRec, "ForwardReq" );
-_LIT( KForwardConf, "ForwardConf" );
-_LIT( KMBoxStoreReq, "MBoxStoreReq" );
-_LIT( KMBoxStoreConf, "MBoxStoreConf" );
-_LIT( KMBoxViewReq, "MBoxViewReq" );
-_LIT( KMBoxViewConf, "MBoxViewConf" );
-_LIT( KMBoxUploadReq, "MBoxUploadReq" );
-_LIT( KMBoxUploadConf, "MBoxUploadConf" );
-_LIT( KMBoxDeleteReq, "MBoxDeleteReq" );
-_LIT( KMBoxDeleteConf, "MBoxDeleteConf" );
-_LIT( KMBoxDescr, "MBoxDescr" );
-_LIT( KDeleteReq, "DeleteReq" );
-_LIT( KDeleteConf, "DeleteConf" );
-_LIT( KCancelReq, "CancelReq" );
-_LIT( KCancelResp, "CancelConf" );
-// X-Mms-Read-Status
-_LIT( KRead, "Read" );
-_LIT( KDelNotRead, "DeletedNotRead" );
-// X-Mms-Reply-Charging
-_LIT( KRequested, "Requested" );
-_LIT( KReqTextOnly, "ReqTextOnly" );
-_LIT( KAccepted, "Accepted" );
-_LIT( KAccTextOnly, "AccTextOnly" );
-// X-Mms-Cancel-Status (only receival of request, not actual cancellation)
-_LIT( KCancelSuccessful, "CancelSuccess" );
-_LIT( KCancelCorrupted, "CancelCorrupted" );
-// X-Mms-Content-Class
-_LIT( KText, "Text" );
-_LIT( KImageBasic, "ImageBasic" );
-_LIT( KImageRich, "ImageRich" );
-_LIT( KVideoBasic, "VideoBasic" );
-_LIT( KVideoRich, "VideoRich" );
-_LIT( KMegaPixel, "MegaPixel" );
-_LIT( KContentBasic, "ContentBasic" );
-_LIT( KContentRich, "ContentRich" );
-// X-Mms-Recommended-Retrieval-Mode
-_LIT( KManual, "Manual" );
-
-//X-Mms-ResponseStatus
-// legacy values
-_LIT( KOk, "OK" );
-_LIT( KErrUnspecified, "Unspecified" );
-_LIT( KErrServiceDenied, "ServiceDenied" );
-_LIT( KErrMessageFormatCorrupt, "FormatCorrupt" );
-_LIT( KErrAddressUnresolved, "AddressUnresolved" );
-_LIT( KErrMessageNotFound, "MessageNotFound" );
-_LIT( KErrNetworkProblem, "NetworkProblem" );
-_LIT( KErrContentNotAccepted, "ContentNotAccepted" );
-_LIT( KErrUnsupportedMessage, "UnsupportedMessage" );
-// values since 1.1 (and 1.2)
-_LIT( KErrTransient, "TransientFailure" );
-_LIT( KErrTransientAddressUnresolved, "TransientAddressUnresolved" );
-_LIT( KErrTransientNotFound, "TransientMessageNotFound" );
-_LIT( KErrTransientNetworkproblem, "TransientNetworkProblem" );
-_LIT( KErrTransientPartialSuccess, "PartialSuccess" );
-_LIT( KErrPermanent, "PermanentFailure" );
-_LIT( KErrPermanentServiceDenied, "PermanentServiceDenied" );
-_LIT( KErrPermanentMessageFormatCorrupt, "PermanentFormatCorrupt" );
-_LIT( KErrPermanentAddressUnresolved, "PermanentAddressUnresolved" );
-_LIT( KErrPermanentNotFound, "PermanentMessageNotFound" );
-_LIT( KErrPermanentContentNotAccepted, "PermanentContentNotAccepted" );
-_LIT( KErrReplyChargingLimitNotMet, "ReplyChargingLimitNotMet" );
-_LIT( KErrReplyChargingRequestNotAccepted, "ReplyChargingRequestNotAccepted" );
-_LIT( KErrReplyChargingForwardingDenied, "ReplyChargingForwardingDenied" );
-_LIT( KErrReplyChargingNotSupported, "ReplyChargingNotSupported" );
-_LIT( KErrAddressHidingNotSupported, "AddressHidingNotSupported" );
-_LIT( KErrPermanentLackOfPrepaid, "PermanentLackOfPrepaid" );
-//X-Mms-RetrieveStatus (one extra value)
-_LIT( KErrRetrieveContentUnsupported, "PermanentContentUnsupported" );
-//X-Mms-Store-Status (one extra value)
-_LIT( KErrMMBoxFull, "MMBoxFull" );
-
-_LIT8( KTestContent, "Content" ); // For attribute list only
-_LIT8( KTestAdditionalHeaders, "ADDITIONAL-HEADERS" ); // For attribute list only
-_LIT8( KTestDeliveryTime, "DELIVERY-TIME"); // for attribute list only
-_LIT8( KTestExpiry, "EXPIRY"); // for attribute list only
-_LIT8( KTestReplyCharg, "REPLY-CHARG-DEADLINE" ); // for attribute list only
-_LIT8( KTestContentType, "CONTENT-TYPE" ); // for attribute list only
-
-/**
-* CMmsReadFile
-*/
-NONSHARABLE_CLASS( CMmsReadFile ):public CBase
- {
- public: // Constructors and destructor
-
- static CMmsReadFile* NewL(RFs& aFs, RFileReadStream& aReadStream ); // Two-phased constructor.
- virtual ~CMmsReadFile(); // Destructor
-
- public: // New functions
-
- TInt CompleteTestL(TInt aMessageCounter, CMmsHeaders& aMmsHeaders);
- TTestReadStatus ReadRowL();
- void CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders );
- TInt FindAlias(TPtrC alias);
- void SetAttaStructure( TBool aOldAttaStructure = EFalse );
-
- protected: // Functions from base classes
-
- private:
-
- CMmsReadFile(); // C++ default constructor.
- // By default constructor is private.
- void ConstructL( RFs& aFs, RFileReadStream& aReadStream );
- void Reset();
-
- public: // data
- TInt iMessageType;
-
-
- private: // Data
-
- RFs iFs;
- RFileReadStream* iReader;
- TBuf<DefaultBufLen> iValueBuffer;
- CDesCArray* iAliasArray; // aliases
- HBufC8* iByteBuffer;
- TTime iDate;
- CArrayPtrFlat<CMmsAttaStructure>* iAttaStructures;
- TInt iAttaCount;
- TInt iAttaRoot;
- TInt iAliasCount;
- TInt iNextMessageType;
- TParse iParse;
- TFileName iFilename;
-
- protected: // Data
- private: // Data
-
- // CArrayFixFlat <TestMessage>* iMessages;
-
- public: // Friend classes
- protected: // Friend classes
- private: // Friend classes
-
- };
-
-
-NONSHARABLE_CLASS( CMmsAttaStructure ):public CBase
- {
- public: // Constructors and destructor
- static CMmsAttaStructure* NewL(); // Two-phased constructor.
- virtual ~CMmsAttaStructure(); // Destructor
- private:
- CMmsAttaStructure(); // C++ default constructor.
- // By default constructor is private.
- void ConstructL();
-
- public: // Data
- HBufC8* iAtta;
- HBufC8* iAttaName; // content location
- HBufC8* iAttaType;
- HBufC8* iAttaCid;
- TInt iAttaCharset;
- HBufC* iAttaRecommendedName; // recommended filename
- CDesC8ArrayFlat* iContentTypeParams; // zero or more "parameter"
- CDesC8ArrayFlat* iXTypeParams; // zero or more X-Type "parameters"
-
- };
-
-
-#endif // MMSREADFILE_H
-
-// End of File
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/inc/mmstestbed.h Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#ifndef MMSTESTBED_H
-#define MMSTESTBED_H
-
-#ifdef BUILD_MMSTESTBED_DLL
-#define MMSTESTBED_EXPORT Q_DECL_EXPORT
-#else
-#define MMSTESTBED_EXPORT Q_DECL_IMPORT
-#endif
-
-#include <QObject>
-#include <QString>
-
-#include <msvids.h> //for consts like KMsvNullIndexEntryIdValue
-#include <MSVAPI.H>
-#include <MTCLREG.H>
-#include <mmsclient.h>
-//#include <mmsservercommon.h>
-
-class CTestUiTimer;
-class CMsvSession;
-class CMmsClientMtm;
-class CMmsSettings;
-class CMmsHeaders;
-class CLogEvent;
-class CLogViewEvent;
-class CLogFilter;
-class CLogClient;
-
-class MMSTESTBED_EXPORT MmsTestBed : public QObject, public MMsvSessionObserver
- {
- Q_OBJECT
-
-public:
- /**
- *
- */
- MmsTestBed();
- ~MmsTestBed();
- void setConnectionLocal(bool value);
- void fromOutboxToMmsc();
- void fromMmscToInbox();
- /**
- * cleanup MMS service
- */
- void cleanupAndCreateNewService();
- void deleteNotifications();
- void restoreFactorySettings();
- void setFetchingState( TMmsReceivingMode aState );
- void sendFromFile();
- void sendOneByOne();
- void sendNotifications();
- void copyDrafts();
- void garbageCollection(TUint32 aReason = 0x00000001); //0x00000001 == KMmsReasonBoot
- void messageVariation();
- void cancelSendScheduling();
- void scheduledSend(TMsvId aBoxId, TInt aDelay = 5);
- void deleteSendSchedule();
- void cancelFetchScheduling();
- void fetchForced(TInt aDelay = 5);
- void deleteFetchSchedule();
- void doAFetchCycle();
- void createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry);
- void cleanOutbox();
- void cleanInbox();
- void cleanSent();
- void cleanDrafts();
- void cleanAll();
- void reply();
- void replyToAll();
- void forward();
- void sendReadReport(); // send a read report
- int fromOutboxToMmscWithMemoryFailure(); // returns memory failure count
- int fromMmscToInboxWithMemoryFailure(); // returns memory failure count
- void sendViaClient();
- void scheduledFetch(TInt aDelay = 5);
- void fetchForcedImmediate();
- void getEventType();
- void addEventType();
- void deleteEventType();
- void cleanLog();
- void setOnline(bool value);
- void generateDeliveryReport( CMmsHeaders* aMmsHeaders );
- void sendDeliveryReport();
-
-signals:
- void entryCreatedInDraft(long int id);
- void entryMovedToOutbox(long int id);
- void entryMovedToSent(long int id);
- void entryCreatedInInbox(long int id);
-
-protected:
- /**
- * From MMsvSessionObserver
- */
- void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
- TAny* aArg2, TAny* aArg3);
-
-private:
- void findDefaultL();
- void createMmsService();
- void cleanup();
- void deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry);
- void testFile(TFileName& aFilePath, TInt aCommand = 0, TMsvId aBox = KMsvGlobalOutBoxIndexEntryId);
- void addMMBoxDescriptions();
- void encodeMessageFromDrafts();
- TMsvId findMMSFolder();
- bool checkLogClient();
- int getLogEntries();
-
-private:
- //data
- CTestUiTimer* iTimer;
- CMsvOperationActiveSchedulerWait* iWait;
- CMsvSession* iSession;
- CClientMtmRegistry* iClientMtmRegistry;
- CMmsClientMtm* iMmsClient;
- CMmsSettings* iSettings;
- CMmsHeaders* iMmsHeaders;
- TMsvId iServiceId;
- TMsvId iDefaultServiceId;
- TMsvSessionEvent iEvent;
- RFs iFs;
- TFileName iFilename;
- TFileName iCurrentFile;
- TFileName iCurrentPath;
- TParse iParse; // parse buffer as member to save stack space
- CBufFlat* iEncodeBuffer;
- CMsvEntrySelection* iMsvEntrySelection;
- CLogEvent* iLogEvent;
- CLogClient* iLogClient;
- CLogViewEvent* iLogView;
- CLogFilter* iLogFilter;
- };
-
-#endif // MMSTESTBED_H
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/inc/mmstestbed.hrh Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#include <bldvariant.hrh>
-
-
-#ifndef MMSTESTBED_HRH
-#define MMSTESTBED_HRH
-
-enum
-{
- EAppMainOk = 1,
- EAppMainCancel,
- //
- EMenufrmCmdCascadeTest,
- ECleanup,
- ECleanOutbox,
- ESaveSettings,
- ELoadSettings,
- ECleanInbox,
- EShowIn,
- EShowOut,
- EOutToMMSC,
- EMMSCToIn,
- ESendScheduled,
- EReceiveScheduled,
- EShowSent,
- ECleanSent,
- EStartMyNotifier,
- EGetEventType,
- EAddEventType,
- EDeleteEventType,
- EViewLog,
- ECleanLog,
- EShowWapAccessPoints,
- ESelectWapAccessPoint,
- EShowConnectionMode,
- EShowIAP,
- EConnectToIAP,
- EDeleteSendSchedule,
- EDeleteReceiveSchedule,
- EDeleteNotifications,
- ERestoreFactorySettings,
- ECreateFromFile,
- EShowNotifications,
- ESendDeliveryReport,
- EShowDrafts,
- ECleanDrafts,
- ECleanAll,
- EFetchingDeferred,
- EFetchingOn,
- ESendFromFile,
- ESwitchToLocal,
- ESwitchToGlobal,
- EDecodeLoggingOn,
- EDecodeLoggingOff,
- EBinaryDumpOn,
- EBinaryDumpOff,
- ESendNotification,
- ECreateToInbox,
- ECreateToSentItems,
- ESendFromDrafts,
- EFindMMSFolder,
- ESendOneByOne,
- ECreateToDrafts,
- ESendViaClient,
- ESendMemFail,
- EFetchMemFail,
- EReceiveForced,
- ECreateHeadersFromFile,
- ESwitchToOffline,
- ESwitchToOnline,
- ECopyDrafts,
- ECreateNotification,
- EReply,
- EReplyToAll,
- EForward,
- EFetchingManual,
- EFirstBoot,
- ENoFirstBoot,
- EFindNetworkStatus,
- ESendReadReport,
- ECreateMMBoxViewConf,
- EGetMMBoxView,
- ECleanMMBox,
- EShowMMBox
-};
-
-#define ETestLabel1 1
-#define ETestLabel2 2
-#define ETestLabel3 3
-#define ETestLabel4 4
-
-#define EServiceList 2
-
-
-enum TTestBedDlgCtrlIds
- {
- ETestEditField = 1
- };
-
-enum TEditServiceControls
- {
- EFolderLabel = 1,
- EEditUri
-// EEditServiceFolder,
-// ENameLabel,
-// EEditServiceName,
-// ENumberLabel,
-// EEditServiceNumber
- };
-
-enum
- {
- EFsViewDialogId = 1
- };
-
-#endif
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/inc/mmsteststaticutils.h Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,203 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#ifndef MMSTESTSTATICUTILS_H
-#define MMSTESTSTATICUTILS_H
-
-#include <e32std.h>
-#include <msvstd.h>
-#include <badesca.h>
-
-#include "mmsconst.h"
-
-class RFs;
-class CMsvSession;
-class CMmsEncode;
-class CMmsHeaders;
-
-#ifdef __WINS__
-_LIT( KRootPath, "c:\\" );
-#else
-// This is removable disk.
-// drive letter should not be hard coded, must be investigated further
-// We use c: for a while for the tests (to be cahnged later)
-_LIT( KRootPath, "c:\\" );
-//_LIT( KRootPath, "e:\\" );
-#endif
-
-// directory where mmbox descriptions are created
-_LIT( KMmsMMBoxDescriptionDirectory, "C:\\mmsmmboxdescriptions\\");
-// directory where created headers are dumped
-_LIT( KMmsDumpDirectory, "C:\\mmsdump\\");
-// content type of MMS PDUs
-_LIT8( KMmsMimeType, "application/vnd.wap.mms-message" );
-
-_LIT( KWild, "*" );
-
-
-/**
- * joined array structure
- *
- */
-NONSHARABLE_CLASS( TMmsJoinedArrays ): public MDesCArray
- {
-public:
- TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2);
- TInt MdcaCount() const;
- TPtrC16 MdcaPoint(TInt aIndex) const;
-private:
- CDesCArray* const & iArray1;
- CDesCArray* const & iArray2;
- };
-
-/**
- * static utility functions
- *
- */
-class TMmsTestUtils
- {
-
-public:
-
- /**
- *
- */
- TMmsTestUtils();
-
- /**
- * read phone number for sending messages
- *
- * @param aFileName full path for filename
- * @param aFs file system handle
- * @return allocated pointer containing the name
- * The caller must delete the pointer when no longer needed
- */
- static HBufC* ReadContactFromFileL( TDesC& aFileName, RFs& aFs );
-
- static void DecodeLoggingOnL();
- static void DecodeLoggingOffL();
- static void BinaryDumpOnL();
- static void BinaryDumpOffL();
-
- /**
- * Clean all temporary directories used in local mode.
- * Does not delete the directories, only the contents
- *
- * @param aFs file system handle
- */
- static void CleanDirectoryL( RFs& aFs );
-
- /**
- * Dump a binary message
- *
- * @param aBuffer buffer containing the binary message
- * @param aFilename full path of the directory whenre the dump goes
- * @param aParse reference to parser (to save stack space)
- * @param aFs file system handle
- */
- static void Dump(
- CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs );
-
- /**
- * Delete all MMS messages and notifications from a given folder
- *
- * @param aBoxId folder id
- * @param aSession Messaging server session
- */
- static void CleanBoxL(TMsvId aBoxId, CMsvSession& aSession);
-
- /**
- * turn on logging messages sent to email addresses
- */
- static void EmailLoggingOnL();
-
- /**
- * turn off logging messages sent to email addresses
- */
- static void EmailLoggingOffL();
-
- /**
- * load list of children into selection and return count
- *
- * @param aBoxId folder id
- * @param aMsvEntrySelection reference to a pointer that will contain the list of child ids
- * caller is responsible of deleting the pointer afterwards.
- * Pointer may be NULL at entry, and a new pointer will be allocated
- * @param aSession messge server session
- * @param aMessageType child MTM type, default is multimedia message
- * @return number of entries in selection
- */
- static TInt CountChildrenL(
- TMsvId aBoxId,
- CMsvEntrySelection*& aMsvEntrySelection,
- CMsvSession& aSession,
- TUid aMessageType = KUidMsgTypeMultimedia);
-
- /**
- * Create a folder entry
- *
- * @param aSession messge server session
- * @param aParentFolder the parent folder
- * @param aFolderName name of the folder
- * @param aFolderId will contain the if of the new folder if creation was successful
- */
- static void CreateFolderEntryL(
- CMsvSession& aSession,
- TMsvId aParentFolder,
- const TDesC& aFolderName,
- TMsvId& aFolderId );
-
- /**
- * Create an MMS notification from data in buffer
- * @param aNotificationFolder mms notification folder (target folder)
- * @param aServiceId id of MMS service
- * @param aEncodeBuffer buffer that contains the data
- * @param aSession message server session
- * @return id of the created notification
- */
- static TMsvId CreateNotificationEntryL(
- TMsvId aNotificationFolder,
- TMsvId aServiceId,
- CBufFlat* aEncodeBuffer,
- CMsvSession& aSession );
-
- /**
- * Encode an MMS notification into buffer
- * @param aUrl url of the notification for local messages a filepath
- * @param aSize size of the message
- * @param aMmsHeaders MMS headers structure for creating the notification
- * @param aMmsEncoder reference to CMmsEncode class
- * @param aEncodeBuffer flat buffer that will contain the encoded notification
- */
- static void FormNotification(
- TDesC8& aUrl,
- TInt aSize,
- CMmsHeaders& aMmsHeaders,
- CMmsEncode& aMmsEncoder,
- CBufFlat* aEncodeBuffer );
-
-
- static TBool IsDrive(const TDesC& aFileName);
- static TBool IsDir(const TDesC& aFileName, RFs& aFs);
- static TBool IsFile(const TDesC& aFileName, RFs& aFs);
-
-
-private:
-
- };
-
-
-#endif // MMSTESTSTATICUTILS_H
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/inc/mmstestuitimer.h Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#ifndef C_TESTUITIMER_H
-#define C_TESTUITIMER_H
-
-
-#include <e32base.h>
-
-#define KPeriod 10000 // period of timer
-
-/**
- * timer for test programs
- */
-NONSHARABLE_CLASS( CTestUiTimer ): public CTimer
- {
-public:
-
- static CTestUiTimer* NewL();
- virtual ~CTestUiTimer();
-
- void RunL();
- void DoCancel();
- void ConstructL();
- void IssueRequest();
- void TimeoutOperation(CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds);
-
-private:
- CTestUiTimer();
-
-public:
- TTimeIntervalMicroSeconds32 period;
-
-private: // data
- CActive* iObject;
- };
-
-#endif // C_TESTUITIMER_H
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/mmstestbed.pro Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-QT += testlib
-QT -= gui
-
-TEMPLATE = lib
-
-TARGET = mmstestbed
-
-INCLUDEPATH += .
-INCLUDEPATH += inc
-INCLUDEPATH += ../../inc
-INCLUDEPATH += ../../../../../mmsengine/inc
-INCLUDEPATH += ../../../../../mmsengine/mmscodec/inc
-INCLUDEPATH += ../../../../../mmsengine/mmshttptransport/inc
-INCLUDEPATH += ../../../../../mmsengine/mmsmessage/inc
-INCLUDEPATH += ../../../../../mmsengine/mmsconninit/inc
-INCLUDEPATH += ../../../../../mmsengine/mmsserver/inc
-INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
-
-DEFINES += BUILD_MMSTESTBED_DLL
-
-SOURCES += src/mmstestbed.cpp \
- src/mmsteststaticutils.cpp \
- src/mmsreadfile.cpp \
- src/mmstestuitimer.cpp
-
-HEADERS += inc/mmstestbed.h \
- inc/mmsteststaticutils.h \
- inc/mmsreadfile.h \
- inc/mmstestuitimer.h \
- inc/mmstestbed.hrh
-
-SYMBIAN_PLATFORMS = WINSCW ARMV5
-
-symbian {
- TARGET.CAPABILITY = CAP_GENERAL_DLL
- TARGET.EPOCSTACKSIZE = 0x8000
- TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
- TARGET.EPOCALLOWDLLDATA = 1
- }
-
-# Build.inf rules
-BLD_INF_RULES.prj_exports += \
- "$${LITERAL_HASH}include <platform_paths.hrh>"
-
-LIBS += -lmsgs \
- -lmmsmessage \
- -lmmsconninit \
- -lmmscodec \
- -lmmsserversettings \
- -lcentralrepository \
- -lapparc \
- -lbafl \
- -lefsrv \
- -lesock \
- -lestor \
- -leuser \
- -llogcli \
- -llogwrap \
- -lapgrfx \
- -lapmime
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/src/mmsreadfile.cpp Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1799 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-// INCLUDE FILES
-#include <e32base.h>
-#include <badesca.h>
-#include <e32def.h>
-#include <s32file.h>
-#include <msvids.h>
-#include <mtmdef.h>
-//#include <eikenv.h>
-#include <apgcli.h>
-#include <CMsvMimeHeaders.h>
-#include <AknNoteWrappers.h>
-
-#include <mmsservercommon.h>
-#include "mmsconst.h"
-#include "mmsclient.h"
-#include "mmsheaders.h"
-#include "mmsreadfile.h"
-#include "mmsmmboxviewheaders.h"
-#include "mmsmmboxmessageheaders.h"
-#include "mmsmmboxflags.h"
-#include "mmssettings.h"
-
-
-// EXTERNAL DATA STRUCTURES
-
-// EXTERNAL FUNCTION PROTOTYPES
-
-// CONSTANTS
-const TInt KMmsGranularity = 8;
-_LIT( K1970, "19700000:000000.000000" ); // 1-Jan 1970 0:00:00
-
-
-// MACROS
-
-// LOCAL CONSTANTS AND MACROS
-
-// MODULE DATA STRUCTURES
-
-// LOCAL FUNCTION PROTOTYPES
-
-// ==================== LOCAL FUNCTIONS ====================
-
-
-// ================= MEMBER FUNCTIONS =======================
-
-
-// C++ default constructor can NOT contain any code, that
-// might leave.
-//
-CMmsReadFile::CMmsReadFile()
- {
- // all member variables in a class derived from CBase
- // are automatically set to 0.
- }
-
-
-//
-void CMmsReadFile::ConstructL(RFs& aFs, RFileReadStream& aReadStream )
- {
- // iRowBuffer = HBufC8::NewMaxL( 500 ); // Max row length!!!!
- iFs = aFs;
- iReader = &aReadStream;
- iByteBuffer = HBufC8::NewL( DefaultBufLen );
- iAliasArray = new ( ELeave ) CDesCArrayFlat( KMmsGranularity );
- iAttaStructures = new ( ELeave ) CArrayPtrFlat<CMmsAttaStructure>( KMmsGranularity );
- Reset();
- }
-
-// Two-phased constructor.
-CMmsReadFile* CMmsReadFile::NewL(RFs& aFs, RFileReadStream& aReadStream )
- {
- CMmsReadFile* self = new ( ELeave ) CMmsReadFile();
- CleanupStack::PushL( self );
- self->ConstructL( aFs, aReadStream );
- CleanupStack::Pop();
- return self;
- }
-
-
-// Destructor
-CMmsReadFile::~CMmsReadFile()
- {
- Reset(); // resets and destroys all array data
- if (iAliasArray != NULL) iAliasArray->Reset();
- delete iByteBuffer;
- delete iAliasArray;
- delete iAttaStructures;
- }
-
-void CMmsReadFile::Reset()
- {
- // reset all arrays
- if (iAttaStructures != NULL) iAttaStructures->ResetAndDestroy();
- iAttaCount = 0;
- iAttaRoot = 0;
- }
-
-// ---------------------------------------------------------
-// CMmsReadFile()::CompleteTest
-// ---------------------------------------------------------
-//
-TInt CMmsReadFile::CompleteTestL( TInt aMessageCounter, CMmsHeaders& aMmsHeaders )
-{
- Reset(); // new message
-
- TUint32 val;
- TUint limit = 1000000;
- TUint sizeLimit = 1000 * 1024; //max message size 1000 kB!
- TUint allLimit = 999999;
- TInt error;
- TRadix radix = EDecimal;
- TLex16 lex;
- TTestReadStatus readStatus = ETestUnknown;
- CMmsAttaStructure* oneAtta = NULL;
- TInt index;
- TTime y1970( K1970 );
- TTimeIntervalMicroSeconds interval;
- TTime date;
- TInt order = 0;
- TInt16 shortInteger = 0;
-
- //iso luuppi, joka kiertää ja lukee kunnes EOF tule vastaan
- //Big Loop, which passes around and read until the EOF
-
- iMessageType = iNextMessageType;
- while(readStatus != ETestEof)
- {
- readStatus = ReadRowL();
- if ( readStatus == ETestEof )
- {
- return(-1);
- }
- if ( readStatus == ETestUnknown )
- {
- // A line containing only comments, or an unknown tag
- // As using the scripts to test settings is no longer supported,
- // any old keywords used to test CMmsSettings class are ignored
- continue;
- }
- if( readStatus == ETestNewMessage )
- {
- iNextMessageType = readStatus;
- if(aMessageCounter++)
- {
- return(NULL);
- }
- else
- {
- iMessageType = iNextMessageType;
- continue;
- }
- }
- if ( iMessageType == ETestNewMessage)
- {
- switch(readStatus)
- {
- case ETestFrom:
- aMmsHeaders.SetSenderL( iValueBuffer );
- break;
- case ETestFromAlias:
- index = FindAlias(iValueBuffer);
- if(index >= 0)
- {
- aMmsHeaders.SetSenderL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ) );
- }
- break;
- case ETestTo:
- aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientTo );
- break;
- case ETestToAlias:
- index = FindAlias(iValueBuffer);
- if(index >= 0)
- {
- aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsTo );
- }
- break;
- case ETestCc:
- aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientCc );
- break;
- case ETestCcAlias:
- index = FindAlias(iValueBuffer);
- if(index >= 0)
- {
- aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsCc );
- }
- break;
- case ETestBcc:
- aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientBcc );
- break;
- case ETestBccAlias:
- index = FindAlias(iValueBuffer);
- if(index >= 0)
- {
- aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsBcc );
- }
- break;
- case ETestSubject:
- aMmsHeaders.SetSubjectL( iValueBuffer );
- break;
- case ETestExpiryRel:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetExpiryInterval( val );
- }
- break;
- case ETestExpiryAbs:
- error = iDate.Set(iValueBuffer);
- interval = iDate.MicroSecondsFrom( y1970 );
- // expiry date in seconds from 1.1.1970.
- aMmsHeaders.SetExpiryDate( (interval.Int64())/1000000 );
- break;
- case ETestDeliveryTimeRel:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetDeliveryTimeInterval( val );
- }
- break;
- case ETestDeliveryTimeAbs:
- error = iDate.Set(iValueBuffer);
- interval = iDate.MicroSecondsFrom( y1970 );
- aMmsHeaders.SetDeliveryDate( (interval.Int64())/1000000 );
- break;
- case ETestDate:
- error = iDate.Set(iValueBuffer);
- interval = iDate.MicroSecondsFrom( y1970 );
- aMmsHeaders.SetDate( (interval.Int64())/1000000 );
- case ETestPriority:
- val = 0;
- if ((iValueBuffer.CompareF(KLow)) == 0)
- {
- val = EMmsPriorityLow;
- }
- else if ((iValueBuffer.CompareF(KNormal)) == 0)
- {
- val = EMmsPriorityNormal;
- }
- else if ((iValueBuffer.CompareF(KHigh)) == 0)
- {
- val = EMmsPriorityHigh;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetMessagePriority( val );
- break;
- case ETestSenderVisibility:
- val = 0;
- if ((iValueBuffer.CompareF(KHide)) == 0)
- {
- val = EMmsSenderVisibilityHide;
- }
- else if ((iValueBuffer.CompareF(KShow)) == 0)
- {
- val = EMmsSenderVisibilityShow;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetSenderVisibility( val );
- break;
- case ETestDeliveryReport:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = EMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = EMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetDeliveryReport( val );
- break;
- case ETestDelivReportSendAllow:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = EMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = EMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetReportAllowed( val );
- break;
-
- case ETestReadReply:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = EMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = EMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetReadReply( val );
- break;
- case ETestNewAttachment:
- oneAtta = CMmsAttaStructure::NewL();
- iAttaStructures->AppendL(oneAtta);
- oneAtta->iAtta->Des().Copy( iValueBuffer );
- iAttaCount++;
- break;
- case ETestAttachmentType:
- if (oneAtta != NULL)
- {
- oneAtta->iAttaType->Des().Copy( iValueBuffer );
- }
- break;
- case ETestAttachmentContLoc:
- if (oneAtta != NULL)
- {
- oneAtta->iAttaName->Des().Copy( iValueBuffer );
- }
- break;
- case ETestAttaRecommendedName:
- if (oneAtta != NULL)
- {
- oneAtta->iAttaRecommendedName->Des().Copy( iValueBuffer );
- }
- break;
- case ETestAttachmentCharset:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- if (oneAtta != NULL)
- {
- oneAtta->iAttaCharset = val;
- }
- }
- break;
- case ETestAttachmentCid:
- if (oneAtta != NULL)
- {
- oneAtta->iAttaCid->Des().Copy(iValueBuffer);
- }
- break;
- case ETestAttContTypeParamName:
- iByteBuffer->Des().Copy( iValueBuffer );
- if (oneAtta != NULL)
- {
- oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
- }
- break;
- case ETestAttContTypeParamValue:
- iByteBuffer->Des().Copy( iValueBuffer );
- if (oneAtta != NULL)
- {
- oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
- }
- break;
- case ETestAttXTypeParamName:
- iByteBuffer->Des().Copy( iValueBuffer );
- if (oneAtta != NULL)
- {
- oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
- }
- break;
- case ETestAttXTypeParamValue:
- iByteBuffer->Des().Copy( iValueBuffer );
- if (oneAtta != NULL)
- {
- oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
- }
- break;
- case ETestAttachmentRoot:
- iAttaRoot = iAttaCount;
- break;
- case ETestAlias:
- // all aliases are global even if they appear
- // in the middle of a message
- iAliasArray->AppendL( iValueBuffer );
- iAliasCount++;
- break;
- case ETestMessageClass: // should be handled!
- val = EMmsClassPersonal;
- if ((iValueBuffer.CompareF(KPersonal)) == 0)
- {
- val = EMmsClassPersonal;
- }
- else if ((iValueBuffer.CompareF(KAdvertisement)) == 0)
- {
- val = EMmsClassAdvertisement;
- }
- else if ((iValueBuffer.CompareF(KInformational)) == 0)
- {
- val = EMmsClassInformational;
- }
- else if ((iValueBuffer.CompareF(KAuto)) == 0)
- {
- val = EMmsClassAuto;
- }
- else
- {
- val = (TMmsMessageClass)KMmsTestIllegalValue;
- }
- aMmsHeaders.SetMessageClass( val );
- break;
- case ETestReplyCharging:
- val = 0;
- if ((iValueBuffer.CompareF(KRequested)) == 0)
- {
- val = KMmsReplyChargingRequested;
- }
- else if ((iValueBuffer.CompareF(KReqTextOnly)) == 0)
- {
- val = KMmsReplyChargingRequestedTextOnly;
- }
- else if ((iValueBuffer.CompareF(KAccepted)) == 0)
- {
- val = KMmsReplyChargingAccepted;
- }
- else if ((iValueBuffer.CompareF(KAccTextOnly)) == 0)
- {
- val = KMmsReplyChargingAcceptedTextOnly;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetReplyCharging( val );
- break;
- case ETestReplyChargAbs:
- error = date.Set(iValueBuffer);
- if ( error == KErrNone )
- {
- interval = date.MicroSecondsFrom( y1970 );
- aMmsHeaders.SetReplyChargingDate( (interval.Int64())/1000000 );
- }
- break;
- case ETestReplyChargRel:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetReplyChargingInterval( val );
- }
- break;
- case ETestReplyChargSize:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,sizeLimit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetReplyChargingSize( val );
- }
- break;
- case ETestReplyChargID:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetReplyChargingIdL( iByteBuffer->Des() );
- break;
- case ETestTID:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetTidL( iByteBuffer->Des() );
- break;
- case ETestContentLocation:
- iByteBuffer->Des().Copy( iValueBuffer );
- if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
- aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf ||
- aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteReq )
- {
- aMmsHeaders.MMBoxMessageHeadersL().ContentLocationList().AppendL( iByteBuffer->Des() );
- }
- else if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
- {
- aMmsHeaders.InsertDeleteContentLocationL( order, iByteBuffer->Des() );
- }
- else
- {
- aMmsHeaders.SetContentLocationL( iByteBuffer->Des() );
- }
- break;
- case ETestPreviouslySentIndex:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- order = val;
- break;
- case ETestPreviouslySentBy:
- aMmsHeaders.InsertPreviouslySentByL( order, iValueBuffer );
- break;
- case ETestPreviouslySentDate:
- error = date.Set(iValueBuffer);
- if ( error == KErrNone )
- {
- interval = date.MicroSecondsFrom( y1970 );
- aMmsHeaders.InsertPreviouslySentDateL( order, (interval.Int64())/1000000 );
- }
- break;
- case ETestMessageId:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetMessageIdL( iByteBuffer->Des() );
- break;
- case ETestMessageSize:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,sizeLimit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetMessageSize( val );
- }
- break;
- case ETestVersion:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,EHex,limit);
- shortInteger = TInt16( val );
- if (error == KErrNone)
- {
- aMmsHeaders.SetMmsVersion( shortInteger );
- }
- break;
- case ETestReadStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KRead)) == 0)
- {
- val = KMmsReadStatusRead;
- }
- else if ((iValueBuffer.CompareF(KDelNotRead)) == 0)
- {
- val = KMmsReadStatusDeletedWithoutBeingRead;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetReadStatus( val );
- break;
- case ETestResponseStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KOk)) == 0)
- {
- val = KMmsStatusOk;
- }
- else if ((iValueBuffer.CompareF(KErrUnspecified)) == 0)
- {
- val = KMmsErrorUnspecified;
- }
- else if ((iValueBuffer.CompareF(KErrServiceDenied)) == 0)
- {
- val = KMmsErrorServiceDenied;
- }
- else if ((iValueBuffer.CompareF(KErrMessageFormatCorrupt)) == 0)
- {
- val = KMmsErrorMessageFormatCorrupt;
- }
- else if ((iValueBuffer.CompareF(KErrAddressUnresolved)) == 0)
- {
- val = KMmsErrorSendingAddressUnresolved;
- }
- else if ((iValueBuffer.CompareF(KErrMessageNotFound)) == 0)
- {
- val = KMmsErrorMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrNetworkProblem)) == 0)
- {
- val = KMmsErrorNetworkProblem;
- }
- else if ((iValueBuffer.CompareF(KErrContentNotAccepted)) == 0)
- {
- val = KMmsErrorNoContentAccepted;
- }
- else if ((iValueBuffer.CompareF(KErrUnsupportedMessage)) == 0)
- {
- val = KMmsErrorUnsupportedMessage;
- }
- else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
- {
- val = KMmsErrorTransientFailure;
- }
- else if ((iValueBuffer.CompareF(KErrTransientAddressUnresolved)) == 0)
- {
- val = KMmsErrorTransientSendingAddressUnresolved;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
- {
- val = KMmsErrorTransientMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
- {
- val = KMmsErrorTransientNetworkProblem;
- }
- else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
- {
- val = KMmsErrorPermanentFailure;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
- {
- val = KMmsErrorPermanentServiceDenied;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
- {
- val = KMmsErrorPermanentMessageFormatCorrupt;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentAddressUnresolved)) == 0)
- {
- val = KMmsErrorPermanentSendingAddressUnresolved;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
- {
- val = KMmsErrorPermanentMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentContentNotAccepted)) == 0)
- {
- val = KMmsErrorPermanentContentNotAccepted;
- }
- else if ((iValueBuffer.CompareF(KErrReplyChargingLimitNotMet)) == 0)
- {
- val = KMmsErrorPermanentReplyChargingLimitationsNotMet;
- }
- else if ((iValueBuffer.CompareF(KErrReplyChargingRequestNotAccepted)) == 0)
- {
- val = KMmsErrorPermanentReplyChargingRequestNotAccepted;
- }
- else if ((iValueBuffer.CompareF(KErrReplyChargingForwardingDenied)) == 0)
- {
- val = KMmsErrorPermanentReplyChargingForwardingDenied;
- }
- else if ((iValueBuffer.CompareF(KErrReplyChargingNotSupported)) == 0)
- {
- val = KMmsErrorPermanentReplyChargingNotSupported;
- }
- else if ((iValueBuffer.CompareF(KErrTransientPartialSuccess)) == 0)
- {
- val = KMmsErrorTransientPartialSuccess;
- }
- else if ((iValueBuffer.CompareF(KErrAddressHidingNotSupported)) == 0)
- {
- val = KMmsErrorPermanentAddressHidingNotSupported;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
- {
- aMmsHeaders.InsertDeleteStatusL( order, val );
- }
- else
- {
- aMmsHeaders.SetResponseStatus( val );
- }
- break;
- case ETestResponseText:
- if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
- {
- aMmsHeaders.InsertDeleteResponseTextL( order, iValueBuffer );
- }
- else
- {
- aMmsHeaders.SetResponseTextL( iValueBuffer );
- }
- break;
- case ETestRetrieveStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KOk)) == 0)
- {
- val = KMmsStatusOk;
- }
- else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
- {
- val = KMmsErrorTransientFailure;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
- {
- val = KMmsErrorReceiveTransientMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
- {
- val = KMmsErrorReceiveTransientNetworkProblem;
- }
- else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
- {
- val = KMmsErrorPermanentFailure;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
- {
- val = KMmsErrorPermanentServiceDenied;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
- {
- val = KMmsErrorReceivePermanentMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrRetrieveContentUnsupported)) == 0)
- {
- val = KMmsErrorReceivePermanentContentUnsupported;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetResponseStatus( val );
- break;
- case ETestRetrieveText:
- aMmsHeaders.SetResponseTextL( iValueBuffer );
- break;
- case ETestStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KDeferred)) == 0)
- {
- val = KMmsMessageStatusDeferred;
- }
- else if ((iValueBuffer.CompareF(KExpired)) == 0)
- {
- val = KMmsMessageStatusExpired;
- }
- else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
- {
- val = KMmsMessageStatusRetrieved;
- }
- else if ((iValueBuffer.CompareF(KRejected)) == 0)
- {
- val = KMmsMessageStatusRejected;
- }
- else if ((iValueBuffer.CompareF(KUnrecognized)) == 0)
- {
- val = KMmsMessageStatusUnrecognized;
- }
- else if ((iValueBuffer.CompareF(KIndeterminate)) == 0)
- {
- val = KMmsMessageStatusIndeterminate;
- }
- else if ((iValueBuffer.CompareF(KForwarded)) == 0)
- {
- val = KMmsMessageStatusForwarded;
- }
- else if ((iValueBuffer.CompareF(KUnreachable)) == 0)
- {
- val = KMmsMessageStatusUnreachable;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetStatus( val );
- break;
- case ETestMessageType:
- val = 0;
- if ((iValueBuffer.CompareF(KSendReq)) == 0)
- {
- val = KMmsMessageTypeMSendReq;
- }
- else if ((iValueBuffer.CompareF(KSendConf)) == 0)
- {
- val = KMmsMessageTypeMSendConf;
- }
- else if ((iValueBuffer.CompareF(KNotifInd)) == 0)
- {
- val = KMmsMessageTypeMNotificationInd;
- }
- else if ((iValueBuffer.CompareF(KNotifResp)) == 0)
- {
- val = KMmsMessageTypeMNotifyRespInd;
- }
- else if ((iValueBuffer.CompareF(KRetrConf)) == 0)
- {
- val = KMmsMessageTypeMRetrieveConf;
- }
- else if ((iValueBuffer.CompareF(KAckInd)) == 0)
- {
- val = KMmsMessageTypeAcknowledgeInd;
- }
- else if ((iValueBuffer.CompareF(KDelInd)) == 0)
- {
- val = KMmsMessageTypeDeliveryInd;
- }
- else if ((iValueBuffer.CompareF(KReadReqInd)) == 0)
- {
- val = KMmsMessageTypeReadRecInd;
- }
- else if ((iValueBuffer.CompareF(KReadOrigInd)) == 0)
- {
- val = KMmsMessageTypeReadOrigInd;
- }
- else if ((iValueBuffer.CompareF(KForwardRec)) == 0)
- {
- val = KMmsMessageTypeForwardReq;
- }
- else if ((iValueBuffer.CompareF(KForwardConf)) == 0)
- {
- val = KMmsMessageTypeForwardConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxStoreReq)) == 0)
- {
- val = KMmsMessageTypeMboxStoreReq;
- }
- else if ((iValueBuffer.CompareF(KMBoxStoreConf)) == 0)
- {
- val = KMmsMessageTypeMboxStoreConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxViewReq)) == 0)
- {
- val = KMmsMessageTypeMboxViewReq;
- }
- else if ((iValueBuffer.CompareF(KMBoxViewConf)) == 0)
- {
- val = KMmsMessageTypeMboxViewConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxUploadReq)) == 0)
- {
- val = KMmsMessageTypeMBoxUploadReq;
- }
- else if ((iValueBuffer.CompareF(KMBoxUploadConf)) == 0)
- {
- val = KMmsMessageTypeMBoxUploadConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxDeleteReq)) == 0)
- {
- val = KMmsMessageTypeMBoxDeleteReq;
- }
- else if ((iValueBuffer.CompareF(KMBoxDeleteConf)) == 0)
- {
- val = KMmsMessageTypeMBoxDeleteConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxDescr)) == 0)
- {
- val = KMmsMessageTypeMBoxDescr;
- }
- else if ((iValueBuffer.CompareF(KDeleteReq)) == 0)
- {
- val = KMmsMessageTypeDeleteReq;
- }
- else if ((iValueBuffer.CompareF(KDeleteConf)) == 0)
- {
- val = KMmsMessageTypeDeleteConf;
- }
- else if ((iValueBuffer.CompareF(KCancelReq)) == 0)
- {
- val = KMmsMessageTypeCancelReq;
- }
- else if ((iValueBuffer.CompareF(KCancelResp)) == 0)
- {
- val = KMmsMessageTypeCancelConf;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetMessageType( val );
- break;
- case ETestAttribute:
- val = 0;
- iByteBuffer->Des().Copy( iValueBuffer );
- if ((iByteBuffer->Des().CompareF(KTestBcc)) == 0)
- {
- val = KMmsAssignedBcc;
- }
- else if ((iByteBuffer->Des().CompareF(KTestCc)) == 0)
- {
- val = KMmsAssignedCc;
- }
- else if ((iByteBuffer->Des().CompareF(KTestContent)) == 0)
- {
- val = KMmsAssignedContent;
- }
- else if ((iByteBuffer->Des().CompareF(KTestContentType)) == 0)
- {
- val = KMmsAssignedContentType;
- }
- else if ((iByteBuffer->Des().CompareF(KTestDate)) == 0)
- {
- val = KMmsAssignedDate;
- }
- else if ((iByteBuffer->Des().CompareF(KTestDeliveryReport)) == 0)
- {
- val = KMmsAssignedDeliveryReport;
- }
- else if ((iByteBuffer->Des().CompareF(KTestDeliveryTime)) == 0)
- {
- val = KMmsAssignedDeliveryTime;
- }
- else if ((iByteBuffer->Des().CompareF(KTestExpiry)) == 0)
- {
- val = KMmsAssignedExpiry;
- }
- else if ((iByteBuffer->Des().CompareF(KTestFrom)) == 0)
- {
- val = KMmsAssignedFrom;
- }
- else if ((iByteBuffer->Des().CompareF(KTestMessageClass)) == 0)
- {
- val = KMmsAssignedMessageClass;
- }
- else if ((iByteBuffer->Des().CompareF(KTestMessageId)) == 0)
- {
- val = KMmsAssignedMessageId;
- }
- else if ((iByteBuffer->Des().CompareF(KTestMessageSize)) == 0)
- {
- val = KMmsAssignedMessageSize;
- }
- else if ((iByteBuffer->Des().CompareF(KTestPriority)) == 0)
- {
- val = KMmsAssignedPriority;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReadReply)) == 0)
- {
- val = KMmsAssignedReadReply;
- }
- else if ((iByteBuffer->Des().CompareF(KTestSubject)) == 0)
- {
- val = KMmsAssignedSubject;
- }
- else if ((iByteBuffer->Des().CompareF(KTestTo)) == 0)
- {
- val = KMmsAssignedTo;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReplyCharging)) == 0)
- {
- val = KMmsAssignedReplyCharging;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReplyChargID)) == 0)
- {
- val = KMmsAssignedReplyChargingID;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReplyCharg)) == 0)
- {
- val = KMmsAssignedReplyChargingDeadline;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReplyChargSize)) == 0)
- {
- val = KMmsAssignedReplyChargingSize;
- }
- else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentBy)) == 0)
- {
- val = KMmsAssignedPreviouslySentBy;
- }
- else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentDate)) == 0)
- {
- val = KMmsAssignedPreviouslySentDate;
- }
- else if ((iByteBuffer->Des().CompareF(KTestAdditionalHeaders)) == 0)
- {
- val = KMmsAssignedAdditionalHeaders;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxViewHeadersL().AttributeArray().InsertInOrder(val);
- break;
- case ETestDistributionIndicator:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetDistributionIndicator( val );
- break;
- case ETestLimit:
- aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if( error == KErrNone )
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(val);
- }
- break;
- case ETestMessageQuota:
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(val);
- }
- break;
- case ETestSizeQuota:
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(val);
- }
- break;
- case ETestMessageTotal:
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(val);
- }
- break;
- case ETestSizeTotal:
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(val);
- }
- break;
- case ETestMessageCount:
- aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(val);
- }
- break;
- case ETestAddKeyword:
- aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsAddToken, iValueBuffer);
- break;
- case ETestRemoveKeyword:
- aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsRemoveToken, iValueBuffer);
- break;
- case ETestFilterKeyword:
- aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsFilterToken, iValueBuffer);
- break;
- case ETestMMState:
- val = 0;
- if ((iValueBuffer.CompareF(KDraft)) == 0)
- {
- val = KMmsDraft;
- }
- else if ((iValueBuffer.CompareF(KSent)) == 0)
- {
- val = KMmsSent;
- }
- else if ((iValueBuffer.CompareF(KNew)) == 0)
- {
- val = KMmsNew;
- }
- else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
- {
- val = KMmsRetrieved;
- }
- else if ((iValueBuffer.CompareF(KForwarded)) == 0)
- {
- val = KMmsForwarded;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
- aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf )
- {
- aMmsHeaders.MMBoxViewHeadersL().MMStateArray().InsertInOrder( val );
- }
- else
- {
- aMmsHeaders.MMBoxMessageHeadersL().SetMMState( val );
- }
- break;
- case ETestQuota:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxViewHeadersL().SetMmsQuotas( val );
- break;
- case ETestStart:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMmsStart(val);
- }
- break;
- case ETestStore:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxMessageHeadersL().SetMmsStore( val );
- break;
- case ETestStored:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxMessageHeadersL().SetMmsStored( val );
- break;
- case ETestStoreStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KOk)) == 0)
- {
- val = KMmsStatusOk;
- }
- else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
- {
- val = KMmsErrorTransientFailure;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
- {
- val = KMmsErrorStoreStatusTransientNetworkProblem;
- }
- else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
- {
- val = KMmsErrorPermanentFailure;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
- {
- val = KMmsErrorPermanentServiceDenied;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
- {
- val = KMmsErrorPermanentMessageFormatCorrupt;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
- {
- val = KMmsErrorStoreStatusPermanentMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrMMBoxFull)) == 0)
- {
- val = KMmsErrorStoreStatusPermanentMmboxFull;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatus( val );
- break;
- case ETestStoreStatusText:
- aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatusTextL( iValueBuffer );
- break;
- case ETestTotals:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxViewHeadersL().SetMmsTotals( val );
- break;
-
- case ETestDeleteInfoIndex:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- order = val;
- break;
-
- case ETestApplicId:
- aMmsHeaders.SetApplicIdL( iValueBuffer );
- break;
- case ETestReplyApplicId:
- aMmsHeaders.SetReplyApplicIdL( iValueBuffer );
- break;
- case ETestApplicInfo:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetAuxApplicInfoL( iByteBuffer->Des() );
- break;
- case ETestContentClass:
- val = 0;
- if ((iValueBuffer.CompareF(KText)) == 0)
- {
- val = KMmsContentClassText;
- }
- else if ((iValueBuffer.CompareF(KImageBasic)) == 0)
- {
- val = KMmsContentClassImageBasic;
- }
- else if ((iValueBuffer.CompareF(KImageRich)) == 0)
- {
- val = KMmsContentClassImageRich;
- }
- else if ((iValueBuffer.CompareF(KVideoBasic)) == 0)
- {
- val = KMmsContentClassVideoBasic;
- }
- else if ((iValueBuffer.CompareF(KVideoRich)) == 0)
- {
- val = KMmsContentClassVideoRich;
- }
- else if ((iValueBuffer.CompareF(KMegaPixel)) == 0)
- {
- val = KMmsContentClassMegaPixel;
- }
- else if ((iValueBuffer.CompareF(KContentBasic)) == 0)
- {
- val = KMmsContentClassContentBasic;
- }
- else if ((iValueBuffer.CompareF(KContentRich)) == 0)
- {
- val = KMmsContentClassContentRich;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetContentClass( val );
- break;
- case ETestDrmContent:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetDrmContent( val );
- break;
- case ETestAdaptationAllowed:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetAdaptationAllowed( val );
- break;
- case ETestRecommendedRetrievalMode:
- val = 0;
- if ((iValueBuffer.CompareF(KManual)) == 0)
- {
- val = KMmsRecommendedRetrievalModeManual;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetRecommendedRetrievalMode( val );
- break;
- case ETestRecRetrievalModeText:
- aMmsHeaders.SetRecommendedRetrievalModeTextL( iValueBuffer );
- break;
- case ETestReplaceId:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
- break;
- case ETestStatusText:
- aMmsHeaders.SetResponseTextL( iValueBuffer );
- break;
- case ETestCancelId:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
- break;
- case ETestCancelStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KCancelSuccessful)) == 0)
- {
- val = KMmsCancelRequestSuccessfullyReceived;
- }
- else if ((iValueBuffer.CompareF(KCancelCorrupted)) == 0)
- {
- val = KMmsCancelRequestCorrupted;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetCancelStatus( val );
- break;
- default:
- break;
- }
- }
- else
- {
- switch(readStatus)
- {
- case ETestAlias:
- iAliasArray->AppendL( iValueBuffer );
- iAliasCount++;
- break;
-
- default:
- break;
- }
-
- }
- }
- return(-1);
-}
-
-// ---------------------------------------------------------
-// CMmsReadFile()::ReadRowL
-// ---------------------------------------------------------
-//
-TTestReadStatus CMmsReadFile::ReadRowL()
- {
-
- TBuf8<DefaultBufLen> RowBuffer;
- TBuf8<32> KeyBuffer;
-
- // READ ONE ROW AND DROP CR+LF FROM THE END OF LINE
- TChar delim( 10 );
- iReader->ReadL( RowBuffer, delim);
- TInt length = RowBuffer.Length();
- if ( RowBuffer.Length() < 2 )
- {
- return ETestEof;
- }
- RowBuffer.Delete(length - 2,2);
-
- // DROP POSSIBLE COMMENT OUT
- TInt pos = RowBuffer.Locate( ';' );
- if ( pos >= 0 ) RowBuffer.Delete( pos, length-pos-2 );
-
- if ( RowBuffer.Length() == 0 )
- {
- // the line contained only comment
- return ETestUnknown;
- }
-
- // First split the row (:)
- pos = RowBuffer.Locate( ':' );
- if (pos > 0)
- {
- TPtrC8 p = RowBuffer.Mid( pos+1 );
- length = p.Length();
- iValueBuffer.Zero();
- for (TInt i=0; i < length; ++i)
- {
- iValueBuffer.Append(p[i]);
- }
- iValueBuffer.Trim();
- TPtrC8 pp = RowBuffer.Left(pos);
- KeyBuffer.CopyUC(pp);
- KeyBuffer.Trim();
- }
- // TRY TO FIND CORRECT TAG
- if ((KeyBuffer.CompareF(KTestNewMessage)) == 0) return(ETestNewMessage);
- if ((KeyBuffer.CompareF(KTestMessageType)) == 0) return ETestMessageType;
- if ((KeyBuffer.CompareF(KTestDate)) == 0) return ETestDate;
- if ((KeyBuffer.CompareF(KTestFrom)) == 0) return ETestFrom;
- if ((KeyBuffer.CompareF(KTestTo)) == 0) return ETestTo;
- if ((KeyBuffer.CompareF(KTestCc)) == 0) return ETestCc;
- if ((KeyBuffer.CompareF(KTestBcc)) == 0) return ETestBcc;
- if ((KeyBuffer.CompareF(KTestSubject)) == 0) return ETestSubject;
- if ((KeyBuffer.CompareF(KTestExpiryRel)) == 0) return ETestExpiryRel;
- if ((KeyBuffer.CompareF(KTestExpiryAbs)) == 0) return ETestExpiryAbs;
- if ((KeyBuffer.CompareF(KTestDeliveryTimeRel)) == 0) return ETestDeliveryTimeRel;
- if ((KeyBuffer.CompareF(KTestDeliveryTimeAbs)) == 0) return ETestDeliveryTimeAbs;
- if ((KeyBuffer.CompareF(KTestPriority)) == 0) return ETestPriority;
- if ((KeyBuffer.CompareF(KTestSenderVisibility)) == 0) return ETestSenderVisibility;
- if ((KeyBuffer.CompareF(KTestDeliveryReport)) == 0) return ETestDeliveryReport;
- if ((KeyBuffer.CompareF(KTestReadReply)) == 0) return ETestReadReply;
- if ((KeyBuffer.CompareF(KTestNewAttachment)) == 0) return ETestNewAttachment;
- if ((KeyBuffer.CompareF(KTestAttachmentName)) == 0) return ETestAttaRecommendedName;
- if ((KeyBuffer.CompareF(KTestAttachmentContLoc)) == 0) return ETestAttachmentContLoc;
- if ((KeyBuffer.CompareF(KTestAttachmentType)) == 0) return ETestAttachmentType;
- if ((KeyBuffer.CompareF(KTestAttachmentCharset)) == 0) return ETestAttachmentCharset;
- if ((KeyBuffer.CompareF(KTestAttachmentCid)) == 0) return ETestAttachmentCid;
- if ((KeyBuffer.CompareF(KTestAttachmentRoot)) == 0) return ETestAttachmentRoot;
- if ((KeyBuffer.CompareF(KTestEndOfFile)) == 0) return ETestEof;
- if ((KeyBuffer.CompareF(KTestMessageClass)) == 0) return ETestMessageClass;
- if ((KeyBuffer.CompareF(KTestDelivRepSendAllow)) == 0) return ETestDelivReportSendAllow;
- if ((KeyBuffer.CompareF(KTestAlias)) == 0 ) return ETestAlias;
- if ((KeyBuffer.CompareF(KTestFromAlias)) == 0 ) return ETestFromAlias;
- if ((KeyBuffer.CompareF(KTestToAlias)) == 0 ) return ETestToAlias;
- if ((KeyBuffer.CompareF(KTestCcAlias)) == 0 ) return ETestCcAlias;
- if ((KeyBuffer.CompareF(KTestBccAlias)) == 0 ) return ETestBccAlias;
- if ((KeyBuffer.CompareF(KTestReplyCharging)) == 0 ) return ETestReplyCharging;
- if ((KeyBuffer.CompareF(KTestReplyChargAbs)) == 0 ) return ETestReplyChargAbs;
- if ((KeyBuffer.CompareF(KTestReplyChargRel)) == 0 ) return ETestReplyChargRel;
- if ((KeyBuffer.CompareF(KTestReplyChargSize)) == 0 ) return ETestReplyChargSize;
- if ((KeyBuffer.CompareF(KTestReplyChargID)) == 0 ) return ETestReplyChargID;
- if ((KeyBuffer.CompareF(KTestTID)) == 0 ) return ETestTID;
- if ((KeyBuffer.CompareF(KTestContentLocation)) == 0 ) return ETestContentLocation;
- if ((KeyBuffer.CompareF(KTestPreviouslySentIndex)) == 0 ) return ETestPreviouslySentIndex;
- if ((KeyBuffer.CompareF(KTestPreviouslySentBy)) == 0 ) return ETestPreviouslySentBy;
- if ((KeyBuffer.CompareF(KTestPreviouslySentDate)) == 0 ) return ETestPreviouslySentDate;
- if ((KeyBuffer.CompareF(KTestMessageId)) == 0 ) return ETestMessageId;
- if ((KeyBuffer.CompareF(KTestMessageSize)) == 0 ) return ETestMessageSize;
- if ((KeyBuffer.CompareF(KTestVersion)) == 0 ) return ETestVersion;
- if ((KeyBuffer.CompareF(KTestReadStatus)) == 0 ) return ETestReadStatus;
- if ((KeyBuffer.CompareF(KTestResponseStatus)) == 0 ) return ETestResponseStatus;
- if ((KeyBuffer.CompareF(KTestResponseText)) == 0 ) return ETestResponseText;
- if ((KeyBuffer.CompareF(KTestRetrieveStatus)) == 0 ) return ETestRetrieveStatus;
- if ((KeyBuffer.CompareF(KTestRetrieveText)) == 0 ) return ETestRetrieveText;
- if ((KeyBuffer.CompareF(KTestStatus)) == 0 ) return ETestStatus;
- if ((KeyBuffer.CompareF(KTestAttribute)) == 0 ) return ETestAttribute;
- if ((KeyBuffer.CompareF(KTestDistributionIndicator)) == 0 ) return ETestDistributionIndicator;
- if ((KeyBuffer.CompareF(KTestLimit)) == 0 ) return ETestLimit;
- if ((KeyBuffer.CompareF(KTestMessageQuota)) == 0 ) return ETestMessageQuota;
- if ((KeyBuffer.CompareF(KTestSizeQuota)) == 0 ) return ETestSizeQuota;
- if ((KeyBuffer.CompareF(KTestMessageTotal)) == 0 ) return ETestMessageTotal;
- if ((KeyBuffer.CompareF(KTestSizeTotal)) == 0 ) return ETestSizeTotal;
- if ((KeyBuffer.CompareF(KTestMessageCount)) == 0 ) return ETestMessageCount;
- if ((KeyBuffer.CompareF(KTestAddKeyword)) == 0 ) return ETestAddKeyword;
- if ((KeyBuffer.CompareF(KTestRemoveKeyword)) == 0 ) return ETestRemoveKeyword;
- if ((KeyBuffer.CompareF(KTestFilterKeyword)) == 0 ) return ETestFilterKeyword;
- if ((KeyBuffer.CompareF(KTestMMState)) == 0 ) return ETestMMState;
- if ((KeyBuffer.CompareF(KTestQuota)) == 0 ) return ETestQuota;
- if ((KeyBuffer.CompareF(KTestStart)) == 0 ) return ETestStart;
- if ((KeyBuffer.CompareF(KTestStore)) == 0 ) return ETestStore;
- if ((KeyBuffer.CompareF(KTestStored)) == 0 ) return ETestStored;
- if ((KeyBuffer.CompareF(KTestStoreStatus)) == 0 ) return ETestStoreStatus;
- if ((KeyBuffer.CompareF(KTestStoreStatusText)) == 0 ) return ETestStoreStatusText;
- if ((KeyBuffer.CompareF(KTestTotals)) == 0 ) return ETestTotals;
- if ((KeyBuffer.CompareF(KTestDeleteInfoIndex)) == 0 ) return ETestDeleteInfoIndex;
- if ((KeyBuffer.CompareF(KTestApplicId)) == 0 ) return ETestApplicId;
- if ((KeyBuffer.CompareF(KTestReplyApplicId)) == 0 ) return ETestReplyApplicId;
- if ((KeyBuffer.CompareF(KTestApplicInfo)) == 0 ) return ETestApplicInfo;
- if ((KeyBuffer.CompareF(KTestContentClass)) == 0 ) return ETestContentClass;
- if ((KeyBuffer.CompareF(KTestDrmContent)) == 0 ) return ETestDrmContent;
- if ((KeyBuffer.CompareF(KTestAdaptationAllowed)) == 0 ) return ETestAdaptationAllowed;
- if ((KeyBuffer.CompareF(KTestRecommendedRetrievalMode)) == 0 ) return ETestRecommendedRetrievalMode;
- if ((KeyBuffer.CompareF(KTestRecRetrievalModeText)) == 0 ) return ETestRecRetrievalModeText;
- if ((KeyBuffer.CompareF(KTestReplaceId)) == 0 ) return ETestReplaceId;
- if ((KeyBuffer.CompareF(KTestStatusText)) == 0 ) return ETestStatusText;
- if ((KeyBuffer.CompareF(KTestCancelId)) == 0 ) return ETestCancelId;
- if ((KeyBuffer.CompareF(KTestCancelStatus)) == 0 ) return ETestCancelStatus;
- if ((KeyBuffer.CompareF(KTestAttContTypeParamName)) == 0 ) return ETestAttContTypeParamName;
- if ((KeyBuffer.CompareF(KTestAttContTypeParamValue)) == 0 ) return ETestAttContTypeParamValue;
- if ((KeyBuffer.CompareF(KTestAttXTypeParamName)) == 0 ) return ETestAttXTypeParamName;
- if ((KeyBuffer.CompareF(KTestAttXTypeParamValue)) == 0 ) return ETestAttXTypeParamValue;
- return ETestUnknown;
- }
-
-// ---------------------------------------------------------
-// CMmsReadFile()::CreateMessageL
-// program build a message from given parts
-// ---------------------------------------------------------
-//
-void CMmsReadFile::CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders )
- {
-
- // Reset inactivity timer to keem viewServer from crashing
- User::ResetInactivityTime();
-
- TInt i;
- TInt error = KErrNone;
- RFile attaFile;
- _LIT8(KLeftAngle, "<");
- _LIT8(KRightAngle, ">");
- // we can't use "seconds from" as it only returns a
- // 32 bit signed integer. If fails in 2038.
- // "microseconds from" returns a 64 bit signed integer
-
- CMsvStore* store = aMmsClient->Entry().EditStoreL();
- CleanupStack::PushL(store);
- aMmsHeaders->StoreL(*store);
- store->CommitL();
- CleanupStack::PopAndDestroy( store );
- store = NULL;
-
- aMmsClient->LoadMessageL(); // read store is needed to do this
-
- store = aMmsClient->Entry().EditStoreL();
- CleanupStack::PushL(store);
- CMsvAttachment* attaInfo = NULL;
- TMsvAttachmentId attaId = 0;
-
- for ( i=0; i < iAttaStructures->Count(); ++i)
- {
- attaId = KMsvNullIndexEntryId;
- iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
-
- error = attaFile.Open( iFs, iFilename, EFileShareReadersOnly | EFileRead );
- User::LeaveIfError( error );
-
- CleanupClosePushL(attaFile);
-
- CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
- CleanupStack::PushL( mimeHeaders );
- TPtrC8 contentType = iAttaStructures->At(i)->iAttaType->Des();
-
- TDataRecognitionResult result;
- result.Reset(); // make sure that it is cleared
-
- if(iAttaStructures->At(i)->iAttaCid->Length())
- {
- TPtr8 attaCID = iAttaStructures->At(i)->iAttaCid->Des();
- if (attaCID.Find(KLeftAngle) == 0 &&
- attaCID.Find(KRightAngle) == attaCID.Length()-1 )
- {
- // remove angle brackets from cid
- attaCID = attaCID.Mid(1,attaCID.Length()-2);
- }
- mimeHeaders->SetContentIdL(attaCID);
- }
-
- if (iAttaStructures->At(i)->iAttaCharset)
- {
- mimeHeaders->SetMimeCharset(iAttaStructures->At(i)->iAttaCharset);
- }
-
- if (iAttaStructures->At(i)->iAttaName->Length())
- {
- iFilename.Copy(iAttaStructures->At(i)->iAttaName->Des());
- }
- iParse.Set( iFilename, NULL, NULL );
- iFilename.Copy( iParse.NameAndExt() );
-
- mimeHeaders->SetContentLocationL( iFilename );
-
- // if Mime type has not been set, use RapaRecognizer
- if ( iAttaStructures->At(i)->iAttaType->Length() == 0 && iFilename.Length() > 0)
- {
- // TO BE IMPLEMENTED
-
- RApaLsSession lsSession;
-
- if ( lsSession.Connect() == KErrNone )
- {
- CleanupClosePushL( lsSession );
-
- iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
- if ( lsSession.RecognizeData( iFilename, TPtrC8(), result ) == KErrNone )
- {
- // Check confidence level. Recognization must be at least
- // "EProbable". We don't accept the result if it is "EPossible"
- // or "EUnlikely" or "ENotRecognized"!
-
- if ( result.iConfidence < CApaDataRecognizerType::EProbable )
- {
- result.Reset(); // clear buffer and try again with longer buffer
- }
-
- TPtrC8 mimeBuf8 = result.iDataType.Des8();
-
- if ( mimeBuf8.Length() == 0 )
- {
- // Open file buffer and try again..
-
- TInt bufSize = 0;
- (void)lsSession.GetMaxDataBufSize( bufSize ); // ignore errors
- if ( bufSize <= 0 )
- {
- bufSize = 30;
- }
- HBufC8* buf = HBufC8::NewLC( bufSize );
- TPtr8 des = buf->Des();
-
- RFile file;
- TInt err=file.Open( iFs, iFilename, EFileShareReadersOnly );
- if ( err == KErrNone )
- {
- err = file.Read( des );
- file.Close();
- if ( err == KErrNone )
- {
- if ( ( lsSession.RecognizeData( iFilename, des, result ) ) == KErrNone )
- {
- mimeBuf8.Set( result.iDataType.Des8() );
- }
- }
-
- }
- CleanupStack::PopAndDestroy(); // buf
- }
- if ( mimeBuf8.Length() > 0 &&
- result.iConfidence >= CApaDataRecognizerType::EProbable )
- {
- contentType.Set( result.iDataType.Des8() );
- }
- }
- CleanupStack::PopAndDestroy(1); // lssession
- }
- }
-
- if ( contentType.Length() > 0 )
- {
- TInt position = contentType.Find( KMmsSlash8 );
- if ( position >= 0 )
- {
- mimeHeaders->SetContentTypeL( contentType.Left( position ) );
- }
- if ( position < contentType.Length() - 1 )
- {
- mimeHeaders->SetContentSubTypeL( contentType.Mid( position + 1 ) );
- }
-// CreateAttachment2L sets the content type to attaInfo
-// attaInfo->SetMimeTypeL( contentType );
- }
-
- if (iAttaStructures->At(i)->iAttaRecommendedName->Length())
- {
- iFilename.Copy(iAttaStructures->At(i)->iAttaRecommendedName->Des());
- iParse.Set( iFilename, NULL, NULL );
- iFilename.Copy( iParse.NameAndExt() );
- mimeHeaders->SetSuggestedFilenameL( iFilename );
- }
-
- TInt j = 0;
- for ( j = 0; j < iAttaStructures->At(i)->iContentTypeParams->MdcaCount(); ++j )
- {
- mimeHeaders->ContentTypeParams().AppendL( iAttaStructures->At(i)->iContentTypeParams->MdcaPoint( j ) );
- }
- for ( j = 0; j < iAttaStructures->At(i)->iXTypeParams->MdcaCount(); ++j )
- {
- mimeHeaders->XTypeParams().AppendL( iAttaStructures->At(i)->iXTypeParams->MdcaPoint( j ) );
- }
-
- attaInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
- // attaInfo does not go onto cleaunpstack because ownership will
- // be transferred to attachment manager.
-
- aMmsClient->CreateAttachment2L(
- *store,
- attaFile,
- contentType,
- *mimeHeaders,
- attaInfo,
- attaId);
- attaInfo = NULL; // ownership transferred
-
- CleanupStack::PopAndDestroy(); // mimeHeaders
- CleanupStack::PopAndDestroy(); // attaFile.Close()
-
- if ( iAttaRoot > 0 && iAttaRoot == ( i + 1 ) )
- {
- aMmsClient->SetMessageRootL( attaId );
- }
- }
-
- store->CommitL();
- CleanupStack::PopAndDestroy(); // store
-
- // This frees all memory and resets all values
- Reset();
- // Reset inactivity timer to keem viewServer from crashing
- User::ResetInactivityTime();
- }
-
-
-// ---------------------------------------------------------
-// CMmsReadFile()::FindAlias
-// program build a message from given parts
-// ---------------------------------------------------------
-//
-TInt CMmsReadFile::FindAlias( TPtrC aAlias )
- {
- TBuf<DefaultBufLen> abuf;
- for( TInt i=0; i < iAliasCount; ++i )
- {
- abuf.Copy( iAliasArray->MdcaPoint(i) );
- abuf.SetLength( abuf.Locate('=') );
- if( ( abuf.CompareF( aAlias ) ) == 0 ) return( i );
- }
- return( -1 );
- }
-
-
-// C++ default constructor can NOT contain any code, that
-// might leave.
-//
-CMmsAttaStructure::CMmsAttaStructure()
- {
- iAtta = NULL;
- iAttaType = NULL;
- iAttaName = NULL;
- iAttaCid = NULL;
- iAttaRecommendedName = NULL;
- }
-
-
-//
-void CMmsAttaStructure::ConstructL()
- {
- iAtta = HBufC8::NewL(DefaultBufLen);
- iAttaType = HBufC8::NewL(DefaultBufLen);
- iAttaName = HBufC8::NewL(DefaultBufLen);
- iAttaCid = HBufC8::NewL(DefaultBufLen);
- iAttaRecommendedName = HBufC::NewL(DefaultBufLen);
- iAttaCharset = 0;
- iXTypeParams = new(ELeave) CDesC8ArrayFlat(4);
- iContentTypeParams = new(ELeave) CDesC8ArrayFlat(4);
-
- }
-
-// Two-phased constructor.
-CMmsAttaStructure* CMmsAttaStructure::NewL()
- {
- CMmsAttaStructure* self = new ( ELeave ) CMmsAttaStructure;
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop();
- return self;
- }
-
-// Destructor
-CMmsAttaStructure::~CMmsAttaStructure()
- {
- delete iAtta;
- delete iAttaName;
- delete iAttaType;
- delete iAttaCid;
- delete iAttaRecommendedName;
- if ( iContentTypeParams )
- {
- iContentTypeParams->Reset();
- }
- delete iContentTypeParams;
- if ( iXTypeParams )
- {
- iXTypeParams->Reset();
- }
- delete iXTypeParams;
- }
-
-
-// End of File
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/src/mmstestbed.cpp Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2357 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#include <mtmdef.h>
-#include <CoreApplicationUIsSDKCRKeys.h>
-#include <mmsheaders.h>
-#include <mmscmds.h>
-#include <mmsencode.h>
-#include <mmscliententry.h>
-#include <logwrap.h>
-#include <logcli.h>
-#include <logview.h>
-#include "mmssettings.h" //use mmssettings.h instead of cmmssettings.h
-#include "mmstestbed.h"
-#include "mmsreadfile.h"
-#include "mmstestuitimer.h"
-#include "mmsteststaticutils.h"
-#include "mmstestbed.hrh"
-
-//constants
-_LIT( KMmsSender, "0601234567" );
-
-MmsTestBed::MmsTestBed()
- {
- //start the timer
- iTimer = CTestUiTimer::NewL();
- iTimer->Cancel();
-
- iWait = CMsvOperationActiveSchedulerWait::NewLC();
- // don't leave iWait on cleanup stack
- CleanupStack::Pop();
-
- //open msvsession
- iSession = CMsvSession::OpenSyncL(*this);
- //create client registry
- iClientMtmRegistry = CClientMtmRegistry::NewL(*iSession);
- //create client mtm
- iMmsClient = (CMmsClientMtm *) iClientMtmRegistry->NewMtmL(
- KUidMsgTypeMultimedia);
-
- User::LeaveIfError( iFs.Connect() );
- iFs.SetSessionPath( KRootPath );
- iSettings = CMmsSettings::NewL();
- iMmsHeaders = CMmsHeaders::NewL(iSettings->MmsVersion());
- findDefaultL();
- iServiceId = iDefaultServiceId;
-
- //validate the settings
- iSettings->ValidateSettings();
-
- iLogEvent = CLogEvent::NewL();
- iLogEvent->SetEventType(KLogMmsEventTypeUid);
- iLogClient = NULL; // we test soon if this is available
- iLogView = NULL; // needs log client
- if ( checkLogClient() )
- {
- // first we generate a general view of all events
- // we'll set the filter when we update the view
- iLogView = CLogViewEvent::NewL( *iLogClient );
- }
- iLogFilter = CLogFilter::NewL();
- // we try to filter MMS events
- iLogFilter->SetEventType(KLogMmsEventTypeUid);
- }
-
-MmsTestBed::~MmsTestBed()
- {
- delete iLogView;
- delete iLogFilter;
- delete iLogClient;
- delete iLogEvent;
- delete iSettings;
- delete iMmsHeaders;
- if(iTimer)
- {
- iTimer->Cancel();
- delete iTimer;
- }
- //delete iMsvEntrySelection;
- delete iMmsClient;
- delete iClientMtmRegistry;
- //delete iClientMtmRegistry;
- delete iSession;
- delete iWait;
- }
-
-void MmsTestBed::setConnectionLocal(bool value)
- {
- //value = true for global off, local on
- //value = false for global on, local off
- iSettings->LoadSettingsL();
- iSettings->SetLocalMode( value );
- iSettings->SaveSettingsL();
- }
-
-void MmsTestBed::fromOutboxToMmsc()
- {
- CMsvEntry* cEntry = NULL;
-
- // Get List of services
- cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
- CleanupStack::PushL(cEntry);
- // Get all mms messages of outbox
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL(
- KUidMsgTypeMultimedia);
- CleanupStack::PushL(selection);
-
- // Change state to "KMsvSendStateUnknown" in case the entry has been suspended earlier
- for (TInt i = 0; i < selection->Count(); ++i)
- {
- cEntry->SetEntryL(selection->At(i));
- TMsvEntry entry = cEntry->Entry();
- entry.SetReadOnly(EFalse);
- entry.SetSendingState(KMsvSendStateUnknown);
- cEntry->ChangeL(entry);
- }
-
- selection->InsertL(0, iServiceId);
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack(parameters);
-
- op = iSession->TransferCommandL(*selection, EMmsSend, paramPack,
- iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending)
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if (iWait->iStatus.Int() != KErrNone)
- {
- //DEBUG(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- CleanupStack::PopAndDestroy(); //cEntry
- }
-
-void MmsTestBed::fromMmscToInbox()
- {
- CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
- CleanupStack::PushL(msvEntrySelection);
-
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- msvEntrySelection->InsertL(0, iServiceId);
- }
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack(parameters);
-
- op = iMmsClient->InvokeAsyncFunctionL(EMmsReceive, *msvEntrySelection,
- paramPack, iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending)
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if (iWait->iStatus.Int() != KErrNone)
- {
- //DEBUG(_L("Testbed tried to receive, return status %d"),iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); //msvEntrySelection
- }
-
-void MmsTestBed::findDefaultL()
- {
- iSettings->LoadSettingsL();
- iDefaultServiceId = iSettings->Service();
- }
-
-void MmsTestBed::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
- TAny* aArg2, TAny* /*aArg3*/)
- {
- iEvent = aEvent;
- if (aEvent == EMsvGeneralError)
- {
- return;
- }
- TMsvId parentId = KMsvNullIndexEntryId;
- if (aArg2 != NULL)
- {
- parentId = *(TMsvId*) aArg2;
- }
-
- CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
- TMsvEntry tEntry;
- TMsvId service;
- TInt error = KErrNone;
- error = iSession->GetEntry(selection->At(0), service, tEntry);
-
- CMsvEntry* cEntry = NULL;
- switch (aEvent)
- {
- case EMsvEntriesCreated:
- {
- if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
- {
- // emit signal for new entry into INBOX
- emit entryCreatedInInbox(tEntry.Id());
- }
- else if (parentId == KMsvDraftEntryIdValue)
- {
- // emit signal for new entry into Draft
- emit entryCreatedInDraft(tEntry.Id());
- }
- else if (parentId == iServiceId)
- {
- // emit signal for new Entry into SERVICE
- }
- else
- {
- // do nothing
- }
- }
- break;
- case EMsvEntriesChanged:
- {
- TMsvId id;
- CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
- if (selection == NULL)
- {
- // no selection, cannot handle
- return;
- }
- id = selection->At(0);
- //DEBUG Entry changed"));
- if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
- {
-/*
- cEntry = iSession->GetEntryL( parentId );
- CleanupStack::PushL( cEntry );
- TRAPD (error, cEntry->SetEntryL( id ));
- if ( error != KErrNone )
- {
- CleanupStack::PopAndDestroy(); // cEntry
- return;
- }
- TMsvEntry tEntry = cEntry->Entry();
- if ( tEntry.Visible() )
- {
- // generate fake delivery report
- CMsvStore* store = cEntry->ReadStoreL();
- CleanupStack::PushL( store );
- CMmsHeaders* mmsHeaders = CMmsHeaders::NewL( iSettings->MmsVersion() );
- CleanupStack::PushL( mmsHeaders );
- mmsHeaders->RestoreL( *store );
- iEncodeBuffer->ResizeL( 0 );
- generateDeliveryReport( mmsHeaders );
- CleanupStack::PopAndDestroy( 2 ); // mmsHeaders, store
- }
- CleanupStack::PopAndDestroy(); // cEntry
-*/
- }
- }
- break;
- case EMsvEntriesDeleted:
- {
- //emit signal for entry deleted
- }
- break;
- case EMsvEntriesMoved:
- {
- if (parentId == KMsvGlobalOutBoxIndexEntryIdValue)
- {
- // entry moved to outbox
- emit entryMovedToOutbox(tEntry.Id());
- }
- else if (parentId == KMsvSentEntryIdValue)
- {
- // entry moved to sent folder
- emit entryMovedToSent(tEntry.Id());
- }
- else
- {
- // do nothing
- }
- }
- break;
- default:
- break;
- }
- }
-
-void MmsTestBed::createMmsService()
- {
- CMmsSettings * settings = CMmsSettings::NewL();
- CleanupStack::PushL( settings );
- settings->CreateNewServiceL( *iSession );
- CleanupStack::PopAndDestroy(); // settings
- return;
- }
-
-void MmsTestBed::cleanup()
- {
- TMsvId entryToBeKilled;
- // Get access to root index
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
-
- entryToBeKilled = iSettings->Service();
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- while (entryToBeKilled != KMsvNullIndexEntryId)
- {
- // delete child of root entry
- deleteEntry(entryToBeKilled, *cEntry);
- entryToBeKilled = iSettings->Service();
- }
-
- CleanupStack::PopAndDestroy(); // cEntry
- // We deleted everything!
- iDefaultServiceId = KMsvNullIndexEntryId;
- iServiceId = KMsvNullIndexEntryId;
- }
-
-void MmsTestBed::deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry)
- {
- aClientEntry.DeleteL(aEntryId);
- }
-
-void MmsTestBed::cleanupAndCreateNewService()
- {
- cleanup();
- // all old service entries have been destroyed, create a new one
- createMmsService();
- }
-
-void MmsTestBed::testFile(TFileName& aFilePath, TInt aCommand /* = 0 */, TMsvId aBox /* = KMsvGlobalOutBoxIndexEntryId */ )
- {
- // update settings in mmsclient
- iMmsClient->RestoreSettingsL();
- iSettings->CopyL( iMmsClient->MmsSettings() );
-
- RFileReadStream readStream;
- readStream.PushL();
-// TMsvId id = KMsvNullIndexEntryId;
- CBufFlat* encodeBuffer = NULL;
- CMmsEncode* encoder = NULL;
-
- // Open the file
- TInt err = readStream.Open(iFs, aFilePath, EFileShareReadersOnly );
- if (err != KErrNone) User::Leave( err );
-
- TInt retCode = 0;
- CMmsReadFile* readFile = NULL;
- readFile = CMmsReadFile::NewL( iFs, readStream );
- CleanupStack::PushL( readFile );
-
- TInt messageCounter = 0;
- CMsvEntry* cEntry = NULL;
-
- while(!retCode)
- {
- // READ MESSAGE TO BUFFERS
- iMmsHeaders->Reset(iSettings);
- // put in some message type just for fun (testing...)
- iMmsHeaders->SetMessageType( KMmsMessageTypeForwardReq );
- retCode = readFile->CompleteTestL( messageCounter++, *iMmsHeaders );
- if(readFile->iMessageType == ETestNewMessage)
- {
- // CREATE MESSAGE ENTRY
- switch ( aCommand )
- {
- case ECreateToInbox:
- case ECreateNotification:
- cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
- break;
- case ECreateToSentItems:
- cEntry = iSession->GetEntryL(KMsvSentEntryId);
- break;
- case ECreateToDrafts:
- cEntry = iSession->GetEntryL(KMsvDraftEntryId);
- break;
- case ECreateHeadersFromFile:
- // here we just encode headers, no message entry
- // the entry is fake.
- break;
- case ECreateMMBoxViewConf:
- if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
- {
- // entry is not created for the description items
- // they become attachments
- cEntry = iSession->GetEntryL(KMsvDraftEntryId);
- }
- break;
- default:
- cEntry = iSession->GetEntryL(aBox);
- break;
- }
-
- // if we are just playing with headers we have no entry
- if ( aCommand != ECreateHeadersFromFile && aCommand != ECreateMMBoxViewConf )
- {
- CleanupStack::PushL(cEntry);
- iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
-
- // CREATE MESSAGE
- iMmsClient->CreateMessageL(iServiceId);
- }
- else if ( aCommand == ECreateMMBoxViewConf )
- {
- if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
- {
- CleanupStack::PushL(cEntry);
- iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
-
- // CREATE MESSAGE
- iMmsClient->CreateMessageL(iServiceId);
- }
- else
- {
- encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
- CleanupStack::PushL( encodeBuffer );
- encoder = CMmsEncode::NewL( iFs );
- CleanupStack::PushL( encoder );
-
- // encode headers to a binary file
- encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
-
- iFilename = KMmsMMBoxDescriptionDirectory;
- TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
-
- CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
- encodeBuffer = NULL;
- encoder = NULL;
- }
- }
- else
- {
- encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
- CleanupStack::PushL( encodeBuffer );
- encoder = CMmsEncode::NewL( iFs );
- CleanupStack::PushL( encoder );
-
- // encode headers to a binary file
- encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
-
- iFilename = KMmsDumpDirectory;
- TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
-
- CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
- encodeBuffer = NULL;
- encoder = NULL;
- }
- }
-
- if ( aCommand != ECreateHeadersFromFile &&
- ( aCommand != ECreateMMBoxViewConf || iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf ) )
- {
- if(readFile->iMessageType == ETestSettings)
- {
- TMsvId ServiceId = iMmsClient->DefaultServiceL();
- iMmsClient->RestoreSettingsL();
- iSettings->CopyL( iMmsClient->MmsSettings() );
- }
-
- TMemoryInfoV1Buf memory;
- UserHal::MemoryInfo( memory );
- TInt available = memory().iFreeRamInBytes;
-// TMmsLogger::Log(_L("Free memory before CreateMessageL %d"), available );
-
- TRAP (err, readFile->CreateMessageL(iMmsClient, iMmsHeaders));
-
- available = memory().iFreeRamInBytes;
-// TMmsLogger::Log(_L("Free memory after CreateMessageL %d"), available );
-
- if(readFile->iMessageType == ETestNewMessage)
- {
- TMsvEntry tEntry = iMmsClient->Entry().Entry();
- TMsvId id = tEntry.Id();
- if ( err == KErrNone )
- {
- // SAVE MESSAGE
- iMmsClient->SaveMessageL();
-
- // If we are creating a MMBox View confirmation,
- // we add all binary files from KMmsMMBoxDirectory
- // as attachments.
-
- if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
- {
- addMMBoxDescriptions();
- }
-
- // reload the entry in case mms client put something into it
- // MESSAGE MUST BE SET VISIBLE
- tEntry = iMmsClient->Entry().Entry();
- if ( iMmsClient->MessageClass() == EMmsClassAdvertisement )
- {
- tEntry.iMtmData1 |= KMmsMessageAdvertisement;
- }
- else if ( iMmsClient->MessageClass() == EMmsClassInformational )
- {
- tEntry.iMtmData1 |= KMmsMessageInformational;
- }
- tEntry.iMtmData1 &= ~KMmsMessageMobileTerminated;
-
- // Test: Set all as editor oriented - except notifications!
- if ( aCommand == ECreateNotification )
- {
- tEntry.iMtm = KUidMsgMMSNotification;
- }
- else
- {
- tEntry.iMtmData1 |= KMmsMessageEditorOriented;
- }
- if ( aCommand == ECreateToInbox )
- {
- tEntry.iMtmData1 |= KMmsMessageMobileTerminated;
- tEntry.SetReadOnly( ETrue );
- tEntry.SetNew( ETrue );
- tEntry.SetUnread( ETrue );
- }
- else if ( aCommand == ECreateToSentItems )
- {
- tEntry.SetReadOnly( ETrue );
- }
- tEntry.SetVisible( ETrue );
- tEntry.SetInPreparation( EFalse );
- TTime now;
- now.UniversalTime();
- tEntry.iDate = now;
- TMsvId entryId = tEntry.Id();
- iMmsClient->Entry().ChangeL( tEntry );
- if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
- {
- // Encode to the directory that is used to fetch MMBox view
- iFilename.Copy( KMmsMMBoxDirectory );
- encodeMessageFromDrafts();
- cEntry->SetEntryL( KMsvDraftEntryId );
- cEntry->DeleteL( entryId );
- }
- }
- else
- {
- //TMmsLogger::Log(_L("CreateMessageL left with error %d"), err );
- iSession->RemoveEntry(id);
- err = KErrNone; // clear error
- }
- CleanupStack::PopAndDestroy(); // cEntry
- cEntry = NULL;
- }
- if(readFile->iMessageType == ETestSettings)
- {
- iMmsClient->SetSettingsL( *iSettings );
- iMmsClient->StoreSettingsL();
- }
- }
- }
-
- CleanupStack::PopAndDestroy(); //readFile
-
- readStream.Close();
- readStream.Pop();
-
- /*
- iMmsClient->SwitchCurrentEntryL(id);
- */
- }
-
-void MmsTestBed::addMMBoxDescriptions()
- {
- // add the contents of KMmsMMBoxDescriptionDirectory as attachments
- CDir* fileList = NULL;
- TInt i = 0; // general counter
- TInt error = KErrNone;
- iCurrentPath = KMmsMMBoxDescriptionDirectory;
-
- iFs.SetSessionPath(iCurrentPath);
-
- TFindFile finder( iFs );
- error = finder.FindWildByPath( KWild, NULL, fileList );
- CleanupStack::PushL( fileList );
- TInt fileCounter = 0;
-
- if ( error == KErrNone )
- {
- fileCounter = fileList->Count();
- }
-
- TEntry entry;
-
- if ( error == KErrNone )
- {
- for ( i = 0; i < fileCounter; ++i )
- {
- // Reset inactivity timer to keep viewServer from crashing
- User::ResetInactivityTime();
- entry = (*fileList)[i]; // name is entry.iName
- iFilename.Copy( iCurrentPath );
- iFilename.Append( entry.iName );
- TPtrC ptr;
- ptr.Set( iFilename );
- iWait->iStatus = KErrNone;
- iMmsClient->AddAttachmentL( ptr, KMmsMimeType, 0, iWait->iStatus );
-
- iWait->Start();
- // The descriptions are cleared after being used
- iFs.Delete( ptr);
- }
- }
-
- iMmsClient->SaveMessageL(); // just in case somthing must be updated
- CleanupStack::PopAndDestroy(); // fileList
- fileList = NULL;
- }
-
-void MmsTestBed::encodeMessageFromDrafts()
- {
- CMmsEncode* encoder = CMmsEncode::NewL( iFs );
- CleanupStack::PushL( encoder );
- // encode a message iMmsClientPoints to
- iMmsClient->LoadMessageL();
- CMsvStore* store = iMmsClient->Entry().ReadStoreL();
- CleanupStack::PushL( store );
- iMmsHeaders->RestoreL( *store );
- CleanupStack::PopAndDestroy(); // store
- store = NULL;
- iWait->iStatus = KErrNone;
-
-// caller sets the directory
-// iFilename = KMmsMessageDumpDirectory;
-
- CMmsClientEntry* entryWrapper = CMmsClientEntry::NewL( iFs, iMmsClient->Entry(), iServiceId );
- CleanupStack::PushL( entryWrapper );
- iEncodeBuffer->ResizeL(0);
- encoder->StartL( *entryWrapper, *iMmsHeaders, *iEncodeBuffer, iWait->iStatus );
- iWait->Start();
- if ( iWait->iStatus == KErrNone )
- {
- TMmsTestUtils::Dump( *iEncodeBuffer, iFilename, iParse, iFs );
- }
- iEncodeBuffer->ResizeL(0);
- CleanupStack::PopAndDestroy(); // entryWrapper
- CleanupStack::PopAndDestroy(); // encoder
- }
-
-void MmsTestBed::deleteNotifications()
- {
- TMsvId mmsFolderId = KMsvNullIndexEntryId;
- mmsFolderId = findMMSFolder();
-
- CMsvEntry* cEntry = NULL;
- // delete all messages from the specified box
- cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
-
- if ( mmsFolderId != KMsvNullIndexEntryId )
- {
- cEntry->SetEntryL(mmsFolderId);
-
- // show invisible entries
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PushL(msvEntrySelection);
-
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- if (msvEntrySelection->Count() > 0)
- {
- CMsvOperation* op = iSession->TransferCommandL(
- *msvEntrySelection,
- EMmsDeleteEntries,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- CleanupStack::PopAndDestroy(); // op
- }
-
- // These cannot be deleted unless we have the a server mtm
- // corresponding to this mtm type.
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- CleanupStack::PopAndDestroy(); //msvEntrySelection
- msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgMMSNotification );
- CleanupStack::PushL(msvEntrySelection);
-
- if (msvEntrySelection->Count() > 0)
- {
- CMsvOperation* op = iSession->TransferCommandL(
- *msvEntrySelection,
- EMmsDeleteEntries,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- CleanupStack::PopAndDestroy(); // op
- }
-
- CleanupStack::PopAndDestroy(); //msvEntrySelection
-
- CleanupStack::PopAndDestroy(); //cEntry
- }
- }
-
-TMsvId MmsTestBed::findMMSFolder()
- {
- return iSettings->NotificationFolder();
- }
-
-void MmsTestBed::restoreFactorySettings()
- {
- iMmsClient->RestoreSettingsL();
- iSettings->CopyL( iMmsClient->MmsSettings() );
- // do not reset access point
- TInt accessPoint = iSettings->AccessPoint( 0 );
- iSettings->RestoreFactorySettingsL( iMmsClient->Session(), EMmsFactorySettingsLevelDeep );
- TInt count = iSettings->AccessPointCount();
- TInt i = 0;
- for ( i = count - 1; i >= 0; --i )
- {
- iSettings->DeleteAccessPointL( i );
- }
- // restore the original access point
- if ( accessPoint > 0 )
- {
- // a negative access point is an error (most likely "KErrNotFound")
- iSettings->AddAccessPointL( accessPoint, 0 );
- }
- iMmsClient->SetSettingsL( *iSettings );
- iMmsClient->StoreSettingsL();
- }
-
-void MmsTestBed::setFetchingState( TMmsReceivingMode aState )
- {
- iMmsClient->RestoreSettingsL();
- iSettings->CopyL( iMmsClient->MmsSettings() );
-
- iSettings->SetReceivingModeHome( aState );
-
- iMmsClient->SetSettingsL( *iSettings );
- iMmsClient->StoreSettingsL();
- }
-
-void MmsTestBed::sendFromFile()
- {
- CMsvOperation * op = NULL;
-
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
- CleanupStack::PushL( cEntry );
-
- CMsvEntrySelection* selection = NULL;
- selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PopAndDestroy(); // cEntry
- CleanupStack::PushL( selection );
-
- TRAPD (error, op = iMmsClient->SendL(*selection, iWait->iStatus));
- if ( error != KErrNone )
- {
- CleanupStack::PopAndDestroy(); // selection
- delete op;
- return;
- }
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(2); // op, selection
- }
-
-void MmsTestBed::sendOneByOne()
- {
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
- CleanupStack::PushL( cEntry );
-
- CMsvEntrySelection* selection = NULL;
- selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PushL( selection );
-
- CMsvEntrySelection* shortSelection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( shortSelection );
-
- TInt i;
-
- for ( i = 0; i < selection->Count(); ++i )
- {
- shortSelection->Reset();
- shortSelection->AppendL( selection->At( i ) );
-
- CMsvOperation * op = NULL;
-
- TTime now;
- now.UniversalTime();
-
- TRAPD (error, op = iMmsClient->SendL(*shortSelection, iWait->iStatus, now ));
- if ( error != KErrNone )
- {
- delete op;
- CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
- return;
- }
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
-
- }
- CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
- }
-
-void MmsTestBed::sendNotifications()
- {
- // Only send one notification!!
-
- TInt error = KErrNone;
-
- if (! TMmsTestUtils::IsFile(iCurrentFile, iFs) )
- {
- //Not a file
- return;
- }
- TMsvId mmsFolder = findMMSFolder();
-
- TEntry entry;
-
-
- // now I think we have a filename
- TEntry orgEntry;
- TUint size = 0;
- error = iFs.Entry( iCurrentFile, orgEntry );
- size = orgEntry.iSize;
-
- //TMmsLogger::Log(_L("- notification %S "), &iCurrentFile);
- if ( size == 0 )
- {
- //empty file
- //TMmsLogger::Log(_L("- empty file"));
- return;
- }
-
- if ( iEncodeBuffer == NULL )
- {
- iEncodeBuffer = CBufFlat::NewL( size );
- }
- else
- {
- iEncodeBuffer->ResizeL( 0 );
- iEncodeBuffer->ResizeL( size );
- }
-
- RFile inFile;
- error = inFile.Open( iFs, iCurrentFile, EFileShareReadersOnly );
- TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
- if ( error == KErrNone )
- {
- error = inFile.Read( ptr, size );
- inFile.Close();
- }
- else
- {
- //Error
- //TMmsLogger::Log(_L("- can't read file"));
- return;
- }
-
- TUint8 byte;
- TUint position = 0;
- TUint32 uintvar = 0;
-
- if ( size > 2 )
- {
- iEncodeBuffer->Read( 1, &byte, 1 );
- if ( byte == 6 ) // PUSH PDU
- {
- // try to find out length of header
- position = 2;
- iEncodeBuffer->Read( position, &byte, 1);
-
- while ( byte & 0x80 && position < size )
- {
- uintvar += ( byte & 0x7f );
- uintvar <<= 7;
- position++;
- iEncodeBuffer->Read( position, &byte, 1 );
- }
-
- // add last byte without shift
- uintvar += byte;
- position++;
- }
- }
-
- position += uintvar;
-
- if ( position < size )
- {
- ptr = iEncodeBuffer->Ptr( position );
- size = ptr.Length();
- }
-
- if ( size == 0 )
- {
- //no MMS stuff
- //TMmsLogger::Log(_L("- no MMS stuff"));
- return;
- }
-
- TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
-
- // Now we have streamed our data into this entry.
- // Now we have an entry that says: local service, MMS MTM
- CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( selection );
- if ( entryId != KMsvNullIndexEntryId )
- {
- selection->AppendL( entryId );
- }
- else
- {
- selection->AppendL( iDefaultServiceId );
- }
-
- TWatcherParameters parameters; // initialized to zero
- parameters.iWatcherId = RThread().Id();
- parameters.iDataPointer = &ptr;
- TWatcherParametersBuf paramPack( parameters );
-
- CMsvOperation * op = NULL;
-
- op = iSession->TransferCommandL(
- *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- User::After(1000000);
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::copyDrafts()
- {
- CMsvEntry* cEntry = NULL;
-// Copies contents of sent folder to drafts for retrying sending.
-
- cEntry = iSession->GetEntryL(KMsvSentEntryId);
- CleanupStack::PushL(cEntry);
- // Get all mms messages in drafts
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
-
- TMsvLocalOperationProgress progress;
- cEntry->CopyL( *selection, KMsvDraftEntryId, progress );
-
- TInt i = 0;
- for ( i = 0; i < selection->Count(); ++i )
- {
- cEntry->SetEntryL( selection->At( i ) );
- TMsvEntry entry = cEntry->Entry();
- entry.SetReadOnly( EFalse );
- cEntry->ChangeL( entry );
- }
-
- CleanupStack::PopAndDestroy(2); // selection, cEntry
- }
-
-void MmsTestBed::garbageCollection(TUint32 aReason)
- {
- CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( selection );
- selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
-
- TMMSGarbageCollectionParameters parameters; // initialized to zero
- parameters.iReasonFlags = aReason;
- TMMSGarbageCollectionParametersBuf paramPack( parameters );
- op = iSession->TransferCommandL(
- *selection, EMmsGarbageCollection, paramPack, iWait->iStatus );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::messageVariation()
- {
- CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( selection );
- selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
-
- op = iSession->TransferCommandL(
- *selection, EMmsMessageGeneration, TPtrC8(), iWait->iStatus );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::cancelSendScheduling()
- {
- CMsvEntry* cEntry = NULL;
- setFetchingState( EMmsReceivingPostpone );
- testFile( iCurrentFile );
- scheduledSend(KMsvGlobalOutBoxIndexEntryIdValue, 10000); // long delay so that we have time to cancel
- deleteSendSchedule();
-
- cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
- cEntry->SetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
- if (iMsvEntrySelection != NULL)
- {
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- }
- iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PopAndDestroy();
- }
-
-void MmsTestBed::scheduledSend(TMsvId aBoxId, TInt aDelay /* = 5 */)
- {
- CMsvEntry* cEntry = NULL;
- TCommandParameters parameters;
- parameters.iInitialDelay = aDelay;
- TCommandParametersBuf paramPack( parameters );
-
- cEntry = iSession->GetEntryL(aBoxId);
- CleanupStack::PushL(cEntry);
- // Get all mms messages of outbox
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
-// selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsScheduledSend,
- *selection,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(2); // cEntry, selection
- }
-
-void MmsTestBed::deleteSendSchedule()
- {
- CMsvEntry* cEntry = NULL;
-
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
- CleanupStack::PushL(cEntry);
- // Get all mms messages of outbox
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
- selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsDeleteSchedule,
- *selection,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(2); // cEntry, selection
- }
-
-void MmsTestBed::cancelFetchScheduling()
- {
- TMsvId mmsFolder = findMMSFolder();
- CMsvEntry* cEntry = NULL;
- setFetchingState( EMmsReceivingPostpone );
- testFile( iCurrentFile );
- fromOutboxToMmsc(); // immediate send (EMmsSend)
-
- // Wait until notification has arrived - may take a while in global mode
- TInt i = 0;
- while ( TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) == 0
- && i < 2000 )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- i++;
- if ( (i/100) * 100 == i )
- {
- //TMmsLogger::Log(_L("%d:th wait cycle"), i );
- }
- CActiveScheduler::Start();
- }
- iTimer->Cancel();
-
- fetchForced( 10000 ); // delay to allow cancelling
- deleteFetchSchedule();
-
- cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
- cEntry->SetEntryL(mmsFolder);
- if (iMsvEntrySelection != NULL)
- {
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- }
- iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PopAndDestroy(); // cEntry
- }
-
-void MmsTestBed::fetchForced(TInt aDelay /* = 5 */)
- {
- TCommandParameters parameters;
- parameters.iInitialDelay = aDelay;
- TCommandParametersBuf paramPack( parameters );
-
- CMsvEntrySelection* selection = new CMsvEntrySelection;
- CleanupStack::PushL( selection );
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- selection->InsertL(0, iServiceId);
- }
- else
- {
- selection->InsertL(0, iDefaultServiceId);
- }
-
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsScheduledReceiveForced,
- *selection,
- paramPack,
- iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::deleteFetchSchedule()
- {
- CMsvEntry* cEntry = NULL;
-
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- TMsvId mmsFolderId = KMsvNullIndexEntryId;
- mmsFolderId = findMMSFolder();
- cEntry = iSession->GetEntryL( mmsFolderId );
- CleanupStack::PushL(cEntry);
- // Get all notifications
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
- selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsDeleteSchedule,
- *selection,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(2); // cEntry, selection
- }
-
-void MmsTestBed::doAFetchCycle()
- {
- // Sends a message from iCurrentFile and lets it come back
- TMsvId mmsFolder = findMMSFolder();
- testFile( iCurrentFile );
- fromOutboxToMmsc(); // immediate send (EMmsSend)
- // fetching will start automatically
-
- TInt i = 0;
- while ( TMmsTestUtils::CountChildrenL( KMsvGlobalInBoxIndexEntryId, iMsvEntrySelection, *iSession ) == 0
- && i < 2000
- && TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) > 0 )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- i++;
- if ( (i/100) * 100 == i )
- {
- //TMmsLogger::Log(_L("%d:th wait cycle"), i );
- }
- CActiveScheduler::Start();
- }
- iTimer->Cancel();
- }
-
-bool MmsTestBed::checkLogClient()
- {
- if ( iLogClient == NULL )
- {
- TRAP_IGNORE( iLogClient = CLogClient::NewL( iFs ) );
- }
- return ( iLogClient != NULL );
- }
-
-int MmsTestBed::getLogEntries()
- {
- TInt count = 0;
- if ( !iLogView )
- {
- return 0;
- }
-
- if ( iLogView->SetFilterL( *iLogFilter, iWait->iStatus ) )
- {
- // should complete with KErrNone
- iWait->Start();
- if ( iWait->iStatus.Int() == KErrNone )
- {
- count = iLogView->CountL();
- }
- }
- return count;
- }
-
-void MmsTestBed::createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry)
- {
- CMsvOperation* opert = aClientEntry.CreateL(aNewEntry, iWait->iStatus);
- iWait->Start();
- if (!opert->iStatus.Int()==KErrNone)
- {
- // what should we do? panic?
- }
-
- TPckgBuf<TMsvLocalOperationProgress> package;
- package.Copy(opert->ProgressL());
- *(TMsvId*)&aNewEntry = package().iId;
-
- delete opert; opert=NULL;
- }
-
-void MmsTestBed::cleanOutbox()
- {
- TMmsTestUtils::CleanBoxL(KMsvGlobalOutBoxIndexEntryId, *iSession);
- }
-
-void MmsTestBed::cleanInbox()
- {
- TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
- }
-
-void MmsTestBed::cleanSent()
- {
- TMmsTestUtils::CleanBoxL(KMsvSentEntryId, *iSession);
- }
-
-void MmsTestBed::cleanDrafts()
- {
- TMmsTestUtils::CleanBoxL(KMsvDraftEntryId, *iSession);
- }
-
-void MmsTestBed::cleanAll()
- {
- cleanInbox();
- cleanOutbox();
- cleanSent();
- cleanDrafts();
- TMmsTestUtils::CleanBoxL( iSettings->MMBoxFolder(), *iSession );
- deleteNotifications();
- }
-
-void MmsTestBed::reply()
- {
- // The first message from inbox is replied to
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
- CleanupStack::PushL(cEntry);
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- if ( iMsvEntrySelection->Count() > 0 )
- {
- TMsvId originalEntry = iMsvEntrySelection->At(0);
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription;
- CMsvOperation * op = NULL;
- op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Create reply, return status %d"), iWait->iStatus.Int());
- }
- else
- {
- TMsvId newEntry = KMsvNullIndexEntryId;
- TPckgBuf<TMsvId> package;
- package.Copy(op->ProgressL());
- newEntry = package();
- if ( newEntry != KMsvNullIndexEntryId )
- {
- cEntry->SetEntryL( newEntry );
- TMsvEntry entry = cEntry->Entry();
- entry.SetInPreparation( EFalse );
- entry.SetVisible( ETrue );
- cEntry->ChangeL(entry);
- }
- }
- CleanupStack::PopAndDestroy(); // op
- }
- CleanupStack::PopAndDestroy(); // cEntry
- }
-
-void MmsTestBed::replyToAll()
- {
- // The first message from inbox is replied to
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
- CleanupStack::PushL(cEntry);
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
-
- if ( iMsvEntrySelection->Count() > 0 )
- {
- TMsvId originalEntry = iMsvEntrySelection->At(0);
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
- KMsvMessagePartRecipient;
- CMsvOperation * op = NULL;
- op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Create reply to all, return status %d"), iWait->iStatus.Int());
- }
- else
- {
- TMsvId newEntry = KMsvNullIndexEntryId;
- TPckgBuf<TMsvId> package;
- package.Copy(op->ProgressL());
- newEntry = package();
- if ( newEntry != KMsvNullIndexEntryId )
- {
- cEntry->SetEntryL( newEntry );
- TMsvEntry entry = cEntry->Entry();
- entry.SetInPreparation( EFalse );
- entry.SetVisible( ETrue );
- cEntry->ChangeL(entry);
- }
- }
- CleanupStack::PopAndDestroy(); // op
- }
- CleanupStack::PopAndDestroy(); // cEntry
- }
-
-void MmsTestBed::forward()
- {
- // The first message from inbox is forwarded
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
- CleanupStack::PushL(cEntry);
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
-
- if ( iMsvEntrySelection->Count() > 0 )
- {
- TMsvId originalEntry = iMsvEntrySelection->At(0);
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
- KMsvMessagePartRecipient | KMsvMessagePartAttachments;
- CMsvOperation * op = NULL;
- op = iMmsClient->ForwardL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Create forward, return status %d"), iWait->iStatus.Int());
- }
- else
- {
- TMsvId newEntry = KMsvNullIndexEntryId;
- TPckgBuf<TMsvId> package;
- package.Copy(op->ProgressL());
- newEntry = package();
- if ( newEntry != KMsvNullIndexEntryId )
- {
- iMmsClient->SwitchCurrentEntryL( newEntry );
- // Add a sender: 0601234567
- iMmsClient->LoadMessageL();
- iMmsClient->SetSenderL( KMmsSender );
- iMmsClient->SaveMessageL();
- cEntry->SetEntryL( newEntry );
- TMsvEntry entry = cEntry->Entry();
- entry.SetInPreparation( EFalse );
- entry.SetVisible( ETrue );
- cEntry->ChangeL(entry);
- }
- }
- CleanupStack::PopAndDestroy(); // op
- }
- CleanupStack::PopAndDestroy(); // cEntry
- }
-
-void MmsTestBed::sendReadReport()
- {
- // TURN READ REPORTS ON (until available from menu)
- iSettings->LoadSettingsL();
- iSettings->SetReadReplyReportSendingAllowed( ETrue );
- iSettings->SaveSettingsL();
- iMmsClient->RestoreSettingsL();
-
-
- // Read report is sent for the first message in inbox
- CMsvEntry* cEntry = iSession->GetEntryL( KMsvGlobalInBoxIndexEntryId );
- CleanupStack::PushL(cEntry);
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
-
- if ( iMsvEntrySelection->Count() == 0 )
- {
- return;
- }
- TMsvId originalEntry = iMsvEntrySelection->At( 0 );
-
- // new test using Client MTM
- CMsvOperation * op = NULL;
- op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy( op );
- op = NULL;
-
- // Try sending the read report to current entry
-
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy( op );
- op = NULL;
-
-/*
- cEntry->SetEntryL( originalEntry );
- iMmsHeaders->Reset();
- CMsvStore* store = cEntry->ReadStoreL();
- CleanupStack::PushL( store );
- iMmsHeaders->RestoreL( *store );
- CleanupStack::PopAndDestroy( store );
- store = NULL;
- HBufC8* messageId = HBufC8::NewL( iMmsHeaders->MessageId().Length() );
- CleanupStack::PushL( messageId );
- messageId->Des().Copy( iMmsHeaders->MessageId() );
-
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- iMmsClient->LoadMessageL();
-
- iMmsHeaders->Reset();
- iMmsHeaders->SetMessageType( KMmsMessageTypeReadRecInd );
- // Message id cannot be accessed via MMS Client MTM!
-
- iMmsHeaders->SetMessageIdL( messageId->Des() );
- CleanupStack::PopAndDestroy( messageId );
-
- iMmsHeaders->AddTypedAddresseeL( iMmsClient->Sender(), EMsvRecipientTo );
- // sender must be insert-address-token because we don't know our number
- TTime now;
- now.UniversalTime();
-
- _LIT( K1970, "19700000:000000.000000" ); // 1-Jan 1970 0:00:00
-
- TTime y1970( K1970 );
- TTimeIntervalMicroSeconds interval;
- // we can't use "seconds from" as it only returns a
- // 32 bit signed integer. If fails in 2038.
- // "microseconds from" returns a 64 bit signed integer
- interval = now.MicroSecondsFrom( y1970 );
- // date in iMmsHeaders() in seconds from 1.1.1970.
- iMmsHeaders->SetDate( (interval.Int64() ) / KMmsMillion );
- iMmsHeaders->SetReadStatus( KMmsReadStatusRead );
-
- TMsvId mmsFolderId = KMsvNullIndexEntryId;
- mmsFolderId = FindMMSFolderL();
-
- cEntry->SetEntryL( mmsFolderId );
-
- TMsvEntry entry;
- entry.iType = KUidMsvMessageEntry;
- entry.iMtm = KUidMsgTypeMultimedia;
- entry.SetVisible( ETrue );
- entry.SetInPreparation( EFalse );
- entry.iServiceId = KMsvLocalServiceIndexEntryId;
- entry.iRelatedId = iDefaultServiceId;
- entry.iMtmData1 = KMmsMessageReadRecInd;
- cEntry->CreateL( entry );
- TMsvId entryId = entry.Id();
-
- cEntry->SetEntryL( entryId );
-
- store = cEntry->EditStoreL();
- CleanupStack::PushL( store );
- iMmsHeaders->StoreL( *store );
- store->CommitL();
- CleanupStack::PopAndDestroy( store );
- store = NULL;
-
- CMsvEntrySelection* selection = new ( ELeave ) CMsvEntrySelection;
- CleanupStack::PushL( selection );
- selection->InsertL(0, entryId);
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- op = iSession->TransferCommandL(*selection,EMmsScheduledReadReport,paramPack,iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy( op );
- CleanupStack::PopAndDestroy( selection );
-*/
- CleanupStack::PopAndDestroy( cEntry );
- }
-
-int MmsTestBed::fromOutboxToMmscWithMemoryFailure()
- {
- TInt error = KErrNone;
- TInt messageCount = 0;
- TInt failureCount = 0;
- do {
- CMsvEntry* cEntry = NULL;
-
- // Get List of services
- cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
- CleanupStack::PushL(cEntry);
- // Get all mms messages of outbox
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
- failureCount++;
- // These are failures that fail in Message server.
- if ( failureCount >= 63 && failureCount <= 64 )
- {
- failureCount = 65;
- }
- cEntry->SetEntryL( iServiceId );
- TMsvEntry entry = cEntry->Entry();
- entry.iMtmData3 &= 0x0000000FF;
- entry.iMtmData3 |= failureCount << 8;
- cEntry->ChangeL( entry );
-
- selection->InsertL(0, iServiceId);
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- TRAP (error, op = iSession->TransferCommandL(*selection,EMmsSend,paramPack,iWait->iStatus));
-
- if ( error == KErrNone )
- {
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- error = iWait->iStatus.Int();
- if ( iWait->iStatus.Int() != KErrNoMemory )
- {
- //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
- }
- }
-
- CleanupStack::PopAndDestroy(); // op
- }
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // selection
- CleanupStack::PopAndDestroy(); // cEntry
- selection = NULL;
- cEntry = NULL;
- cEntry = iSession->GetEntryL( KMsvGlobalOutBoxIndexEntryIdValue );
- CleanupStack::PushL(cEntry);
- selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- messageCount = selection->Count();
- delete selection;
- selection = 0;
- CleanupStack::PopAndDestroy(); //cEntry
- }
- while ( error == KErrNoMemory || messageCount > 0 );
- return failureCount;
- }
-
-int MmsTestBed::fromMmscToInboxWithMemoryFailure()
- {
- TInt error = KErrNone;
- TInt failureCount = 0;
- TInt messageCount = 0;
- TMsvId mmsFolderId = KMsvNullIndexEntryId;
- mmsFolderId = findMMSFolder();
-
- do {
- // Inbox must be cleaned if failure makes message to be fetched more than once.
- // should not happen, but this test is quite stressful, and perfect result
- // cannot be guaranteed.
- // What is expected:
- // 1. Program does not crash
- // 2. After sufficient number of retries the message is fetched and notification deleted.
- TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
- CMsvEntry* cEntry = NULL;
- CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
- CleanupStack::PushL(msvEntrySelection);
-
- cEntry = iSession->GetEntryL(iServiceId);
- CleanupStack::PushL(cEntry);
-
- failureCount++;
- // These are failures that fail in Message server.
- if ( failureCount >= 63 && failureCount <= 64 )
- {
- failureCount = 65;
- }
- cEntry->SetEntryL( iServiceId );
-
- TMsvEntry entry = cEntry->Entry();
- entry.iMtmData3 &= 0x0000000FF;
- entry.iMtmData3 |= failureCount << 8;
- cEntry->ChangeL( entry );
-
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- msvEntrySelection->InsertL(0, iServiceId);
- }
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- TRAP (error, op = iMmsClient->InvokeAsyncFunctionL(
- EMmsReceiveForced,
- *msvEntrySelection,
- paramPack,
- iWait->iStatus) );
-
- if ( error == KErrNone )
- {
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- error = iWait->iStatus.Int();
- if ( iWait->iStatus.Int() != KErrNoMemory )
- {
- //TMmsLogger::Log(_L("Testbed tried to receive, return status %d"), iWait->iStatus.Int());
- }
- }
-
- CleanupStack::PopAndDestroy(); // op
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // msvEntrySelection
- CleanupStack::PopAndDestroy(); // cEntry
- msvEntrySelection = NULL;
- cEntry = NULL;
- cEntry = iSession->GetEntryL( mmsFolderId );
- CleanupStack::PushL(cEntry);
- msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- messageCount = msvEntrySelection->Count();
- delete msvEntrySelection;
- msvEntrySelection = 0;
- CleanupStack::PopAndDestroy(); //cEntry
- }
- while ( error == KErrNoMemory || messageCount > 0 );
- if ( error != KErrNoMemory && error != KErrNone )
- {
- //TMmsLogger::Log(_L("Memory failure loop ended with %d"), error);
- }
- return failureCount;
- }
-
-void MmsTestBed::sendViaClient()
- {
- CMsvEntry* cEntry = NULL;
-
- cEntry = iSession->GetEntryL(KMsvDraftEntryId);
- CleanupStack::PushL(cEntry);
- // Get all mms messages in drafts
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
-
- CMsvOperation * op = NULL;
- TTime now;
- now.UniversalTime();
- op = iMmsClient->SendL( *selection, iWait->iStatus, now );
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(2); // cEntry, selection
- }
-
-void MmsTestBed::scheduledFetch(TInt aDelay /* = 5 */)
- {
- TCommandParameters parameters;
- parameters.iInitialDelay = aDelay;
- TCommandParametersBuf paramPack( parameters );
-
- CMsvEntrySelection* selection = new CMsvEntrySelection;
- CleanupStack::PushL( selection );
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- selection->InsertL(0, iServiceId);
- }
- else
- {
- selection->InsertL(0, iDefaultServiceId);
- }
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsScheduledReceive,
- *selection,
- paramPack,
- iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::fetchForcedImmediate()
- {
- TCommandParameters parameters;
- TCommandParametersBuf paramPack( parameters );
-
- CMsvEntrySelection* selection = new CMsvEntrySelection;
- CleanupStack::PushL( selection );
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- selection->InsertL(0, iServiceId);
- }
- else
- {
- selection->InsertL(0, iDefaultServiceId);
- }
-
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsReceiveForced,
- *selection,
- paramPack,
- iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::getEventType()
- {
- if ( !checkLogClient() )
- {
- return; // not available
- }
-
- CLogEventType* eventType = CLogEventType::NewL();
- CleanupStack::PushL( eventType );
- eventType->SetUid(iLogEvent->EventType());
- iLogClient->GetEventType( *eventType, iWait->iStatus );
-
- iWait->Start();
- CleanupStack::PopAndDestroy(); // eventType
- }
-
-void MmsTestBed::addEventType()
- {
- if ( !checkLogClient() )
- {
- return; // not available
- }
-
- CLogEventType* eventType = CLogEventType::NewL();
- CleanupStack::PushL( eventType );
- eventType->SetUid(iLogEvent->EventType());
- eventType->SetDescription(_L("Multimedia Message") );
- eventType->SetLoggingEnabled( ETrue );
-
-// iWait->iStatus = KRequestPending;
- iLogClient->AddEventType( *eventType, iWait->iStatus );
- iWait->Start();
- CleanupStack::PopAndDestroy(); // eventType
- }
-
-void MmsTestBed::deleteEventType()
- {
- if ( !checkLogClient() )
- {
- return; // not available
- }
-// iWait->iStatus = KRequestPending;
- iLogClient->DeleteEventType( iLogEvent->EventType(), iWait->iStatus );
- iWait->Start();
- }
-
-void MmsTestBed::cleanLog()
- {
- TInt count = 0;
-
- count = getLogEntries();
-
- TInt i;
- for ( i = 0; i < count; ++i )
- {
- // when a view is created, it will be positioned on the first event
-// iWait->iStatus = KRequestPending;
- iLogClient->DeleteEvent(iLogView->Event().Id(), iWait->iStatus);
- iWait->Start();
-
- if ( iLogView->NextL( iWait->iStatus ) )
- {
- // should complete with KErrNone
- iWait->Start();
- if ( iWait->iStatus.Int() != KErrNone )
- {
- // could not get next event!
- break;
- }
- }
- else
- {
- break; // no more events!
- }
- }
- }
-
-void MmsTestBed::setOnline(bool value)
- {
- //value = true for online mode
- //value = false for offline mode
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KCRUidCoreApplicationUIs ) );
- if( retval == KErrNone )
- {
- repository->Set( KCoreAppUIsNetworkConnectionAllowed, value );
- delete repository;
- }
- }
-
-void MmsTestBed::generateDeliveryReport( CMmsHeaders* aMmsHeaders )
- {
- iEncodeBuffer->ResizeL( 1024 );
-
- TInt position = 0;
-
- // encode message type
- iEncodeBuffer->Write( position, &KMmsAssignedMessageType, 1 );
- position++;
- iEncodeBuffer->Write( position, &KMmsMessageTypeDeliveryInd, 1 );
- position++;
-
- // version
- iEncodeBuffer->Write( position, &KMmsAssignedMmsVersion, 1 );
- position++;
-
- TUint8 version = aMmsHeaders->MmsVersion() | 0x80; // current version as short integer
- iEncodeBuffer->Write( position, &version, 1 );
- position++;
-
- // message id from the headers
- // At least once MMSC did not send us the message id!
- // if message id is missing, we cannot match the entry!
- // This only a fake. Real delivery reports should always
- // contain the message id.
- if ( aMmsHeaders->MessageId().Length() > 0 )
- {
- iEncodeBuffer->Write( position, &KMmsAssignedMessageId, 1 );
- position++;
- iEncodeBuffer->Write( position, &(aMmsHeaders->MessageId()[0]), aMmsHeaders->MessageId().Length() );
- position += aMmsHeaders->MessageId().Length();
- iEncodeBuffer->Write( position, &KMmsNull, 1 );
- position++;
- }
-
- // To is taken from the headers
- iEncodeBuffer->Write( position, &KMmsAssignedTo, 1 );
- position++;
-
- TPtrC recipient;
- if ( aMmsHeaders->ToRecipients().MdcaCount() > 0 &&
- aMmsHeaders->ToRecipients()[0].Length() > 0 )
- {
- recipient.Set( aMmsHeaders->ToRecipients()[0] );
- }
- else if( aMmsHeaders->CcRecipients().MdcaCount() > 0 &&
- aMmsHeaders->CcRecipients()[0].Length() > 0 )
- {
- recipient.Set( aMmsHeaders->CcRecipients()[0] );
- }
- else if( aMmsHeaders->BccRecipients().MdcaCount() > 0 &&
- aMmsHeaders->BccRecipients()[0].Length() > 0 )
- {
- recipient.Set( aMmsHeaders->BccRecipients()[0] );
- }
- else
- {
- recipient.Set( _L("Jasso-Kissa@jii.fi") );
- }
-
- TMmsAddressType addressType = EMmsAddressTypeUnknown;
-
- if ( recipient.Find( KMiuMau ) != KErrNotFound )
- {
- addressType = EMmsAddressTypeEmail;
- }
- else
- {
- addressType = EMmsAddressTypeMobile;
- }
-
- TUint8 character;
- TInt i;
- if ( addressType == EMmsAddressTypeEmail )
- {
- // email address - ASCII ONLY - THIS IS JUST A TEST!
-
- for ( i = 0; i < recipient.Length(); ++i )
- {
- character = TUint8( recipient[i] & 0xff );
- iEncodeBuffer->Write( position, &character, 1 );
- position++;
- }
- iEncodeBuffer->Write( position, &KMmsNull, 1 );
- position++;
-
- }
- else
- {
- // must be a phone number
- // We expect for now that the format is correct as is
- // All legal characters present in a phone number are ASCII
-
- TInt i;
- for ( i = 0; i < recipient.Length(); ++i )
- {
- character = TUint8( recipient[i] & 0xff );
- iEncodeBuffer->Write( position, &character, 1 );
- position++;
- }
- iEncodeBuffer->Write( position, KMmsPlmn, KMmsPlmnLength );
- position += KMmsPlmnLength;
- iEncodeBuffer->Write( position, &KMmsNull, 1 );
- position++;
- }
-
- // date
- iEncodeBuffer->Write( position, &KMmsAssignedDate, 1 );
- position++;
-
- TLocale locale;
- locale.Refresh();
- TInt64 UtcDate;
- TTimeIntervalSeconds universalTimeOffset( locale.UniversalTimeOffset() );
-
- TTime now;
- now.UniversalTime();
- UtcDate = ( now.MicroSecondsFrom( TTime( KMmsYear1970String ) ).Int64() ) / 1000000 ;
-
- UtcDate -= universalTimeOffset.Int();
-
- if ( locale.QueryHomeHasDaylightSavingOn() )
- {
- TTimeIntervalSeconds daylightSaving( 60 * 60 );
- UtcDate -= daylightSaving.Int();
- }
-
- TUint8 len; // number of bytes we will need
- len = 0;
- TUint8 array[8];
-
- TInt64 temp = UtcDate;
-
- for (i = 7; i >= 0; --i)
- {
- array[i] = TInt8( ( I64INT( temp ) ) & 0xFF );
- I64LSR( temp, 8 );
- }
-
- len = 8;
- i = 0;
- while( ( array[i]== 0 ) && ( i < 8 ) )
- {
- i++;
- len--;
- }
-
- // a zero should be coded as short integer.
- // However, if there is a valid reason to code a zero as a long integer,
- // we allow it. The caller should know what he is doing.
- if ( len == 0 )
- {
- len = 1;
- }
- // write short length
- iEncodeBuffer->Write( position, &len, 1 );
- position++;
- // write as many bytes as were non-zero
- iEncodeBuffer->Write( position, &(array[8 - len] ), len );
- position+= len;
- // status
- iEncodeBuffer->Write( position, &KMmsAssignedStatus, 1 );
- position++;
- iEncodeBuffer->Write( position, &KMmsMessageStatusRetrieved, 1 );
- position++;
- // DONE!!!
- iEncodeBuffer->ResizeL( position );
- return;
- }
-
-void MmsTestBed::sendDeliveryReport()
- {
- if ( iEncodeBuffer->Size() == 0 )
- {
- //No delivery report
- return;
- }
-
-
- TMsvId mmsFolder = findMMSFolder();
- CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( selection );
-
- TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
- TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
-
- // Now we have streamed our data into this entry.
- // Now we have an entry that says: local service, MMS MTM
-
- if ( entryId != KMsvNullIndexEntryId )
- {
- selection->AppendL( entryId );
- }
- else
- {
- selection->AppendL( iDefaultServiceId );
- }
-
- TWatcherParameters parameters; // initialized to zero
- parameters.iWatcherId = RThread().Id();
- parameters.iDataPointer = &ptr;
- TWatcherParametersBuf paramPack( parameters );
-
- CMsvOperation * op = NULL;
-
-// iWait->iStatus = KRequestPending;
- op = iSession->TransferCommandL(
- *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/src/mmsteststaticutils.cpp Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,528 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#include <f32file.h>
-#include <centralrepository.h>
-#include <apparc.h>
-#include <msvapi.h>
-#include <msvids.h>
-
-#include "mmsteststaticutils.h"
-#include "mmsconst.h"
-#include "MmsEnginePrivateCRKeys.h"
-#include "mmssettings.h"
-#include "mmsheaders.h"
-#include "mmsservercommon.h"
-#include "mmsencode.h"
-
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-TMmsJoinedArrays::TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2)
-: iArray1(aArray1), iArray2(aArray2)
- {
- }
-
-TInt TMmsJoinedArrays::MdcaCount() const
- {
- TInt count=0;
- if (iArray1)
- count += iArray1->MdcaCount();
- if (iArray2)
- count += iArray2->MdcaCount();
- return count;
- }
-
-TPtrC16 TMmsJoinedArrays::MdcaPoint(TInt aIndex) const
- {
- if (iArray1)
- {
- if (aIndex < iArray1->MdcaCount())
- return iArray1->MdcaPoint(aIndex);
- else
- aIndex -= iArray1->MdcaCount();
- }
- return iArray2->MdcaPoint(aIndex);
- }
-
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-TMmsTestUtils::TMmsTestUtils()
- {
-
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-HBufC* TMmsTestUtils::ReadContactFromFileL( TDesC& aFileName, RFs& aFs )
- {
- RFile file;
- TInt error = KErrNone;
-
- TInt textBufferSize = 256;
- HBufC* textBuffer = HBufC::NewL( textBufferSize );
- TPtr textPtr = textBuffer->Des();
- TFileText textFile;
-
- error = file.Open( aFs, aFileName,
- EFileRead|EFileShareReadersOnly );
-
- if ( error == KErrNone )
- {
- textFile.Set( file );
- error = textFile.Seek( ESeekStart );
- }
-
- if ( error == KErrNone )
- {
- error = textFile.Read( textPtr );
- }
-
- file.Close();
-
- if ( textBuffer->Des().Find( &KMmsByteOrderMark, 1 ) == 0 )
- {
- textBuffer->Des().Copy( textBuffer->Des().Mid( 1 ) );
- }
-
- return textBuffer;
- }
-
-//----------------------------------------------------------------------------------------
-// turn on detailed logging while decoding a message
-//----------------------------------------------------------------------------------------
-//
-void TMmsTestUtils::DecodeLoggingOnL()
- {
- // CenRep for decodelogging
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
- if( retval == KErrNone )
- {
- // Best effort - if cannot access repository, no can do
- TInt temp = 1;
- repository->Set( KMmsEngineDecodeLog, temp );
- delete repository;
- }
- }
-
-//----------------------------------------------------------------------------------------
-// turn off detailed logging while decoding a message
-//----------------------------------------------------------------------------------------
-//
-void TMmsTestUtils::DecodeLoggingOffL()
- {
- // CenRep for decodelogging
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
- if( retval == KErrNone )
- {
- // Best effort - if cannot access repository, no can do
- TInt temp = 0;
- repository->Set( KMmsEngineDecodeLog, temp );
- delete repository;
- }
-
- }
-
-//----------------------------------------------------------------------------------------
-// turn on binary dump of incoming messages
-//----------------------------------------------------------------------------------------
-//
-void TMmsTestUtils::BinaryDumpOnL()
- {
- // CenRep for binarydump setting
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
- if( retval == KErrNone )
- {
- // Best effort - if cannot access repository, no can do
- TInt temp = 1;
- repository->Set( KMmsEngineBinaryDump, temp );
- delete repository;
- }
-
- }
-
-//----------------------------------------------------------------------------------------
-// turn off binary dump of incoming messages
-//----------------------------------------------------------------------------------------
-//
-void TMmsTestUtils::BinaryDumpOffL()
- {
- // CenRep for binarydump setting
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
- if( retval == KErrNone )
- {
- // Best effort - if cannot access repository, no can do
- TInt temp = 0;
- repository->Set( KMmsEngineBinaryDump, temp );
- delete repository;
- }
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-void TMmsTestUtils::CleanDirectoryL( RFs& aFs )
- {
- // Delete the files in the directory
- CFileMan* fileMan = CFileMan::NewL( aFs );
- CleanupStack::PushL( fileMan );
- fileMan->RmDir( KMmsDefaultLocalModeDir );
- fileMan->RmDir( KMmsMMBoxDirectory );
- fileMan->RmDir( KMmsMMBoxDescriptionDirectory );
- CleanupStack::PopAndDestroy(); // fileManager
- // we don't want to throw these away!
- aFs.MkDirAll( KMmsDefaultLocalModeDir );
- aFs.MkDirAll( KMmsMMBoxDirectory );
- aFs.MkDirAll( KMmsMMBoxDescriptionDirectory );
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-void TMmsTestUtils::Dump( CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs )
- {
- TInt error = KErrNone;
- aFs.MkDirAll( aFilename );
- TUint att;
- if ( aFs.Att( aFilename, att ) == KErrNone )
- {
- _LIT( KRelated, "dump.mms");
- aParse.Set( aFilename, &KRelated, NULL );
- aFilename = aParse.FullName();
- error = CApaApplication::GenerateFileName( aFs, aFilename );
- if ( error == KErrNone )
- {
- RFile file;
- error = file.Create( aFs, aFilename, EFileWrite | EFileShareExclusive );
- // for message id generation
- aParse.Set( aFilename, NULL, NULL );
- if ( error == KErrNone )
- {
- // the data is supposed to be in the encode buffer
- TPtr8 ptr = aBuffer.Ptr( 0 );
- file.Write( ptr );
- file.Flush();
- }
-
- // done - close files
- file.Close();
- }
- }
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-void TMmsTestUtils::CleanBoxL(TMsvId aBoxId, CMsvSession& aSession)
- {
- CMsvEntry* cEntry = NULL;
- // delete all messages from the specified box
- cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
- cEntry->SetEntryL(aBoxId);
- // show invisible entries
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PushL(msvEntrySelection);
-
- CMsvEntrySelection* selection = NULL;
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- selection = cEntry->ChildrenWithMtmL(KUidMsgMMSNotification);
- CleanupStack::PushL( selection );
- if ( selection->Count() > 0 )
- {
- msvEntrySelection->AppendL( selection->Back( 0 ), selection->Count() );
- }
- CleanupStack::PopAndDestroy(); // selection
-
- int i;
- for (i = 0; i < msvEntrySelection->Count(); ++i)
- {
- CMsvEntry* entry = aSession.GetEntryL( msvEntrySelection->At(i) );
- CleanupStack::PushL( entry );
- TMsvEntry tEntry = entry->Entry();
- tEntry.SetReadOnly(EFalse);
- entry->ChangeL(tEntry);
- cEntry->DeleteL( msvEntrySelection->At(i) );
- CleanupStack::PopAndDestroy( entry );
- }
-
- CleanupStack::PopAndDestroy(msvEntrySelection);
- CleanupStack::PopAndDestroy(cEntry);
- }
-
-//----------------------------------------------------------------------------------------
-// turn on logging email recipients
-//----------------------------------------------------------------------------------------
-void TMmsTestUtils::EmailLoggingOnL()
- {
- // CenRep for binarydump setting
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
- if( retval == KErrNone )
- {
- TInt temp = 1;
- repository->Set( KMmsEngineLogEmailRecipients, temp );
- delete repository;
- }
-
- }
-
-//----------------------------------------------------------------------------------------
-// turn off logging email recipients
-//----------------------------------------------------------------------------------------
-void TMmsTestUtils::EmailLoggingOffL()
- {
- // CenRep for binarydump setting
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
- if( retval == KErrNone )
- {
- TInt temp = 0;
- repository->Set( KMmsEngineLogEmailRecipients, temp );
- delete repository;
- }
-
- }
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TInt TMmsTestUtils::CountChildrenL(TMsvId aBoxId, CMsvEntrySelection*& aMsvEntrySelection, CMsvSession& aSession, TUid aMessageType )
- {
- CMsvEntry* cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
- cEntry->SetEntryL(aBoxId);
- if (aMsvEntrySelection != NULL)
- {
- delete aMsvEntrySelection;
- aMsvEntrySelection = NULL;
- }
- aMsvEntrySelection = cEntry->ChildrenWithMtmL(aMessageType);
- CleanupStack::PopAndDestroy(); // cEntry
- return aMsvEntrySelection->Count();
- }
-
-
-// -----------------------------------------------------------------------------
-// CreateFolderEntryL
-//
-// -----------------------------------------------------------------------------
-//
-void TMmsTestUtils::CreateFolderEntryL(
- CMsvSession& aSession,
- TMsvId aParentFolder,
- const TDesC& aFolderName,
- TMsvId& aFolderId )
- {
- aFolderId = KMsvNullIndexEntryId;
- CMsvEntry* cEntry = aSession.GetEntryL( aParentFolder );
- CleanupStack::PushL( cEntry );
-
- // Create a new folder.
-
- TMsvEntry entry;
- entry.iType = KUidMsvFolderEntry;
- entry.iMtm = KUidMsvLocalServiceMtm;
- entry.iDetails.Set( aFolderName );
- entry.SetVisible( EFalse );
- entry.SetInPreparation( EFalse );
- entry.iServiceId = KMsvLocalServiceIndexEntryId;
- cEntry->CreateL( entry );
- aFolderId = entry.Id();
- CleanupStack::PopAndDestroy( cEntry );
-
- }
-
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TMsvId TMmsTestUtils::CreateNotificationEntryL(
- TMsvId aNotificationFolder,
- TMsvId aServiceId,
- CBufFlat* aEncodeBuffer,
- CMsvSession& aSession )
- {
- TMsvId entryId = KMsvNullIndexEntryId;
- if ( aNotificationFolder == KMsvNullIndexEntryId )
- {
- // no folder no entry
- return entryId;
- }
-
- CMsvEntry* cEntry = aSession.GetEntryL( aNotificationFolder );
- CleanupStack::PushL(cEntry);
-
- TMsvEntry entry;
- entry.iType = KUidMsvMessageEntry;
- entry.iMtm = KUidMsgTypeMultimedia;
- entry.SetVisible( ETrue );
- // If we want to put data here, InPreparation must be set to true first
- entry.SetInPreparation( EFalse );
- entry.iServiceId = KMsvLocalServiceIndexEntryId;
- entry.iRelatedId = aServiceId;
- entry.iMtmData2 = KMmsNotificationBinary;
- cEntry->CreateL( entry );
- entryId = entry.Id();
-
- //
- // Stream
- // 1) length of the data as 32 bit integer
- // 2) pushed message data
- // into created entry's stream
- //
- cEntry->SetEntryL( entryId );
- CMsvStore* store = cEntry->EditStoreL();
- CleanupStack::PushL( store ); // ***
- RMsvWriteStream outs;
- outs.AssignLC( *store, KUidBinaryNotificationStream ); // ***
- TPtrC8 ptr = aEncodeBuffer->Ptr( 0 );
- outs.WriteUint32L( ptr.Length() );
- outs.WriteL( ptr );
- outs.CommitL();
- outs.Close();
- store->CommitL();
-
- CleanupStack::PopAndDestroy( &outs ); // close outs
- CleanupStack::PopAndDestroy( store );
- CleanupStack::PopAndDestroy( cEntry );
-
- return entryId;
-
- }
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-void TMmsTestUtils::FormNotification(
- TDesC8& aUrl,
- TInt aSize,
- CMmsHeaders& aMmsHeaders,
- CMmsEncode& aMmsEncoder,
- CBufFlat* aEncodeBuffer )
- {
- // for test purposes aUrl will contain the filename.
-
- // Reset sets the default encapsulation version
- // The default version has been set from MmsSettings in NewL
- aMmsHeaders.Reset();
-
- // construct the notification into iMmsHeaders, and call encode
-
- aMmsHeaders.SetMessageType( KMmsMessageTypeMNotificationInd );
-
- TTime currentTime;
- currentTime.UniversalTime();
- currentTime.Int64();
-
- TPtrC8 tid;
- TBufC8<KMMSMAXTIDLENGTH> target;
- TInt random = 0;
-
- // we don't generate a true random TID: We generate the
- // TID from the URL so that if we generate a notification
- // twice from the same file, we get the same TID and the
- // same URL. This way we can test the pruning function in
- // server MTM
-
- TInt i;
- for ( i = 0; i < aUrl.Length(); ++i )
- {
- random += aUrl[ i ];
- }
-
- target.Des().Num( random );
- tid.Set( target.Des() );
- aMmsHeaders.SetTidL( tid );
-
- aMmsHeaders.SetMessageClass( EMmsClassPersonal );
- aMmsHeaders.SetMessageSize( aSize );
- const TInt KTenHours = 10 * 60 * 60; // 10 hours relative expiry
- aMmsHeaders.SetExpiryInterval( KTenHours );
- aMmsHeaders.SetContentLocationL( aUrl );
-
- aMmsEncoder.EncodeHeadersL( aMmsHeaders, *aEncodeBuffer );
-
- }
-
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TBool TMmsTestUtils::IsFile(const TDesC& aFileName, RFs& aFs)
- {
- //Is the name a file?
- if (IsDrive(aFileName))
- return EFalse;
- return !(IsDir(aFileName, aFs));
- }
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TBool TMmsTestUtils::IsDir(const TDesC& aFileName, RFs& aFs)
- {
- //Is the name a directory?
- TEntry entry;
- TInt err = aFs.Entry(aFileName, entry);
- if (err)
- return EFalse;
- else
- return entry.IsDir();
- }
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TBool TMmsTestUtils::IsDrive(const TDesC& aFileName)
- {
- //horrible little function to figure if the path is just a drive
- TBool retVal = EFalse;
- if (aFileName.Length()==3) //eg "c:\"
- {
- if ((aFileName[1] == ':') && (aFileName[2] == '\\'))
- retVal=ETrue;
- }
- else if (aFileName.Length()==2) //eg "c:"
- {
- if (aFileName[1] == ':')
- retVal=ETrue;
- }
- return retVal;
- }
-
-// end of file
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/mmstestbed/src/mmstestuitimer.cpp Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#include "mmstestuitimer.h"
-
-
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CTestUiTimer::CTestUiTimer(): CTimer( 5 )
- {
- period = KPeriod;
- }
-
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::ConstructL()
- {
- CTimer::ConstructL();
- CActiveScheduler::Add(this);
- }
-
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CTestUiTimer* CTestUiTimer::NewL()
- {
- CTestUiTimer* self = new(ELeave) CTestUiTimer();
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CTestUiTimer::~CTestUiTimer()
- {
- }
-
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::IssueRequest()
- {
- // No operation to cancel if this function is called
- iObject = NULL;
- After(period);
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::TimeoutOperation( CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds )
- {
- iObject = aObject;
- TTimeIntervalMicroSeconds32 timeout = aTimeoutInSeconds.Int() * 1000000;
- After( timeout );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::DoCancel()
- {
- CTimer::DoCancel();
- if ( iObject )
- {
- iObject->Cancel();
- iObject = NULL;
- }
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::RunL()
- {
- if ( iObject )
- {
- // If we timeout while holding an active object, we cancel it
- iObject->Cancel();
- iObject = NULL;
- }
- else
- {
- CActiveScheduler::Stop();
- }
- }
-
-// ======== GLOBAL FUNCTIONS ========
-
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutils/inc/testconvergedmessageutils.h Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description: Main test class declaration for ConvergedMessageUtils
- */
-
-#ifndef TEST_MMS_PLUGIN_H
-#define TEST_MMS_PLUGIN_H
-
-#ifdef BUILD_TEST_DLL
-#define TEST_EXPORT Q_DECL_EXPORT
-#else
-#define TEST_EXPORT Q_DECL_IMPORT
-#endif
-
-#include <QObject>
-#include <QSignalSpy>
-#include <e32const.h>
-
-//Forward Declarations
-class UniEditorMmsPlugin;
-class ConvergedMessage;
-class MmsTestBed;
-
-//Main Tets Class Declaration
-class TEST_EXPORT TestConvergedMessageUtils: public QObject
- {
- Q_OBJECT
-
-private slots:
-
- /**
- * Initialises the whole Test
- **/
- void initTestCase();//called before the first testfunction is executed.
-
- /**
- * Initialises each Test Case
- **/
- void init();//called before each testfunction is executed.
-
- /**
- * Creates a MMS messsage
- **/
- void createMMS();
-
- /**
- * Tests the MMS message
- **/
- void testMMS();
-
- /**
- * Test Methods of ConvergedMessageId which were not part of the tests above
- **/
- void testConvergedMessageIdUnusedMethods();
-
-
- /**
- * Test Methods of ConvergedMessageAttachment which were not part of the tests above
- **/
- void testConvergedMessageAttachmentUnusedMethods();
-
- /**
- * Cleans up each Test Case
- **/
- void cleanup();//called after every testfunction.
-
- /**
- * Cleans up the whole Test Case
- **/
- void cleanupTestCase();//called after the last testfunction was executed.
-
-private: //Data
-
- /**
- * msgPlugin - MMS Message Plug-in
- **/
- UniEditorMmsPlugin* msgPlugin;
-
- /**
- * mmstestbed - MMS Message Simulator
- **/
- MmsTestBed* mmstestbed;
-
- /**
- * spy_draft - Signal Spy for Draft Folder
- **/
- QSignalSpy* spy_draft;
-
- /**
- * mmsMsgId - The MMS message Id
- **/
- long int mmsMsgId;
- };
-#endif //TEST_MMS_PLUGIN_H
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutils/inc/testconvergedmessageutils.ini Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description: Input data Set File for TestConvergedMessageUtils test cases
- */
-
-const char TEST_MSG_BODY[] = "TestTextE_1_2";
-const char TEST_MSG_SUBJECT[] = "Message Subject";
-const char TEST_SENDER[] = "+919860479112";
-const char TEST_ATTACHMENT[] = "c:\\sample.txt";
-const char TEST_CC[] = "DummyCCAddress";
-const char TEST_BCC[] = "DummyBCCAddress";
-const char TEST_ALIAS[] = "DummySenderAlias";
-
-//out put directory for test results.
-QString OUTPUTDIRECTORY = "c:/logs/TestConvergedMessageUtils";
-//o/p directory for data to be written on temp file.
-QString TEMPDIR = "c:/logs/TestConvergedMessageUtils/testdata";
-//test result O/P file name.
-QString RESULTFILE = "c:/logs/TestConvergedMessageUtils/result_%1.txt";
-// folder named UID3 of msgapptestsuite inside private folder.
-const QString PRIVATE_DIR("C:/private/E39cd515");
\ No newline at end of file
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutils/src/testconvergedmessageutils.cpp Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,343 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description: Main test class definition for ConvergedMessageUtils
- */
-
-#include <QtTest/QtTest>
-#include <QTimer>
-#include <QSignalSpy>
-#include "debugtraces.h"
-#include "testconvergedmessageutils.h"
-#include "convergedmessage.h"
-#include "convergedmessageid.h"
-#include "unieditormmsplugin.h"
-#include "mmstestbed.h"
-#include "testconvergedmessageutils.ini"
-
-//---------------------------------------------------------------
-// TestConvergedMessageUtils::initTestCase
-//---------------------------------------------------------------
-void TestConvergedMessageUtils::initTestCase()
-{
- //register user defined object to meta system.
- qRegisterMetaType<long int> ("long int");
-
- //Verify MmsTestBed Instance.
- mmstestbed = new MmsTestBed;
- QVERIFY(mmstestbed != NULL);
-
- //Instantiate UniEditorMmsPlugin and verify if it is correctly Instantited.
- msgPlugin = new UniEditorMmsPlugin();
- QVERIFY(msgPlugin != NULL);
-
- //set up signalspy to listen to signals emitted by mmstestbed
- spy_draft = new QSignalSpy(mmstestbed, SIGNAL(entryCreatedInDraft(long int)));
-}
-
-//---------------------------------------------------------------
-// TestConvergedMessageUtils::init
-//---------------------------------------------------------------
-void TestConvergedMessageUtils::init()
-{
-}
-
-//---------------------------------------------------------------
-// TestConvergedMessageUtils::createMMS
-//---------------------------------------------------------------
-void TestConvergedMessageUtils::createMMS()
-{
- //Create a Converged Message instance.
- QString subject = TEST_MSG_SUBJECT;
-
- qint64 timeStamp = QDateTime::currentDateTime().toTime_t();
-
- QString sender(TEST_SENDER);
- ConvergedMessageAddress address(sender);
- ConvergedMessageAttachmentList attachmentList;
-
- //Add a text attachment to attachment list.
- QString attachmentPath = TEST_ATTACHMENT;
- ConvergedMessageAttachment* attachment =
- new ConvergedMessageAttachment(attachmentPath, ConvergedMessageAttachment::EAttachment);
-
- attachmentList.append(attachment);
-
- //Instantiate a Converged Message object and set service a MMS
- ConvergedMessage msg;
-
- msg.setMessageType(ConvergedMessage::Mms);
-
- //Set Subject
- msg.setSubject(subject);
-
- //Set Timestamp and verify
- msg.setTimeStamp(timeStamp);
- QVERIFY(timeStamp == msg.timeStamp());
-
- //Set Alias to an address
- address.setAlias(QString (TEST_ALIAS));
-
- //Set recipient.
- msg.addToRecipient(address);
-
- //Add attachments' list
- msg.addAttachments(attachmentList);
- msg.setPriority(ConvergedMessage::Normal);
-
- //Adding CC Address
- QString ccAddress(TEST_CC);
- ConvergedMessageAddress ccAdd(ccAddress);
- msg.addCcRecipient(ccAdd);
-
- //Adding BCC Address
- QString bccAddress(TEST_BCC);
- ConvergedMessageAddress bccAdd(bccAddress);
- msg.addBccRecipient(bccAdd);
-
- //Adding From Address
- QString recipientAddress(TEST_SENDER);
- ConvergedMessageAddress recipientAdd(recipientAddress);
- msg.addFromRecipient(recipientAdd);
-
- //Set Body Text and verify
- msg.setBodyText(QString(TEST_MSG_BODY));
- QVERIFY(msg.bodyText().compare(QString(TEST_MSG_BODY)) == 0);
-
- //Removing Body Text as MMS messages do not contain Body Text
- msg.setBodyText(QString(NULL));
-
- //Set Property and Verify
- msg.setProperty(ConvergedMessage::Attachment);
- msg.setProperty(ConvergedMessage::Unread);
- QVERIFY(msg.properties() == ConvergedMessage::Attachment | ConvergedMessage::Unread);
- QVERIFY(msg.hasAttachment() == true);
- QVERIFY(msg.isUnread() == true);
-
- //Set Location
- msg.setLocation(ConvergedMessage::Draft);
-
- //Set Sending State and Verify
- msg.setSendingState(ConvergedMessage::Waiting);
- QVERIFY(msg.sendingState() == ConvergedMessage::Waiting);
-
- //Set Direction
- msg.setDirection(ConvergedMessage::Outgoing);
-
- //Set Priority
- msg.setPriority(ConvergedMessage::Normal);
-
- //Set Sub Type and verify
- msg.setMessageSubType(ConvergedMessage::NokiaService);
- QVERIFY(msg.messageSubType() == ConvergedMessage::NokiaService);
-
- //Create another Converged Message
- ConvergedMessage msgCopyFirst(msg);
- ConvergedMessage msgCopySecond(*(msg.id()));//by Id
- QCOMPARE(msgCopySecond.id()->getId(), msg.id()->getId());//Verify if the copy was as expected
-
- //Create a Converged Message with serializing and deserializing and verify
- QFile file("c:\\test.txt");
- file.open(QIODevice::WriteOnly);
- QDataStream out(&file); // Serialize the data into the file
- msg.serialize(out); // Serialize a string
- file.close();
-
- file.open(QIODevice::ReadOnly);
- QDataStream in(&file); // read the data serialized from the file
-
- ConvergedMessage msgCopyThird;//Third Copy of the Actual Message
- msgCopyThird.deserialize(in);
- file.close();
-
- //Verify the 3rd Copy with the Original Copy
- QVERIFY(msgCopyThird.id()->getId() == msg.id()->getId());
- QCOMPARE(msgCopyThird.subject(), msg.subject());
- QVERIFY(msgCopyThird.messageType() == msg.messageType());
-
- //Get a valid MMS message ID and verify that it is valid.
- mmsMsgId = msgPlugin->convertTo(&msgCopyFirst);
- QVERIFY(mmsMsgId != -1);
- QDEBUG_WRITE("MMS Successfully Sent to Dratfs Folder");
-}
-
-//---------------------------------------------------------------
-// TestConvergedMessageUtils::testMMS
-//---------------------------------------------------------------
-void TestConvergedMessageUtils::testMMS()
-{
- long int mmsDraftMsgId;
-
- //check if draft-folder signal was received...this means message was created in draft
- if( 1 <= spy_draft->count())
- {
- //compare the msgid and verify with the ID given by MMS plugin
- void * temp = const_cast<void*>(spy_draft->at(0).at(0).data());
- mmsDraftMsgId = *reinterpret_cast< long int(*)>(temp);
- QVERIFY(mmsDraftMsgId == mmsMsgId);
-
- //Validate the MMS message with all the values set before.
- ConvergedMessage* draftMsg = msgPlugin->convertFrom(mmsDraftMsgId);
- QVERIFY(draftMsg->subject().compare(QString(TEST_MSG_SUBJECT)) == 0);
- QVERIFY(draftMsg->messageType() == ConvergedMessage::Mms);
- QVERIFY(QString(TEST_SENDER).contains(draftMsg->toAddressList()[0]->address(), Qt::CaseInsensitive) == true);
- QVERIFY(QString(TEST_ALIAS).contains(draftMsg->toAddressList()[0]->alias(), Qt::CaseInsensitive) == true);
- QVERIFY(QString(TEST_CC).contains(draftMsg->ccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
- QVERIFY(QString(TEST_BCC).contains(draftMsg->bccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
- QVERIFY(QString(TEST_SENDER).contains(draftMsg->fromAddress()->address(), Qt::CaseInsensitive) == true);
- QVERIFY(draftMsg->attachments().count() == 1);
- QVERIFY(draftMsg->attachments()[0]->attachmentType() == ConvergedMessageAttachment::EAttachment);
- QVERIFY(draftMsg->attachments()[0]->filePath().contains(QString(TEST_ATTACHMENT).mid(QString(TEST_ATTACHMENT).indexOf(QString("Sample.txt"), 0, Qt::CaseInsensitive)), Qt::CaseInsensitive) == true);
- QVERIFY(draftMsg->location() == ConvergedMessage::Draft);
- QVERIFY(draftMsg->priority() == ConvergedMessage::Normal);
- QVERIFY(draftMsg->direction() == ConvergedMessage::Outgoing);
- QDEBUG_WRITE("MMS Successfully Verified at Drafts Folder");
- }
- else
- {
- QFAIL("testSendReceiveMMS: Failed to create message in Draft");
- }
-}
-
-//---------------------------------------------------------------
-// TestConvergedMessageUtils::testConvergedMessageIdUnusedMethods
-//---------------------------------------------------------------
-void TestConvergedMessageUtils::testConvergedMessageIdUnusedMethods()
-{
- //Create a copy of ConvergedMessageId object from another object
- ConvergedMessageId msgId1;
- msgId1.setId(0x646);
-
- //Verify if the two objects match
- ConvergedMessageId msgId3;
- msgId3 = msgId1;
- QVERIFY(msgId3 == msgId1);
-}
-
-//---------------------------------------------------------------
-// TestConvergedMessageUtils::testConvergedMessageAttachmentUnusedMethods
-//---------------------------------------------------------------
-void TestConvergedMessageUtils::testConvergedMessageAttachmentUnusedMethods()
-{
- //Set Attachment File Path and Type and Verify
- ConvergedMessageAttachment msgAttachment;
- msgAttachment.setFilePath(QString(TEST_ATTACHMENT));
- QCOMPARE(msgAttachment.filePath(), QString(TEST_ATTACHMENT));
- msgAttachment.setAttachmentType(ConvergedMessageAttachment::EAttachment);
- QVERIFY(msgAttachment.attachmentType() == ConvergedMessageAttachment::EAttachment);
-
- //Second Copy with same Contents
- ConvergedMessageAttachment msgAttachmentCopy;
- msgAttachmentCopy.setFilePath(QString(TEST_ATTACHMENT));
- msgAttachmentCopy.setAttachmentType(ConvergedMessageAttachment::EAttachment);
-
- //Verify if they are same
- QVERIFY(msgAttachmentCopy == msgAttachment);
-}
-
-//---------------------------------------------------------------
-// TestConvergedMessageUtils::cleanup
-//---------------------------------------------------------------
-void TestConvergedMessageUtils::cleanup()
-{
-}
-
-//---------------------------------------------------------------
-// TestConvergedMessageUtils::cleanupTestCase
-//---------------------------------------------------------------
-void TestConvergedMessageUtils::cleanupTestCase()
-{
- //Cleanup
- mmstestbed->cleanAll();//Clean All messages from varios Folders
- delete spy_draft;//Signal for Draft Folder
- delete msgPlugin;//MMS Plugin
- delete mmstestbed;//MMS Testbed
-}
-
-//---------------------------------------------------------------
-// getObject
-// factory method to create objects.
-//---------------------------------------------------------------
-QObject* getObject(QString className)
-{
- if(className == "TestConvergedMessageUtils" )
- {
- return new TestConvergedMessageUtils;
- }
- else
- {
- return 0;
- }
-}
-
-//---------------------------------------------------------------
-// createOutPutDirectory
-// creating o/p directory.
-//---------------------------------------------------------------
-void createOutPutDirectory()
- {
- QDir dir;
- //o/p dir
- dir.mkdir(OUTPUTDIRECTORY);
- //tmp dir
- dir.mkdir(TEMPDIR);
- // dir inside private folder.
- dir.mkdir(PRIVATE_DIR);
- }
-
-//---------------------------------------------------------------
-// main
-// main entry point
-//---------------------------------------------------------------
-int main(int argc, char *argv[])
- {
- int ret = -1;
- QCoreApplication app(argc, argv);
-
- //creating output directory.
- createOutPutDirectory();
-
- //the configuration file.
- QFile data("c:/testconvergedmessageutils.cfg");
-
- if (data.open(QFile::ReadOnly))
- {
- QTextStream in(&data);
- while(!in.atEnd())
- {
- QStringList args;
- QString appName = argv[0];
- args << appName;
-
- QString option = "-o";
- args << option;
-
- QString outFile = RESULTFILE;
- QString name = in.readLine();
- outFile = outFile.arg(name);
- args << outFile;
-
- QObject* tc = getObject(name);
-
- if(tc)
- {
- ret = QTest::qExec(tc, args);
- delete tc;
- }
- }
- }
- data.close();
- return ret;
- }
-
-//End of File
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutils/testconvergedmessageutils.cfg Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-TestConvergedMessageUtils
\ No newline at end of file
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutils/testconvergedmessageutils.pl Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,182 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: Test Case Report Generation file for ConvergedMessageUtils
-#
-#!/usr/bin/perl -w
-use warnings;
-use strict;
-
-my $TOTALCASES = 0;
-my $TOTALPASSED = 0;
-my $TOTALRUN = 0;
-my $TOTALFAILED = 0;
-my $TOTALSKIPPED = 0;
-
-sub parse_line
-{
- my $line = $_[0];
- my @parts = split (" ", $line);
- my $passed = $parts[1];
- my $failed = $parts[3];
- my $skipped = $parts[5];
-
- my $total = $passed + $failed + $skipped;
- my $passrate = $passed * 100 / $total;
- my $passrateround = sprintf("%.0f",$passrate);
- my $runrate = ($total - $skipped)*100/$total;
- my $runrateround = sprintf("%.0f",$runrate);
-
- $TOTALCASES += $total;
- $TOTALPASSED += $passed;
- $TOTALRUN += ($total - $skipped);
- $TOTALFAILED += $failed;
- $TOTALSKIPPED += $skipped;
-
- printf MYFILE "<td>\n";
- printf MYFILE "$passed\n";
- printf MYFILE "</td>\n";
-
- if($failed > 0)
- {
- printf MYFILE "<td style=\"font-weight:bold;color:red\">\n";
- printf MYFILE "$failed\n";
- printf MYFILE "</td>\n";
- }
- else
- {
- printf MYFILE "<td>\n";
- printf MYFILE "$failed\n";
- printf MYFILE "</td>\n";
- }
-
- printf MYFILE "<td>\n";
- printf MYFILE "$skipped\n";
- printf MYFILE "</td>\n";
-
- printf MYFILE "<td>\n";
- printf MYFILE "$total\n";
- printf MYFILE "</td>\n";
-
- printf MYFILE "<td>\n";
- printf MYFILE ("$passrateround %%\n");
- printf MYFILE "</td>\n";
-
- printf MYFILE "<td>\n";
- printf MYFILE "$runrateround %%\n";
- printf MYFILE "</td>\n";
-
-
-}
-
-sub parse_file
- {
- my $pattern = "Totals";
- my $file = $_[0];
- open (FILE,$file);
-
- while (my $line= <FILE>)
- {
- chomp ($line);
- if ($line =~ m/$pattern/)
- {
- parse_line $line;
- }
- }
- close(FILE);
- }
-
-
-sub generate_report
- {
- open (MYFILE, '>/epoc32/winscw/c/logs/TestConvergedMessageUtils/report.html');
- printf MYFILE "<html>\n";
- printf MYFILE "<body>\n";
- printf MYFILE "<head>\n";
- printf MYFILE "<title>ConvergedMessageUtils Test Reports</title>";
- printf MYFILE "</head>\n";
- printf MYFILE "<h2 align = center>ConvergedMessageUtils Test Report</h2>\n";
- printf MYFILE "<table border = 2 cellpadding = 10 align = center>\n";
- printf MYFILE "<tr style = \" background-color:lavender \">\n";
- printf MYFILE "<th>Module</th>\n";
- printf MYFILE "<th style = color:green>Passed</th>\n";
- printf MYFILE "<th style = color:red>Failed</th>\n";
- printf MYFILE "<th style = color:chocolate>Skipped</th>\n";
- printf MYFILE "<th>Total Cases</th>\n";
- printf MYFILE "<th>Pass Rate</th>\n";
- printf MYFILE "<th>Run Rate</th>\n";
- printf MYFILE "</tr>\n";
-
-
- my @files = </epoc32/winscw/c/logs/TestConvergedMessageUtils/*.txt>;
- foreach my $file (@files)
- {
- my @splitedpath = split("/",$file);
- my $filename = $splitedpath[-1];
- my $length = length($filename);
- my $name = substr($filename,11,$length-15);
- printf MYFILE "<tr>\n";
- printf MYFILE "<td>\n";
- printf MYFILE "<a HREF=$filename style = text-decoration:none><b>$name</b></a>\n";
- printf MYFILE "</td>\n";
-
- parse_file $file;
-
- printf MYFILE "</tr>\n";
- }
-
- printf MYFILE "<tr style= \"font-weight:bold; color:white; background-color:gray\">\n";
- printf MYFILE "<td>\n";
- printf MYFILE "<b>Overall</b>\n";
- printf MYFILE "</td>\n";
-
-
- printf MYFILE "<td>\n";
- printf MYFILE "$TOTALPASSED\n";
- printf MYFILE "</td>\n";
-
- printf MYFILE "<td>\n";
- printf MYFILE "$TOTALFAILED\n";
- printf MYFILE "</td>\n";
-
- printf MYFILE "<td>\n";
- printf MYFILE "$TOTALSKIPPED\n";
- printf MYFILE "</td>\n";
-
- printf MYFILE "<td>\n";
- printf MYFILE "$TOTALCASES\n";
- printf MYFILE "</td>\n";
-
- my $passrate = $TOTALPASSED*100/$TOTALCASES;
- my $passrateround = sprintf("%.0f",$passrate);
- printf MYFILE "<td>\n";
- printf MYFILE "$passrateround%%\n";
- printf MYFILE "</td>\n";
-
- my $runrate = ($TOTALCASES - $TOTALSKIPPED)*100/$TOTALCASES;
- my $runrateround = sprintf("%.0f",$runrate);
- printf MYFILE "<td>\n";
- printf MYFILE "$runrateround%%\n";
- printf MYFILE "</td>\n";
-
- printf MYFILE "</tr>\n";
-
- printf MYFILE "</table>\n";
- printf MYFILE "</body>\n";
- printf MYFILE "</html>\n";
-
- close (MYFILE);
- }
-
-
-generate_report;
\ No newline at end of file
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutils/testconvergedmessageutils.pro Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: Test Case Project Definition for ConvergedMessageUtils
-#
-
-QT += testlib
-QT -= gui
-
-TEMPLATE = app
-TARGET = testconvergedmessageutils
-
-
-INCLUDEPATH += ./inc
-INCLUDEPATH += ../../inc
-INCLUDEPATH += ../mmstestbed/inc
-INCLUDEPATH += ../../../../../inc
-INCLUDEPATH += ../../../s60qconversions/inc
-INCLUDEPATH += ../../../unidatautils/unidatamodel/inc
-INCLUDEPATH += ../../../../../../../mw/hb/include/hbcore
-INCLUDEPATH += ../../../unieditorutils/editorgenutils/inc
-INCLUDEPATH += ../../../unieditorutils/unieditorplugins/unieditormmsplugin/inc
-INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
-
-DEFINES += BUILD_TEST_DLL
-CONFIG += hb plugin
-
-SYMBIAN_PLATFORMS = WINSCW ARMV5
-
-SOURCES += \
- ./src/testconvergedmessageutils.cpp \
- ../../../unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin.cpp \
- ../../../unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin_p.cpp
-
-# Input
-HEADERS += \
- ./inc/testconvergedmessageutils.h \
- ../../../unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin.h \
- ../../../unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin_p.h
-
-SYMBIAN_PLATFORMS = WINSCW ARMV5
- symbian {
- TARGET.CAPABILITY = All -TCB -DRM
- TARGET.EPOCSTACKSIZE = 0x8000
- TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
- BLD_INF_RULES.prj_exports += "testconvergedmessageutils.cfg c:/testconvergedmessageutils.cfg"
- BLD_INF_RULES.prj_exports += "testconvergedmessageutils.pl c:/testconvergedmessageutils.pl"
- }
-
-LIBS += -leuser \
- -lconvergedmessageutils \
- -ls60qconversions \
- -lMsgMedia \
- -leditorgenutils \
- -lcone \
- -leikcoctl \
- -leikcore \
- -leikdlg \
- -lmsgs \
- -letext \
- -lgsmu \
- -lmmsgenutils \
- -lefsrv \
- -lestor \
- -lsmcm \
- -lCommonEngine \
- -lbafl \
- -lCdlEngine \
- -lFeatMgr \
- -lapmime \
- -lapgrfx \
- -lcharconv \
- -lInetProtUtil \
- -lsmildtd \
- -lxmldom \
- -lxmlparser \
- -lcone \
- -lQtCore \
- -letel \
- -lcommdb \
- -lcommsdat \
- -letelmm \
- -lunidatamodelloader \
- -lunidatamodel \
- -lavkon \
- -leikcoctl \
- -leikctl \
- -lform \
- -luiklaf\
- -lmmstestbed \
- -lmmsmessage \
- -lmmsserversettings \
- -lxqutils
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/mmstestbed/bwins/mmstestbedu.def Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,71 @@
+EXPORTS
+ ?cleanSent@MmsTestBed@@QAEXXZ @ 1 NONAME ; void MmsTestBed::cleanSent(void)
+ ?cancelSendScheduling@MmsTestBed@@QAEXXZ @ 2 NONAME ; void MmsTestBed::cancelSendScheduling(void)
+ ?replyToAll@MmsTestBed@@QAEXXZ @ 3 NONAME ; void MmsTestBed::replyToAll(void)
+ ?getLogEntries@MmsTestBed@@AAEHXZ @ 4 NONAME ; int MmsTestBed::getLogEntries(void)
+ ?restoreFactorySettings@MmsTestBed@@QAEXXZ @ 5 NONAME ; void MmsTestBed::restoreFactorySettings(void)
+ ?fromOutboxToMmscWithMemoryFailure@MmsTestBed@@QAEHXZ @ 6 NONAME ; int MmsTestBed::fromOutboxToMmscWithMemoryFailure(void)
+ ?encodeMessageFromDrafts@MmsTestBed@@AAEXXZ @ 7 NONAME ; void MmsTestBed::encodeMessageFromDrafts(void)
+ ?reply@MmsTestBed@@QAEXXZ @ 8 NONAME ; void MmsTestBed::reply(void)
+ ?deleteEntry@MmsTestBed@@AAEXJAAVCMsvEntry@@@Z @ 9 NONAME ; void MmsTestBed::deleteEntry(long, class CMsvEntry &)
+ ?findDefaultL@MmsTestBed@@AAEXXZ @ 10 NONAME ; void MmsTestBed::findDefaultL(void)
+ ?messageVariation@MmsTestBed@@QAEXXZ @ 11 NONAME ; void MmsTestBed::messageVariation(void)
+ ?sendReadReport@MmsTestBed@@QAEXXZ @ 12 NONAME ; void MmsTestBed::sendReadReport(void)
+ ?garbageCollection@MmsTestBed@@QAEXK@Z @ 13 NONAME ; void MmsTestBed::garbageCollection(unsigned long)
+ ?fetchForced@MmsTestBed@@QAEXH@Z @ 14 NONAME ; void MmsTestBed::fetchForced(int)
+ ?scheduledSend@MmsTestBed@@QAEXJH@Z @ 15 NONAME ; void MmsTestBed::scheduledSend(long, int)
+ ?createMmsService@MmsTestBed@@AAEXXZ @ 16 NONAME ; void MmsTestBed::createMmsService(void)
+ ?trUtf8@MmsTestBed@@SA?AVQString@@PBD0H@Z @ 17 NONAME ; class QString MmsTestBed::trUtf8(char const *, char const *, int)
+ ?qt_metacast@MmsTestBed@@UAEPAXPBD@Z @ 18 NONAME ; void * MmsTestBed::qt_metacast(char const *)
+ ?deleteEventType@MmsTestBed@@QAEXXZ @ 19 NONAME ; void MmsTestBed::deleteEventType(void)
+ ??_EMmsTestBed@@UAE@I@Z @ 20 NONAME ; MmsTestBed::~MmsTestBed(unsigned int)
+ ?cleanLog@MmsTestBed@@QAEXXZ @ 21 NONAME ; void MmsTestBed::cleanLog(void)
+ ?createEntry@MmsTestBed@@QAEXAAVTMsvEntry@@AAVCMsvEntry@@@Z @ 22 NONAME ; void MmsTestBed::createEntry(class TMsvEntry &, class CMsvEntry &)
+ ?scheduledFetch@MmsTestBed@@QAEXH@Z @ 23 NONAME ; void MmsTestBed::scheduledFetch(int)
+ ?sendFromFile@MmsTestBed@@QAEXXZ @ 24 NONAME ; void MmsTestBed::sendFromFile(void)
+ ??0MmsTestBed@@QAE@XZ @ 25 NONAME ; MmsTestBed::MmsTestBed(void)
+ ?cleanInbox@MmsTestBed@@QAEXXZ @ 26 NONAME ; void MmsTestBed::cleanInbox(void)
+ ?deleteFetchSchedule@MmsTestBed@@QAEXXZ @ 27 NONAME ; void MmsTestBed::deleteFetchSchedule(void)
+ ?fromMmscToInbox@MmsTestBed@@QAEXXZ @ 28 NONAME ; void MmsTestBed::fromMmscToInbox(void)
+ ?doAFetchCycle@MmsTestBed@@QAEXXZ @ 29 NONAME ; void MmsTestBed::doAFetchCycle(void)
+ ?entryMovedToSent@MmsTestBed@@IAEXJ@Z @ 30 NONAME ; void MmsTestBed::entryMovedToSent(long)
+ ?cleanupAndCreateNewService@MmsTestBed@@QAEXXZ @ 31 NONAME ; void MmsTestBed::cleanupAndCreateNewService(void)
+ ?cleanup@MmsTestBed@@AAEXXZ @ 32 NONAME ; void MmsTestBed::cleanup(void)
+ ?qt_metacall@MmsTestBed@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 33 NONAME ; int MmsTestBed::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?getEventType@MmsTestBed@@QAEXXZ @ 34 NONAME ; void MmsTestBed::getEventType(void)
+ ?sendViaClient@MmsTestBed@@QAEXXZ @ 35 NONAME ; void MmsTestBed::sendViaClient(void)
+ ?setFetchingState@MmsTestBed@@QAEXW4TMmsReceivingMode@@@Z @ 36 NONAME ; void MmsTestBed::setFetchingState(enum TMmsReceivingMode)
+ ?sendNotifications@MmsTestBed@@QAEXXZ @ 37 NONAME ; void MmsTestBed::sendNotifications(void)
+ ?metaObject@MmsTestBed@@UBEPBUQMetaObject@@XZ @ 38 NONAME ; struct QMetaObject const * MmsTestBed::metaObject(void) const
+ ?setOnline@MmsTestBed@@QAEX_N@Z @ 39 NONAME ; void MmsTestBed::setOnline(bool)
+ ?cleanOutbox@MmsTestBed@@QAEXXZ @ 40 NONAME ; void MmsTestBed::cleanOutbox(void)
+ ?checkLogClient@MmsTestBed@@AAE_NXZ @ 41 NONAME ; bool MmsTestBed::checkLogClient(void)
+ ?cleanDrafts@MmsTestBed@@QAEXXZ @ 42 NONAME ; void MmsTestBed::cleanDrafts(void)
+ ?tr@MmsTestBed@@SA?AVQString@@PBD0H@Z @ 43 NONAME ; class QString MmsTestBed::tr(char const *, char const *, int)
+ ?copyDrafts@MmsTestBed@@QAEXXZ @ 44 NONAME ; void MmsTestBed::copyDrafts(void)
+ ?fromMmscToInboxWithMemoryFailure@MmsTestBed@@QAEHXZ @ 45 NONAME ; int MmsTestBed::fromMmscToInboxWithMemoryFailure(void)
+ ?fetchForcedImmediate@MmsTestBed@@QAEXXZ @ 46 NONAME ; void MmsTestBed::fetchForcedImmediate(void)
+ ?deleteSendSchedule@MmsTestBed@@QAEXXZ @ 47 NONAME ; void MmsTestBed::deleteSendSchedule(void)
+ ?staticMetaObject@MmsTestBed@@2UQMetaObject@@B @ 48 NONAME ; struct QMetaObject const MmsTestBed::staticMetaObject
+ ?entryCreatedInDraft@MmsTestBed@@IAEXJ@Z @ 49 NONAME ; void MmsTestBed::entryCreatedInDraft(long)
+ ?generateDeliveryReport@MmsTestBed@@QAEXPAVCMmsHeaders@@@Z @ 50 NONAME ; void MmsTestBed::generateDeliveryReport(class CMmsHeaders *)
+ ?forward@MmsTestBed@@QAEXXZ @ 51 NONAME ; void MmsTestBed::forward(void)
+ ?entryCreatedInInbox@MmsTestBed@@IAEXJ@Z @ 52 NONAME ; void MmsTestBed::entryCreatedInInbox(long)
+ ?fromOutboxToMmsc@MmsTestBed@@QAEXXZ @ 53 NONAME ; void MmsTestBed::fromOutboxToMmsc(void)
+ ?entryMovedToOutbox@MmsTestBed@@IAEXJ@Z @ 54 NONAME ; void MmsTestBed::entryMovedToOutbox(long)
+ ?findMMSFolder@MmsTestBed@@AAEJXZ @ 55 NONAME ; long MmsTestBed::findMMSFolder(void)
+ ??1MmsTestBed@@UAE@XZ @ 56 NONAME ; MmsTestBed::~MmsTestBed(void)
+ ?cleanAll@MmsTestBed@@QAEXXZ @ 57 NONAME ; void MmsTestBed::cleanAll(void)
+ ?getStaticMetaObject@MmsTestBed@@SAABUQMetaObject@@XZ @ 58 NONAME ; struct QMetaObject const & MmsTestBed::getStaticMetaObject(void)
+ ?sendDeliveryReport@MmsTestBed@@QAEXXZ @ 59 NONAME ; void MmsTestBed::sendDeliveryReport(void)
+ ?setConnectionLocal@MmsTestBed@@QAEX_N@Z @ 60 NONAME ; void MmsTestBed::setConnectionLocal(bool)
+ ?sendOneByOne@MmsTestBed@@QAEXXZ @ 61 NONAME ; void MmsTestBed::sendOneByOne(void)
+ ?cancelFetchScheduling@MmsTestBed@@QAEXXZ @ 62 NONAME ; void MmsTestBed::cancelFetchScheduling(void)
+ ?trUtf8@MmsTestBed@@SA?AVQString@@PBD0@Z @ 63 NONAME ; class QString MmsTestBed::trUtf8(char const *, char const *)
+ ?deleteNotifications@MmsTestBed@@QAEXXZ @ 64 NONAME ; void MmsTestBed::deleteNotifications(void)
+ ?testFile@MmsTestBed@@AAEXAAV?$TBuf@$0BAA@@@HJ@Z @ 65 NONAME ; void MmsTestBed::testFile(class TBuf<256> &, int, long)
+ ?HandleSessionEventL@MmsTestBed@@MAEXW4TMsvSessionEvent@MMsvSessionObserver@@PAX11@Z @ 66 NONAME ; void MmsTestBed::HandleSessionEventL(enum MMsvSessionObserver::TMsvSessionEvent, void *, void *, void *)
+ ?tr@MmsTestBed@@SA?AVQString@@PBD0@Z @ 67 NONAME ; class QString MmsTestBed::tr(char const *, char const *)
+ ?addEventType@MmsTestBed@@QAEXXZ @ 68 NONAME ; void MmsTestBed::addEventType(void)
+ ?addMMBoxDescriptions@MmsTestBed@@AAEXXZ @ 69 NONAME ; void MmsTestBed::addMMBoxDescriptions(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/mmstestbed/eabi/mmstestbedu.def Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,72 @@
+EXPORTS
+ _ZN10MmsTestBed10cleanInboxEv @ 1 NONAME
+ _ZN10MmsTestBed10copyDraftsEv @ 2 NONAME
+ _ZN10MmsTestBed10replyToAllEv @ 3 NONAME
+ _ZN10MmsTestBed11cleanDraftsEv @ 4 NONAME
+ _ZN10MmsTestBed11cleanOutboxEv @ 5 NONAME
+ _ZN10MmsTestBed11createEntryER9TMsvEntryR9CMsvEntry @ 6 NONAME
+ _ZN10MmsTestBed11deleteEntryElR9CMsvEntry @ 7 NONAME
+ _ZN10MmsTestBed11fetchForcedEi @ 8 NONAME
+ _ZN10MmsTestBed11qt_metacallEN11QMetaObject4CallEiPPv @ 9 NONAME
+ _ZN10MmsTestBed11qt_metacastEPKc @ 10 NONAME
+ _ZN10MmsTestBed12addEventTypeEv @ 11 NONAME
+ _ZN10MmsTestBed12findDefaultLEv @ 12 NONAME
+ _ZN10MmsTestBed12getEventTypeEv @ 13 NONAME
+ _ZN10MmsTestBed12sendFromFileEv @ 14 NONAME
+ _ZN10MmsTestBed12sendOneByOneEv @ 15 NONAME
+ _ZN10MmsTestBed13doAFetchCycleEv @ 16 NONAME
+ _ZN10MmsTestBed13findMMSFolderEv @ 17 NONAME
+ _ZN10MmsTestBed13getLogEntriesEv @ 18 NONAME
+ _ZN10MmsTestBed13scheduledSendEli @ 19 NONAME
+ _ZN10MmsTestBed13sendViaClientEv @ 20 NONAME
+ _ZN10MmsTestBed14checkLogClientEv @ 21 NONAME
+ _ZN10MmsTestBed14scheduledFetchEi @ 22 NONAME
+ _ZN10MmsTestBed14sendReadReportEv @ 23 NONAME
+ _ZN10MmsTestBed15deleteEventTypeEv @ 24 NONAME
+ _ZN10MmsTestBed15fromMmscToInboxEv @ 25 NONAME
+ _ZN10MmsTestBed16createMmsServiceEv @ 26 NONAME
+ _ZN10MmsTestBed16entryMovedToSentEl @ 27 NONAME
+ _ZN10MmsTestBed16fromOutboxToMmscEv @ 28 NONAME
+ _ZN10MmsTestBed16messageVariationEv @ 29 NONAME
+ _ZN10MmsTestBed16setFetchingStateE17TMmsReceivingMode @ 30 NONAME
+ _ZN10MmsTestBed16staticMetaObjectE @ 31 NONAME DATA 16
+ _ZN10MmsTestBed17garbageCollectionEm @ 32 NONAME
+ _ZN10MmsTestBed17sendNotificationsEv @ 33 NONAME
+ _ZN10MmsTestBed18deleteSendScheduleEv @ 34 NONAME
+ _ZN10MmsTestBed18entryMovedToOutboxEl @ 35 NONAME
+ _ZN10MmsTestBed18sendDeliveryReportEv @ 36 NONAME
+ _ZN10MmsTestBed18setConnectionLocalEb @ 37 NONAME
+ _ZN10MmsTestBed19HandleSessionEventLEN19MMsvSessionObserver16TMsvSessionEventEPvS2_S2_ @ 38 NONAME
+ _ZN10MmsTestBed19deleteFetchScheduleEv @ 39 NONAME
+ _ZN10MmsTestBed19deleteNotificationsEv @ 40 NONAME
+ _ZN10MmsTestBed19entryCreatedInDraftEl @ 41 NONAME
+ _ZN10MmsTestBed19entryCreatedInInboxEl @ 42 NONAME
+ _ZN10MmsTestBed19getStaticMetaObjectEv @ 43 NONAME
+ _ZN10MmsTestBed20addMMBoxDescriptionsEv @ 44 NONAME
+ _ZN10MmsTestBed20cancelSendSchedulingEv @ 45 NONAME
+ _ZN10MmsTestBed20fetchForcedImmediateEv @ 46 NONAME
+ _ZN10MmsTestBed21cancelFetchSchedulingEv @ 47 NONAME
+ _ZN10MmsTestBed22generateDeliveryReportEP11CMmsHeaders @ 48 NONAME
+ _ZN10MmsTestBed22restoreFactorySettingsEv @ 49 NONAME
+ _ZN10MmsTestBed23encodeMessageFromDraftsEv @ 50 NONAME
+ _ZN10MmsTestBed26cleanupAndCreateNewServiceEv @ 51 NONAME
+ _ZN10MmsTestBed32fromMmscToInboxWithMemoryFailureEv @ 52 NONAME
+ _ZN10MmsTestBed33fromOutboxToMmscWithMemoryFailureEv @ 53 NONAME
+ _ZN10MmsTestBed5replyEv @ 54 NONAME
+ _ZN10MmsTestBed7cleanupEv @ 55 NONAME
+ _ZN10MmsTestBed7forwardEv @ 56 NONAME
+ _ZN10MmsTestBed8cleanAllEv @ 57 NONAME
+ _ZN10MmsTestBed8cleanLogEv @ 58 NONAME
+ _ZN10MmsTestBed8testFileER4TBufILi256EEil @ 59 NONAME
+ _ZN10MmsTestBed9cleanSentEv @ 60 NONAME
+ _ZN10MmsTestBed9setOnlineEb @ 61 NONAME
+ _ZN10MmsTestBedC1Ev @ 62 NONAME
+ _ZN10MmsTestBedC2Ev @ 63 NONAME
+ _ZN10MmsTestBedD0Ev @ 64 NONAME
+ _ZN10MmsTestBedD1Ev @ 65 NONAME
+ _ZN10MmsTestBedD2Ev @ 66 NONAME
+ _ZNK10MmsTestBed10metaObjectEv @ 67 NONAME
+ _ZTI10MmsTestBed @ 68 NONAME
+ _ZTV10MmsTestBed @ 69 NONAME
+ _ZThn8_N10MmsTestBed19HandleSessionEventLEN19MMsvSessionObserver16TMsvSessionEventEPvS2_S2_ @ 70 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/mmstestbed/inc/mmsreadfile.h Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,471 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#ifndef MMSREADFILE_H
+#define MMSREADFILE_H
+
+// INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+#include <f32file.h>
+#include <msvstd.h>
+
+// forward references
+class CMmsAttaStructure;
+class CMmsHeaders;
+class CEikonEnv;
+class CMmsClientMtm;
+
+// Out-of-range value for any MMS header with assigned number
+// Used in coverage tests to get coverage for "default" branches
+// in "case" statements.
+const TInt KMmsTestIllegalValue = 255;
+
+//
+// TEST KEY WORDS
+// Extended to include all MMS headers to allow generation of arbitrary PDUs
+// Content type header cannot be separately defined,
+// it will always be "multipat/mixed" or "multipart/related"
+_LIT8( KTestEndOfFile, "EOF" );
+_LIT8( KTestNewMessage, "MESSAGE BEGIN" );
+//------------------------------------------------
+_LIT8( KTestMessageType, "MESSAGE-TYPE" ); //X-Mms-Message-Type
+_LIT8( KTestDate, "DATE" ); // Date
+_LIT8( KTestFrom, "FROM" ); // From
+_LIT8( KTestTo, "TO" ); // To
+_LIT8( KTestCc, "CC" ); // Cc
+_LIT8( KTestBcc, "BCC" ); // Bcc
+_LIT8( KTestSubject, "SUBJECT" ); // Subject
+_LIT8( KTestExpiryRel, "EXPIRY-REL" ); // X-Mms-Expiry, relative
+_LIT8( KTestExpiryAbs, "EXPIRY-ABS" ); // X-Mms-Expiry, absolute
+_LIT8( KTestDeliveryTimeRel, "DELIVERY-TIME-REL" ); // X-Mms-Delivery-Time, relative
+_LIT8( KTestDeliveryTimeAbs, "DELIVERY-TIME-ABS" ); // X-Mms-Delivery-Time, absolute
+_LIT8( KTestPriority, "PRIORITY" ); // X-Mms-Priority
+_LIT8( KTestSenderVisibility, "SENDER-VISIBILITY" ); // X-Mms-Sender-Visibility
+_LIT8( KTestDeliveryReport, "DELIVERY-REPORT" ); // X-Mms-Delivery-Report
+_LIT8( KTestReadReply, "READ-REPLY" ); // X-Mms-Read-Report
+// ---------------------------------------------------
+_LIT8( KTestNewAttachment, "ATTACHMENT" );
+_LIT8( KTestAttachmentType, "ATTACHMENTTYPE" );
+_LIT8( KTestAttachmentName, "ATTACHMENTNAME" );
+_LIT8( KTestAttachmentContLoc, "ATTACHMENTCONTLOC" );
+_LIT8( KTestAttachmentCharset, "ATTACHMENTCHARSET" );
+_LIT8( KTestAttachmentCid, "ATTACHMENTCID" );
+_LIT8( KTestAttachmentRoot, "ATTACHMENTROOT" );
+// content-type and x-type parameters for attachments
+// should appear in name-value pairs.
+// Test program is not responsible for verifying illegal scripts
+_LIT8( KTestAttContTypeParamName, "ContTypeParamName" );
+_LIT8( KTestAttContTypeParamValue, "ContTypeParamValue" );
+_LIT8( KTestAttXTypeParamName, "X-TypeParamName" );
+_LIT8( KTestAttXTypeParamValue, "X-TypeParamValue" );
+// -----------------------------------------------------
+_LIT8( KTestMessageClass, "MESSAGE-CLASS" ); // X-Mms-Message-Class
+_LIT8( KTestDelivRepSendAllow, "DELIV-REP-SEND-ALLOW" ); // X-Mms-Report-Allowed
+_LIT8( KTestAcceptAdvertis, "ACCEPT-ADVERTISEMENTS" );
+_LIT8( KTestRetryCount, "RETRY-COUNT" );
+_LIT8( KTestRetryInterval, "RETRY-INTERVAL" );
+// -------------------------------------------------
+_LIT8( KTestAlias, "ALIAS" );
+_LIT8( KTestFromAlias, "FROMALIAS" );
+_LIT8( KTestToAlias, "TOALIAS" );
+_LIT8( KTestCcAlias, "CCALIAS" );
+_LIT8( KTestBccAlias, "BCCALIAS" );
+// -------------------------------------------------
+// more Message headers to allow testing all possible PDUs and
+// MMS 1.1 headers
+_LIT8( KTestReplyCharging, "REPLY-CHARGING" ); // X-Mms-Reply-Charging
+_LIT8( KTestReplyChargAbs, "REPLY-CHARG-DEADLINE-ABS" ); // X-Mms-Reply-Charging, absolute
+_LIT8( KTestReplyChargRel, "REPLY-CHARG-DEADLINE-REL" ); // X-Mms-Reply-Charging, relative
+_LIT8( KTestReplyChargSize, "REPLY-CHARG-SIZE" ); // X-Mms-Reply-Charging-Size (octets)
+_LIT8( KTestReplyChargID, "REPLY-CHARGING-ID" ); // X-Mms-Reply-Charging-ID
+_LIT8( KTestTID, "TID" );
+_LIT8( KTestContentLocation, "CONTLOC" ); // X-Mms-Content-Location
+// The following three must appear as triplets.
+// index must be first, address and date may appear in any order
+_LIT8( KTestPreviouslySentIndex, "PREVIOUSINDEX" ); // forwarded count for X-Mms-PreviouslySent headers
+_LIT8( KTestPreviouslySentBy, "PREV-SENT-BY" ); // X-Mms-Previously-Sent-By
+_LIT8( KTestPreviouslySentDate, "PREV-SENT-DATE" ); // X-Mms-Previously-Sent-Date
+//---
+_LIT8( KTestMessageId, "MESSAGE-ID" ); // Message-ID
+_LIT8( KTestMessageSize, "MESSAGE-SIZE" ); // X-Mms-Message-Size (octets)
+_LIT8( KTestVersion, "MMS-VERSION" ); // X-MMS-Version (hex:, 10 = 1.0, 11 = 1.1 etc. )
+_LIT8( KTestReadStatus, "READ-STATUS" ); // X-Mms-Read-Status
+_LIT8( KTestResponseStatus, "RESPONSE-STATUS" ); // X-Mms-Response-Status
+_LIT8( KTestResponseText, "RESPONSE-TEXT" ); // X-Mms-Response-Text
+_LIT8( KTestRetrieveStatus, "RETRIEVE-STATUS" ); // X-Mms-Retrieve-Status
+_LIT8( KTestRetrieveText, "RETRIEVE-TEXT" ); // X-Mms-Retrieve-Text
+_LIT8( KTestStatus, "STATUS" ); // X-Mms-Status
+// -------------------------------------------------
+// MMS 1.2 headers
+_LIT8( KTestAttribute, "ATTRIBUTE" ); // X-Mms-Attribute
+// The value should be one of the following:
+// BCC, CC, CONTENT, CONTENT-TYPE, DATE, DELIVERY-REPORT, DELIVERY-TIME-ABS,
+// EXPIRY-ABS, FROM, MESSAGE-CLASS, MESSAGE-ID, MESSAGE-SIZE, PRIORITY,
+// READ-REPLY, SUBJECT, TO, REPLY-CHARGING, REPLY-CHARGING-ID,
+// REPLY-CHARG-DEADLINE-ABS, REPLY-CHARG-SIZE, PREV-SENT-BY,
+// PREV-SENT-DATE, ADDITIONAL-HEADERS
+_LIT8( KTestDistributionIndicator, "DISTRIBUTION-INDICATOR" ); // X-Mms-Distribution-Indicator
+_LIT8( KTestLimit, "LIMIT" ); // X-Mms-Limit
+_LIT8( KTestMessageQuota, "MESSAGE-QUOTA" ); // X-Mms-Mbox-Quota, message number
+_LIT8( KTestSizeQuota, "SIZE-QUOTA" ); // X-Mms-Mbox-Quota, size quota
+_LIT8( KTestMessageTotal, "MESSAGE-TOTAL" ); // X-Mms-Mbox-Totals, message number
+_LIT8( KTestSizeTotal, "SIZE-TOTAL" ); // X-Mms-Mbox-Totals, total size
+_LIT8( KTestMessageCount, "MESSAGE-COUNT" ); // X-Mms-Message-Count
+_LIT8( KTestAddKeyword, "ADD-KEYWORD" ); // X-Mms-MM-Flags
+_LIT8( KTestRemoveKeyword, "REMOVE-KEYWORD" ); // X-Mms-MM-Flags
+_LIT8( KTestFilterKeyword, "FILTER-KEYWORD" ); // X-Mms-MM-FLags
+_LIT8( KTestMMState, "MESSAGE-STATE" ); // X-Mms-MM-State
+_LIT8( KTestQuota, "QUOTA" ); // X-Mms-Quotas
+_LIT8( KTestStart, "START" ); // X-Mms-Start
+_LIT8( KTestStore, "STORE" ); // X-Mms-Store
+_LIT8( KTestStored, "STORED" ); // X-Mms-Stored
+_LIT8( KTestStoreStatus, "STORE-STATUS" ); // X-Mms-Store-Status
+_LIT8( KTestStoreStatusText, "STORE-STATUS-TEXT" ); // X-Mms-Store-Status-Text
+_LIT8( KTestTotals, "TOTALS" ); // X-Mms-Totals
+// Delete confirmation header structure
+// This consists of index, content location, response status and response status text.
+// All three values are not always necessary for each index, but at least content-location
+// and response status should be present.
+// The index retains its value until a new index is encountered.
+_LIT8( KTestDeleteInfoIndex, "DELETESTATUSINDEX" ); // index for next delete info fields
+// This header must precede content-location, response-status and response-text fields
+// in a delete confirmation. Index retains its value until a new index is encountered.
+
+// Element descriptor header not implemented
+
+// Application id headers
+// These will officially be supported in MMS encapsulation version 1.3
+// Java has non-standard support even earlier
+
+_LIT8( KTestApplicId, "APPLIC-ID" ); // X-Mms-Applic-ID
+_LIT8( KTestReplyApplicId, "REPLY-APPLIC-ID" ); // X-Mms-Reply-Applic-ID
+_LIT8( KTestApplicInfo, "AUX-APPLIC-INFO" ); // X-Mms-Aux-Applic-Info
+
+// Since Encapsulation 1.3
+_LIT8( KTestContentClass, "CONTENT-CLASS" ); // X-Mms-Content-Class
+_LIT8( KTestDrmContent, "DRM-CONTENT" ); // X-Mms-DRM-Content
+_LIT8( KTestAdaptationAllowed, "ADAPTATION-ALLOWED" ); // X-Mms-Adaptation-Allowed
+_LIT8( KTestRecommendedRetrievalMode, "REC-RETRIEVAL-MODE" ); // X-Mms-Recommended-Retrieval-Mode
+_LIT8( KTestRecRetrievalModeText, "REC-RETR-MODE-TEXT" ); // X-Mms-Recommended-Retrieval-Mode-Text
+_LIT8( KTestReplaceId, "REPLACE-ID" ); // X-Mms-Replace-ID
+_LIT8( KTestStatusText, "STATUS-TEXT" ); // X-Mms-Status-Text
+_LIT8( KTestCancelId, "CANCEL-ID" ); // X-Mms-Cancel-ID
+_LIT8( KTestCancelStatus, "CANCEL-STATUS" ); // X-Mms-Cancel-Status
+
+// DATA TYPES
+#define aSet 1
+#define aReset 0
+#define PartCount 100
+#define MaxAttaCount 10
+#define DefaultBufLen 256
+#define MaxRecipients 5
+
+// status returned by ReadRow
+enum TTestReadStatus
+ {
+ ETestUnknown,
+ ETestNewMessage,
+ ETestNewAttachment,
+ ETestEof, // End of file
+ ETestMessageType,
+ ETestDate,
+ ETestFrom,
+ ETestTo,
+ ETestCc,
+ ETestBcc,
+ ETestAlias,
+ ETestFromAlias,
+ ETestToAlias,
+ ETestCcAlias,
+ ETestBccAlias,
+ ETestSubject,
+ ETestExpiryRel,
+ ETestExpiryAbs,
+ ETestDeliveryTimeRel,
+ ETestDeliveryTimeAbs,
+ ETestPriority,
+ ETestSenderVisibility,
+ ETestDeliveryReport,
+ ETestReadReply,
+ ETestAttachmentType,
+// ETestAttachmentName,
+ ETestAttachmentCharset,
+ ETestAttachmentCid,
+ ETestAttachmentRoot,
+ ETestSettings,
+ ETestMessageClass,
+ ETestDelivReportSendAllow,
+ ETestSingleMessageClass,
+ ETestReplyCharging,
+ ETestReplyChargAbs,
+ ETestReplyChargRel,
+ ETestReplyChargSize,
+ ETestReplyChargID,
+ ETestTID,
+ ETestContentLocation,
+ ETestPreviouslySentIndex,
+ ETestPreviouslySentBy,
+ ETestPreviouslySentDate,
+ ETestMessageId,
+ ETestMessageSize,
+ ETestVersion,
+ ETestReadStatus,
+ ETestResponseStatus,
+ ETestResponseText,
+ ETestRetrieveStatus,
+ ETestRetrieveText,
+ ETestStatus,
+ ETestAttribute,
+ ETestDistributionIndicator,
+ ETestLimit,
+ ETestMessageQuota,
+ ETestSizeQuota,
+ ETestMessageTotal,
+ ETestSizeTotal,
+ ETestMessageCount,
+ ETestAddKeyword,
+ ETestRemoveKeyword,
+ ETestFilterKeyword,
+ ETestMMState,
+ ETestQuota,
+ ETestStart,
+ ETestStore,
+ ETestStored,
+ ETestStoreStatus,
+ ETestStoreStatusText,
+ ETestTotals,
+ ETestDeleteInfoIndex,
+ ETestApplicId,
+ ETestReplyApplicId,
+ ETestApplicInfo,
+ ETestContentClass,
+ ETestDrmContent,
+ ETestAdaptationAllowed,
+ ETestRecommendedRetrievalMode,
+ ETestRecRetrievalModeText,
+ ETestReplaceId,
+ ETestStatusText,
+ ETestCancelId,
+ ETestCancelStatus,
+ ETestAttaRecommendedName,
+ ETestAttachmentContLoc,
+ ETestAttContTypeParamName,
+ ETestAttContTypeParamValue,
+ ETestAttXTypeParamName,
+ ETestAttXTypeParamValue
+
+ };
+
+// VALUE KEYWORDS
+_LIT( KPersonal, "Personal" );
+_LIT( KAdvertisement, "Advertisement" );
+_LIT( KInformational, "Informational" );
+_LIT( KAuto, "Auto" );
+_LIT( KLow, "Low" );
+_LIT( KNormal, "Normal" );
+_LIT( KHigh, "High" );
+_LIT( KHide, "Hide" );
+_LIT( KShow, "Show" );
+_LIT( KYes, "Yes" );
+_LIT( KNo, "No" );
+_LIT( KOn, "On" );
+_LIT( KOff, "Off" );
+_LIT( KDeferred, "Deferred" );
+_LIT( KExpired, "Expired" );
+_LIT( KRetrieved, "Retrieved" );
+_LIT( KRejected, "Rejected" );
+_LIT( KUnrecognized, "Unrecognized" );
+_LIT( KIndeterminate, "Indeterminate" );
+_LIT( KForwarded, "Forwarded" );
+_LIT( KUnreachable, "Unreachable" );
+_LIT( KDraft, "Draft");
+_LIT( KSent, "Sent" );
+_LIT( KNew, "New" );
+// X-Mms-Message-Type
+_LIT( KSendReq, "SendReq" );
+_LIT( KSendConf, "SendConf" );
+_LIT( KNotifInd, "NotifInd" );
+_LIT( KNotifResp, "NotifResp" );
+_LIT( KRetrConf, "RetrConf" );
+_LIT( KAckInd, "AckInd" );
+_LIT( KDelInd, "DelInd" );
+_LIT( KReadReqInd, "ReadReqInd" );
+_LIT( KReadOrigInd, "ReadOrigInd" );
+_LIT( KForwardRec, "ForwardReq" );
+_LIT( KForwardConf, "ForwardConf" );
+_LIT( KMBoxStoreReq, "MBoxStoreReq" );
+_LIT( KMBoxStoreConf, "MBoxStoreConf" );
+_LIT( KMBoxViewReq, "MBoxViewReq" );
+_LIT( KMBoxViewConf, "MBoxViewConf" );
+_LIT( KMBoxUploadReq, "MBoxUploadReq" );
+_LIT( KMBoxUploadConf, "MBoxUploadConf" );
+_LIT( KMBoxDeleteReq, "MBoxDeleteReq" );
+_LIT( KMBoxDeleteConf, "MBoxDeleteConf" );
+_LIT( KMBoxDescr, "MBoxDescr" );
+_LIT( KDeleteReq, "DeleteReq" );
+_LIT( KDeleteConf, "DeleteConf" );
+_LIT( KCancelReq, "CancelReq" );
+_LIT( KCancelResp, "CancelConf" );
+// X-Mms-Read-Status
+_LIT( KRead, "Read" );
+_LIT( KDelNotRead, "DeletedNotRead" );
+// X-Mms-Reply-Charging
+_LIT( KRequested, "Requested" );
+_LIT( KReqTextOnly, "ReqTextOnly" );
+_LIT( KAccepted, "Accepted" );
+_LIT( KAccTextOnly, "AccTextOnly" );
+// X-Mms-Cancel-Status (only receival of request, not actual cancellation)
+_LIT( KCancelSuccessful, "CancelSuccess" );
+_LIT( KCancelCorrupted, "CancelCorrupted" );
+// X-Mms-Content-Class
+_LIT( KText, "Text" );
+_LIT( KImageBasic, "ImageBasic" );
+_LIT( KImageRich, "ImageRich" );
+_LIT( KVideoBasic, "VideoBasic" );
+_LIT( KVideoRich, "VideoRich" );
+_LIT( KMegaPixel, "MegaPixel" );
+_LIT( KContentBasic, "ContentBasic" );
+_LIT( KContentRich, "ContentRich" );
+// X-Mms-Recommended-Retrieval-Mode
+_LIT( KManual, "Manual" );
+
+//X-Mms-ResponseStatus
+// legacy values
+_LIT( KOk, "OK" );
+_LIT( KErrUnspecified, "Unspecified" );
+_LIT( KErrServiceDenied, "ServiceDenied" );
+_LIT( KErrMessageFormatCorrupt, "FormatCorrupt" );
+_LIT( KErrAddressUnresolved, "AddressUnresolved" );
+_LIT( KErrMessageNotFound, "MessageNotFound" );
+_LIT( KErrNetworkProblem, "NetworkProblem" );
+_LIT( KErrContentNotAccepted, "ContentNotAccepted" );
+_LIT( KErrUnsupportedMessage, "UnsupportedMessage" );
+// values since 1.1 (and 1.2)
+_LIT( KErrTransient, "TransientFailure" );
+_LIT( KErrTransientAddressUnresolved, "TransientAddressUnresolved" );
+_LIT( KErrTransientNotFound, "TransientMessageNotFound" );
+_LIT( KErrTransientNetworkproblem, "TransientNetworkProblem" );
+_LIT( KErrTransientPartialSuccess, "PartialSuccess" );
+_LIT( KErrPermanent, "PermanentFailure" );
+_LIT( KErrPermanentServiceDenied, "PermanentServiceDenied" );
+_LIT( KErrPermanentMessageFormatCorrupt, "PermanentFormatCorrupt" );
+_LIT( KErrPermanentAddressUnresolved, "PermanentAddressUnresolved" );
+_LIT( KErrPermanentNotFound, "PermanentMessageNotFound" );
+_LIT( KErrPermanentContentNotAccepted, "PermanentContentNotAccepted" );
+_LIT( KErrReplyChargingLimitNotMet, "ReplyChargingLimitNotMet" );
+_LIT( KErrReplyChargingRequestNotAccepted, "ReplyChargingRequestNotAccepted" );
+_LIT( KErrReplyChargingForwardingDenied, "ReplyChargingForwardingDenied" );
+_LIT( KErrReplyChargingNotSupported, "ReplyChargingNotSupported" );
+_LIT( KErrAddressHidingNotSupported, "AddressHidingNotSupported" );
+_LIT( KErrPermanentLackOfPrepaid, "PermanentLackOfPrepaid" );
+//X-Mms-RetrieveStatus (one extra value)
+_LIT( KErrRetrieveContentUnsupported, "PermanentContentUnsupported" );
+//X-Mms-Store-Status (one extra value)
+_LIT( KErrMMBoxFull, "MMBoxFull" );
+
+_LIT8( KTestContent, "Content" ); // For attribute list only
+_LIT8( KTestAdditionalHeaders, "ADDITIONAL-HEADERS" ); // For attribute list only
+_LIT8( KTestDeliveryTime, "DELIVERY-TIME"); // for attribute list only
+_LIT8( KTestExpiry, "EXPIRY"); // for attribute list only
+_LIT8( KTestReplyCharg, "REPLY-CHARG-DEADLINE" ); // for attribute list only
+_LIT8( KTestContentType, "CONTENT-TYPE" ); // for attribute list only
+
+/**
+* CMmsReadFile
+*/
+NONSHARABLE_CLASS( CMmsReadFile ):public CBase
+ {
+ public: // Constructors and destructor
+
+ static CMmsReadFile* NewL(RFs& aFs, RFileReadStream& aReadStream ); // Two-phased constructor.
+ virtual ~CMmsReadFile(); // Destructor
+
+ public: // New functions
+
+ TInt CompleteTestL(TInt aMessageCounter, CMmsHeaders& aMmsHeaders);
+ TTestReadStatus ReadRowL();
+ void CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders );
+ TInt FindAlias(TPtrC alias);
+ void SetAttaStructure( TBool aOldAttaStructure = EFalse );
+
+ protected: // Functions from base classes
+
+ private:
+
+ CMmsReadFile(); // C++ default constructor.
+ // By default constructor is private.
+ void ConstructL( RFs& aFs, RFileReadStream& aReadStream );
+ void Reset();
+
+ public: // data
+ TInt iMessageType;
+
+
+ private: // Data
+
+ RFs iFs;
+ RFileReadStream* iReader;
+ TBuf<DefaultBufLen> iValueBuffer;
+ CDesCArray* iAliasArray; // aliases
+ HBufC8* iByteBuffer;
+ TTime iDate;
+ CArrayPtrFlat<CMmsAttaStructure>* iAttaStructures;
+ TInt iAttaCount;
+ TInt iAttaRoot;
+ TInt iAliasCount;
+ TInt iNextMessageType;
+ TParse iParse;
+ TFileName iFilename;
+
+ protected: // Data
+ private: // Data
+
+ // CArrayFixFlat <TestMessage>* iMessages;
+
+ public: // Friend classes
+ protected: // Friend classes
+ private: // Friend classes
+
+ };
+
+
+NONSHARABLE_CLASS( CMmsAttaStructure ):public CBase
+ {
+ public: // Constructors and destructor
+ static CMmsAttaStructure* NewL(); // Two-phased constructor.
+ virtual ~CMmsAttaStructure(); // Destructor
+ private:
+ CMmsAttaStructure(); // C++ default constructor.
+ // By default constructor is private.
+ void ConstructL();
+
+ public: // Data
+ HBufC8* iAtta;
+ HBufC8* iAttaName; // content location
+ HBufC8* iAttaType;
+ HBufC8* iAttaCid;
+ TInt iAttaCharset;
+ HBufC* iAttaRecommendedName; // recommended filename
+ CDesC8ArrayFlat* iContentTypeParams; // zero or more "parameter"
+ CDesC8ArrayFlat* iXTypeParams; // zero or more X-Type "parameters"
+
+ };
+
+
+#endif // MMSREADFILE_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/mmstestbed/inc/mmstestbed.h Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#ifndef MMSTESTBED_H
+#define MMSTESTBED_H
+
+#ifdef BUILD_MMSTESTBED_DLL
+#define MMSTESTBED_EXPORT Q_DECL_EXPORT
+#else
+#define MMSTESTBED_EXPORT Q_DECL_IMPORT
+#endif
+
+#include <QObject>
+#include <QString>
+
+#include <msvids.h> //for consts like KMsvNullIndexEntryIdValue
+#include <MSVAPI.H>
+#include <MTCLREG.H>
+#include <mmsclient.h>
+//#include <mmsservercommon.h>
+
+class CTestUiTimer;
+class CMsvSession;
+class CMmsClientMtm;
+class CMmsSettings;
+class CMmsHeaders;
+class CLogEvent;
+class CLogViewEvent;
+class CLogFilter;
+class CLogClient;
+
+class MMSTESTBED_EXPORT MmsTestBed : public QObject, public MMsvSessionObserver
+ {
+ Q_OBJECT
+
+public:
+ /**
+ *
+ */
+ MmsTestBed();
+ ~MmsTestBed();
+ void setConnectionLocal(bool value);
+ void fromOutboxToMmsc();
+ void fromMmscToInbox();
+ /**
+ * cleanup MMS service
+ */
+ void cleanupAndCreateNewService();
+ void deleteNotifications();
+ void restoreFactorySettings();
+ void setFetchingState( TMmsReceivingMode aState );
+ void sendFromFile();
+ void sendOneByOne();
+ void sendNotifications();
+ void copyDrafts();
+ void garbageCollection(TUint32 aReason = 0x00000001); //0x00000001 == KMmsReasonBoot
+ void messageVariation();
+ void cancelSendScheduling();
+ void scheduledSend(TMsvId aBoxId, TInt aDelay = 5);
+ void deleteSendSchedule();
+ void cancelFetchScheduling();
+ void fetchForced(TInt aDelay = 5);
+ void deleteFetchSchedule();
+ void doAFetchCycle();
+ void createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry);
+ void cleanOutbox();
+ void cleanInbox();
+ void cleanSent();
+ void cleanDrafts();
+ void cleanAll();
+ void reply();
+ void replyToAll();
+ void forward();
+ void sendReadReport(); // send a read report
+ int fromOutboxToMmscWithMemoryFailure(); // returns memory failure count
+ int fromMmscToInboxWithMemoryFailure(); // returns memory failure count
+ void sendViaClient();
+ void scheduledFetch(TInt aDelay = 5);
+ void fetchForcedImmediate();
+ void getEventType();
+ void addEventType();
+ void deleteEventType();
+ void cleanLog();
+ void setOnline(bool value);
+ void generateDeliveryReport( CMmsHeaders* aMmsHeaders );
+ void sendDeliveryReport();
+
+signals:
+ void entryCreatedInDraft(long int id);
+ void entryMovedToOutbox(long int id);
+ void entryMovedToSent(long int id);
+ void entryCreatedInInbox(long int id);
+
+protected:
+ /**
+ * From MMsvSessionObserver
+ */
+ void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
+ TAny* aArg2, TAny* aArg3);
+
+private:
+ void findDefaultL();
+ void createMmsService();
+ void cleanup();
+ void deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry);
+ void testFile(TFileName& aFilePath, TInt aCommand = 0, TMsvId aBox = KMsvGlobalOutBoxIndexEntryId);
+ void addMMBoxDescriptions();
+ void encodeMessageFromDrafts();
+ TMsvId findMMSFolder();
+ bool checkLogClient();
+ int getLogEntries();
+
+private:
+ //data
+ CTestUiTimer* iTimer;
+ CMsvOperationActiveSchedulerWait* iWait;
+ CMsvSession* iSession;
+ CClientMtmRegistry* iClientMtmRegistry;
+ CMmsClientMtm* iMmsClient;
+ CMmsSettings* iSettings;
+ CMmsHeaders* iMmsHeaders;
+ TMsvId iServiceId;
+ TMsvId iDefaultServiceId;
+ TMsvSessionEvent iEvent;
+ RFs iFs;
+ TFileName iFilename;
+ TFileName iCurrentFile;
+ TFileName iCurrentPath;
+ TParse iParse; // parse buffer as member to save stack space
+ CBufFlat* iEncodeBuffer;
+ CMsvEntrySelection* iMsvEntrySelection;
+ CLogEvent* iLogEvent;
+ CLogClient* iLogClient;
+ CLogViewEvent* iLogView;
+ CLogFilter* iLogFilter;
+ };
+
+#endif // MMSTESTBED_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/mmstestbed/inc/mmstestbed.hrh Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#include <bldvariant.hrh>
+
+
+#ifndef MMSTESTBED_HRH
+#define MMSTESTBED_HRH
+
+enum
+{
+ EAppMainOk = 1,
+ EAppMainCancel,
+ //
+ EMenufrmCmdCascadeTest,
+ ECleanup,
+ ECleanOutbox,
+ ESaveSettings,
+ ELoadSettings,
+ ECleanInbox,
+ EShowIn,
+ EShowOut,
+ EOutToMMSC,
+ EMMSCToIn,
+ ESendScheduled,
+ EReceiveScheduled,
+ EShowSent,
+ ECleanSent,
+ EStartMyNotifier,
+ EGetEventType,
+ EAddEventType,
+ EDeleteEventType,
+ EViewLog,
+ ECleanLog,
+ EShowWapAccessPoints,
+ ESelectWapAccessPoint,
+ EShowConnectionMode,
+ EShowIAP,
+ EConnectToIAP,
+ EDeleteSendSchedule,
+ EDeleteReceiveSchedule,
+ EDeleteNotifications,
+ ERestoreFactorySettings,
+ ECreateFromFile,
+ EShowNotifications,
+ ESendDeliveryReport,
+ EShowDrafts,
+ ECleanDrafts,
+ ECleanAll,
+ EFetchingDeferred,
+ EFetchingOn,
+ ESendFromFile,
+ ESwitchToLocal,
+ ESwitchToGlobal,
+ EDecodeLoggingOn,
+ EDecodeLoggingOff,
+ EBinaryDumpOn,
+ EBinaryDumpOff,
+ ESendNotification,
+ ECreateToInbox,
+ ECreateToSentItems,
+ ESendFromDrafts,
+ EFindMMSFolder,
+ ESendOneByOne,
+ ECreateToDrafts,
+ ESendViaClient,
+ ESendMemFail,
+ EFetchMemFail,
+ EReceiveForced,
+ ECreateHeadersFromFile,
+ ESwitchToOffline,
+ ESwitchToOnline,
+ ECopyDrafts,
+ ECreateNotification,
+ EReply,
+ EReplyToAll,
+ EForward,
+ EFetchingManual,
+ EFirstBoot,
+ ENoFirstBoot,
+ EFindNetworkStatus,
+ ESendReadReport,
+ ECreateMMBoxViewConf,
+ EGetMMBoxView,
+ ECleanMMBox,
+ EShowMMBox
+};
+
+#define ETestLabel1 1
+#define ETestLabel2 2
+#define ETestLabel3 3
+#define ETestLabel4 4
+
+#define EServiceList 2
+
+
+enum TTestBedDlgCtrlIds
+ {
+ ETestEditField = 1
+ };
+
+enum TEditServiceControls
+ {
+ EFolderLabel = 1,
+ EEditUri
+// EEditServiceFolder,
+// ENameLabel,
+// EEditServiceName,
+// ENumberLabel,
+// EEditServiceNumber
+ };
+
+enum
+ {
+ EFsViewDialogId = 1
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/mmstestbed/inc/mmsteststaticutils.h Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#ifndef MMSTESTSTATICUTILS_H
+#define MMSTESTSTATICUTILS_H
+
+#include <e32std.h>
+#include <msvstd.h>
+#include <badesca.h>
+
+#include "mmsconst.h"
+
+class RFs;
+class CMsvSession;
+class CMmsEncode;
+class CMmsHeaders;
+
+#ifdef __WINS__
+_LIT( KRootPath, "c:\\" );
+#else
+// This is removable disk.
+// drive letter should not be hard coded, must be investigated further
+// We use c: for a while for the tests (to be cahnged later)
+_LIT( KRootPath, "c:\\" );
+//_LIT( KRootPath, "e:\\" );
+#endif
+
+// directory where mmbox descriptions are created
+_LIT( KMmsMMBoxDescriptionDirectory, "C:\\mmsmmboxdescriptions\\");
+// directory where created headers are dumped
+_LIT( KMmsDumpDirectory, "C:\\mmsdump\\");
+// content type of MMS PDUs
+_LIT8( KMmsMimeType, "application/vnd.wap.mms-message" );
+
+_LIT( KWild, "*" );
+
+
+/**
+ * joined array structure
+ *
+ */
+NONSHARABLE_CLASS( TMmsJoinedArrays ): public MDesCArray
+ {
+public:
+ TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2);
+ TInt MdcaCount() const;
+ TPtrC16 MdcaPoint(TInt aIndex) const;
+private:
+ CDesCArray* const & iArray1;
+ CDesCArray* const & iArray2;
+ };
+
+/**
+ * static utility functions
+ *
+ */
+class TMmsTestUtils
+ {
+
+public:
+
+ /**
+ *
+ */
+ TMmsTestUtils();
+
+ /**
+ * read phone number for sending messages
+ *
+ * @param aFileName full path for filename
+ * @param aFs file system handle
+ * @return allocated pointer containing the name
+ * The caller must delete the pointer when no longer needed
+ */
+ static HBufC* ReadContactFromFileL( TDesC& aFileName, RFs& aFs );
+
+ static void DecodeLoggingOnL();
+ static void DecodeLoggingOffL();
+ static void BinaryDumpOnL();
+ static void BinaryDumpOffL();
+
+ /**
+ * Clean all temporary directories used in local mode.
+ * Does not delete the directories, only the contents
+ *
+ * @param aFs file system handle
+ */
+ static void CleanDirectoryL( RFs& aFs );
+
+ /**
+ * Dump a binary message
+ *
+ * @param aBuffer buffer containing the binary message
+ * @param aFilename full path of the directory whenre the dump goes
+ * @param aParse reference to parser (to save stack space)
+ * @param aFs file system handle
+ */
+ static void Dump(
+ CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs );
+
+ /**
+ * Delete all MMS messages and notifications from a given folder
+ *
+ * @param aBoxId folder id
+ * @param aSession Messaging server session
+ */
+ static void CleanBoxL(TMsvId aBoxId, CMsvSession& aSession);
+
+ /**
+ * turn on logging messages sent to email addresses
+ */
+ static void EmailLoggingOnL();
+
+ /**
+ * turn off logging messages sent to email addresses
+ */
+ static void EmailLoggingOffL();
+
+ /**
+ * load list of children into selection and return count
+ *
+ * @param aBoxId folder id
+ * @param aMsvEntrySelection reference to a pointer that will contain the list of child ids
+ * caller is responsible of deleting the pointer afterwards.
+ * Pointer may be NULL at entry, and a new pointer will be allocated
+ * @param aSession messge server session
+ * @param aMessageType child MTM type, default is multimedia message
+ * @return number of entries in selection
+ */
+ static TInt CountChildrenL(
+ TMsvId aBoxId,
+ CMsvEntrySelection*& aMsvEntrySelection,
+ CMsvSession& aSession,
+ TUid aMessageType = KUidMsgTypeMultimedia);
+
+ /**
+ * Create a folder entry
+ *
+ * @param aSession messge server session
+ * @param aParentFolder the parent folder
+ * @param aFolderName name of the folder
+ * @param aFolderId will contain the if of the new folder if creation was successful
+ */
+ static void CreateFolderEntryL(
+ CMsvSession& aSession,
+ TMsvId aParentFolder,
+ const TDesC& aFolderName,
+ TMsvId& aFolderId );
+
+ /**
+ * Create an MMS notification from data in buffer
+ * @param aNotificationFolder mms notification folder (target folder)
+ * @param aServiceId id of MMS service
+ * @param aEncodeBuffer buffer that contains the data
+ * @param aSession message server session
+ * @return id of the created notification
+ */
+ static TMsvId CreateNotificationEntryL(
+ TMsvId aNotificationFolder,
+ TMsvId aServiceId,
+ CBufFlat* aEncodeBuffer,
+ CMsvSession& aSession );
+
+ /**
+ * Encode an MMS notification into buffer
+ * @param aUrl url of the notification for local messages a filepath
+ * @param aSize size of the message
+ * @param aMmsHeaders MMS headers structure for creating the notification
+ * @param aMmsEncoder reference to CMmsEncode class
+ * @param aEncodeBuffer flat buffer that will contain the encoded notification
+ */
+ static void FormNotification(
+ TDesC8& aUrl,
+ TInt aSize,
+ CMmsHeaders& aMmsHeaders,
+ CMmsEncode& aMmsEncoder,
+ CBufFlat* aEncodeBuffer );
+
+
+ static TBool IsDrive(const TDesC& aFileName);
+ static TBool IsDir(const TDesC& aFileName, RFs& aFs);
+ static TBool IsFile(const TDesC& aFileName, RFs& aFs);
+
+
+private:
+
+ };
+
+
+#endif // MMSTESTSTATICUTILS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/mmstestbed/inc/mmstestuitimer.h Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#ifndef C_TESTUITIMER_H
+#define C_TESTUITIMER_H
+
+
+#include <e32base.h>
+
+#define KPeriod 10000 // period of timer
+
+/**
+ * timer for test programs
+ */
+NONSHARABLE_CLASS( CTestUiTimer ): public CTimer
+ {
+public:
+
+ static CTestUiTimer* NewL();
+ virtual ~CTestUiTimer();
+
+ void RunL();
+ void DoCancel();
+ void ConstructL();
+ void IssueRequest();
+ void TimeoutOperation(CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds);
+
+private:
+ CTestUiTimer();
+
+public:
+ TTimeIntervalMicroSeconds32 period;
+
+private: // data
+ CActive* iObject;
+ };
+
+#endif // C_TESTUITIMER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/mmstestbed/mmstestbed.pro Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,90 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: Project Definiton File for mmstestbed
+#
+
+QT += testlib
+QT -= gui
+
+CONFIG += hb
+CONFIG += symbian_test
+CONFIG += qtestlib
+
+TEMPLATE = lib
+
+TARGET = mmstestbed
+
+INCLUDEPATH += .
+INCLUDEPATH += inc
+INCLUDEPATH += ../../../inc
+INCLUDEPATH += ../../../../../../mmsengine/inc
+INCLUDEPATH += ../../../../../../mmsengine/mmscodec/inc
+INCLUDEPATH += ../../../../../../mmsengine/mmshttptransport/inc
+INCLUDEPATH += ../../../../../../mmsengine/mmsmessage/inc
+INCLUDEPATH += ../../../../../../mmsengine/mmsconninit/inc
+INCLUDEPATH += ../../../../../../mmsengine/mmsserver/inc
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+DEFINES += BUILD_MMSTESTBED_DLL
+
+SOURCES += src/mmstestbed.cpp \
+ src/mmsteststaticutils.cpp \
+ src/mmsreadfile.cpp \
+ src/mmstestuitimer.cpp
+
+HEADERS += inc/mmstestbed.h \
+ inc/mmsteststaticutils.h \
+ inc/mmsreadfile.h \
+ inc/mmstestuitimer.h \
+ inc/mmstestbed.hrh
+
+SYMBIAN_PLATFORMS = WINSCW ARMV5
+
+symbian {
+ TARGET.UID3 = 0xE5c588a1
+ TARGET.CAPABILITY = CAP_GENERAL_DLL
+ TARGET.EPOCSTACKSIZE = 0x8000
+ TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
+ TARGET.EPOCALLOWDLLDATA = 1
+ VENDORID = VID_DEFAULT
+ }
+
+#Def File rules
+defBlock = \
+"$${LITERAL_HASH}if defined(EABI)" \
+"DEFFILE eabi/mmstestbedu.def" \
+"$${LITERAL_HASH}else" \
+"DEFFILE bwins/mmstestbedu.def" \
+"$${LITERAL_HASH}endif"
+
+# Build.inf rules
+BLD_INF_RULES.prj_exports += \
+ "$${LITERAL_HASH}include <platform_paths.hrh>"
+
+LIBS += -lmsgs \
+ -lmmsmessage \
+ -lmmsconninit \
+ -lmmscodec \
+ -lmmsserversettings \
+ -lcentralrepository \
+ -lapparc \
+ -lbafl \
+ -lefsrv \
+ -lesock \
+ -lestor \
+ -leuser \
+ -llogcli \
+ -llogwrap \
+ -lapgrfx \
+ -lapmime
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/mmstestbed/src/mmsreadfile.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,1799 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <badesca.h>
+#include <e32def.h>
+#include <s32file.h>
+#include <msvids.h>
+#include <mtmdef.h>
+//#include <eikenv.h>
+#include <apgcli.h>
+#include <CMsvMimeHeaders.h>
+#include <AknNoteWrappers.h>
+
+#include <mmsservercommon.h>
+#include "mmsconst.h"
+#include "mmsclient.h"
+#include "mmsheaders.h"
+#include "mmsreadfile.h"
+#include "mmsmmboxviewheaders.h"
+#include "mmsmmboxmessageheaders.h"
+#include "mmsmmboxflags.h"
+#include "mmssettings.h"
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+const TInt KMmsGranularity = 8;
+_LIT( K1970, "19700000:000000.000000" ); // 1-Jan 1970 0:00:00
+
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// ==================== LOCAL FUNCTIONS ====================
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+CMmsReadFile::CMmsReadFile()
+ {
+ // all member variables in a class derived from CBase
+ // are automatically set to 0.
+ }
+
+
+//
+void CMmsReadFile::ConstructL(RFs& aFs, RFileReadStream& aReadStream )
+ {
+ // iRowBuffer = HBufC8::NewMaxL( 500 ); // Max row length!!!!
+ iFs = aFs;
+ iReader = &aReadStream;
+ iByteBuffer = HBufC8::NewL( DefaultBufLen );
+ iAliasArray = new ( ELeave ) CDesCArrayFlat( KMmsGranularity );
+ iAttaStructures = new ( ELeave ) CArrayPtrFlat<CMmsAttaStructure>( KMmsGranularity );
+ Reset();
+ }
+
+// Two-phased constructor.
+CMmsReadFile* CMmsReadFile::NewL(RFs& aFs, RFileReadStream& aReadStream )
+ {
+ CMmsReadFile* self = new ( ELeave ) CMmsReadFile();
+ CleanupStack::PushL( self );
+ self->ConstructL( aFs, aReadStream );
+ CleanupStack::Pop();
+ return self;
+ }
+
+
+// Destructor
+CMmsReadFile::~CMmsReadFile()
+ {
+ Reset(); // resets and destroys all array data
+ if (iAliasArray != NULL) iAliasArray->Reset();
+ delete iByteBuffer;
+ delete iAliasArray;
+ delete iAttaStructures;
+ }
+
+void CMmsReadFile::Reset()
+ {
+ // reset all arrays
+ if (iAttaStructures != NULL) iAttaStructures->ResetAndDestroy();
+ iAttaCount = 0;
+ iAttaRoot = 0;
+ }
+
+// ---------------------------------------------------------
+// CMmsReadFile()::CompleteTest
+// ---------------------------------------------------------
+//
+TInt CMmsReadFile::CompleteTestL( TInt aMessageCounter, CMmsHeaders& aMmsHeaders )
+{
+ Reset(); // new message
+
+ TUint32 val;
+ TUint limit = 1000000;
+ TUint sizeLimit = 1000 * 1024; //max message size 1000 kB!
+ TUint allLimit = 999999;
+ TInt error;
+ TRadix radix = EDecimal;
+ TLex16 lex;
+ TTestReadStatus readStatus = ETestUnknown;
+ CMmsAttaStructure* oneAtta = NULL;
+ TInt index;
+ TTime y1970( K1970 );
+ TTimeIntervalMicroSeconds interval;
+ TTime date;
+ TInt order = 0;
+ TInt16 shortInteger = 0;
+
+ //iso luuppi, joka kiertää ja lukee kunnes EOF tule vastaan
+ //Big Loop, which passes around and read until the EOF
+
+ iMessageType = iNextMessageType;
+ while(readStatus != ETestEof)
+ {
+ readStatus = ReadRowL();
+ if ( readStatus == ETestEof )
+ {
+ return(-1);
+ }
+ if ( readStatus == ETestUnknown )
+ {
+ // A line containing only comments, or an unknown tag
+ // As using the scripts to test settings is no longer supported,
+ // any old keywords used to test CMmsSettings class are ignored
+ continue;
+ }
+ if( readStatus == ETestNewMessage )
+ {
+ iNextMessageType = readStatus;
+ if(aMessageCounter++)
+ {
+ return(NULL);
+ }
+ else
+ {
+ iMessageType = iNextMessageType;
+ continue;
+ }
+ }
+ if ( iMessageType == ETestNewMessage)
+ {
+ switch(readStatus)
+ {
+ case ETestFrom:
+ aMmsHeaders.SetSenderL( iValueBuffer );
+ break;
+ case ETestFromAlias:
+ index = FindAlias(iValueBuffer);
+ if(index >= 0)
+ {
+ aMmsHeaders.SetSenderL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ) );
+ }
+ break;
+ case ETestTo:
+ aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientTo );
+ break;
+ case ETestToAlias:
+ index = FindAlias(iValueBuffer);
+ if(index >= 0)
+ {
+ aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsTo );
+ }
+ break;
+ case ETestCc:
+ aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientCc );
+ break;
+ case ETestCcAlias:
+ index = FindAlias(iValueBuffer);
+ if(index >= 0)
+ {
+ aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsCc );
+ }
+ break;
+ case ETestBcc:
+ aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientBcc );
+ break;
+ case ETestBccAlias:
+ index = FindAlias(iValueBuffer);
+ if(index >= 0)
+ {
+ aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsBcc );
+ }
+ break;
+ case ETestSubject:
+ aMmsHeaders.SetSubjectL( iValueBuffer );
+ break;
+ case ETestExpiryRel:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetExpiryInterval( val );
+ }
+ break;
+ case ETestExpiryAbs:
+ error = iDate.Set(iValueBuffer);
+ interval = iDate.MicroSecondsFrom( y1970 );
+ // expiry date in seconds from 1.1.1970.
+ aMmsHeaders.SetExpiryDate( (interval.Int64())/1000000 );
+ break;
+ case ETestDeliveryTimeRel:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetDeliveryTimeInterval( val );
+ }
+ break;
+ case ETestDeliveryTimeAbs:
+ error = iDate.Set(iValueBuffer);
+ interval = iDate.MicroSecondsFrom( y1970 );
+ aMmsHeaders.SetDeliveryDate( (interval.Int64())/1000000 );
+ break;
+ case ETestDate:
+ error = iDate.Set(iValueBuffer);
+ interval = iDate.MicroSecondsFrom( y1970 );
+ aMmsHeaders.SetDate( (interval.Int64())/1000000 );
+ case ETestPriority:
+ val = 0;
+ if ((iValueBuffer.CompareF(KLow)) == 0)
+ {
+ val = EMmsPriorityLow;
+ }
+ else if ((iValueBuffer.CompareF(KNormal)) == 0)
+ {
+ val = EMmsPriorityNormal;
+ }
+ else if ((iValueBuffer.CompareF(KHigh)) == 0)
+ {
+ val = EMmsPriorityHigh;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetMessagePriority( val );
+ break;
+ case ETestSenderVisibility:
+ val = 0;
+ if ((iValueBuffer.CompareF(KHide)) == 0)
+ {
+ val = EMmsSenderVisibilityHide;
+ }
+ else if ((iValueBuffer.CompareF(KShow)) == 0)
+ {
+ val = EMmsSenderVisibilityShow;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetSenderVisibility( val );
+ break;
+ case ETestDeliveryReport:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = EMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = EMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetDeliveryReport( val );
+ break;
+ case ETestDelivReportSendAllow:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = EMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = EMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetReportAllowed( val );
+ break;
+
+ case ETestReadReply:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = EMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = EMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetReadReply( val );
+ break;
+ case ETestNewAttachment:
+ oneAtta = CMmsAttaStructure::NewL();
+ iAttaStructures->AppendL(oneAtta);
+ oneAtta->iAtta->Des().Copy( iValueBuffer );
+ iAttaCount++;
+ break;
+ case ETestAttachmentType:
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaType->Des().Copy( iValueBuffer );
+ }
+ break;
+ case ETestAttachmentContLoc:
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaName->Des().Copy( iValueBuffer );
+ }
+ break;
+ case ETestAttaRecommendedName:
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaRecommendedName->Des().Copy( iValueBuffer );
+ }
+ break;
+ case ETestAttachmentCharset:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaCharset = val;
+ }
+ }
+ break;
+ case ETestAttachmentCid:
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaCid->Des().Copy(iValueBuffer);
+ }
+ break;
+ case ETestAttContTypeParamName:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if (oneAtta != NULL)
+ {
+ oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
+ }
+ break;
+ case ETestAttContTypeParamValue:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if (oneAtta != NULL)
+ {
+ oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
+ }
+ break;
+ case ETestAttXTypeParamName:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if (oneAtta != NULL)
+ {
+ oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
+ }
+ break;
+ case ETestAttXTypeParamValue:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if (oneAtta != NULL)
+ {
+ oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
+ }
+ break;
+ case ETestAttachmentRoot:
+ iAttaRoot = iAttaCount;
+ break;
+ case ETestAlias:
+ // all aliases are global even if they appear
+ // in the middle of a message
+ iAliasArray->AppendL( iValueBuffer );
+ iAliasCount++;
+ break;
+ case ETestMessageClass: // should be handled!
+ val = EMmsClassPersonal;
+ if ((iValueBuffer.CompareF(KPersonal)) == 0)
+ {
+ val = EMmsClassPersonal;
+ }
+ else if ((iValueBuffer.CompareF(KAdvertisement)) == 0)
+ {
+ val = EMmsClassAdvertisement;
+ }
+ else if ((iValueBuffer.CompareF(KInformational)) == 0)
+ {
+ val = EMmsClassInformational;
+ }
+ else if ((iValueBuffer.CompareF(KAuto)) == 0)
+ {
+ val = EMmsClassAuto;
+ }
+ else
+ {
+ val = (TMmsMessageClass)KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetMessageClass( val );
+ break;
+ case ETestReplyCharging:
+ val = 0;
+ if ((iValueBuffer.CompareF(KRequested)) == 0)
+ {
+ val = KMmsReplyChargingRequested;
+ }
+ else if ((iValueBuffer.CompareF(KReqTextOnly)) == 0)
+ {
+ val = KMmsReplyChargingRequestedTextOnly;
+ }
+ else if ((iValueBuffer.CompareF(KAccepted)) == 0)
+ {
+ val = KMmsReplyChargingAccepted;
+ }
+ else if ((iValueBuffer.CompareF(KAccTextOnly)) == 0)
+ {
+ val = KMmsReplyChargingAcceptedTextOnly;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetReplyCharging( val );
+ break;
+ case ETestReplyChargAbs:
+ error = date.Set(iValueBuffer);
+ if ( error == KErrNone )
+ {
+ interval = date.MicroSecondsFrom( y1970 );
+ aMmsHeaders.SetReplyChargingDate( (interval.Int64())/1000000 );
+ }
+ break;
+ case ETestReplyChargRel:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetReplyChargingInterval( val );
+ }
+ break;
+ case ETestReplyChargSize:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,sizeLimit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetReplyChargingSize( val );
+ }
+ break;
+ case ETestReplyChargID:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetReplyChargingIdL( iByteBuffer->Des() );
+ break;
+ case ETestTID:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetTidL( iByteBuffer->Des() );
+ break;
+ case ETestContentLocation:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
+ aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf ||
+ aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteReq )
+ {
+ aMmsHeaders.MMBoxMessageHeadersL().ContentLocationList().AppendL( iByteBuffer->Des() );
+ }
+ else if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
+ {
+ aMmsHeaders.InsertDeleteContentLocationL( order, iByteBuffer->Des() );
+ }
+ else
+ {
+ aMmsHeaders.SetContentLocationL( iByteBuffer->Des() );
+ }
+ break;
+ case ETestPreviouslySentIndex:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ order = val;
+ break;
+ case ETestPreviouslySentBy:
+ aMmsHeaders.InsertPreviouslySentByL( order, iValueBuffer );
+ break;
+ case ETestPreviouslySentDate:
+ error = date.Set(iValueBuffer);
+ if ( error == KErrNone )
+ {
+ interval = date.MicroSecondsFrom( y1970 );
+ aMmsHeaders.InsertPreviouslySentDateL( order, (interval.Int64())/1000000 );
+ }
+ break;
+ case ETestMessageId:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetMessageIdL( iByteBuffer->Des() );
+ break;
+ case ETestMessageSize:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,sizeLimit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetMessageSize( val );
+ }
+ break;
+ case ETestVersion:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,EHex,limit);
+ shortInteger = TInt16( val );
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetMmsVersion( shortInteger );
+ }
+ break;
+ case ETestReadStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KRead)) == 0)
+ {
+ val = KMmsReadStatusRead;
+ }
+ else if ((iValueBuffer.CompareF(KDelNotRead)) == 0)
+ {
+ val = KMmsReadStatusDeletedWithoutBeingRead;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetReadStatus( val );
+ break;
+ case ETestResponseStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KOk)) == 0)
+ {
+ val = KMmsStatusOk;
+ }
+ else if ((iValueBuffer.CompareF(KErrUnspecified)) == 0)
+ {
+ val = KMmsErrorUnspecified;
+ }
+ else if ((iValueBuffer.CompareF(KErrServiceDenied)) == 0)
+ {
+ val = KMmsErrorServiceDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrMessageFormatCorrupt)) == 0)
+ {
+ val = KMmsErrorMessageFormatCorrupt;
+ }
+ else if ((iValueBuffer.CompareF(KErrAddressUnresolved)) == 0)
+ {
+ val = KMmsErrorSendingAddressUnresolved;
+ }
+ else if ((iValueBuffer.CompareF(KErrMessageNotFound)) == 0)
+ {
+ val = KMmsErrorMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrNetworkProblem)) == 0)
+ {
+ val = KMmsErrorNetworkProblem;
+ }
+ else if ((iValueBuffer.CompareF(KErrContentNotAccepted)) == 0)
+ {
+ val = KMmsErrorNoContentAccepted;
+ }
+ else if ((iValueBuffer.CompareF(KErrUnsupportedMessage)) == 0)
+ {
+ val = KMmsErrorUnsupportedMessage;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
+ {
+ val = KMmsErrorTransientFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientAddressUnresolved)) == 0)
+ {
+ val = KMmsErrorTransientSendingAddressUnresolved;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
+ {
+ val = KMmsErrorTransientMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
+ {
+ val = KMmsErrorTransientNetworkProblem;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
+ {
+ val = KMmsErrorPermanentFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
+ {
+ val = KMmsErrorPermanentServiceDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
+ {
+ val = KMmsErrorPermanentMessageFormatCorrupt;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentAddressUnresolved)) == 0)
+ {
+ val = KMmsErrorPermanentSendingAddressUnresolved;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
+ {
+ val = KMmsErrorPermanentMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentContentNotAccepted)) == 0)
+ {
+ val = KMmsErrorPermanentContentNotAccepted;
+ }
+ else if ((iValueBuffer.CompareF(KErrReplyChargingLimitNotMet)) == 0)
+ {
+ val = KMmsErrorPermanentReplyChargingLimitationsNotMet;
+ }
+ else if ((iValueBuffer.CompareF(KErrReplyChargingRequestNotAccepted)) == 0)
+ {
+ val = KMmsErrorPermanentReplyChargingRequestNotAccepted;
+ }
+ else if ((iValueBuffer.CompareF(KErrReplyChargingForwardingDenied)) == 0)
+ {
+ val = KMmsErrorPermanentReplyChargingForwardingDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrReplyChargingNotSupported)) == 0)
+ {
+ val = KMmsErrorPermanentReplyChargingNotSupported;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientPartialSuccess)) == 0)
+ {
+ val = KMmsErrorTransientPartialSuccess;
+ }
+ else if ((iValueBuffer.CompareF(KErrAddressHidingNotSupported)) == 0)
+ {
+ val = KMmsErrorPermanentAddressHidingNotSupported;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
+ {
+ aMmsHeaders.InsertDeleteStatusL( order, val );
+ }
+ else
+ {
+ aMmsHeaders.SetResponseStatus( val );
+ }
+ break;
+ case ETestResponseText:
+ if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
+ {
+ aMmsHeaders.InsertDeleteResponseTextL( order, iValueBuffer );
+ }
+ else
+ {
+ aMmsHeaders.SetResponseTextL( iValueBuffer );
+ }
+ break;
+ case ETestRetrieveStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KOk)) == 0)
+ {
+ val = KMmsStatusOk;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
+ {
+ val = KMmsErrorTransientFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
+ {
+ val = KMmsErrorReceiveTransientMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
+ {
+ val = KMmsErrorReceiveTransientNetworkProblem;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
+ {
+ val = KMmsErrorPermanentFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
+ {
+ val = KMmsErrorPermanentServiceDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
+ {
+ val = KMmsErrorReceivePermanentMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrRetrieveContentUnsupported)) == 0)
+ {
+ val = KMmsErrorReceivePermanentContentUnsupported;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetResponseStatus( val );
+ break;
+ case ETestRetrieveText:
+ aMmsHeaders.SetResponseTextL( iValueBuffer );
+ break;
+ case ETestStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KDeferred)) == 0)
+ {
+ val = KMmsMessageStatusDeferred;
+ }
+ else if ((iValueBuffer.CompareF(KExpired)) == 0)
+ {
+ val = KMmsMessageStatusExpired;
+ }
+ else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
+ {
+ val = KMmsMessageStatusRetrieved;
+ }
+ else if ((iValueBuffer.CompareF(KRejected)) == 0)
+ {
+ val = KMmsMessageStatusRejected;
+ }
+ else if ((iValueBuffer.CompareF(KUnrecognized)) == 0)
+ {
+ val = KMmsMessageStatusUnrecognized;
+ }
+ else if ((iValueBuffer.CompareF(KIndeterminate)) == 0)
+ {
+ val = KMmsMessageStatusIndeterminate;
+ }
+ else if ((iValueBuffer.CompareF(KForwarded)) == 0)
+ {
+ val = KMmsMessageStatusForwarded;
+ }
+ else if ((iValueBuffer.CompareF(KUnreachable)) == 0)
+ {
+ val = KMmsMessageStatusUnreachable;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetStatus( val );
+ break;
+ case ETestMessageType:
+ val = 0;
+ if ((iValueBuffer.CompareF(KSendReq)) == 0)
+ {
+ val = KMmsMessageTypeMSendReq;
+ }
+ else if ((iValueBuffer.CompareF(KSendConf)) == 0)
+ {
+ val = KMmsMessageTypeMSendConf;
+ }
+ else if ((iValueBuffer.CompareF(KNotifInd)) == 0)
+ {
+ val = KMmsMessageTypeMNotificationInd;
+ }
+ else if ((iValueBuffer.CompareF(KNotifResp)) == 0)
+ {
+ val = KMmsMessageTypeMNotifyRespInd;
+ }
+ else if ((iValueBuffer.CompareF(KRetrConf)) == 0)
+ {
+ val = KMmsMessageTypeMRetrieveConf;
+ }
+ else if ((iValueBuffer.CompareF(KAckInd)) == 0)
+ {
+ val = KMmsMessageTypeAcknowledgeInd;
+ }
+ else if ((iValueBuffer.CompareF(KDelInd)) == 0)
+ {
+ val = KMmsMessageTypeDeliveryInd;
+ }
+ else if ((iValueBuffer.CompareF(KReadReqInd)) == 0)
+ {
+ val = KMmsMessageTypeReadRecInd;
+ }
+ else if ((iValueBuffer.CompareF(KReadOrigInd)) == 0)
+ {
+ val = KMmsMessageTypeReadOrigInd;
+ }
+ else if ((iValueBuffer.CompareF(KForwardRec)) == 0)
+ {
+ val = KMmsMessageTypeForwardReq;
+ }
+ else if ((iValueBuffer.CompareF(KForwardConf)) == 0)
+ {
+ val = KMmsMessageTypeForwardConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxStoreReq)) == 0)
+ {
+ val = KMmsMessageTypeMboxStoreReq;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxStoreConf)) == 0)
+ {
+ val = KMmsMessageTypeMboxStoreConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxViewReq)) == 0)
+ {
+ val = KMmsMessageTypeMboxViewReq;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxViewConf)) == 0)
+ {
+ val = KMmsMessageTypeMboxViewConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxUploadReq)) == 0)
+ {
+ val = KMmsMessageTypeMBoxUploadReq;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxUploadConf)) == 0)
+ {
+ val = KMmsMessageTypeMBoxUploadConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxDeleteReq)) == 0)
+ {
+ val = KMmsMessageTypeMBoxDeleteReq;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxDeleteConf)) == 0)
+ {
+ val = KMmsMessageTypeMBoxDeleteConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxDescr)) == 0)
+ {
+ val = KMmsMessageTypeMBoxDescr;
+ }
+ else if ((iValueBuffer.CompareF(KDeleteReq)) == 0)
+ {
+ val = KMmsMessageTypeDeleteReq;
+ }
+ else if ((iValueBuffer.CompareF(KDeleteConf)) == 0)
+ {
+ val = KMmsMessageTypeDeleteConf;
+ }
+ else if ((iValueBuffer.CompareF(KCancelReq)) == 0)
+ {
+ val = KMmsMessageTypeCancelReq;
+ }
+ else if ((iValueBuffer.CompareF(KCancelResp)) == 0)
+ {
+ val = KMmsMessageTypeCancelConf;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetMessageType( val );
+ break;
+ case ETestAttribute:
+ val = 0;
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if ((iByteBuffer->Des().CompareF(KTestBcc)) == 0)
+ {
+ val = KMmsAssignedBcc;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestCc)) == 0)
+ {
+ val = KMmsAssignedCc;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestContent)) == 0)
+ {
+ val = KMmsAssignedContent;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestContentType)) == 0)
+ {
+ val = KMmsAssignedContentType;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestDate)) == 0)
+ {
+ val = KMmsAssignedDate;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestDeliveryReport)) == 0)
+ {
+ val = KMmsAssignedDeliveryReport;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestDeliveryTime)) == 0)
+ {
+ val = KMmsAssignedDeliveryTime;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestExpiry)) == 0)
+ {
+ val = KMmsAssignedExpiry;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestFrom)) == 0)
+ {
+ val = KMmsAssignedFrom;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestMessageClass)) == 0)
+ {
+ val = KMmsAssignedMessageClass;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestMessageId)) == 0)
+ {
+ val = KMmsAssignedMessageId;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestMessageSize)) == 0)
+ {
+ val = KMmsAssignedMessageSize;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestPriority)) == 0)
+ {
+ val = KMmsAssignedPriority;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReadReply)) == 0)
+ {
+ val = KMmsAssignedReadReply;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestSubject)) == 0)
+ {
+ val = KMmsAssignedSubject;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestTo)) == 0)
+ {
+ val = KMmsAssignedTo;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReplyCharging)) == 0)
+ {
+ val = KMmsAssignedReplyCharging;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReplyChargID)) == 0)
+ {
+ val = KMmsAssignedReplyChargingID;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReplyCharg)) == 0)
+ {
+ val = KMmsAssignedReplyChargingDeadline;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReplyChargSize)) == 0)
+ {
+ val = KMmsAssignedReplyChargingSize;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentBy)) == 0)
+ {
+ val = KMmsAssignedPreviouslySentBy;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentDate)) == 0)
+ {
+ val = KMmsAssignedPreviouslySentDate;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestAdditionalHeaders)) == 0)
+ {
+ val = KMmsAssignedAdditionalHeaders;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxViewHeadersL().AttributeArray().InsertInOrder(val);
+ break;
+ case ETestDistributionIndicator:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetDistributionIndicator( val );
+ break;
+ case ETestLimit:
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if( error == KErrNone )
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(val);
+ }
+ break;
+ case ETestMessageQuota:
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(val);
+ }
+ break;
+ case ETestSizeQuota:
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(val);
+ }
+ break;
+ case ETestMessageTotal:
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(val);
+ }
+ break;
+ case ETestSizeTotal:
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(val);
+ }
+ break;
+ case ETestMessageCount:
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(val);
+ }
+ break;
+ case ETestAddKeyword:
+ aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsAddToken, iValueBuffer);
+ break;
+ case ETestRemoveKeyword:
+ aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsRemoveToken, iValueBuffer);
+ break;
+ case ETestFilterKeyword:
+ aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsFilterToken, iValueBuffer);
+ break;
+ case ETestMMState:
+ val = 0;
+ if ((iValueBuffer.CompareF(KDraft)) == 0)
+ {
+ val = KMmsDraft;
+ }
+ else if ((iValueBuffer.CompareF(KSent)) == 0)
+ {
+ val = KMmsSent;
+ }
+ else if ((iValueBuffer.CompareF(KNew)) == 0)
+ {
+ val = KMmsNew;
+ }
+ else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
+ {
+ val = KMmsRetrieved;
+ }
+ else if ((iValueBuffer.CompareF(KForwarded)) == 0)
+ {
+ val = KMmsForwarded;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
+ aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ aMmsHeaders.MMBoxViewHeadersL().MMStateArray().InsertInOrder( val );
+ }
+ else
+ {
+ aMmsHeaders.MMBoxMessageHeadersL().SetMMState( val );
+ }
+ break;
+ case ETestQuota:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsQuotas( val );
+ break;
+ case ETestStart:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsStart(val);
+ }
+ break;
+ case ETestStore:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxMessageHeadersL().SetMmsStore( val );
+ break;
+ case ETestStored:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxMessageHeadersL().SetMmsStored( val );
+ break;
+ case ETestStoreStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KOk)) == 0)
+ {
+ val = KMmsStatusOk;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
+ {
+ val = KMmsErrorTransientFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
+ {
+ val = KMmsErrorStoreStatusTransientNetworkProblem;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
+ {
+ val = KMmsErrorPermanentFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
+ {
+ val = KMmsErrorPermanentServiceDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
+ {
+ val = KMmsErrorPermanentMessageFormatCorrupt;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
+ {
+ val = KMmsErrorStoreStatusPermanentMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrMMBoxFull)) == 0)
+ {
+ val = KMmsErrorStoreStatusPermanentMmboxFull;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatus( val );
+ break;
+ case ETestStoreStatusText:
+ aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatusTextL( iValueBuffer );
+ break;
+ case ETestTotals:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsTotals( val );
+ break;
+
+ case ETestDeleteInfoIndex:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ order = val;
+ break;
+
+ case ETestApplicId:
+ aMmsHeaders.SetApplicIdL( iValueBuffer );
+ break;
+ case ETestReplyApplicId:
+ aMmsHeaders.SetReplyApplicIdL( iValueBuffer );
+ break;
+ case ETestApplicInfo:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetAuxApplicInfoL( iByteBuffer->Des() );
+ break;
+ case ETestContentClass:
+ val = 0;
+ if ((iValueBuffer.CompareF(KText)) == 0)
+ {
+ val = KMmsContentClassText;
+ }
+ else if ((iValueBuffer.CompareF(KImageBasic)) == 0)
+ {
+ val = KMmsContentClassImageBasic;
+ }
+ else if ((iValueBuffer.CompareF(KImageRich)) == 0)
+ {
+ val = KMmsContentClassImageRich;
+ }
+ else if ((iValueBuffer.CompareF(KVideoBasic)) == 0)
+ {
+ val = KMmsContentClassVideoBasic;
+ }
+ else if ((iValueBuffer.CompareF(KVideoRich)) == 0)
+ {
+ val = KMmsContentClassVideoRich;
+ }
+ else if ((iValueBuffer.CompareF(KMegaPixel)) == 0)
+ {
+ val = KMmsContentClassMegaPixel;
+ }
+ else if ((iValueBuffer.CompareF(KContentBasic)) == 0)
+ {
+ val = KMmsContentClassContentBasic;
+ }
+ else if ((iValueBuffer.CompareF(KContentRich)) == 0)
+ {
+ val = KMmsContentClassContentRich;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetContentClass( val );
+ break;
+ case ETestDrmContent:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetDrmContent( val );
+ break;
+ case ETestAdaptationAllowed:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetAdaptationAllowed( val );
+ break;
+ case ETestRecommendedRetrievalMode:
+ val = 0;
+ if ((iValueBuffer.CompareF(KManual)) == 0)
+ {
+ val = KMmsRecommendedRetrievalModeManual;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetRecommendedRetrievalMode( val );
+ break;
+ case ETestRecRetrievalModeText:
+ aMmsHeaders.SetRecommendedRetrievalModeTextL( iValueBuffer );
+ break;
+ case ETestReplaceId:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
+ break;
+ case ETestStatusText:
+ aMmsHeaders.SetResponseTextL( iValueBuffer );
+ break;
+ case ETestCancelId:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
+ break;
+ case ETestCancelStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KCancelSuccessful)) == 0)
+ {
+ val = KMmsCancelRequestSuccessfullyReceived;
+ }
+ else if ((iValueBuffer.CompareF(KCancelCorrupted)) == 0)
+ {
+ val = KMmsCancelRequestCorrupted;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetCancelStatus( val );
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ switch(readStatus)
+ {
+ case ETestAlias:
+ iAliasArray->AppendL( iValueBuffer );
+ iAliasCount++;
+ break;
+
+ default:
+ break;
+ }
+
+ }
+ }
+ return(-1);
+}
+
+// ---------------------------------------------------------
+// CMmsReadFile()::ReadRowL
+// ---------------------------------------------------------
+//
+TTestReadStatus CMmsReadFile::ReadRowL()
+ {
+
+ TBuf8<DefaultBufLen> RowBuffer;
+ TBuf8<32> KeyBuffer;
+
+ // READ ONE ROW AND DROP CR+LF FROM THE END OF LINE
+ TChar delim( 10 );
+ iReader->ReadL( RowBuffer, delim);
+ TInt length = RowBuffer.Length();
+ if ( RowBuffer.Length() < 2 )
+ {
+ return ETestEof;
+ }
+ RowBuffer.Delete(length - 2,2);
+
+ // DROP POSSIBLE COMMENT OUT
+ TInt pos = RowBuffer.Locate( ';' );
+ if ( pos >= 0 ) RowBuffer.Delete( pos, length-pos-2 );
+
+ if ( RowBuffer.Length() == 0 )
+ {
+ // the line contained only comment
+ return ETestUnknown;
+ }
+
+ // First split the row (:)
+ pos = RowBuffer.Locate( ':' );
+ if (pos > 0)
+ {
+ TPtrC8 p = RowBuffer.Mid( pos+1 );
+ length = p.Length();
+ iValueBuffer.Zero();
+ for (TInt i=0; i < length; ++i)
+ {
+ iValueBuffer.Append(p[i]);
+ }
+ iValueBuffer.Trim();
+ TPtrC8 pp = RowBuffer.Left(pos);
+ KeyBuffer.CopyUC(pp);
+ KeyBuffer.Trim();
+ }
+ // TRY TO FIND CORRECT TAG
+ if ((KeyBuffer.CompareF(KTestNewMessage)) == 0) return(ETestNewMessage);
+ if ((KeyBuffer.CompareF(KTestMessageType)) == 0) return ETestMessageType;
+ if ((KeyBuffer.CompareF(KTestDate)) == 0) return ETestDate;
+ if ((KeyBuffer.CompareF(KTestFrom)) == 0) return ETestFrom;
+ if ((KeyBuffer.CompareF(KTestTo)) == 0) return ETestTo;
+ if ((KeyBuffer.CompareF(KTestCc)) == 0) return ETestCc;
+ if ((KeyBuffer.CompareF(KTestBcc)) == 0) return ETestBcc;
+ if ((KeyBuffer.CompareF(KTestSubject)) == 0) return ETestSubject;
+ if ((KeyBuffer.CompareF(KTestExpiryRel)) == 0) return ETestExpiryRel;
+ if ((KeyBuffer.CompareF(KTestExpiryAbs)) == 0) return ETestExpiryAbs;
+ if ((KeyBuffer.CompareF(KTestDeliveryTimeRel)) == 0) return ETestDeliveryTimeRel;
+ if ((KeyBuffer.CompareF(KTestDeliveryTimeAbs)) == 0) return ETestDeliveryTimeAbs;
+ if ((KeyBuffer.CompareF(KTestPriority)) == 0) return ETestPriority;
+ if ((KeyBuffer.CompareF(KTestSenderVisibility)) == 0) return ETestSenderVisibility;
+ if ((KeyBuffer.CompareF(KTestDeliveryReport)) == 0) return ETestDeliveryReport;
+ if ((KeyBuffer.CompareF(KTestReadReply)) == 0) return ETestReadReply;
+ if ((KeyBuffer.CompareF(KTestNewAttachment)) == 0) return ETestNewAttachment;
+ if ((KeyBuffer.CompareF(KTestAttachmentName)) == 0) return ETestAttaRecommendedName;
+ if ((KeyBuffer.CompareF(KTestAttachmentContLoc)) == 0) return ETestAttachmentContLoc;
+ if ((KeyBuffer.CompareF(KTestAttachmentType)) == 0) return ETestAttachmentType;
+ if ((KeyBuffer.CompareF(KTestAttachmentCharset)) == 0) return ETestAttachmentCharset;
+ if ((KeyBuffer.CompareF(KTestAttachmentCid)) == 0) return ETestAttachmentCid;
+ if ((KeyBuffer.CompareF(KTestAttachmentRoot)) == 0) return ETestAttachmentRoot;
+ if ((KeyBuffer.CompareF(KTestEndOfFile)) == 0) return ETestEof;
+ if ((KeyBuffer.CompareF(KTestMessageClass)) == 0) return ETestMessageClass;
+ if ((KeyBuffer.CompareF(KTestDelivRepSendAllow)) == 0) return ETestDelivReportSendAllow;
+ if ((KeyBuffer.CompareF(KTestAlias)) == 0 ) return ETestAlias;
+ if ((KeyBuffer.CompareF(KTestFromAlias)) == 0 ) return ETestFromAlias;
+ if ((KeyBuffer.CompareF(KTestToAlias)) == 0 ) return ETestToAlias;
+ if ((KeyBuffer.CompareF(KTestCcAlias)) == 0 ) return ETestCcAlias;
+ if ((KeyBuffer.CompareF(KTestBccAlias)) == 0 ) return ETestBccAlias;
+ if ((KeyBuffer.CompareF(KTestReplyCharging)) == 0 ) return ETestReplyCharging;
+ if ((KeyBuffer.CompareF(KTestReplyChargAbs)) == 0 ) return ETestReplyChargAbs;
+ if ((KeyBuffer.CompareF(KTestReplyChargRel)) == 0 ) return ETestReplyChargRel;
+ if ((KeyBuffer.CompareF(KTestReplyChargSize)) == 0 ) return ETestReplyChargSize;
+ if ((KeyBuffer.CompareF(KTestReplyChargID)) == 0 ) return ETestReplyChargID;
+ if ((KeyBuffer.CompareF(KTestTID)) == 0 ) return ETestTID;
+ if ((KeyBuffer.CompareF(KTestContentLocation)) == 0 ) return ETestContentLocation;
+ if ((KeyBuffer.CompareF(KTestPreviouslySentIndex)) == 0 ) return ETestPreviouslySentIndex;
+ if ((KeyBuffer.CompareF(KTestPreviouslySentBy)) == 0 ) return ETestPreviouslySentBy;
+ if ((KeyBuffer.CompareF(KTestPreviouslySentDate)) == 0 ) return ETestPreviouslySentDate;
+ if ((KeyBuffer.CompareF(KTestMessageId)) == 0 ) return ETestMessageId;
+ if ((KeyBuffer.CompareF(KTestMessageSize)) == 0 ) return ETestMessageSize;
+ if ((KeyBuffer.CompareF(KTestVersion)) == 0 ) return ETestVersion;
+ if ((KeyBuffer.CompareF(KTestReadStatus)) == 0 ) return ETestReadStatus;
+ if ((KeyBuffer.CompareF(KTestResponseStatus)) == 0 ) return ETestResponseStatus;
+ if ((KeyBuffer.CompareF(KTestResponseText)) == 0 ) return ETestResponseText;
+ if ((KeyBuffer.CompareF(KTestRetrieveStatus)) == 0 ) return ETestRetrieveStatus;
+ if ((KeyBuffer.CompareF(KTestRetrieveText)) == 0 ) return ETestRetrieveText;
+ if ((KeyBuffer.CompareF(KTestStatus)) == 0 ) return ETestStatus;
+ if ((KeyBuffer.CompareF(KTestAttribute)) == 0 ) return ETestAttribute;
+ if ((KeyBuffer.CompareF(KTestDistributionIndicator)) == 0 ) return ETestDistributionIndicator;
+ if ((KeyBuffer.CompareF(KTestLimit)) == 0 ) return ETestLimit;
+ if ((KeyBuffer.CompareF(KTestMessageQuota)) == 0 ) return ETestMessageQuota;
+ if ((KeyBuffer.CompareF(KTestSizeQuota)) == 0 ) return ETestSizeQuota;
+ if ((KeyBuffer.CompareF(KTestMessageTotal)) == 0 ) return ETestMessageTotal;
+ if ((KeyBuffer.CompareF(KTestSizeTotal)) == 0 ) return ETestSizeTotal;
+ if ((KeyBuffer.CompareF(KTestMessageCount)) == 0 ) return ETestMessageCount;
+ if ((KeyBuffer.CompareF(KTestAddKeyword)) == 0 ) return ETestAddKeyword;
+ if ((KeyBuffer.CompareF(KTestRemoveKeyword)) == 0 ) return ETestRemoveKeyword;
+ if ((KeyBuffer.CompareF(KTestFilterKeyword)) == 0 ) return ETestFilterKeyword;
+ if ((KeyBuffer.CompareF(KTestMMState)) == 0 ) return ETestMMState;
+ if ((KeyBuffer.CompareF(KTestQuota)) == 0 ) return ETestQuota;
+ if ((KeyBuffer.CompareF(KTestStart)) == 0 ) return ETestStart;
+ if ((KeyBuffer.CompareF(KTestStore)) == 0 ) return ETestStore;
+ if ((KeyBuffer.CompareF(KTestStored)) == 0 ) return ETestStored;
+ if ((KeyBuffer.CompareF(KTestStoreStatus)) == 0 ) return ETestStoreStatus;
+ if ((KeyBuffer.CompareF(KTestStoreStatusText)) == 0 ) return ETestStoreStatusText;
+ if ((KeyBuffer.CompareF(KTestTotals)) == 0 ) return ETestTotals;
+ if ((KeyBuffer.CompareF(KTestDeleteInfoIndex)) == 0 ) return ETestDeleteInfoIndex;
+ if ((KeyBuffer.CompareF(KTestApplicId)) == 0 ) return ETestApplicId;
+ if ((KeyBuffer.CompareF(KTestReplyApplicId)) == 0 ) return ETestReplyApplicId;
+ if ((KeyBuffer.CompareF(KTestApplicInfo)) == 0 ) return ETestApplicInfo;
+ if ((KeyBuffer.CompareF(KTestContentClass)) == 0 ) return ETestContentClass;
+ if ((KeyBuffer.CompareF(KTestDrmContent)) == 0 ) return ETestDrmContent;
+ if ((KeyBuffer.CompareF(KTestAdaptationAllowed)) == 0 ) return ETestAdaptationAllowed;
+ if ((KeyBuffer.CompareF(KTestRecommendedRetrievalMode)) == 0 ) return ETestRecommendedRetrievalMode;
+ if ((KeyBuffer.CompareF(KTestRecRetrievalModeText)) == 0 ) return ETestRecRetrievalModeText;
+ if ((KeyBuffer.CompareF(KTestReplaceId)) == 0 ) return ETestReplaceId;
+ if ((KeyBuffer.CompareF(KTestStatusText)) == 0 ) return ETestStatusText;
+ if ((KeyBuffer.CompareF(KTestCancelId)) == 0 ) return ETestCancelId;
+ if ((KeyBuffer.CompareF(KTestCancelStatus)) == 0 ) return ETestCancelStatus;
+ if ((KeyBuffer.CompareF(KTestAttContTypeParamName)) == 0 ) return ETestAttContTypeParamName;
+ if ((KeyBuffer.CompareF(KTestAttContTypeParamValue)) == 0 ) return ETestAttContTypeParamValue;
+ if ((KeyBuffer.CompareF(KTestAttXTypeParamName)) == 0 ) return ETestAttXTypeParamName;
+ if ((KeyBuffer.CompareF(KTestAttXTypeParamValue)) == 0 ) return ETestAttXTypeParamValue;
+ return ETestUnknown;
+ }
+
+// ---------------------------------------------------------
+// CMmsReadFile()::CreateMessageL
+// program build a message from given parts
+// ---------------------------------------------------------
+//
+void CMmsReadFile::CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders )
+ {
+
+ // Reset inactivity timer to keem viewServer from crashing
+ User::ResetInactivityTime();
+
+ TInt i;
+ TInt error = KErrNone;
+ RFile attaFile;
+ _LIT8(KLeftAngle, "<");
+ _LIT8(KRightAngle, ">");
+ // we can't use "seconds from" as it only returns a
+ // 32 bit signed integer. If fails in 2038.
+ // "microseconds from" returns a 64 bit signed integer
+
+ CMsvStore* store = aMmsClient->Entry().EditStoreL();
+ CleanupStack::PushL(store);
+ aMmsHeaders->StoreL(*store);
+ store->CommitL();
+ CleanupStack::PopAndDestroy( store );
+ store = NULL;
+
+ aMmsClient->LoadMessageL(); // read store is needed to do this
+
+ store = aMmsClient->Entry().EditStoreL();
+ CleanupStack::PushL(store);
+ CMsvAttachment* attaInfo = NULL;
+ TMsvAttachmentId attaId = 0;
+
+ for ( i=0; i < iAttaStructures->Count(); ++i)
+ {
+ attaId = KMsvNullIndexEntryId;
+ iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
+
+ error = attaFile.Open( iFs, iFilename, EFileShareReadersOnly | EFileRead );
+ User::LeaveIfError( error );
+
+ CleanupClosePushL(attaFile);
+
+ CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
+ CleanupStack::PushL( mimeHeaders );
+ TPtrC8 contentType = iAttaStructures->At(i)->iAttaType->Des();
+
+ TDataRecognitionResult result;
+ result.Reset(); // make sure that it is cleared
+
+ if(iAttaStructures->At(i)->iAttaCid->Length())
+ {
+ TPtr8 attaCID = iAttaStructures->At(i)->iAttaCid->Des();
+ if (attaCID.Find(KLeftAngle) == 0 &&
+ attaCID.Find(KRightAngle) == attaCID.Length()-1 )
+ {
+ // remove angle brackets from cid
+ attaCID = attaCID.Mid(1,attaCID.Length()-2);
+ }
+ mimeHeaders->SetContentIdL(attaCID);
+ }
+
+ if (iAttaStructures->At(i)->iAttaCharset)
+ {
+ mimeHeaders->SetMimeCharset(iAttaStructures->At(i)->iAttaCharset);
+ }
+
+ if (iAttaStructures->At(i)->iAttaName->Length())
+ {
+ iFilename.Copy(iAttaStructures->At(i)->iAttaName->Des());
+ }
+ iParse.Set( iFilename, NULL, NULL );
+ iFilename.Copy( iParse.NameAndExt() );
+
+ mimeHeaders->SetContentLocationL( iFilename );
+
+ // if Mime type has not been set, use RapaRecognizer
+ if ( iAttaStructures->At(i)->iAttaType->Length() == 0 && iFilename.Length() > 0)
+ {
+ // TO BE IMPLEMENTED
+
+ RApaLsSession lsSession;
+
+ if ( lsSession.Connect() == KErrNone )
+ {
+ CleanupClosePushL( lsSession );
+
+ iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
+ if ( lsSession.RecognizeData( iFilename, TPtrC8(), result ) == KErrNone )
+ {
+ // Check confidence level. Recognization must be at least
+ // "EProbable". We don't accept the result if it is "EPossible"
+ // or "EUnlikely" or "ENotRecognized"!
+
+ if ( result.iConfidence < CApaDataRecognizerType::EProbable )
+ {
+ result.Reset(); // clear buffer and try again with longer buffer
+ }
+
+ TPtrC8 mimeBuf8 = result.iDataType.Des8();
+
+ if ( mimeBuf8.Length() == 0 )
+ {
+ // Open file buffer and try again..
+
+ TInt bufSize = 0;
+ (void)lsSession.GetMaxDataBufSize( bufSize ); // ignore errors
+ if ( bufSize <= 0 )
+ {
+ bufSize = 30;
+ }
+ HBufC8* buf = HBufC8::NewLC( bufSize );
+ TPtr8 des = buf->Des();
+
+ RFile file;
+ TInt err=file.Open( iFs, iFilename, EFileShareReadersOnly );
+ if ( err == KErrNone )
+ {
+ err = file.Read( des );
+ file.Close();
+ if ( err == KErrNone )
+ {
+ if ( ( lsSession.RecognizeData( iFilename, des, result ) ) == KErrNone )
+ {
+ mimeBuf8.Set( result.iDataType.Des8() );
+ }
+ }
+
+ }
+ CleanupStack::PopAndDestroy(); // buf
+ }
+ if ( mimeBuf8.Length() > 0 &&
+ result.iConfidence >= CApaDataRecognizerType::EProbable )
+ {
+ contentType.Set( result.iDataType.Des8() );
+ }
+ }
+ CleanupStack::PopAndDestroy(1); // lssession
+ }
+ }
+
+ if ( contentType.Length() > 0 )
+ {
+ TInt position = contentType.Find( KMmsSlash8 );
+ if ( position >= 0 )
+ {
+ mimeHeaders->SetContentTypeL( contentType.Left( position ) );
+ }
+ if ( position < contentType.Length() - 1 )
+ {
+ mimeHeaders->SetContentSubTypeL( contentType.Mid( position + 1 ) );
+ }
+// CreateAttachment2L sets the content type to attaInfo
+// attaInfo->SetMimeTypeL( contentType );
+ }
+
+ if (iAttaStructures->At(i)->iAttaRecommendedName->Length())
+ {
+ iFilename.Copy(iAttaStructures->At(i)->iAttaRecommendedName->Des());
+ iParse.Set( iFilename, NULL, NULL );
+ iFilename.Copy( iParse.NameAndExt() );
+ mimeHeaders->SetSuggestedFilenameL( iFilename );
+ }
+
+ TInt j = 0;
+ for ( j = 0; j < iAttaStructures->At(i)->iContentTypeParams->MdcaCount(); ++j )
+ {
+ mimeHeaders->ContentTypeParams().AppendL( iAttaStructures->At(i)->iContentTypeParams->MdcaPoint( j ) );
+ }
+ for ( j = 0; j < iAttaStructures->At(i)->iXTypeParams->MdcaCount(); ++j )
+ {
+ mimeHeaders->XTypeParams().AppendL( iAttaStructures->At(i)->iXTypeParams->MdcaPoint( j ) );
+ }
+
+ attaInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
+ // attaInfo does not go onto cleaunpstack because ownership will
+ // be transferred to attachment manager.
+
+ aMmsClient->CreateAttachment2L(
+ *store,
+ attaFile,
+ contentType,
+ *mimeHeaders,
+ attaInfo,
+ attaId);
+ attaInfo = NULL; // ownership transferred
+
+ CleanupStack::PopAndDestroy(); // mimeHeaders
+ CleanupStack::PopAndDestroy(); // attaFile.Close()
+
+ if ( iAttaRoot > 0 && iAttaRoot == ( i + 1 ) )
+ {
+ aMmsClient->SetMessageRootL( attaId );
+ }
+ }
+
+ store->CommitL();
+ CleanupStack::PopAndDestroy(); // store
+
+ // This frees all memory and resets all values
+ Reset();
+ // Reset inactivity timer to keem viewServer from crashing
+ User::ResetInactivityTime();
+ }
+
+
+// ---------------------------------------------------------
+// CMmsReadFile()::FindAlias
+// program build a message from given parts
+// ---------------------------------------------------------
+//
+TInt CMmsReadFile::FindAlias( TPtrC aAlias )
+ {
+ TBuf<DefaultBufLen> abuf;
+ for( TInt i=0; i < iAliasCount; ++i )
+ {
+ abuf.Copy( iAliasArray->MdcaPoint(i) );
+ abuf.SetLength( abuf.Locate('=') );
+ if( ( abuf.CompareF( aAlias ) ) == 0 ) return( i );
+ }
+ return( -1 );
+ }
+
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+CMmsAttaStructure::CMmsAttaStructure()
+ {
+ iAtta = NULL;
+ iAttaType = NULL;
+ iAttaName = NULL;
+ iAttaCid = NULL;
+ iAttaRecommendedName = NULL;
+ }
+
+
+//
+void CMmsAttaStructure::ConstructL()
+ {
+ iAtta = HBufC8::NewL(DefaultBufLen);
+ iAttaType = HBufC8::NewL(DefaultBufLen);
+ iAttaName = HBufC8::NewL(DefaultBufLen);
+ iAttaCid = HBufC8::NewL(DefaultBufLen);
+ iAttaRecommendedName = HBufC::NewL(DefaultBufLen);
+ iAttaCharset = 0;
+ iXTypeParams = new(ELeave) CDesC8ArrayFlat(4);
+ iContentTypeParams = new(ELeave) CDesC8ArrayFlat(4);
+
+ }
+
+// Two-phased constructor.
+CMmsAttaStructure* CMmsAttaStructure::NewL()
+ {
+ CMmsAttaStructure* self = new ( ELeave ) CMmsAttaStructure;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// Destructor
+CMmsAttaStructure::~CMmsAttaStructure()
+ {
+ delete iAtta;
+ delete iAttaName;
+ delete iAttaType;
+ delete iAttaCid;
+ delete iAttaRecommendedName;
+ if ( iContentTypeParams )
+ {
+ iContentTypeParams->Reset();
+ }
+ delete iContentTypeParams;
+ if ( iXTypeParams )
+ {
+ iXTypeParams->Reset();
+ }
+ delete iXTypeParams;
+ }
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/mmstestbed/src/mmstestbed.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,2357 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#include <mtmdef.h>
+#include <CoreApplicationUIsSDKCRKeys.h>
+#include <mmsheaders.h>
+#include <mmscmds.h>
+#include <mmsencode.h>
+#include <mmscliententry.h>
+#include <logwrap.h>
+#include <logcli.h>
+#include <logview.h>
+#include "mmssettings.h" //use mmssettings.h instead of cmmssettings.h
+#include "mmstestbed.h"
+#include "mmsreadfile.h"
+#include "mmstestuitimer.h"
+#include "mmsteststaticutils.h"
+#include "mmstestbed.hrh"
+
+//constants
+_LIT( KMmsSender, "0601234567" );
+
+MmsTestBed::MmsTestBed()
+ {
+ //start the timer
+ iTimer = CTestUiTimer::NewL();
+ iTimer->Cancel();
+
+ iWait = CMsvOperationActiveSchedulerWait::NewLC();
+ // don't leave iWait on cleanup stack
+ CleanupStack::Pop();
+
+ //open msvsession
+ iSession = CMsvSession::OpenSyncL(*this);
+ //create client registry
+ iClientMtmRegistry = CClientMtmRegistry::NewL(*iSession);
+ //create client mtm
+ iMmsClient = (CMmsClientMtm *) iClientMtmRegistry->NewMtmL(
+ KUidMsgTypeMultimedia);
+
+ User::LeaveIfError( iFs.Connect() );
+ iFs.SetSessionPath( KRootPath );
+ iSettings = CMmsSettings::NewL();
+ iMmsHeaders = CMmsHeaders::NewL(iSettings->MmsVersion());
+ findDefaultL();
+ iServiceId = iDefaultServiceId;
+
+ //validate the settings
+ iSettings->ValidateSettings();
+
+ iLogEvent = CLogEvent::NewL();
+ iLogEvent->SetEventType(KLogMmsEventTypeUid);
+ iLogClient = NULL; // we test soon if this is available
+ iLogView = NULL; // needs log client
+ if ( checkLogClient() )
+ {
+ // first we generate a general view of all events
+ // we'll set the filter when we update the view
+ iLogView = CLogViewEvent::NewL( *iLogClient );
+ }
+ iLogFilter = CLogFilter::NewL();
+ // we try to filter MMS events
+ iLogFilter->SetEventType(KLogMmsEventTypeUid);
+ }
+
+MmsTestBed::~MmsTestBed()
+ {
+ delete iLogView;
+ delete iLogFilter;
+ delete iLogClient;
+ delete iLogEvent;
+ delete iSettings;
+ delete iMmsHeaders;
+ if(iTimer)
+ {
+ iTimer->Cancel();
+ delete iTimer;
+ }
+ //delete iMsvEntrySelection;
+ delete iMmsClient;
+ delete iClientMtmRegistry;
+ //delete iClientMtmRegistry;
+ delete iSession;
+ delete iWait;
+ }
+
+void MmsTestBed::setConnectionLocal(bool value)
+ {
+ //value = true for global off, local on
+ //value = false for global on, local off
+ iSettings->LoadSettingsL();
+ iSettings->SetLocalMode( value );
+ iSettings->SaveSettingsL();
+ }
+
+void MmsTestBed::fromOutboxToMmsc()
+ {
+ CMsvEntry* cEntry = NULL;
+
+ // Get List of services
+ cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages of outbox
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL(
+ KUidMsgTypeMultimedia);
+ CleanupStack::PushL(selection);
+
+ // Change state to "KMsvSendStateUnknown" in case the entry has been suspended earlier
+ for (TInt i = 0; i < selection->Count(); ++i)
+ {
+ cEntry->SetEntryL(selection->At(i));
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetReadOnly(EFalse);
+ entry.SetSendingState(KMsvSendStateUnknown);
+ cEntry->ChangeL(entry);
+ }
+
+ selection->InsertL(0, iServiceId);
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack(parameters);
+
+ op = iSession->TransferCommandL(*selection, EMmsSend, paramPack,
+ iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending)
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if (iWait->iStatus.Int() != KErrNone)
+ {
+ //DEBUG(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ CleanupStack::PopAndDestroy(); //cEntry
+ }
+
+void MmsTestBed::fromMmscToInbox()
+ {
+ CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
+ CleanupStack::PushL(msvEntrySelection);
+
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ msvEntrySelection->InsertL(0, iServiceId);
+ }
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack(parameters);
+
+ op = iMmsClient->InvokeAsyncFunctionL(EMmsReceive, *msvEntrySelection,
+ paramPack, iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending)
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if (iWait->iStatus.Int() != KErrNone)
+ {
+ //DEBUG(_L("Testbed tried to receive, return status %d"),iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); //msvEntrySelection
+ }
+
+void MmsTestBed::findDefaultL()
+ {
+ iSettings->LoadSettingsL();
+ iDefaultServiceId = iSettings->Service();
+ }
+
+void MmsTestBed::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
+ TAny* aArg2, TAny* /*aArg3*/)
+ {
+ iEvent = aEvent;
+ if (aEvent == EMsvGeneralError)
+ {
+ return;
+ }
+ TMsvId parentId = KMsvNullIndexEntryId;
+ if (aArg2 != NULL)
+ {
+ parentId = *(TMsvId*) aArg2;
+ }
+
+ CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
+ TMsvEntry tEntry;
+ TMsvId service;
+ TInt error = KErrNone;
+ error = iSession->GetEntry(selection->At(0), service, tEntry);
+
+ CMsvEntry* cEntry = NULL;
+ switch (aEvent)
+ {
+ case EMsvEntriesCreated:
+ {
+ if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
+ {
+ // emit signal for new entry into INBOX
+ emit entryCreatedInInbox(tEntry.Id());
+ }
+ else if (parentId == KMsvDraftEntryIdValue)
+ {
+ // emit signal for new entry into Draft
+ emit entryCreatedInDraft(tEntry.Id());
+ }
+ else if (parentId == iServiceId)
+ {
+ // emit signal for new Entry into SERVICE
+ }
+ else
+ {
+ // do nothing
+ }
+ }
+ break;
+ case EMsvEntriesChanged:
+ {
+ TMsvId id;
+ CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
+ if (selection == NULL)
+ {
+ // no selection, cannot handle
+ return;
+ }
+ id = selection->At(0);
+ //DEBUG Entry changed"));
+ if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
+ {
+/*
+ cEntry = iSession->GetEntryL( parentId );
+ CleanupStack::PushL( cEntry );
+ TRAPD (error, cEntry->SetEntryL( id ));
+ if ( error != KErrNone )
+ {
+ CleanupStack::PopAndDestroy(); // cEntry
+ return;
+ }
+ TMsvEntry tEntry = cEntry->Entry();
+ if ( tEntry.Visible() )
+ {
+ // generate fake delivery report
+ CMsvStore* store = cEntry->ReadStoreL();
+ CleanupStack::PushL( store );
+ CMmsHeaders* mmsHeaders = CMmsHeaders::NewL( iSettings->MmsVersion() );
+ CleanupStack::PushL( mmsHeaders );
+ mmsHeaders->RestoreL( *store );
+ iEncodeBuffer->ResizeL( 0 );
+ generateDeliveryReport( mmsHeaders );
+ CleanupStack::PopAndDestroy( 2 ); // mmsHeaders, store
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+*/
+ }
+ }
+ break;
+ case EMsvEntriesDeleted:
+ {
+ //emit signal for entry deleted
+ }
+ break;
+ case EMsvEntriesMoved:
+ {
+ if (parentId == KMsvGlobalOutBoxIndexEntryIdValue)
+ {
+ // entry moved to outbox
+ emit entryMovedToOutbox(tEntry.Id());
+ }
+ else if (parentId == KMsvSentEntryIdValue)
+ {
+ // entry moved to sent folder
+ emit entryMovedToSent(tEntry.Id());
+ }
+ else
+ {
+ // do nothing
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+void MmsTestBed::createMmsService()
+ {
+ CMmsSettings * settings = CMmsSettings::NewL();
+ CleanupStack::PushL( settings );
+ settings->CreateNewServiceL( *iSession );
+ CleanupStack::PopAndDestroy(); // settings
+ return;
+ }
+
+void MmsTestBed::cleanup()
+ {
+ TMsvId entryToBeKilled;
+ // Get access to root index
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+
+ entryToBeKilled = iSettings->Service();
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ while (entryToBeKilled != KMsvNullIndexEntryId)
+ {
+ // delete child of root entry
+ deleteEntry(entryToBeKilled, *cEntry);
+ entryToBeKilled = iSettings->Service();
+ }
+
+ CleanupStack::PopAndDestroy(); // cEntry
+ // We deleted everything!
+ iDefaultServiceId = KMsvNullIndexEntryId;
+ iServiceId = KMsvNullIndexEntryId;
+ }
+
+void MmsTestBed::deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry)
+ {
+ aClientEntry.DeleteL(aEntryId);
+ }
+
+void MmsTestBed::cleanupAndCreateNewService()
+ {
+ cleanup();
+ // all old service entries have been destroyed, create a new one
+ createMmsService();
+ }
+
+void MmsTestBed::testFile(TFileName& aFilePath, TInt aCommand /* = 0 */, TMsvId aBox /* = KMsvGlobalOutBoxIndexEntryId */ )
+ {
+ // update settings in mmsclient
+ iMmsClient->RestoreSettingsL();
+ iSettings->CopyL( iMmsClient->MmsSettings() );
+
+ RFileReadStream readStream;
+ readStream.PushL();
+// TMsvId id = KMsvNullIndexEntryId;
+ CBufFlat* encodeBuffer = NULL;
+ CMmsEncode* encoder = NULL;
+
+ // Open the file
+ TInt err = readStream.Open(iFs, aFilePath, EFileShareReadersOnly );
+ if (err != KErrNone) User::Leave( err );
+
+ TInt retCode = 0;
+ CMmsReadFile* readFile = NULL;
+ readFile = CMmsReadFile::NewL( iFs, readStream );
+ CleanupStack::PushL( readFile );
+
+ TInt messageCounter = 0;
+ CMsvEntry* cEntry = NULL;
+
+ while(!retCode)
+ {
+ // READ MESSAGE TO BUFFERS
+ iMmsHeaders->Reset(iSettings);
+ // put in some message type just for fun (testing...)
+ iMmsHeaders->SetMessageType( KMmsMessageTypeForwardReq );
+ retCode = readFile->CompleteTestL( messageCounter++, *iMmsHeaders );
+ if(readFile->iMessageType == ETestNewMessage)
+ {
+ // CREATE MESSAGE ENTRY
+ switch ( aCommand )
+ {
+ case ECreateToInbox:
+ case ECreateNotification:
+ cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+ break;
+ case ECreateToSentItems:
+ cEntry = iSession->GetEntryL(KMsvSentEntryId);
+ break;
+ case ECreateToDrafts:
+ cEntry = iSession->GetEntryL(KMsvDraftEntryId);
+ break;
+ case ECreateHeadersFromFile:
+ // here we just encode headers, no message entry
+ // the entry is fake.
+ break;
+ case ECreateMMBoxViewConf:
+ if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ // entry is not created for the description items
+ // they become attachments
+ cEntry = iSession->GetEntryL(KMsvDraftEntryId);
+ }
+ break;
+ default:
+ cEntry = iSession->GetEntryL(aBox);
+ break;
+ }
+
+ // if we are just playing with headers we have no entry
+ if ( aCommand != ECreateHeadersFromFile && aCommand != ECreateMMBoxViewConf )
+ {
+ CleanupStack::PushL(cEntry);
+ iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
+
+ // CREATE MESSAGE
+ iMmsClient->CreateMessageL(iServiceId);
+ }
+ else if ( aCommand == ECreateMMBoxViewConf )
+ {
+ if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ CleanupStack::PushL(cEntry);
+ iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
+
+ // CREATE MESSAGE
+ iMmsClient->CreateMessageL(iServiceId);
+ }
+ else
+ {
+ encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
+ CleanupStack::PushL( encodeBuffer );
+ encoder = CMmsEncode::NewL( iFs );
+ CleanupStack::PushL( encoder );
+
+ // encode headers to a binary file
+ encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
+
+ iFilename = KMmsMMBoxDescriptionDirectory;
+ TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
+
+ CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
+ encodeBuffer = NULL;
+ encoder = NULL;
+ }
+ }
+ else
+ {
+ encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
+ CleanupStack::PushL( encodeBuffer );
+ encoder = CMmsEncode::NewL( iFs );
+ CleanupStack::PushL( encoder );
+
+ // encode headers to a binary file
+ encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
+
+ iFilename = KMmsDumpDirectory;
+ TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
+
+ CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
+ encodeBuffer = NULL;
+ encoder = NULL;
+ }
+ }
+
+ if ( aCommand != ECreateHeadersFromFile &&
+ ( aCommand != ECreateMMBoxViewConf || iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf ) )
+ {
+ if(readFile->iMessageType == ETestSettings)
+ {
+ TMsvId ServiceId = iMmsClient->DefaultServiceL();
+ iMmsClient->RestoreSettingsL();
+ iSettings->CopyL( iMmsClient->MmsSettings() );
+ }
+
+ TMemoryInfoV1Buf memory;
+ UserHal::MemoryInfo( memory );
+ TInt available = memory().iFreeRamInBytes;
+// TMmsLogger::Log(_L("Free memory before CreateMessageL %d"), available );
+
+ TRAP (err, readFile->CreateMessageL(iMmsClient, iMmsHeaders));
+
+ available = memory().iFreeRamInBytes;
+// TMmsLogger::Log(_L("Free memory after CreateMessageL %d"), available );
+
+ if(readFile->iMessageType == ETestNewMessage)
+ {
+ TMsvEntry tEntry = iMmsClient->Entry().Entry();
+ TMsvId id = tEntry.Id();
+ if ( err == KErrNone )
+ {
+ // SAVE MESSAGE
+ iMmsClient->SaveMessageL();
+
+ // If we are creating a MMBox View confirmation,
+ // we add all binary files from KMmsMMBoxDirectory
+ // as attachments.
+
+ if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ addMMBoxDescriptions();
+ }
+
+ // reload the entry in case mms client put something into it
+ // MESSAGE MUST BE SET VISIBLE
+ tEntry = iMmsClient->Entry().Entry();
+ if ( iMmsClient->MessageClass() == EMmsClassAdvertisement )
+ {
+ tEntry.iMtmData1 |= KMmsMessageAdvertisement;
+ }
+ else if ( iMmsClient->MessageClass() == EMmsClassInformational )
+ {
+ tEntry.iMtmData1 |= KMmsMessageInformational;
+ }
+ tEntry.iMtmData1 &= ~KMmsMessageMobileTerminated;
+
+ // Test: Set all as editor oriented - except notifications!
+ if ( aCommand == ECreateNotification )
+ {
+ tEntry.iMtm = KUidMsgMMSNotification;
+ }
+ else
+ {
+ tEntry.iMtmData1 |= KMmsMessageEditorOriented;
+ }
+ if ( aCommand == ECreateToInbox )
+ {
+ tEntry.iMtmData1 |= KMmsMessageMobileTerminated;
+ tEntry.SetReadOnly( ETrue );
+ tEntry.SetNew( ETrue );
+ tEntry.SetUnread( ETrue );
+ }
+ else if ( aCommand == ECreateToSentItems )
+ {
+ tEntry.SetReadOnly( ETrue );
+ }
+ tEntry.SetVisible( ETrue );
+ tEntry.SetInPreparation( EFalse );
+ TTime now;
+ now.UniversalTime();
+ tEntry.iDate = now;
+ TMsvId entryId = tEntry.Id();
+ iMmsClient->Entry().ChangeL( tEntry );
+ if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ // Encode to the directory that is used to fetch MMBox view
+ iFilename.Copy( KMmsMMBoxDirectory );
+ encodeMessageFromDrafts();
+ cEntry->SetEntryL( KMsvDraftEntryId );
+ cEntry->DeleteL( entryId );
+ }
+ }
+ else
+ {
+ //TMmsLogger::Log(_L("CreateMessageL left with error %d"), err );
+ iSession->RemoveEntry(id);
+ err = KErrNone; // clear error
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+ cEntry = NULL;
+ }
+ if(readFile->iMessageType == ETestSettings)
+ {
+ iMmsClient->SetSettingsL( *iSettings );
+ iMmsClient->StoreSettingsL();
+ }
+ }
+ }
+
+ CleanupStack::PopAndDestroy(); //readFile
+
+ readStream.Close();
+ readStream.Pop();
+
+ /*
+ iMmsClient->SwitchCurrentEntryL(id);
+ */
+ }
+
+void MmsTestBed::addMMBoxDescriptions()
+ {
+ // add the contents of KMmsMMBoxDescriptionDirectory as attachments
+ CDir* fileList = NULL;
+ TInt i = 0; // general counter
+ TInt error = KErrNone;
+ iCurrentPath = KMmsMMBoxDescriptionDirectory;
+
+ iFs.SetSessionPath(iCurrentPath);
+
+ TFindFile finder( iFs );
+ error = finder.FindWildByPath( KWild, NULL, fileList );
+ CleanupStack::PushL( fileList );
+ TInt fileCounter = 0;
+
+ if ( error == KErrNone )
+ {
+ fileCounter = fileList->Count();
+ }
+
+ TEntry entry;
+
+ if ( error == KErrNone )
+ {
+ for ( i = 0; i < fileCounter; ++i )
+ {
+ // Reset inactivity timer to keep viewServer from crashing
+ User::ResetInactivityTime();
+ entry = (*fileList)[i]; // name is entry.iName
+ iFilename.Copy( iCurrentPath );
+ iFilename.Append( entry.iName );
+ TPtrC ptr;
+ ptr.Set( iFilename );
+ iWait->iStatus = KErrNone;
+ iMmsClient->AddAttachmentL( ptr, KMmsMimeType, 0, iWait->iStatus );
+
+ iWait->Start();
+ // The descriptions are cleared after being used
+ iFs.Delete( ptr);
+ }
+ }
+
+ iMmsClient->SaveMessageL(); // just in case somthing must be updated
+ CleanupStack::PopAndDestroy(); // fileList
+ fileList = NULL;
+ }
+
+void MmsTestBed::encodeMessageFromDrafts()
+ {
+ CMmsEncode* encoder = CMmsEncode::NewL( iFs );
+ CleanupStack::PushL( encoder );
+ // encode a message iMmsClientPoints to
+ iMmsClient->LoadMessageL();
+ CMsvStore* store = iMmsClient->Entry().ReadStoreL();
+ CleanupStack::PushL( store );
+ iMmsHeaders->RestoreL( *store );
+ CleanupStack::PopAndDestroy(); // store
+ store = NULL;
+ iWait->iStatus = KErrNone;
+
+// caller sets the directory
+// iFilename = KMmsMessageDumpDirectory;
+
+ CMmsClientEntry* entryWrapper = CMmsClientEntry::NewL( iFs, iMmsClient->Entry(), iServiceId );
+ CleanupStack::PushL( entryWrapper );
+ iEncodeBuffer->ResizeL(0);
+ encoder->StartL( *entryWrapper, *iMmsHeaders, *iEncodeBuffer, iWait->iStatus );
+ iWait->Start();
+ if ( iWait->iStatus == KErrNone )
+ {
+ TMmsTestUtils::Dump( *iEncodeBuffer, iFilename, iParse, iFs );
+ }
+ iEncodeBuffer->ResizeL(0);
+ CleanupStack::PopAndDestroy(); // entryWrapper
+ CleanupStack::PopAndDestroy(); // encoder
+ }
+
+void MmsTestBed::deleteNotifications()
+ {
+ TMsvId mmsFolderId = KMsvNullIndexEntryId;
+ mmsFolderId = findMMSFolder();
+
+ CMsvEntry* cEntry = NULL;
+ // delete all messages from the specified box
+ cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+
+ if ( mmsFolderId != KMsvNullIndexEntryId )
+ {
+ cEntry->SetEntryL(mmsFolderId);
+
+ // show invisible entries
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PushL(msvEntrySelection);
+
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ if (msvEntrySelection->Count() > 0)
+ {
+ CMsvOperation* op = iSession->TransferCommandL(
+ *msvEntrySelection,
+ EMmsDeleteEntries,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ CleanupStack::PopAndDestroy(); // op
+ }
+
+ // These cannot be deleted unless we have the a server mtm
+ // corresponding to this mtm type.
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ CleanupStack::PopAndDestroy(); //msvEntrySelection
+ msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgMMSNotification );
+ CleanupStack::PushL(msvEntrySelection);
+
+ if (msvEntrySelection->Count() > 0)
+ {
+ CMsvOperation* op = iSession->TransferCommandL(
+ *msvEntrySelection,
+ EMmsDeleteEntries,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ CleanupStack::PopAndDestroy(); // op
+ }
+
+ CleanupStack::PopAndDestroy(); //msvEntrySelection
+
+ CleanupStack::PopAndDestroy(); //cEntry
+ }
+ }
+
+TMsvId MmsTestBed::findMMSFolder()
+ {
+ return iSettings->NotificationFolder();
+ }
+
+void MmsTestBed::restoreFactorySettings()
+ {
+ iMmsClient->RestoreSettingsL();
+ iSettings->CopyL( iMmsClient->MmsSettings() );
+ // do not reset access point
+ TInt accessPoint = iSettings->AccessPoint( 0 );
+ iSettings->RestoreFactorySettingsL( iMmsClient->Session(), EMmsFactorySettingsLevelDeep );
+ TInt count = iSettings->AccessPointCount();
+ TInt i = 0;
+ for ( i = count - 1; i >= 0; --i )
+ {
+ iSettings->DeleteAccessPointL( i );
+ }
+ // restore the original access point
+ if ( accessPoint > 0 )
+ {
+ // a negative access point is an error (most likely "KErrNotFound")
+ iSettings->AddAccessPointL( accessPoint, 0 );
+ }
+ iMmsClient->SetSettingsL( *iSettings );
+ iMmsClient->StoreSettingsL();
+ }
+
+void MmsTestBed::setFetchingState( TMmsReceivingMode aState )
+ {
+ iMmsClient->RestoreSettingsL();
+ iSettings->CopyL( iMmsClient->MmsSettings() );
+
+ iSettings->SetReceivingModeHome( aState );
+
+ iMmsClient->SetSettingsL( *iSettings );
+ iMmsClient->StoreSettingsL();
+ }
+
+void MmsTestBed::sendFromFile()
+ {
+ CMsvOperation * op = NULL;
+
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
+ CleanupStack::PushL( cEntry );
+
+ CMsvEntrySelection* selection = NULL;
+ selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PopAndDestroy(); // cEntry
+ CleanupStack::PushL( selection );
+
+ TRAPD (error, op = iMmsClient->SendL(*selection, iWait->iStatus));
+ if ( error != KErrNone )
+ {
+ CleanupStack::PopAndDestroy(); // selection
+ delete op;
+ return;
+ }
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(2); // op, selection
+ }
+
+void MmsTestBed::sendOneByOne()
+ {
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
+ CleanupStack::PushL( cEntry );
+
+ CMsvEntrySelection* selection = NULL;
+ selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PushL( selection );
+
+ CMsvEntrySelection* shortSelection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( shortSelection );
+
+ TInt i;
+
+ for ( i = 0; i < selection->Count(); ++i )
+ {
+ shortSelection->Reset();
+ shortSelection->AppendL( selection->At( i ) );
+
+ CMsvOperation * op = NULL;
+
+ TTime now;
+ now.UniversalTime();
+
+ TRAPD (error, op = iMmsClient->SendL(*shortSelection, iWait->iStatus, now ));
+ if ( error != KErrNone )
+ {
+ delete op;
+ CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
+ return;
+ }
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+
+ }
+ CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
+ }
+
+void MmsTestBed::sendNotifications()
+ {
+ // Only send one notification!!
+
+ TInt error = KErrNone;
+
+ if (! TMmsTestUtils::IsFile(iCurrentFile, iFs) )
+ {
+ //Not a file
+ return;
+ }
+ TMsvId mmsFolder = findMMSFolder();
+
+ TEntry entry;
+
+
+ // now I think we have a filename
+ TEntry orgEntry;
+ TUint size = 0;
+ error = iFs.Entry( iCurrentFile, orgEntry );
+ size = orgEntry.iSize;
+
+ //TMmsLogger::Log(_L("- notification %S "), &iCurrentFile);
+ if ( size == 0 )
+ {
+ //empty file
+ //TMmsLogger::Log(_L("- empty file"));
+ return;
+ }
+
+ if ( iEncodeBuffer == NULL )
+ {
+ iEncodeBuffer = CBufFlat::NewL( size );
+ }
+ else
+ {
+ iEncodeBuffer->ResizeL( 0 );
+ iEncodeBuffer->ResizeL( size );
+ }
+
+ RFile inFile;
+ error = inFile.Open( iFs, iCurrentFile, EFileShareReadersOnly );
+ TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
+ if ( error == KErrNone )
+ {
+ error = inFile.Read( ptr, size );
+ inFile.Close();
+ }
+ else
+ {
+ //Error
+ //TMmsLogger::Log(_L("- can't read file"));
+ return;
+ }
+
+ TUint8 byte;
+ TUint position = 0;
+ TUint32 uintvar = 0;
+
+ if ( size > 2 )
+ {
+ iEncodeBuffer->Read( 1, &byte, 1 );
+ if ( byte == 6 ) // PUSH PDU
+ {
+ // try to find out length of header
+ position = 2;
+ iEncodeBuffer->Read( position, &byte, 1);
+
+ while ( byte & 0x80 && position < size )
+ {
+ uintvar += ( byte & 0x7f );
+ uintvar <<= 7;
+ position++;
+ iEncodeBuffer->Read( position, &byte, 1 );
+ }
+
+ // add last byte without shift
+ uintvar += byte;
+ position++;
+ }
+ }
+
+ position += uintvar;
+
+ if ( position < size )
+ {
+ ptr = iEncodeBuffer->Ptr( position );
+ size = ptr.Length();
+ }
+
+ if ( size == 0 )
+ {
+ //no MMS stuff
+ //TMmsLogger::Log(_L("- no MMS stuff"));
+ return;
+ }
+
+ TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
+
+ // Now we have streamed our data into this entry.
+ // Now we have an entry that says: local service, MMS MTM
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ if ( entryId != KMsvNullIndexEntryId )
+ {
+ selection->AppendL( entryId );
+ }
+ else
+ {
+ selection->AppendL( iDefaultServiceId );
+ }
+
+ TWatcherParameters parameters; // initialized to zero
+ parameters.iWatcherId = RThread().Id();
+ parameters.iDataPointer = &ptr;
+ TWatcherParametersBuf paramPack( parameters );
+
+ CMsvOperation * op = NULL;
+
+ op = iSession->TransferCommandL(
+ *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ User::After(1000000);
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::copyDrafts()
+ {
+ CMsvEntry* cEntry = NULL;
+// Copies contents of sent folder to drafts for retrying sending.
+
+ cEntry = iSession->GetEntryL(KMsvSentEntryId);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages in drafts
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+
+ TMsvLocalOperationProgress progress;
+ cEntry->CopyL( *selection, KMsvDraftEntryId, progress );
+
+ TInt i = 0;
+ for ( i = 0; i < selection->Count(); ++i )
+ {
+ cEntry->SetEntryL( selection->At( i ) );
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetReadOnly( EFalse );
+ cEntry->ChangeL( entry );
+ }
+
+ CleanupStack::PopAndDestroy(2); // selection, cEntry
+ }
+
+void MmsTestBed::garbageCollection(TUint32 aReason)
+ {
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+
+ TMMSGarbageCollectionParameters parameters; // initialized to zero
+ parameters.iReasonFlags = aReason;
+ TMMSGarbageCollectionParametersBuf paramPack( parameters );
+ op = iSession->TransferCommandL(
+ *selection, EMmsGarbageCollection, paramPack, iWait->iStatus );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::messageVariation()
+ {
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+
+ op = iSession->TransferCommandL(
+ *selection, EMmsMessageGeneration, TPtrC8(), iWait->iStatus );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::cancelSendScheduling()
+ {
+ CMsvEntry* cEntry = NULL;
+ setFetchingState( EMmsReceivingPostpone );
+ testFile( iCurrentFile );
+ scheduledSend(KMsvGlobalOutBoxIndexEntryIdValue, 10000); // long delay so that we have time to cancel
+ deleteSendSchedule();
+
+ cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ cEntry->SetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+ if (iMsvEntrySelection != NULL)
+ {
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ }
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PopAndDestroy();
+ }
+
+void MmsTestBed::scheduledSend(TMsvId aBoxId, TInt aDelay /* = 5 */)
+ {
+ CMsvEntry* cEntry = NULL;
+ TCommandParameters parameters;
+ parameters.iInitialDelay = aDelay;
+ TCommandParametersBuf paramPack( parameters );
+
+ cEntry = iSession->GetEntryL(aBoxId);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages of outbox
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+// selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsScheduledSend,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(2); // cEntry, selection
+ }
+
+void MmsTestBed::deleteSendSchedule()
+ {
+ CMsvEntry* cEntry = NULL;
+
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages of outbox
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsDeleteSchedule,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(2); // cEntry, selection
+ }
+
+void MmsTestBed::cancelFetchScheduling()
+ {
+ TMsvId mmsFolder = findMMSFolder();
+ CMsvEntry* cEntry = NULL;
+ setFetchingState( EMmsReceivingPostpone );
+ testFile( iCurrentFile );
+ fromOutboxToMmsc(); // immediate send (EMmsSend)
+
+ // Wait until notification has arrived - may take a while in global mode
+ TInt i = 0;
+ while ( TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) == 0
+ && i < 2000 )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ i++;
+ if ( (i/100) * 100 == i )
+ {
+ //TMmsLogger::Log(_L("%d:th wait cycle"), i );
+ }
+ CActiveScheduler::Start();
+ }
+ iTimer->Cancel();
+
+ fetchForced( 10000 ); // delay to allow cancelling
+ deleteFetchSchedule();
+
+ cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ cEntry->SetEntryL(mmsFolder);
+ if (iMsvEntrySelection != NULL)
+ {
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ }
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PopAndDestroy(); // cEntry
+ }
+
+void MmsTestBed::fetchForced(TInt aDelay /* = 5 */)
+ {
+ TCommandParameters parameters;
+ parameters.iInitialDelay = aDelay;
+ TCommandParametersBuf paramPack( parameters );
+
+ CMsvEntrySelection* selection = new CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ selection->InsertL(0, iServiceId);
+ }
+ else
+ {
+ selection->InsertL(0, iDefaultServiceId);
+ }
+
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsScheduledReceiveForced,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::deleteFetchSchedule()
+ {
+ CMsvEntry* cEntry = NULL;
+
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ TMsvId mmsFolderId = KMsvNullIndexEntryId;
+ mmsFolderId = findMMSFolder();
+ cEntry = iSession->GetEntryL( mmsFolderId );
+ CleanupStack::PushL(cEntry);
+ // Get all notifications
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsDeleteSchedule,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(2); // cEntry, selection
+ }
+
+void MmsTestBed::doAFetchCycle()
+ {
+ // Sends a message from iCurrentFile and lets it come back
+ TMsvId mmsFolder = findMMSFolder();
+ testFile( iCurrentFile );
+ fromOutboxToMmsc(); // immediate send (EMmsSend)
+ // fetching will start automatically
+
+ TInt i = 0;
+ while ( TMmsTestUtils::CountChildrenL( KMsvGlobalInBoxIndexEntryId, iMsvEntrySelection, *iSession ) == 0
+ && i < 2000
+ && TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) > 0 )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ i++;
+ if ( (i/100) * 100 == i )
+ {
+ //TMmsLogger::Log(_L("%d:th wait cycle"), i );
+ }
+ CActiveScheduler::Start();
+ }
+ iTimer->Cancel();
+ }
+
+bool MmsTestBed::checkLogClient()
+ {
+ if ( iLogClient == NULL )
+ {
+ TRAP_IGNORE( iLogClient = CLogClient::NewL( iFs ) );
+ }
+ return ( iLogClient != NULL );
+ }
+
+int MmsTestBed::getLogEntries()
+ {
+ TInt count = 0;
+ if ( !iLogView )
+ {
+ return 0;
+ }
+
+ if ( iLogView->SetFilterL( *iLogFilter, iWait->iStatus ) )
+ {
+ // should complete with KErrNone
+ iWait->Start();
+ if ( iWait->iStatus.Int() == KErrNone )
+ {
+ count = iLogView->CountL();
+ }
+ }
+ return count;
+ }
+
+void MmsTestBed::createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry)
+ {
+ CMsvOperation* opert = aClientEntry.CreateL(aNewEntry, iWait->iStatus);
+ iWait->Start();
+ if (!opert->iStatus.Int()==KErrNone)
+ {
+ // what should we do? panic?
+ }
+
+ TPckgBuf<TMsvLocalOperationProgress> package;
+ package.Copy(opert->ProgressL());
+ *(TMsvId*)&aNewEntry = package().iId;
+
+ delete opert; opert=NULL;
+ }
+
+void MmsTestBed::cleanOutbox()
+ {
+ TMmsTestUtils::CleanBoxL(KMsvGlobalOutBoxIndexEntryId, *iSession);
+ }
+
+void MmsTestBed::cleanInbox()
+ {
+ TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
+ }
+
+void MmsTestBed::cleanSent()
+ {
+ TMmsTestUtils::CleanBoxL(KMsvSentEntryId, *iSession);
+ }
+
+void MmsTestBed::cleanDrafts()
+ {
+ TMmsTestUtils::CleanBoxL(KMsvDraftEntryId, *iSession);
+ }
+
+void MmsTestBed::cleanAll()
+ {
+ cleanInbox();
+ cleanOutbox();
+ cleanSent();
+ cleanDrafts();
+ TMmsTestUtils::CleanBoxL( iSettings->MMBoxFolder(), *iSession );
+ deleteNotifications();
+ }
+
+void MmsTestBed::reply()
+ {
+ // The first message from inbox is replied to
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ if ( iMsvEntrySelection->Count() > 0 )
+ {
+ TMsvId originalEntry = iMsvEntrySelection->At(0);
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription;
+ CMsvOperation * op = NULL;
+ op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Create reply, return status %d"), iWait->iStatus.Int());
+ }
+ else
+ {
+ TMsvId newEntry = KMsvNullIndexEntryId;
+ TPckgBuf<TMsvId> package;
+ package.Copy(op->ProgressL());
+ newEntry = package();
+ if ( newEntry != KMsvNullIndexEntryId )
+ {
+ cEntry->SetEntryL( newEntry );
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetInPreparation( EFalse );
+ entry.SetVisible( ETrue );
+ cEntry->ChangeL(entry);
+ }
+ }
+ CleanupStack::PopAndDestroy(); // op
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+ }
+
+void MmsTestBed::replyToAll()
+ {
+ // The first message from inbox is replied to
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+
+ if ( iMsvEntrySelection->Count() > 0 )
+ {
+ TMsvId originalEntry = iMsvEntrySelection->At(0);
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
+ KMsvMessagePartRecipient;
+ CMsvOperation * op = NULL;
+ op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Create reply to all, return status %d"), iWait->iStatus.Int());
+ }
+ else
+ {
+ TMsvId newEntry = KMsvNullIndexEntryId;
+ TPckgBuf<TMsvId> package;
+ package.Copy(op->ProgressL());
+ newEntry = package();
+ if ( newEntry != KMsvNullIndexEntryId )
+ {
+ cEntry->SetEntryL( newEntry );
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetInPreparation( EFalse );
+ entry.SetVisible( ETrue );
+ cEntry->ChangeL(entry);
+ }
+ }
+ CleanupStack::PopAndDestroy(); // op
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+ }
+
+void MmsTestBed::forward()
+ {
+ // The first message from inbox is forwarded
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+
+ if ( iMsvEntrySelection->Count() > 0 )
+ {
+ TMsvId originalEntry = iMsvEntrySelection->At(0);
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
+ KMsvMessagePartRecipient | KMsvMessagePartAttachments;
+ CMsvOperation * op = NULL;
+ op = iMmsClient->ForwardL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Create forward, return status %d"), iWait->iStatus.Int());
+ }
+ else
+ {
+ TMsvId newEntry = KMsvNullIndexEntryId;
+ TPckgBuf<TMsvId> package;
+ package.Copy(op->ProgressL());
+ newEntry = package();
+ if ( newEntry != KMsvNullIndexEntryId )
+ {
+ iMmsClient->SwitchCurrentEntryL( newEntry );
+ // Add a sender: 0601234567
+ iMmsClient->LoadMessageL();
+ iMmsClient->SetSenderL( KMmsSender );
+ iMmsClient->SaveMessageL();
+ cEntry->SetEntryL( newEntry );
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetInPreparation( EFalse );
+ entry.SetVisible( ETrue );
+ cEntry->ChangeL(entry);
+ }
+ }
+ CleanupStack::PopAndDestroy(); // op
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+ }
+
+void MmsTestBed::sendReadReport()
+ {
+ // TURN READ REPORTS ON (until available from menu)
+ iSettings->LoadSettingsL();
+ iSettings->SetReadReplyReportSendingAllowed( ETrue );
+ iSettings->SaveSettingsL();
+ iMmsClient->RestoreSettingsL();
+
+
+ // Read report is sent for the first message in inbox
+ CMsvEntry* cEntry = iSession->GetEntryL( KMsvGlobalInBoxIndexEntryId );
+ CleanupStack::PushL(cEntry);
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+
+ if ( iMsvEntrySelection->Count() == 0 )
+ {
+ return;
+ }
+ TMsvId originalEntry = iMsvEntrySelection->At( 0 );
+
+ // new test using Client MTM
+ CMsvOperation * op = NULL;
+ op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy( op );
+ op = NULL;
+
+ // Try sending the read report to current entry
+
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy( op );
+ op = NULL;
+
+/*
+ cEntry->SetEntryL( originalEntry );
+ iMmsHeaders->Reset();
+ CMsvStore* store = cEntry->ReadStoreL();
+ CleanupStack::PushL( store );
+ iMmsHeaders->RestoreL( *store );
+ CleanupStack::PopAndDestroy( store );
+ store = NULL;
+ HBufC8* messageId = HBufC8::NewL( iMmsHeaders->MessageId().Length() );
+ CleanupStack::PushL( messageId );
+ messageId->Des().Copy( iMmsHeaders->MessageId() );
+
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ iMmsClient->LoadMessageL();
+
+ iMmsHeaders->Reset();
+ iMmsHeaders->SetMessageType( KMmsMessageTypeReadRecInd );
+ // Message id cannot be accessed via MMS Client MTM!
+
+ iMmsHeaders->SetMessageIdL( messageId->Des() );
+ CleanupStack::PopAndDestroy( messageId );
+
+ iMmsHeaders->AddTypedAddresseeL( iMmsClient->Sender(), EMsvRecipientTo );
+ // sender must be insert-address-token because we don't know our number
+ TTime now;
+ now.UniversalTime();
+
+ _LIT( K1970, "19700000:000000.000000" ); // 1-Jan 1970 0:00:00
+
+ TTime y1970( K1970 );
+ TTimeIntervalMicroSeconds interval;
+ // we can't use "seconds from" as it only returns a
+ // 32 bit signed integer. If fails in 2038.
+ // "microseconds from" returns a 64 bit signed integer
+ interval = now.MicroSecondsFrom( y1970 );
+ // date in iMmsHeaders() in seconds from 1.1.1970.
+ iMmsHeaders->SetDate( (interval.Int64() ) / KMmsMillion );
+ iMmsHeaders->SetReadStatus( KMmsReadStatusRead );
+
+ TMsvId mmsFolderId = KMsvNullIndexEntryId;
+ mmsFolderId = FindMMSFolderL();
+
+ cEntry->SetEntryL( mmsFolderId );
+
+ TMsvEntry entry;
+ entry.iType = KUidMsvMessageEntry;
+ entry.iMtm = KUidMsgTypeMultimedia;
+ entry.SetVisible( ETrue );
+ entry.SetInPreparation( EFalse );
+ entry.iServiceId = KMsvLocalServiceIndexEntryId;
+ entry.iRelatedId = iDefaultServiceId;
+ entry.iMtmData1 = KMmsMessageReadRecInd;
+ cEntry->CreateL( entry );
+ TMsvId entryId = entry.Id();
+
+ cEntry->SetEntryL( entryId );
+
+ store = cEntry->EditStoreL();
+ CleanupStack::PushL( store );
+ iMmsHeaders->StoreL( *store );
+ store->CommitL();
+ CleanupStack::PopAndDestroy( store );
+ store = NULL;
+
+ CMsvEntrySelection* selection = new ( ELeave ) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, entryId);
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ op = iSession->TransferCommandL(*selection,EMmsScheduledReadReport,paramPack,iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy( op );
+ CleanupStack::PopAndDestroy( selection );
+*/
+ CleanupStack::PopAndDestroy( cEntry );
+ }
+
+int MmsTestBed::fromOutboxToMmscWithMemoryFailure()
+ {
+ TInt error = KErrNone;
+ TInt messageCount = 0;
+ TInt failureCount = 0;
+ do {
+ CMsvEntry* cEntry = NULL;
+
+ // Get List of services
+ cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages of outbox
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+ failureCount++;
+ // These are failures that fail in Message server.
+ if ( failureCount >= 63 && failureCount <= 64 )
+ {
+ failureCount = 65;
+ }
+ cEntry->SetEntryL( iServiceId );
+ TMsvEntry entry = cEntry->Entry();
+ entry.iMtmData3 &= 0x0000000FF;
+ entry.iMtmData3 |= failureCount << 8;
+ cEntry->ChangeL( entry );
+
+ selection->InsertL(0, iServiceId);
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ TRAP (error, op = iSession->TransferCommandL(*selection,EMmsSend,paramPack,iWait->iStatus));
+
+ if ( error == KErrNone )
+ {
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ error = iWait->iStatus.Int();
+ if ( iWait->iStatus.Int() != KErrNoMemory )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+ }
+ }
+
+ CleanupStack::PopAndDestroy(); // op
+ }
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // selection
+ CleanupStack::PopAndDestroy(); // cEntry
+ selection = NULL;
+ cEntry = NULL;
+ cEntry = iSession->GetEntryL( KMsvGlobalOutBoxIndexEntryIdValue );
+ CleanupStack::PushL(cEntry);
+ selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ messageCount = selection->Count();
+ delete selection;
+ selection = 0;
+ CleanupStack::PopAndDestroy(); //cEntry
+ }
+ while ( error == KErrNoMemory || messageCount > 0 );
+ return failureCount;
+ }
+
+int MmsTestBed::fromMmscToInboxWithMemoryFailure()
+ {
+ TInt error = KErrNone;
+ TInt failureCount = 0;
+ TInt messageCount = 0;
+ TMsvId mmsFolderId = KMsvNullIndexEntryId;
+ mmsFolderId = findMMSFolder();
+
+ do {
+ // Inbox must be cleaned if failure makes message to be fetched more than once.
+ // should not happen, but this test is quite stressful, and perfect result
+ // cannot be guaranteed.
+ // What is expected:
+ // 1. Program does not crash
+ // 2. After sufficient number of retries the message is fetched and notification deleted.
+ TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
+ CMsvEntry* cEntry = NULL;
+ CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
+ CleanupStack::PushL(msvEntrySelection);
+
+ cEntry = iSession->GetEntryL(iServiceId);
+ CleanupStack::PushL(cEntry);
+
+ failureCount++;
+ // These are failures that fail in Message server.
+ if ( failureCount >= 63 && failureCount <= 64 )
+ {
+ failureCount = 65;
+ }
+ cEntry->SetEntryL( iServiceId );
+
+ TMsvEntry entry = cEntry->Entry();
+ entry.iMtmData3 &= 0x0000000FF;
+ entry.iMtmData3 |= failureCount << 8;
+ cEntry->ChangeL( entry );
+
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ msvEntrySelection->InsertL(0, iServiceId);
+ }
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ TRAP (error, op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsReceiveForced,
+ *msvEntrySelection,
+ paramPack,
+ iWait->iStatus) );
+
+ if ( error == KErrNone )
+ {
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ error = iWait->iStatus.Int();
+ if ( iWait->iStatus.Int() != KErrNoMemory )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to receive, return status %d"), iWait->iStatus.Int());
+ }
+ }
+
+ CleanupStack::PopAndDestroy(); // op
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // msvEntrySelection
+ CleanupStack::PopAndDestroy(); // cEntry
+ msvEntrySelection = NULL;
+ cEntry = NULL;
+ cEntry = iSession->GetEntryL( mmsFolderId );
+ CleanupStack::PushL(cEntry);
+ msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ messageCount = msvEntrySelection->Count();
+ delete msvEntrySelection;
+ msvEntrySelection = 0;
+ CleanupStack::PopAndDestroy(); //cEntry
+ }
+ while ( error == KErrNoMemory || messageCount > 0 );
+ if ( error != KErrNoMemory && error != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Memory failure loop ended with %d"), error);
+ }
+ return failureCount;
+ }
+
+void MmsTestBed::sendViaClient()
+ {
+ CMsvEntry* cEntry = NULL;
+
+ cEntry = iSession->GetEntryL(KMsvDraftEntryId);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages in drafts
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+
+ CMsvOperation * op = NULL;
+ TTime now;
+ now.UniversalTime();
+ op = iMmsClient->SendL( *selection, iWait->iStatus, now );
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(2); // cEntry, selection
+ }
+
+void MmsTestBed::scheduledFetch(TInt aDelay /* = 5 */)
+ {
+ TCommandParameters parameters;
+ parameters.iInitialDelay = aDelay;
+ TCommandParametersBuf paramPack( parameters );
+
+ CMsvEntrySelection* selection = new CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ selection->InsertL(0, iServiceId);
+ }
+ else
+ {
+ selection->InsertL(0, iDefaultServiceId);
+ }
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsScheduledReceive,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::fetchForcedImmediate()
+ {
+ TCommandParameters parameters;
+ TCommandParametersBuf paramPack( parameters );
+
+ CMsvEntrySelection* selection = new CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ selection->InsertL(0, iServiceId);
+ }
+ else
+ {
+ selection->InsertL(0, iDefaultServiceId);
+ }
+
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsReceiveForced,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::getEventType()
+ {
+ if ( !checkLogClient() )
+ {
+ return; // not available
+ }
+
+ CLogEventType* eventType = CLogEventType::NewL();
+ CleanupStack::PushL( eventType );
+ eventType->SetUid(iLogEvent->EventType());
+ iLogClient->GetEventType( *eventType, iWait->iStatus );
+
+ iWait->Start();
+ CleanupStack::PopAndDestroy(); // eventType
+ }
+
+void MmsTestBed::addEventType()
+ {
+ if ( !checkLogClient() )
+ {
+ return; // not available
+ }
+
+ CLogEventType* eventType = CLogEventType::NewL();
+ CleanupStack::PushL( eventType );
+ eventType->SetUid(iLogEvent->EventType());
+ eventType->SetDescription(_L("Multimedia Message") );
+ eventType->SetLoggingEnabled( ETrue );
+
+// iWait->iStatus = KRequestPending;
+ iLogClient->AddEventType( *eventType, iWait->iStatus );
+ iWait->Start();
+ CleanupStack::PopAndDestroy(); // eventType
+ }
+
+void MmsTestBed::deleteEventType()
+ {
+ if ( !checkLogClient() )
+ {
+ return; // not available
+ }
+// iWait->iStatus = KRequestPending;
+ iLogClient->DeleteEventType( iLogEvent->EventType(), iWait->iStatus );
+ iWait->Start();
+ }
+
+void MmsTestBed::cleanLog()
+ {
+ TInt count = 0;
+
+ count = getLogEntries();
+
+ TInt i;
+ for ( i = 0; i < count; ++i )
+ {
+ // when a view is created, it will be positioned on the first event
+// iWait->iStatus = KRequestPending;
+ iLogClient->DeleteEvent(iLogView->Event().Id(), iWait->iStatus);
+ iWait->Start();
+
+ if ( iLogView->NextL( iWait->iStatus ) )
+ {
+ // should complete with KErrNone
+ iWait->Start();
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ // could not get next event!
+ break;
+ }
+ }
+ else
+ {
+ break; // no more events!
+ }
+ }
+ }
+
+void MmsTestBed::setOnline(bool value)
+ {
+ //value = true for online mode
+ //value = false for offline mode
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KCRUidCoreApplicationUIs ) );
+ if( retval == KErrNone )
+ {
+ repository->Set( KCoreAppUIsNetworkConnectionAllowed, value );
+ delete repository;
+ }
+ }
+
+void MmsTestBed::generateDeliveryReport( CMmsHeaders* aMmsHeaders )
+ {
+ iEncodeBuffer->ResizeL( 1024 );
+
+ TInt position = 0;
+
+ // encode message type
+ iEncodeBuffer->Write( position, &KMmsAssignedMessageType, 1 );
+ position++;
+ iEncodeBuffer->Write( position, &KMmsMessageTypeDeliveryInd, 1 );
+ position++;
+
+ // version
+ iEncodeBuffer->Write( position, &KMmsAssignedMmsVersion, 1 );
+ position++;
+
+ TUint8 version = aMmsHeaders->MmsVersion() | 0x80; // current version as short integer
+ iEncodeBuffer->Write( position, &version, 1 );
+ position++;
+
+ // message id from the headers
+ // At least once MMSC did not send us the message id!
+ // if message id is missing, we cannot match the entry!
+ // This only a fake. Real delivery reports should always
+ // contain the message id.
+ if ( aMmsHeaders->MessageId().Length() > 0 )
+ {
+ iEncodeBuffer->Write( position, &KMmsAssignedMessageId, 1 );
+ position++;
+ iEncodeBuffer->Write( position, &(aMmsHeaders->MessageId()[0]), aMmsHeaders->MessageId().Length() );
+ position += aMmsHeaders->MessageId().Length();
+ iEncodeBuffer->Write( position, &KMmsNull, 1 );
+ position++;
+ }
+
+ // To is taken from the headers
+ iEncodeBuffer->Write( position, &KMmsAssignedTo, 1 );
+ position++;
+
+ TPtrC recipient;
+ if ( aMmsHeaders->ToRecipients().MdcaCount() > 0 &&
+ aMmsHeaders->ToRecipients()[0].Length() > 0 )
+ {
+ recipient.Set( aMmsHeaders->ToRecipients()[0] );
+ }
+ else if( aMmsHeaders->CcRecipients().MdcaCount() > 0 &&
+ aMmsHeaders->CcRecipients()[0].Length() > 0 )
+ {
+ recipient.Set( aMmsHeaders->CcRecipients()[0] );
+ }
+ else if( aMmsHeaders->BccRecipients().MdcaCount() > 0 &&
+ aMmsHeaders->BccRecipients()[0].Length() > 0 )
+ {
+ recipient.Set( aMmsHeaders->BccRecipients()[0] );
+ }
+ else
+ {
+ recipient.Set( _L("Jasso-Kissa@jii.fi") );
+ }
+
+ TMmsAddressType addressType = EMmsAddressTypeUnknown;
+
+ if ( recipient.Find( KMiuMau ) != KErrNotFound )
+ {
+ addressType = EMmsAddressTypeEmail;
+ }
+ else
+ {
+ addressType = EMmsAddressTypeMobile;
+ }
+
+ TUint8 character;
+ TInt i;
+ if ( addressType == EMmsAddressTypeEmail )
+ {
+ // email address - ASCII ONLY - THIS IS JUST A TEST!
+
+ for ( i = 0; i < recipient.Length(); ++i )
+ {
+ character = TUint8( recipient[i] & 0xff );
+ iEncodeBuffer->Write( position, &character, 1 );
+ position++;
+ }
+ iEncodeBuffer->Write( position, &KMmsNull, 1 );
+ position++;
+
+ }
+ else
+ {
+ // must be a phone number
+ // We expect for now that the format is correct as is
+ // All legal characters present in a phone number are ASCII
+
+ TInt i;
+ for ( i = 0; i < recipient.Length(); ++i )
+ {
+ character = TUint8( recipient[i] & 0xff );
+ iEncodeBuffer->Write( position, &character, 1 );
+ position++;
+ }
+ iEncodeBuffer->Write( position, KMmsPlmn, KMmsPlmnLength );
+ position += KMmsPlmnLength;
+ iEncodeBuffer->Write( position, &KMmsNull, 1 );
+ position++;
+ }
+
+ // date
+ iEncodeBuffer->Write( position, &KMmsAssignedDate, 1 );
+ position++;
+
+ TLocale locale;
+ locale.Refresh();
+ TInt64 UtcDate;
+ TTimeIntervalSeconds universalTimeOffset( locale.UniversalTimeOffset() );
+
+ TTime now;
+ now.UniversalTime();
+ UtcDate = ( now.MicroSecondsFrom( TTime( KMmsYear1970String ) ).Int64() ) / 1000000 ;
+
+ UtcDate -= universalTimeOffset.Int();
+
+ if ( locale.QueryHomeHasDaylightSavingOn() )
+ {
+ TTimeIntervalSeconds daylightSaving( 60 * 60 );
+ UtcDate -= daylightSaving.Int();
+ }
+
+ TUint8 len; // number of bytes we will need
+ len = 0;
+ TUint8 array[8];
+
+ TInt64 temp = UtcDate;
+
+ for (i = 7; i >= 0; --i)
+ {
+ array[i] = TInt8( ( I64INT( temp ) ) & 0xFF );
+ I64LSR( temp, 8 );
+ }
+
+ len = 8;
+ i = 0;
+ while( ( array[i]== 0 ) && ( i < 8 ) )
+ {
+ i++;
+ len--;
+ }
+
+ // a zero should be coded as short integer.
+ // However, if there is a valid reason to code a zero as a long integer,
+ // we allow it. The caller should know what he is doing.
+ if ( len == 0 )
+ {
+ len = 1;
+ }
+ // write short length
+ iEncodeBuffer->Write( position, &len, 1 );
+ position++;
+ // write as many bytes as were non-zero
+ iEncodeBuffer->Write( position, &(array[8 - len] ), len );
+ position+= len;
+ // status
+ iEncodeBuffer->Write( position, &KMmsAssignedStatus, 1 );
+ position++;
+ iEncodeBuffer->Write( position, &KMmsMessageStatusRetrieved, 1 );
+ position++;
+ // DONE!!!
+ iEncodeBuffer->ResizeL( position );
+ return;
+ }
+
+void MmsTestBed::sendDeliveryReport()
+ {
+ if ( iEncodeBuffer->Size() == 0 )
+ {
+ //No delivery report
+ return;
+ }
+
+
+ TMsvId mmsFolder = findMMSFolder();
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+
+ TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
+ TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
+
+ // Now we have streamed our data into this entry.
+ // Now we have an entry that says: local service, MMS MTM
+
+ if ( entryId != KMsvNullIndexEntryId )
+ {
+ selection->AppendL( entryId );
+ }
+ else
+ {
+ selection->AppendL( iDefaultServiceId );
+ }
+
+ TWatcherParameters parameters; // initialized to zero
+ parameters.iWatcherId = RThread().Id();
+ parameters.iDataPointer = &ptr;
+ TWatcherParametersBuf paramPack( parameters );
+
+ CMsvOperation * op = NULL;
+
+// iWait->iStatus = KRequestPending;
+ op = iSession->TransferCommandL(
+ *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/mmstestbed/src/mmsteststaticutils.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,528 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#include <f32file.h>
+#include <centralrepository.h>
+#include <apparc.h>
+#include <msvapi.h>
+#include <msvids.h>
+
+#include "mmsteststaticutils.h"
+#include "mmsconst.h"
+#include "MmsEnginePrivateCRKeys.h"
+#include "mmssettings.h"
+#include "mmsheaders.h"
+#include "mmsservercommon.h"
+#include "mmsencode.h"
+
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+TMmsJoinedArrays::TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2)
+: iArray1(aArray1), iArray2(aArray2)
+ {
+ }
+
+TInt TMmsJoinedArrays::MdcaCount() const
+ {
+ TInt count=0;
+ if (iArray1)
+ count += iArray1->MdcaCount();
+ if (iArray2)
+ count += iArray2->MdcaCount();
+ return count;
+ }
+
+TPtrC16 TMmsJoinedArrays::MdcaPoint(TInt aIndex) const
+ {
+ if (iArray1)
+ {
+ if (aIndex < iArray1->MdcaCount())
+ return iArray1->MdcaPoint(aIndex);
+ else
+ aIndex -= iArray1->MdcaCount();
+ }
+ return iArray2->MdcaPoint(aIndex);
+ }
+
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+TMmsTestUtils::TMmsTestUtils()
+ {
+
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+HBufC* TMmsTestUtils::ReadContactFromFileL( TDesC& aFileName, RFs& aFs )
+ {
+ RFile file;
+ TInt error = KErrNone;
+
+ TInt textBufferSize = 256;
+ HBufC* textBuffer = HBufC::NewL( textBufferSize );
+ TPtr textPtr = textBuffer->Des();
+ TFileText textFile;
+
+ error = file.Open( aFs, aFileName,
+ EFileRead|EFileShareReadersOnly );
+
+ if ( error == KErrNone )
+ {
+ textFile.Set( file );
+ error = textFile.Seek( ESeekStart );
+ }
+
+ if ( error == KErrNone )
+ {
+ error = textFile.Read( textPtr );
+ }
+
+ file.Close();
+
+ if ( textBuffer->Des().Find( &KMmsByteOrderMark, 1 ) == 0 )
+ {
+ textBuffer->Des().Copy( textBuffer->Des().Mid( 1 ) );
+ }
+
+ return textBuffer;
+ }
+
+//----------------------------------------------------------------------------------------
+// turn on detailed logging while decoding a message
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::DecodeLoggingOnL()
+ {
+ // CenRep for decodelogging
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+ if( retval == KErrNone )
+ {
+ // Best effort - if cannot access repository, no can do
+ TInt temp = 1;
+ repository->Set( KMmsEngineDecodeLog, temp );
+ delete repository;
+ }
+ }
+
+//----------------------------------------------------------------------------------------
+// turn off detailed logging while decoding a message
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::DecodeLoggingOffL()
+ {
+ // CenRep for decodelogging
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+ if( retval == KErrNone )
+ {
+ // Best effort - if cannot access repository, no can do
+ TInt temp = 0;
+ repository->Set( KMmsEngineDecodeLog, temp );
+ delete repository;
+ }
+
+ }
+
+//----------------------------------------------------------------------------------------
+// turn on binary dump of incoming messages
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::BinaryDumpOnL()
+ {
+ // CenRep for binarydump setting
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+ if( retval == KErrNone )
+ {
+ // Best effort - if cannot access repository, no can do
+ TInt temp = 1;
+ repository->Set( KMmsEngineBinaryDump, temp );
+ delete repository;
+ }
+
+ }
+
+//----------------------------------------------------------------------------------------
+// turn off binary dump of incoming messages
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::BinaryDumpOffL()
+ {
+ // CenRep for binarydump setting
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+ if( retval == KErrNone )
+ {
+ // Best effort - if cannot access repository, no can do
+ TInt temp = 0;
+ repository->Set( KMmsEngineBinaryDump, temp );
+ delete repository;
+ }
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+void TMmsTestUtils::CleanDirectoryL( RFs& aFs )
+ {
+ // Delete the files in the directory
+ CFileMan* fileMan = CFileMan::NewL( aFs );
+ CleanupStack::PushL( fileMan );
+ fileMan->RmDir( KMmsDefaultLocalModeDir );
+ fileMan->RmDir( KMmsMMBoxDirectory );
+ fileMan->RmDir( KMmsMMBoxDescriptionDirectory );
+ CleanupStack::PopAndDestroy(); // fileManager
+ // we don't want to throw these away!
+ aFs.MkDirAll( KMmsDefaultLocalModeDir );
+ aFs.MkDirAll( KMmsMMBoxDirectory );
+ aFs.MkDirAll( KMmsMMBoxDescriptionDirectory );
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+void TMmsTestUtils::Dump( CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs )
+ {
+ TInt error = KErrNone;
+ aFs.MkDirAll( aFilename );
+ TUint att;
+ if ( aFs.Att( aFilename, att ) == KErrNone )
+ {
+ _LIT( KRelated, "dump.mms");
+ aParse.Set( aFilename, &KRelated, NULL );
+ aFilename = aParse.FullName();
+ error = CApaApplication::GenerateFileName( aFs, aFilename );
+ if ( error == KErrNone )
+ {
+ RFile file;
+ error = file.Create( aFs, aFilename, EFileWrite | EFileShareExclusive );
+ // for message id generation
+ aParse.Set( aFilename, NULL, NULL );
+ if ( error == KErrNone )
+ {
+ // the data is supposed to be in the encode buffer
+ TPtr8 ptr = aBuffer.Ptr( 0 );
+ file.Write( ptr );
+ file.Flush();
+ }
+
+ // done - close files
+ file.Close();
+ }
+ }
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+void TMmsTestUtils::CleanBoxL(TMsvId aBoxId, CMsvSession& aSession)
+ {
+ CMsvEntry* cEntry = NULL;
+ // delete all messages from the specified box
+ cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ cEntry->SetEntryL(aBoxId);
+ // show invisible entries
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PushL(msvEntrySelection);
+
+ CMsvEntrySelection* selection = NULL;
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ selection = cEntry->ChildrenWithMtmL(KUidMsgMMSNotification);
+ CleanupStack::PushL( selection );
+ if ( selection->Count() > 0 )
+ {
+ msvEntrySelection->AppendL( selection->Back( 0 ), selection->Count() );
+ }
+ CleanupStack::PopAndDestroy(); // selection
+
+ int i;
+ for (i = 0; i < msvEntrySelection->Count(); ++i)
+ {
+ CMsvEntry* entry = aSession.GetEntryL( msvEntrySelection->At(i) );
+ CleanupStack::PushL( entry );
+ TMsvEntry tEntry = entry->Entry();
+ tEntry.SetReadOnly(EFalse);
+ entry->ChangeL(tEntry);
+ cEntry->DeleteL( msvEntrySelection->At(i) );
+ CleanupStack::PopAndDestroy( entry );
+ }
+
+ CleanupStack::PopAndDestroy(msvEntrySelection);
+ CleanupStack::PopAndDestroy(cEntry);
+ }
+
+//----------------------------------------------------------------------------------------
+// turn on logging email recipients
+//----------------------------------------------------------------------------------------
+void TMmsTestUtils::EmailLoggingOnL()
+ {
+ // CenRep for binarydump setting
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
+ if( retval == KErrNone )
+ {
+ TInt temp = 1;
+ repository->Set( KMmsEngineLogEmailRecipients, temp );
+ delete repository;
+ }
+
+ }
+
+//----------------------------------------------------------------------------------------
+// turn off logging email recipients
+//----------------------------------------------------------------------------------------
+void TMmsTestUtils::EmailLoggingOffL()
+ {
+ // CenRep for binarydump setting
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
+ if( retval == KErrNone )
+ {
+ TInt temp = 0;
+ repository->Set( KMmsEngineLogEmailRecipients, temp );
+ delete repository;
+ }
+
+ }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TInt TMmsTestUtils::CountChildrenL(TMsvId aBoxId, CMsvEntrySelection*& aMsvEntrySelection, CMsvSession& aSession, TUid aMessageType )
+ {
+ CMsvEntry* cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ cEntry->SetEntryL(aBoxId);
+ if (aMsvEntrySelection != NULL)
+ {
+ delete aMsvEntrySelection;
+ aMsvEntrySelection = NULL;
+ }
+ aMsvEntrySelection = cEntry->ChildrenWithMtmL(aMessageType);
+ CleanupStack::PopAndDestroy(); // cEntry
+ return aMsvEntrySelection->Count();
+ }
+
+
+// -----------------------------------------------------------------------------
+// CreateFolderEntryL
+//
+// -----------------------------------------------------------------------------
+//
+void TMmsTestUtils::CreateFolderEntryL(
+ CMsvSession& aSession,
+ TMsvId aParentFolder,
+ const TDesC& aFolderName,
+ TMsvId& aFolderId )
+ {
+ aFolderId = KMsvNullIndexEntryId;
+ CMsvEntry* cEntry = aSession.GetEntryL( aParentFolder );
+ CleanupStack::PushL( cEntry );
+
+ // Create a new folder.
+
+ TMsvEntry entry;
+ entry.iType = KUidMsvFolderEntry;
+ entry.iMtm = KUidMsvLocalServiceMtm;
+ entry.iDetails.Set( aFolderName );
+ entry.SetVisible( EFalse );
+ entry.SetInPreparation( EFalse );
+ entry.iServiceId = KMsvLocalServiceIndexEntryId;
+ cEntry->CreateL( entry );
+ aFolderId = entry.Id();
+ CleanupStack::PopAndDestroy( cEntry );
+
+ }
+
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TMsvId TMmsTestUtils::CreateNotificationEntryL(
+ TMsvId aNotificationFolder,
+ TMsvId aServiceId,
+ CBufFlat* aEncodeBuffer,
+ CMsvSession& aSession )
+ {
+ TMsvId entryId = KMsvNullIndexEntryId;
+ if ( aNotificationFolder == KMsvNullIndexEntryId )
+ {
+ // no folder no entry
+ return entryId;
+ }
+
+ CMsvEntry* cEntry = aSession.GetEntryL( aNotificationFolder );
+ CleanupStack::PushL(cEntry);
+
+ TMsvEntry entry;
+ entry.iType = KUidMsvMessageEntry;
+ entry.iMtm = KUidMsgTypeMultimedia;
+ entry.SetVisible( ETrue );
+ // If we want to put data here, InPreparation must be set to true first
+ entry.SetInPreparation( EFalse );
+ entry.iServiceId = KMsvLocalServiceIndexEntryId;
+ entry.iRelatedId = aServiceId;
+ entry.iMtmData2 = KMmsNotificationBinary;
+ cEntry->CreateL( entry );
+ entryId = entry.Id();
+
+ //
+ // Stream
+ // 1) length of the data as 32 bit integer
+ // 2) pushed message data
+ // into created entry's stream
+ //
+ cEntry->SetEntryL( entryId );
+ CMsvStore* store = cEntry->EditStoreL();
+ CleanupStack::PushL( store ); // ***
+ RMsvWriteStream outs;
+ outs.AssignLC( *store, KUidBinaryNotificationStream ); // ***
+ TPtrC8 ptr = aEncodeBuffer->Ptr( 0 );
+ outs.WriteUint32L( ptr.Length() );
+ outs.WriteL( ptr );
+ outs.CommitL();
+ outs.Close();
+ store->CommitL();
+
+ CleanupStack::PopAndDestroy( &outs ); // close outs
+ CleanupStack::PopAndDestroy( store );
+ CleanupStack::PopAndDestroy( cEntry );
+
+ return entryId;
+
+ }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+void TMmsTestUtils::FormNotification(
+ TDesC8& aUrl,
+ TInt aSize,
+ CMmsHeaders& aMmsHeaders,
+ CMmsEncode& aMmsEncoder,
+ CBufFlat* aEncodeBuffer )
+ {
+ // for test purposes aUrl will contain the filename.
+
+ // Reset sets the default encapsulation version
+ // The default version has been set from MmsSettings in NewL
+ aMmsHeaders.Reset();
+
+ // construct the notification into iMmsHeaders, and call encode
+
+ aMmsHeaders.SetMessageType( KMmsMessageTypeMNotificationInd );
+
+ TTime currentTime;
+ currentTime.UniversalTime();
+ currentTime.Int64();
+
+ TPtrC8 tid;
+ TBufC8<KMMSMAXTIDLENGTH> target;
+ TInt random = 0;
+
+ // we don't generate a true random TID: We generate the
+ // TID from the URL so that if we generate a notification
+ // twice from the same file, we get the same TID and the
+ // same URL. This way we can test the pruning function in
+ // server MTM
+
+ TInt i;
+ for ( i = 0; i < aUrl.Length(); ++i )
+ {
+ random += aUrl[ i ];
+ }
+
+ target.Des().Num( random );
+ tid.Set( target.Des() );
+ aMmsHeaders.SetTidL( tid );
+
+ aMmsHeaders.SetMessageClass( EMmsClassPersonal );
+ aMmsHeaders.SetMessageSize( aSize );
+ const TInt KTenHours = 10 * 60 * 60; // 10 hours relative expiry
+ aMmsHeaders.SetExpiryInterval( KTenHours );
+ aMmsHeaders.SetContentLocationL( aUrl );
+
+ aMmsEncoder.EncodeHeadersL( aMmsHeaders, *aEncodeBuffer );
+
+ }
+
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TBool TMmsTestUtils::IsFile(const TDesC& aFileName, RFs& aFs)
+ {
+ //Is the name a file?
+ if (IsDrive(aFileName))
+ return EFalse;
+ return !(IsDir(aFileName, aFs));
+ }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TBool TMmsTestUtils::IsDir(const TDesC& aFileName, RFs& aFs)
+ {
+ //Is the name a directory?
+ TEntry entry;
+ TInt err = aFs.Entry(aFileName, entry);
+ if (err)
+ return EFalse;
+ else
+ return entry.IsDir();
+ }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TBool TMmsTestUtils::IsDrive(const TDesC& aFileName)
+ {
+ //horrible little function to figure if the path is just a drive
+ TBool retVal = EFalse;
+ if (aFileName.Length()==3) //eg "c:\"
+ {
+ if ((aFileName[1] == ':') && (aFileName[2] == '\\'))
+ retVal=ETrue;
+ }
+ else if (aFileName.Length()==2) //eg "c:"
+ {
+ if (aFileName[1] == ':')
+ retVal=ETrue;
+ }
+ return retVal;
+ }
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/mmstestbed/src/mmstestuitimer.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#include "mmstestuitimer.h"
+
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CTestUiTimer::CTestUiTimer(): CTimer( 5 )
+ {
+ period = KPeriod;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::ConstructL()
+ {
+ CTimer::ConstructL();
+ CActiveScheduler::Add(this);
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CTestUiTimer* CTestUiTimer::NewL()
+ {
+ CTestUiTimer* self = new(ELeave) CTestUiTimer();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CTestUiTimer::~CTestUiTimer()
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::IssueRequest()
+ {
+ // No operation to cancel if this function is called
+ iObject = NULL;
+ After(period);
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::TimeoutOperation( CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds )
+ {
+ iObject = aObject;
+ TTimeIntervalMicroSeconds32 timeout = aTimeoutInSeconds.Int() * 1000000;
+ After( timeout );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::DoCancel()
+ {
+ CTimer::DoCancel();
+ if ( iObject )
+ {
+ iObject->Cancel();
+ iObject = NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::RunL()
+ {
+ if ( iObject )
+ {
+ // If we timeout while holding an active object, we cancel it
+ iObject->Cancel();
+ iObject = NULL;
+ }
+ else
+ {
+ CActiveScheduler::Stop();
+ }
+ }
+
+// ======== GLOBAL FUNCTIONS ========
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/testconvergedmessageutils/data/TestConvergedMessageUtilsSample.txt Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,1 @@
+MMSTEST Text
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/testconvergedmessageutils/inc/testconvergedmessageutils.h Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Main test class declaration for ConvergedMessageUtils
+ */
+
+#ifndef TEST_MMS_PLUGIN_H
+#define TEST_MMS_PLUGIN_H
+
+#ifdef BUILD_TEST_DLL
+#define TEST_EXPORT Q_DECL_EXPORT
+#else
+#define TEST_EXPORT Q_DECL_IMPORT
+#endif
+
+#include <QObject>
+#include <QSignalSpy>
+#include <e32const.h>
+
+//Forward Declarations
+class UniEditorMmsPlugin;
+class ConvergedMessage;
+class MmsTestBed;
+
+//Main Tets Class Declaration
+class TEST_EXPORT TestConvergedMessageUtils: public QObject
+ {
+ Q_OBJECT
+
+private slots:
+
+ /**
+ * Initialises the whole Test
+ **/
+ void initTestCase();//called before the first testfunction is executed.
+
+ /**
+ * Initialises each Test Case
+ **/
+ void init();//called before each testfunction is executed.
+
+ /**
+ * Creates a MMS messsage
+ **/
+ void createMMS();
+
+ /**
+ * Tests the MMS message
+ **/
+ void testMMS();
+
+ /**
+ * Test Methods of ConvergedMessageId which were not part of the tests above
+ **/
+ void testConvergedMessageIdUnusedMethods();
+
+
+ /**
+ * Test Methods of ConvergedMessageAttachment which were not part of the tests above
+ **/
+ void testConvergedMessageAttachmentUnusedMethods();
+
+ /**
+ * Cleans up each Test Case
+ **/
+ void cleanup();//called after every testfunction.
+
+ /**
+ * Cleans up the whole Test Case
+ **/
+ void cleanupTestCase();//called after the last testfunction was executed.
+
+private: //Data
+
+ /**
+ * msgPlugin - MMS Message Plug-in
+ **/
+ UniEditorMmsPlugin* msgPlugin;
+
+ /**
+ * mmstestbed - MMS Message Simulator
+ **/
+ MmsTestBed* mmstestbed;
+
+ /**
+ * spy_draft - Signal Spy for Draft Folder
+ **/
+ QSignalSpy* spy_draft;
+
+ /**
+ * mmsMsgId - The MMS message Id
+ **/
+ long int mmsMsgId;
+ };
+#endif //TEST_MMS_PLUGIN_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/testconvergedmessageutils/inc/testconvergedmessageutils.ini Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Input data Set File for TestConvergedMessageUtils test cases
+ */
+
+const char TEST_MSG_BODY[] = "TestTextE_1_2";
+const char TEST_MSG_SUBJECT[] = "Message Subject";
+const char TEST_SENDER[] = "+919860479112";
+const char TEST_ATTACHMENT[] = "c:\\data\\TestConvergedMessageUtilsSample.txt";
+const char TEST_CC[] = "DummyCCAddress";
+const char TEST_BCC[] = "DummyBCCAddress";
+const char TEST_ALIAS[] = "DummySenderAlias";
+
+//out put directory for test results.
+QString OUTPUTDIRECTORY = "c:/logs/TestConvergedMessageUtils";
+//o/p directory for data to be written on temp file.
+QString TEMPDIR = "c:/logs/TestConvergedMessageUtils/testdata";
+//test result O/P file name.
+QString RESULTFILE = "c:/logs/TestConvergedMessageUtils/result_%1.txt";
+// folder named UID3 of msgapptestsuite inside private folder.
+const QString PRIVATE_DIR("C:/private/E39cd515");
+//application class name
+const QString appClassName("TestConvergedMessageUtils");
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/testconvergedmessageutils/src/testconvergedmessageutils.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,331 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Main test class definition for ConvergedMessageUtils
+ */
+
+#include <QtTest/QtTest>
+#include <QTimer>
+#include <QSignalSpy>
+#include "debugtraces.h"
+#include "testconvergedmessageutils.h"
+#include "convergedmessage.h"
+#include "convergedmessageid.h"
+#include "unieditormmsplugin.h"
+#include "mmstestbed.h"
+#include "testconvergedmessageutils.ini"
+
+//---------------------------------------------------------------
+// TestConvergedMessageUtils::initTestCase
+//---------------------------------------------------------------
+void TestConvergedMessageUtils::initTestCase()
+{
+ //register user defined object to meta system.
+ qRegisterMetaType<long int> ("long int");
+
+ //Verify MmsTestBed Instance.
+ mmstestbed = new MmsTestBed;
+ QVERIFY(mmstestbed != NULL);
+
+ //Instantiate UniEditorMmsPlugin and verify if it is correctly Instantited.
+ msgPlugin = new UniEditorMmsPlugin;
+ QVERIFY(msgPlugin != NULL);
+
+ //set up signalspy to listen to signals emitted by mmstestbed
+ spy_draft = new QSignalSpy(mmstestbed, SIGNAL(entryCreatedInDraft(long int)));
+}
+
+//---------------------------------------------------------------
+// TestConvergedMessageUtils::init
+//---------------------------------------------------------------
+void TestConvergedMessageUtils::init()
+{
+}
+
+//---------------------------------------------------------------
+// TestConvergedMessageUtils::createMMS
+//---------------------------------------------------------------
+void TestConvergedMessageUtils::createMMS()
+{
+ //Create a Converged Message instance.
+ QString subject = TEST_MSG_SUBJECT;
+
+ qint64 timeStamp = QDateTime::currentDateTime().toTime_t();
+
+ QString sender(TEST_SENDER);
+ ConvergedMessageAddress address(sender);
+ ConvergedMessageAttachmentList attachmentList;
+
+ //Add a text attachment to attachment list.
+ QString attachmentPath = TEST_ATTACHMENT;
+ ConvergedMessageAttachment* attachment =
+ new ConvergedMessageAttachment(attachmentPath, ConvergedMessageAttachment::EAttachment);
+
+ attachmentList.append(attachment);
+
+ //Instantiate a Converged Message object and set service a MMS
+ ConvergedMessage msg;
+
+ msg.setMessageType(ConvergedMessage::Mms);
+
+ //Set Subject
+ msg.setSubject(subject);
+
+ //Set Timestamp and verify
+ msg.setTimeStamp(timeStamp);
+ QVERIFY(timeStamp == msg.timeStamp());
+
+ //Set Alias to an address
+ address.setAlias(QString (TEST_ALIAS));
+
+ //Set recipient.
+ msg.addToRecipient(address);
+
+ //Add attachments' list
+ msg.addAttachments(attachmentList);
+ msg.setPriority(ConvergedMessage::Normal);
+
+ //Adding CC Address
+ QString ccAddress(TEST_CC);
+ ConvergedMessageAddress ccAdd(ccAddress);
+ msg.addCcRecipient(ccAdd);
+
+ //Adding BCC Address
+ QString bccAddress(TEST_BCC);
+ ConvergedMessageAddress bccAdd(bccAddress);
+ msg.addBccRecipient(bccAdd);
+
+ //Adding From Address
+ QString recipientAddress(TEST_SENDER);
+ ConvergedMessageAddress recipientAdd(recipientAddress);
+ msg.addFromRecipient(recipientAdd);
+
+ //Set Body Text and verify
+ msg.setBodyText(QString(TEST_MSG_BODY));
+ QVERIFY(msg.bodyText().compare(QString(TEST_MSG_BODY)) == 0);
+
+ //Removing Body Text as MMS messages do not contain Body Text
+ msg.setBodyText(QString(NULL));
+
+ //Set Property and Verify
+ msg.setProperty(ConvergedMessage::Attachment);
+ msg.setProperty(ConvergedMessage::Unread);
+ QVERIFY(msg.properties() == ConvergedMessage::Attachment | ConvergedMessage::Unread);
+ QVERIFY(msg.hasAttachment() == true);
+ QVERIFY(msg.isUnread() == true);
+
+ //Set Location
+ msg.setLocation(ConvergedMessage::Draft);
+
+ //Set Sending State and Verify
+ msg.setSendingState(ConvergedMessage::Waiting);
+ QVERIFY(msg.sendingState() == ConvergedMessage::Waiting);
+
+ //Set Direction
+ msg.setDirection(ConvergedMessage::Outgoing);
+
+ //Set Priority
+ msg.setPriority(ConvergedMessage::Normal);
+
+ //Set Sub Type and verify
+ msg.setMessageSubType(ConvergedMessage::NokiaService);
+ QVERIFY(msg.messageSubType() == ConvergedMessage::NokiaService);
+
+ //Create another Converged Message
+ ConvergedMessage msgCopyFirst(msg);
+ ConvergedMessage msgCopySecond(*(msg.id()));//by Id
+ QCOMPARE(msgCopySecond.id()->getId(), msg.id()->getId());//Verify if the copy was as expected
+
+ //Create a Converged Message with serializing and deserializing and verify
+ QFile file("c:\\test.txt");
+ file.open(QIODevice::WriteOnly);
+ QDataStream out(&file); // Serialize the data into the file
+ msg.serialize(out); // Serialize a string
+ file.close();
+
+ file.open(QIODevice::ReadOnly);
+ QDataStream in(&file); // read the data serialized from the file
+
+ ConvergedMessage msgCopyThird;//Third Copy of the Actual Message
+ msgCopyThird.deserialize(in);
+ file.close();
+
+ //Verify the 3rd Copy with the Original Copy
+ QVERIFY(msgCopyThird.id()->getId() == msg.id()->getId());
+ QCOMPARE(msgCopyThird.subject(), msg.subject());
+ QVERIFY(msgCopyThird.messageType() == msg.messageType());
+
+ //Get a valid MMS message ID and verify that it is valid.
+ mmsMsgId = msgPlugin->convertTo(&msgCopyFirst);
+ QVERIFY(mmsMsgId != -1);
+ QDEBUG_WRITE("MMS Successfully Sent to Dratfs Folder");
+}
+
+//---------------------------------------------------------------
+// TestConvergedMessageUtils::testMMS
+//---------------------------------------------------------------
+void TestConvergedMessageUtils::testMMS()
+{
+ long int mmsDraftMsgId;
+
+ //check if draft-folder signal was received...this means message was created in draft
+ if( 1 <= spy_draft->count())
+ {
+ //compare the msgid and verify with the ID given by MMS plugin
+ void * temp = const_cast<void*>(spy_draft->at(0).at(0).data());
+ mmsDraftMsgId = *reinterpret_cast< long int(*)>(temp);
+ QVERIFY(mmsDraftMsgId == mmsMsgId);
+
+ //Validate the MMS message with all the values set before.
+ ConvergedMessage* draftMsg = msgPlugin->convertFrom(mmsDraftMsgId);
+ QVERIFY(draftMsg->subject().compare(QString(TEST_MSG_SUBJECT)) == 0);
+ QVERIFY(draftMsg->messageType() == ConvergedMessage::Mms);
+ QVERIFY(QString(TEST_SENDER).contains(draftMsg->toAddressList()[0]->address(), Qt::CaseInsensitive) == true);
+ QVERIFY(QString(TEST_ALIAS).contains(draftMsg->toAddressList()[0]->alias(), Qt::CaseInsensitive) == true);
+ QVERIFY(QString(TEST_CC).contains(draftMsg->ccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
+ QVERIFY(QString(TEST_BCC).contains(draftMsg->bccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
+ QVERIFY(QString(TEST_SENDER).contains(draftMsg->fromAddress()->address(), Qt::CaseInsensitive) == true);
+ QVERIFY(draftMsg->attachments().count() == 1);
+ QVERIFY(draftMsg->attachments()[0]->attachmentType() == ConvergedMessageAttachment::EAttachment);
+ QVERIFY(draftMsg->attachments()[0]->filePath().contains(QString(TEST_ATTACHMENT).mid(QString(TEST_ATTACHMENT).indexOf(QString("Sample.txt"), 0, Qt::CaseInsensitive)), Qt::CaseInsensitive) == true);
+ QVERIFY(draftMsg->location() == ConvergedMessage::Draft);
+ QVERIFY(draftMsg->priority() == ConvergedMessage::Normal);
+ QVERIFY(draftMsg->direction() == ConvergedMessage::Outgoing);
+ QDEBUG_WRITE("MMS Successfully Verified at Drafts Folder");
+ }
+ else
+ {
+ QFAIL("testSendReceiveMMS: Failed to create message in Draft");
+ }
+}
+
+//---------------------------------------------------------------
+// TestConvergedMessageUtils::testConvergedMessageIdUnusedMethods
+//---------------------------------------------------------------
+void TestConvergedMessageUtils::testConvergedMessageIdUnusedMethods()
+{
+ //Create a copy of ConvergedMessageId object from another object
+ ConvergedMessageId msgId1;
+ msgId1.setId(0x646);
+
+ //Verify if the two objects match
+ ConvergedMessageId msgId3;
+ msgId3 = msgId1;
+ QVERIFY(msgId3 == msgId1);
+}
+
+//---------------------------------------------------------------
+// TestConvergedMessageUtils::testConvergedMessageAttachmentUnusedMethods
+//---------------------------------------------------------------
+void TestConvergedMessageUtils::testConvergedMessageAttachmentUnusedMethods()
+{
+ //Set Attachment File Path and Type and Verify
+ ConvergedMessageAttachment msgAttachment;
+ msgAttachment.setFilePath(QString(TEST_ATTACHMENT));
+ QCOMPARE(msgAttachment.filePath(), QString(TEST_ATTACHMENT));
+ msgAttachment.setAttachmentType(ConvergedMessageAttachment::EAttachment);
+ QVERIFY(msgAttachment.attachmentType() == ConvergedMessageAttachment::EAttachment);
+
+ //Second Copy with same Contents
+ ConvergedMessageAttachment msgAttachmentCopy;
+ msgAttachmentCopy.setFilePath(QString(TEST_ATTACHMENT));
+ msgAttachmentCopy.setAttachmentType(ConvergedMessageAttachment::EAttachment);
+
+ //Verify if they are same
+ QVERIFY(msgAttachmentCopy == msgAttachment);
+}
+
+//---------------------------------------------------------------
+// TestConvergedMessageUtils::cleanup
+//---------------------------------------------------------------
+void TestConvergedMessageUtils::cleanup()
+{
+}
+
+//---------------------------------------------------------------
+// TestConvergedMessageUtils::cleanupTestCase
+//---------------------------------------------------------------
+void TestConvergedMessageUtils::cleanupTestCase()
+{
+ //Cleanup
+ mmstestbed->cleanAll();//Clean All messages from varios Folders
+ delete spy_draft;//Signal for Draft Folder
+ delete msgPlugin;//MMS Plugin
+ delete mmstestbed;//MMS Testbed
+}
+
+//---------------------------------------------------------------
+// getObject
+// factory method to create objects.
+//---------------------------------------------------------------
+QObject* getObject(QString className)
+{
+ if(className == "TestConvergedMessageUtils" )
+ {
+ return new TestConvergedMessageUtils;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+//---------------------------------------------------------------
+// createOutPutDirectory
+// creating o/p directory.
+//---------------------------------------------------------------
+void createOutPutDirectory()
+ {
+ QDir dir;
+ //o/p dir
+ dir.mkdir(OUTPUTDIRECTORY);
+ //tmp dir
+ dir.mkdir(TEMPDIR);
+ // dir inside private folder.
+ dir.mkdir(PRIVATE_DIR);
+ }
+
+//---------------------------------------------------------------
+// main
+// main entry point
+//---------------------------------------------------------------
+int main(int argc, char *argv[])
+ {
+ int ret = -1;
+ QCoreApplication app(argc, argv);
+
+ //creating output directory.
+ createOutPutDirectory();
+
+ QStringList args;
+ QString appName = argv[0];
+ args << appName;
+
+ QString option = "-o";
+ args << option;
+
+ QString outFile = RESULTFILE;
+ outFile = outFile.arg(appClassName);
+ args << outFile;
+
+ QObject* tc = getObject(appClassName);
+
+ if(tc)
+ {
+ ret = QTest::qExec(tc, args);
+ delete tc;
+ }
+ return ret;
+ }
+
+//End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/testconvergedmessageutils/testconvergedmessageutils.pro Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,134 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: Test Case Project Definition for ConvergedMessageUtils
+#
+
+QT += testlib
+QT -= gui
+
+CONFIG += hb
+CONFIG += symbian_test
+CONFIG += qtestlib
+
+TEMPLATE = app
+TARGET = testconvergedmessageutils
+
+INCLUDEPATH += ./inc
+INCLUDEPATH += ../../../inc
+INCLUDEPATH += ../mmstestbed/inc
+INCLUDEPATH += ../../../../../../inc
+INCLUDEPATH += ../../../../unidatautils/unidatamodel/inc
+INCLUDEPATH += ../../../../../../../../mw/hb/include/hbcore
+INCLUDEPATH += ../../../../unieditorutils/editorgenutils/inc
+INCLUDEPATH += ../../../../unieditorutils/unieditorplugins/unieditormmsplugin/inc
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+DEFINES += BUILD_TEST_DLL
+
+SYMBIAN_PLATFORMS = WINSCW ARMV5
+
+SOURCES += \
+ ./src/testconvergedmessageutils.cpp \
+ ../../../../unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin.cpp \
+ ../../../../unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin_p.cpp
+
+# Input
+HEADERS += \
+ ./inc/testconvergedmessageutils.h \
+ ../../../../unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin.h \
+ ../../../../unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin_p.h
+
+SYMBIAN_PLATFORMS = WINSCW ARMV5
+ symbian {
+ TARGET.UID3 = 0xE39cd515
+ TARGET.CAPABILITY = All -TCB -DRM
+ TARGET.EPOCSTACKSIZE = 0x8000
+ TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
+ VENDORID = VID_DEFAULT
+ BLD_INF_RULES.prj_exports += "data/TestConvergedMessageUtilsSample.txt c:/data/TestConvergedMessageUtilsSample.txt"
+ }
+
+LIBS += -leuser \
+ -lconvergedmessageutils \
+ -lMsgMedia \
+ -leditorgenutils \
+ -lcone \
+ -leikcoctl \
+ -leikcore \
+ -leikdlg \
+ -lmsgs \
+ -letext \
+ -lgsmu \
+ -lmmsgenutils \
+ -lefsrv \
+ -lestor \
+ -lsmcm \
+ -lCommonEngine \
+ -lbafl \
+ -lCdlEngine \
+ -lFeatMgr \
+ -lapmime \
+ -lapgrfx \
+ -lcharconv \
+ -lInetProtUtil \
+ -lsmildtd \
+ -lxmldom \
+ -lxmlparser \
+ -lcone \
+ -lQtCore \
+ -letel \
+ -lcommdb \
+ -lcommsdat \
+ -letelmm \
+ -lunidatamodelloader \
+ -lunidatamodel \
+ -lavkon \
+ -leikcoctl \
+ -leikctl \
+ -lform \
+ -luiklaf\
+ -lmmstestbed \
+ -lmmsmessage \
+ -lmmsserversettings \
+ -lxqutils \
+ -lQtContacts
+
+packageheader = "$${LITERAL_HASH}{\"TestConvergedMessageUtils\"},(0xE39cd515),1,0,0,TYPE=SA"
+
+vendorinfo = \
+ "; Localised Vendor name" \
+ "%{\"Nokia\"}" \
+ "; Unique Vendor name" \
+ ":\"Nokia\""
+
+dependencyinfo = \
+ "; Default HW/platform dependencies" \
+ "[0x101F7961],0,0,0,{\"S60ProductID\"}" \
+ "[0x2001E61C],4,6,3,{"Qt"}
+
+default_deployment.pkg_prerules = packageheader \
+ vendorinfo \
+ dependencyinfo
+
+#Copy the dependent DLL
+symbian: {
+ addDll.sources = mmstestbed.dll
+ addDll.path = /sys/bin
+ DEPLOYMENT += addDll
+
+ addFile1.sources = ./data/TestConvergedMessageUtilsSample.txt
+ addFile1.path = C:/data/
+ DEPLOYMENT += addFile1
+ }
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/testconvergedmessageutilsapp.pro Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,22 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: Project Definiton File for testconvergedmessageutilsapp
+#
+
+TEMPLATE = subdirs
+
+SUBDIRS += mmstestbed/mmstestbed.pro
+SUBDIRS += testconvergedmessageutils/testconvergedmessageutils.pro
+
+CONFIG += ordered
\ No newline at end of file
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/tsrc.pro Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/tsrc.pro Sun Jul 25 18:59:19 2010 +0530
@@ -11,12 +11,11 @@
#
# Contributors:
#
-# Description: Project Definiton File for both MMSTestBed and TestConvergedMessageUtils
+# Description: Project Definiton File for testconvergedmessageutilsapp
#
TEMPLATE = subdirs
-SUBDIRS += mmstestbed/mmstestbed.pro
-SUBDIRS += testconvergedmessageutils/testconvergedmessageutils.pro
+SUBDIRS += testconvergedmessageutilsapp/testconvergedmessageutilsapp.pro
CONFIG += ordered
\ No newline at end of file
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/inc/unibiomessagedataplugin_p.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/inc/unibiomessagedataplugin_p.h Sun Jul 25 18:59:19 2010 +0530
@@ -19,6 +19,7 @@
#define UNIBIOMESSAGEDATAPLUGINPRIVATE_H_
#include "unidatamodelplugininterface.h"
+#include <e32base.h>
//Forward Declarations
class CClientMtmRegistry;
@@ -30,7 +31,7 @@
/**
* Symbian specific implementation of the uni SMS plugin
*/
-class UniBioMessageDataPluginPrivate : public MMsvSessionObserver
+class UniBioMessageDataPluginPrivate : public CBase, public MMsvSessionObserver
{
public:
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/src/unibiomessagedataplugin.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/src/unibiomessagedataplugin.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -30,7 +30,7 @@
UniBioMessageDataPlugin::UniBioMessageDataPlugin(QObject* parent) :
QObject(parent)
{
- d_ptr = new UniBioMessageDataPluginPrivate(this);
+ QT_TRAP_THROWING(d_ptr = new UniBioMessageDataPluginPrivate(this));
}
// UniBioMessageDataPlugin::~UniBioMessageDataPlugin()
@@ -120,7 +120,8 @@
//---------------------------------------------------------------
UniMessageInfoList UniBioMessageDataPlugin::attachmentList()
{
- RFile file = d_ptr->attachmentL();
+ RFile file;
+ QT_TRAP_THROWING(file = d_ptr->attachmentL());
if(attachmentCount() == 0)
{
@@ -135,8 +136,8 @@
int size;
TFileName fullName;
- User::LeaveIfError(file.FullName(fullName));
- User::LeaveIfError(file.Size(size));
+ qt_symbian_throwIfError(file.FullName(fullName));
+ qt_symbian_throwIfError(file.Size(size));
path = XQConversions::s60DescToQString(*fullName.AllocL());
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/src/unibiomessagedataplugin_p.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/src/unibiomessagedataplugin_p.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -52,11 +52,11 @@
if(attachmentProcessed == EFalse && iAttachmentCount == 1)
{
- CMsvStore* store = iMsvEntry->EditStoreL();
+ TRAP_IGNORE( CMsvStore* store = iMsvEntry->EditStoreL();
CleanupStack::PushL(store);
MMsvAttachmentManagerSync& attachMan = store->AttachmentManagerExtensionsL();
attachMan.RemoveAttachmentL(0);
- CleanupStack::PopAndDestroy();
+ CleanupStack::PopAndDestroy(););
}
if (iMsvEntry) {
Binary file messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/group/BioMtm.rsc has changed
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/group/TestUniDataModelVCalPlugin.cfg Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-TestUniDataModelVCalPlugin
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/group/TestUniDataModelVCalPlugin.pl Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,182 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-#!/usr/bin/perl -w
-use warnings;
-use strict;
-
-my $TOTALCASES = 0;
-my $TOTALPASSED = 0;
-my $TOTALRUN = 0;
-my $TOTALFAILED = 0;
-my $TOTALSKIPPED = 0;
-
-sub parse_line
-{
- my $line = $_[0];
- my @parts = split (" ", $line);
- my $passed = $parts[1];
- my $failed = $parts[3];
- my $skipped = $parts[5];
-
- my $total = $passed + $failed + $skipped;
- my $passrate = $passed * 100 / $total;
- my $passrateround = sprintf("%.0f",$passrate);
- my $runrate = ($total - $skipped)*100/$total;
- my $runrateround = sprintf("%.0f",$runrate);
-
- $TOTALCASES += $total;
- $TOTALPASSED += $passed;
- $TOTALRUN += ($total - $skipped);
- $TOTALFAILED += $failed;
- $TOTALSKIPPED += $skipped;
-
- printf MYFILE "<td>\n";
- printf MYFILE "$passed\n";
- printf MYFILE "</td>\n";
-
- if($failed > 0)
- {
- printf MYFILE "<td style=\"font-weight:bold;color:red\">\n";
- printf MYFILE "$failed\n";
- printf MYFILE "</td>\n";
- }
- else
- {
- printf MYFILE "<td>\n";
- printf MYFILE "$failed\n";
- printf MYFILE "</td>\n";
- }
-
- printf MYFILE "<td>\n";
- printf MYFILE "$skipped\n";
- printf MYFILE "</td>\n";
-
- printf MYFILE "<td>\n";
- printf MYFILE "$total\n";
- printf MYFILE "</td>\n";
-
- printf MYFILE "<td>\n";
- printf MYFILE ("$passrateround %%\n");
- printf MYFILE "</td>\n";
-
- printf MYFILE "<td>\n";
- printf MYFILE "$runrateround %%\n";
- printf MYFILE "</td>\n";
-
-
-}
-
-sub parse_file
- {
- my $pattern = "Totals";
- my $file = $_[0];
- open (FILE,$file);
-
- while (my $line= <FILE>)
- {
- chomp ($line);
- if ($line =~ m/$pattern/)
- {
- parse_line $line;
- }
- }
- close(FILE);
- }
-
-
-sub generate_report
- {
- open (MYFILE, '>/epoc32/winscw/c/logs/messagingtestsuite/report.html');
- printf MYFILE "<html>\n";
- printf MYFILE "<body>\n";
- printf MYFILE "<head>\n";
- printf MYFILE "<title>MsgApp Test Suite Reports</title>";
- printf MYFILE "</head>\n";
- printf MYFILE "<h2 align = center>Messaging101 Test Suite Report</h2>\n";
- printf MYFILE "<table border = 2 cellpadding = 10 align = center>\n";
- printf MYFILE "<tr style = \" background-color:lavender \">\n";
- printf MYFILE "<th>Module</th>\n";
- printf MYFILE "<th style = color:green>Passed</th>\n";
- printf MYFILE "<th style = color:red>Failed</th>\n";
- printf MYFILE "<th style = color:chocolate>Skipped</th>\n";
- printf MYFILE "<th>Total Cases</th>\n";
- printf MYFILE "<th>Pass Rate</th>\n";
- printf MYFILE "<th>Run Rate</th>\n";
- printf MYFILE "</tr>\n";
-
-
- my @files = </epoc32/winscw/c/logs/messagingtestsuite/*.txt>;
- foreach my $file (@files)
- {
- my @splitedpath = split("/",$file);
- my $filename = $splitedpath[-1];
- my $length = length($filename);
- my $name = substr($filename,11,$length-15);
- printf MYFILE "<tr>\n";
- printf MYFILE "<td>\n";
- printf MYFILE "<a HREF=$filename style = text-decoration:none><b>$name</b></a>\n";
- printf MYFILE "</td>\n";
-
- parse_file $file;
-
- printf MYFILE "</tr>\n";
- }
-
- printf MYFILE "<tr style= \"font-weight:bold; color:white; background-color:gray\">\n";
- printf MYFILE "<td>\n";
- printf MYFILE "<b>Overall</b>\n";
- printf MYFILE "</td>\n";
-
-
- printf MYFILE "<td>\n";
- printf MYFILE "$TOTALPASSED\n";
- printf MYFILE "</td>\n";
-
- printf MYFILE "<td>\n";
- printf MYFILE "$TOTALFAILED\n";
- printf MYFILE "</td>\n";
-
- printf MYFILE "<td>\n";
- printf MYFILE "$TOTALSKIPPED\n";
- printf MYFILE "</td>\n";
-
- printf MYFILE "<td>\n";
- printf MYFILE "$TOTALCASES\n";
- printf MYFILE "</td>\n";
-
- my $passrate = $TOTALPASSED*100/$TOTALCASES;
- my $passrateround = sprintf("%.0f",$passrate);
- printf MYFILE "<td>\n";
- printf MYFILE "$passrateround%%\n";
- printf MYFILE "</td>\n";
-
- my $runrate = ($TOTALCASES - $TOTALSKIPPED)*100/$TOTALCASES;
- my $runrateround = sprintf("%.0f",$runrate);
- printf MYFILE "<td>\n";
- printf MYFILE "$runrateround%%\n";
- printf MYFILE "</td>\n";
-
- printf MYFILE "</tr>\n";
-
- printf MYFILE "</table>\n";
- printf MYFILE "</body>\n";
- printf MYFILE "</html>\n";
-
- close (MYFILE);
- }
-
-
-generate_report;
\ No newline at end of file
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/group/testunidatamodelvcalplugin.pro Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-QT += testlib
-QT -= gui
-
-TEMPLATE = app
-TARGET = test-unidatamodel-vcal-plugin
-
-
-INCLUDEPATH += .
-INCLUDEPATH += ../../../../../../inc
-INCLUDEPATH += ../../../../../../../inc
-#INCLUDEPATH += ../../../../../s60qconversions/inc
-INCLUDEPATH += ../../../../../../../../../../epoc32/include/platform/mw
-INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
-
-DEFINES += BUILD_TEST_DLL
-
-SOURCES += \
- ../src/testunidatamodelvcalplugin.cpp
-
-
-# Input
-HEADERS += \
- ../inc/testunidatamodelvcalplugin.h
-
-
-
-SYMBIAN_PLATFORMS = WINSCW ARMV5
- symbian {
- TARGET.CAPABILITY = CAP_GENERAL_DLL
- TARGET.EPOCSTACKSIZE = 0x8000
- TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
- TARGET.EPOCALLOWDLLDATA = 1
- BLD_INF_RULES.prj_exports += "vcal1.txt /epoc32/winscw/c/test/vcal1.txt"
- BLD_INF_RULES.prj_exports += "BioMtm.rsc /epoc32/winscw/c/resource/messaging/mtm/BioMtm.rsc"
- BLD_INF_RULES.prj_exports += "TestUniDataModelVCalPlugin.cfg c:/TestUniDataModelVCalPlugin.cfg"
- BLD_INF_RULES.prj_exports += "TestUniDataModelVCalPlugin.pl c:/TestUniDataModelVCalPlugin.pl"
-
- }
-
- LIBS += -leuser \
- -lconvergedmessageutils\
- -lmsgs \
- -lsmcm \
- -lgsmu \
- -letext \
- -lmsgs \
- -lunidatamodelloader\
- -lQtCore \
- -lbioc \
- -lefsrv \
- -lbiodb \
- -lxqutils \
- -lbifu
-
-
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/group/vcal1.txt Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-BEGIN:VCALENDAR
-PRODID:-//Microsoft Corporation//Outlook 9.0 MIMEDIR//EN
-VERSION:1.0
-BEGIN:VEVENT
-DTSTART:20000322T080000Z
-DTEND:20000322T083000Z
-LOCATION;ENCODING=QUOTED-PRINTABLE:Somewhere
-UID:040000008200E00074C5B7101A82E0080000000090BB8A23ED93BF010000000000000000100
- 00000AB7E96B01EFFD31192E70060084F0B48
-DESCRIPTION;ENCODING=QUOTED-PRINTABLE:=09You will be busy doing something, =
-somewhere at some point.=0D=0A
-SUMMARY;ENCODING=QUOTED-PRINTABLE:My big appointment
-PRIORITY:3
-END:VEVENT
-END:VCALENDAR
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/inc/testunidatamodelvcalplugin.h Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#ifndef TEST_UNI_DATA_MODEL_VCAL_PLUGIN_H
-#define TEST_UNI_DATA_MODEL_VCAL_PLUGIN_H
-
-#ifdef BUILD_TEST_DLL
-#define TEST_EXPORT Q_DECL_EXPORT
-#else
-#define TEST_EXPORT Q_DECL_IMPORT
-#endif
-
-#include <QObject>
-#include <txtetext.h>
-#include <txtrich.h>
-#include <mtclreg.h>
-#include <mtclbase.h>
-#include <msvids.h>
-#include <smsclnt.h>
-#include <smuthdr.h>
-#include <QDateTime>
-#include <e32math.h>
-
-
-#include <bsp.h>
-
-const TInt32 KUidBIOVCalenderMsg = {0x10005533}; // VCalender diary
-
-class UniDataModelPluginInterface;
-class UniDataModelLoader;
-class MsgObserver;
-class S60QConversions;
-class ConvergedMessage;
-class CBIODatabase;
-class ConvergedMessgageAddress;
-
-typedef enum
- { // GENERATE A MESSAGE USING....
- ENoMessage, // .. error cases
- EBioIapSettingsMessage, // .. IAP grammar, includes Internet settings
- // Email settings, and logon scripts,
- EBioEnpMessage, // .. Email Notification grammar.
- EBioRingTonesMessage, // .. Ringing Tones binary data
- EBioOpLogoMessage, // .. Logo for Operator service
- EBioCompBusCardMessage, // .. Compact Business Card data
- EBiovCardMessage, // .. virtual business card data
- EBiovCalenderMessage, // .. vCalender data
- EBioWAPSettingsMessage, // .. wap settings
- EBioWPRVSettingsMessage // .. wprv settings
- } TBIOMessageType;
-
-
-class TEST_EXPORT TestUniDataModelVCalPlugin : public QObject
-{
-Q_OBJECT
-
-private slots:
- //called by frame work.
- void initTestCase();//called before the first testfunction is executed.
- void init();//called before each testfunction is executed.
-
- //test cases.
- void testInBoxVCalMessage();
- void testDraftsVCalMessage();
- void testUnusedAPIs();
- void cleanup();//called after every testfunction.
- void cleanupTestCase();//called after the last testfunction was executed.
-
-private:
-
- TMsvId CreateBIOEntryL(TDesC& aText, TBIOMessageType aMessageType);
- void CreateBioEntryClientSideL(TMsvEntry& aEntry, CRichText& aBody);
- HBufC* ReadFromFileL(const TDesC& aFile);
- void SetSessionPath(const TDesC& aSessionPath);
- TMsvId CreateBIOEntryFromFileL(const TDesC& aFilename,
- TBIOMessageType aMessageType);
- TBIOMessageType SetMessageType(const TDesC& aFileName);
- CMsvEntrySelection* GenerateMessagesL();
- TMsvId SetBIOServiceIdL();
- void SetForMtmTypeL(TMsvEntry& aEntry, TBIOMessageType aType);
-
-private:
-
- UniDataModelPluginInterface* pluginInterface;
- MsgObserver* iObserver;
- CMsvSession* iMSession;
- CClientMtmRegistry* iMtmReg;
- TMsvId messageId;
- UniDataModelLoader* pluginLoader;
- QDateTime retTimeStamp;
- RFs iFs;
- CDir* iDir;
- TInt iFilesProcessed;
- CMsvEntry* iMsvEntry;
- CBIODatabase* iBioDb;
- TMsvId newEntryId;
- HBufC* tempNumber;
- TBufC<KMaxFileName> currentFile;
- TBool inbox;
- TBool drafts;
-};
-
-class MsgObserver : public MMsvSessionObserver
-{
-public:
- void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2,
- TAny* aArg3);
-};
-
-#endif //TEST_UNI_DATA_MODEL_VCAL_PLUGIN_H
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/inc/testunidatamodelvcalplugin.ini Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-//this file is used to provide predefined set of input data.
-
-//eg.
-const char TEST_MSG_RECIEPIENT[] = "Shweta Singh<77>";
-const char TEST_MSG_FROM1[] = "88";
-const char TEST_MSG_ALIAS1[] = "Shweta Singh";
-const char TEST_MSG_FROM2[] = "999";
-const char TEST_MSG_SUBJECT[] = "Hi";
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/src/testunidatamodelvcalplugin.cpp Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,682 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-#include <QtTest/QtTest>
-#include <QtDebug>
-#include <QTimer>
-#include <QSignalSpy>
-#include <xqconversions.h>
-#include <bsp.h>
-#include <biodb.h>
-#include <biouids.h>
-#include <biocmtm.h>
-#include "convergedmessageaddress.h"
-
-#include "testunidatamodelvcalplugin.h"
-#include <unidatamodelloader.h>
-#include "testunidatamodelvcalplugin.ini"
-#include "unidatamodelplugininterface.h"
-#include <convergedmessage.h>
-
-const TInt KTelephoneNumberMaxLength = 32;
-_LIT(KBIOTxtFilePath, "C:\\test\\");
-_LIT(KBIOvCalenderPrefix, "vcal*");
-// vCalender
-_LIT(KUnixEpoch, "19700000:000000.000000");
-#define KBioUidValue 0x10001262
-
-const TUid KBioUidValueUid =
-{KBioUidValue};
-
-
-
-
-//out put directory for test results.
-QString OUTPUTDIRECTORY = "c:/logs/TestUniDataModelVCalPlugin";
-//o/p directory for data to be written on temp file.
-QString TEMPDIR = "c:/logs/TestUniDataModelVCalPlugin/testdata";
-//test result O/P file name.
-QString RESULTFILE = "c:/logs/TestUniDataModelVCalPlugin/result_%1.txt";
-// folder named UID3 of TestUniDataModelVCalPlugin inside private folder.
-const QString PRIVATE_DIR("C:/private/Ed034a47");
-
-//factory method to create objects.
-QObject* getObject(QString className)
-{
- if(className == "TestUniDataModelVCalPlugin" )
- {
- return new TestUniDataModelVCalPlugin;
- }
- else
- {
- return 0;
- }
-}
-
-//creating o/p directory.
-void createOutPutDirectory()
- {
- QDir dir;
- //o/p dir
- dir.mkdir(OUTPUTDIRECTORY);
- //tmp dir
- dir.mkdir(TEMPDIR);
- // dir inside private folder.
- dir.mkdir(PRIVATE_DIR);
- }
-
-//main entry point
-int main(int argc, char *argv[])
- {
- int ret = -1;
- QCoreApplication app(argc, argv);
-
- //creating output directory.
- createOutPutDirectory();
-
- //the configuration file.
- QFile data("c:/TestUniDataModelVCalPlugin.cfg");
-
- if (data.open(QFile::ReadOnly))
- {
- QTextStream in(&data);
- while(!in.atEnd())
- {
- QStringList args;
- QString appName = argv[0];
- args << appName;
-
- QString option = "-o";
- args << option;
-
- QString outFile = RESULTFILE;
- QString name = in.readLine();
- outFile = outFile.arg(name);
- args << outFile;
-
- QObject* tc = getObject(name);
-
- if(tc)
- {
-
- ret = QTest::qExec(tc, args);
- delete tc;
- }
- }
- }
- data.close();
- return ret;
- }
-
-
-
-
-
-//---------------------------------------------------------------
-// TestUniDataModelVCalPlugin::init
-//---------------------------------------------------------------
-
-
-void TestUniDataModelVCalPlugin::initTestCase()
-{
- iObserver = new (ELeave) MsgObserver();
-
- // Create a new messaging server session..
- iMSession = CMsvSession::OpenSyncL(*iObserver);
-
- iMsvEntry = iMSession->GetEntryL(KMsvRootIndexEntryId);
- newEntryId = 0;
- pluginLoader = new UniDataModelLoader();
-
- retTimeStamp = QDateTime::currentDateTime();
- int err = iFs.Connect();
- QVERIFY(err == 0);
- iBioDb = CBIODatabase::NewL(iFs);
- iFs.SetSessionPath(_L("c:\\"));
- inbox = EFalse;
- drafts = EFalse;
-}
-void TestUniDataModelVCalPlugin::cleanupTestCase()
-{
- delete iMsvEntry;
- iMsvEntry = NULL;
- delete iObserver;
- iObserver = NULL;
- delete iMSession;
- iMSession = NULL;
- delete pluginLoader;
-}
-
-void TestUniDataModelVCalPlugin::init()
-{
-
-}
-
-//---------------------------------------------------------------
-// TestUniDataModelVCalPlugin::cleanup
-//---------------------------------------------------------------
-void TestUniDataModelVCalPlugin::cleanup()
-{
-
-
-}
-
-void TestUniDataModelVCalPlugin::testInBoxVCalMessage()
-{
- inbox = ETrue;
- GenerateMessagesL();
-
- pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::BioMsg);
- pluginInterface->setMessageId(newEntryId);
-
- int count = pluginInterface->attachmentCount();
- QVERIFY(count == 1);
-
- UniMessageInfoList attachmentlist = pluginInterface->attachmentList();
- QVERIFY(!attachmentlist.isEmpty());
-
- UniMessageInfo* att = attachmentlist.at(0);
- QString path = att->path();
-
- QString recepient(TEST_MSG_FROM1);
- QString fromaddress;
- pluginInterface->fromAddress(fromaddress);
- QVERIFY(recepient == fromaddress);
-
- QString body;
- pluginInterface->body(body);
- QVERIFY(!body.isEmpty());
-
- // Compare input message , with the read message
- RFile origFile;
- int op = origFile.Open(iFs, currentFile, EFileRead);
- QVERIFY(op == 0);
-
- TBuf8<1000> readBuf;
- HBufC* readBuf16 = HBufC::NewL(2000);
-
- origFile.Read(readBuf);
- readBuf16->Des().Copy(readBuf);
-
- QString orig = XQConversions::s60DescToQString(*readBuf16);
- origFile.Close();
-
- HBufC* filepath = XQConversions::qStringToS60Desc(path);
-
- int size = pluginInterface->messageSize();
-
- MsgPriority priority = pluginInterface->messagePriority();
- // Normal priority
- qDebug() << "prority" << priority;
- QVERIFY(priority == 1);
-
- QVERIFY(pluginInterface->timeStamp() == retTimeStamp);
-
- ConvergedMessageAddressList recipientList;
- pluginInterface->toRecipientList(recipientList);
- QVERIFY(recipientList.count() == 0);
- qDebug() << "recipientList.count" << recipientList.count();
-
- if (inbox)
- {
- iMsvEntry->SetEntryL(KMsvGlobalInBoxIndexEntryId);
- qDebug() << "SetEntry" ;
- }
-
-
-}
-
-void TestUniDataModelVCalPlugin::testDraftsVCalMessage()
-{
- drafts = ETrue;
- GenerateMessagesL();
-
- pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::BioMsg);
- pluginInterface->setMessageId(newEntryId);
-
- int count = pluginInterface->attachmentCount();
- QVERIFY(count == 1);
-
- UniMessageInfoList attachmentlist = pluginInterface->attachmentList();
- QVERIFY(!attachmentlist.isEmpty());
-
- UniMessageInfo* att = attachmentlist.at(0);
- QString path = att->path();
-
- QString fromaddress;
- pluginInterface->fromAddress(fromaddress);
- QVERIFY(!fromaddress.isEmpty()); //added ! shweta
-
- QString body;
- pluginInterface->body(body);
- QVERIFY(!body.isEmpty());
-
- // Compare input message , with the read message
- RFile origFile;
- int op = origFile.Open(iFs, currentFile, EFileRead);
- QVERIFY(op == 0);
-
- TBuf8<1000> readBuf;
- HBufC* readBuf16 = HBufC::NewL(2000);
-
- origFile.Read(readBuf);
- readBuf16->Des().Copy(readBuf);
-
- QString orig = XQConversions::s60DescToQString(*readBuf16);
- origFile.Close();
-
- int size = pluginInterface->messageSize();
-
- MsgPriority priority = pluginInterface->messagePriority();
- // Normal priority
- qDebug() << "prority" << priority;
- QVERIFY(priority == 1);
-
- QVERIFY(pluginInterface->timeStamp() == retTimeStamp);
-
- QString recepient(TEST_MSG_FROM1);
- ConvergedMessageAddressList recipientList;
- ConvergedMessageAddress alias(recepient);
-
- recipientList.append(&alias);
- pluginInterface->toRecipientList(recipientList);
-
- QVERIFY( recipientList.count() != 0 );
- qDebug() << "recipientList.count()"<<recipientList.count() ;
-
- const QString& copy = recipientList[0]->address();
- qDebug() << "copy = "<<recipientList[0]->address();
- QVERIFY(recepient == copy);
- qDebug() << "Receipient Verified";
-
- if (drafts)
- {
- iMsvEntry->SetEntryL(KMsvDraftEntryId);
- qDebug() << "SetEntry" ;
- }
- }
-
-
-
-void TestUniDataModelVCalPlugin::testUnusedAPIs()
-{
- pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::BioMsg);
-
- QVERIFY(pluginInterface->objectCount() == 0);
-
- UniMessageInfoList objectlist = pluginInterface->objectList();
- QVERIFY(objectlist.isEmpty());
-
- QVERIFY(pluginInterface->slideCount() == 0);
-
- UniMessageInfoList slidelist = pluginInterface->slideContent(0);
- QVERIFY(slidelist.isEmpty());
-
- QVERIFY(pluginInterface->hasAttachment() == true );
-
- ConvergedMessageAddressList recipientList;
-
- pluginInterface->ccRecipientList(recipientList);
- QVERIFY(recipientList.count() == 0);
-
- pluginInterface->bccRecipientList(recipientList);
- QVERIFY(recipientList.count() == 0);
-}
-
-CMsvEntrySelection* TestUniDataModelVCalPlugin::GenerateMessagesL()
-{
- HBufC* aFileDirectory = KBIOTxtFilePath().AllocL();
- TMsvId messageId;
- TBIOMessageType currentMsgType;
-
- CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection();
- CleanupStack::PushL(selection);
-
- TInt err = iFs.GetDir(aFileDirectory->Des(),
- KEntryAttMatchMask,
- ESortByName,
- iDir);
- if (err == KErrPathNotFound)
- {
- TInt makeDirErr = iFs.MkDirAll(aFileDirectory->Des());
- makeDirErr == KErrNone ? User::Leave(KErrNotFound)
- : User::Leave(makeDirErr);
- }
- else if (err != KErrNone)
- {
- User::Leave(err);
- }
-
- // Set the session path for the RFs
- SetSessionPath(aFileDirectory->Des());
- if (iDir)
- {
- delete iDir;
- iDir = NULL;
- }
-
- User::LeaveIfError(iFs.GetDir(_L("*.txt"), KEntryAttNormal, ESortByName, iDir));
- TInt count = iDir->Count();
- if (count == 0)
- {
- User::Leave(KErrNotFound); // No files to process
- }
-
- TBuf<60> outputBuf;
-
- for (TInt loop = 0; loop < count; loop++)
- {
- TEntry as = (*iDir)[0];
- currentFile = (as.iName);
- // Not processed all the messages - so keep the current state
- iFilesProcessed++; // Here because need to update the counter promptly
- currentMsgType = SetMessageType(currentFile);
- if (currentMsgType != ENoMessage) // skip any dodgy filenames
- {
- messageId = CreateBIOEntryFromFileL(currentFile, currentMsgType);
- selection->AppendL(messageId);
- TPtrC tempPtr = (currentFile.Des());
-
- }
- }
- CleanupStack::Pop(); // selection
-
- return selection;
-}
-
-TBIOMessageType TestUniDataModelVCalPlugin::SetMessageType(
- const TDesC& aFileName)
-{
-
- if (aFileName.MatchF(KBIOvCalenderPrefix) == 0)
- {
- return EBiovCalenderMessage;
- }
-
- return ENoMessage;
-}
-
-TMsvId TestUniDataModelVCalPlugin::CreateBIOEntryFromFileL(
- const TDesC& aFilename,
- TBIOMessageType aMessageType)
-{
- //First use the filename to get the message body,
- // then convert '\n' to the paragraph delimiters used in proper SMS
- HBufC* tempBuffer;
-
- tempBuffer = ReadFromFileL(aFilename);
- CleanupStack::PushL(tempBuffer);
-
- newEntryId = CreateBIOEntryL(*tempBuffer, aMessageType);
-
- // Finished with our local descriptors - free up some memory
- CleanupStack::PopAndDestroy();
-
- return newEntryId;
-}
-
-void TestUniDataModelVCalPlugin::SetSessionPath(const TDesC& aSessionPath)
-{
- iFs.SetSessionPath(aSessionPath);
-}
-
-HBufC* TestUniDataModelVCalPlugin::ReadFromFileL(const TDesC& aFile)
-{
- RFile file;
- TBuf8<1024> lineBuffer;
- TInt err = KErrNone;
-
- err = file.Open(iFs, aFile, EFileStreamText | EFileRead | EFileShareAny);
-
- if (err != KErrNone) // Didn't find the file, so leave - should only get valid filenames!
- {
- User::Leave(KErrNotFound);
- }
-
- HBufC* bioBuf = HBufC::NewLC(65535); // Create a new descriptor on the heap.
- HBufC* copyBuffer = HBufC::NewLC(1024);
-
- do // Read in the text from file, and also check if there is a name field:
- {
- err = file.Read(lineBuffer);// Read upto 256 chars, '\n' and all...
- //err = ReadLineL(file,lineBuffer);
- if (err == KErrNone) // Made a valid read,
- if (lineBuffer.Length() == 0) // but read 0 chars
- err = KErrEof; // so set err value to end processing
-
- if (err == KErrNone)
- {
- copyBuffer->Des().Copy(lineBuffer);// Copy, and overwrite existing text
- if ( (bioBuf->Length() + copyBuffer->Length())
- > bioBuf->Des().MaxLength())
- {
- bioBuf = bioBuf->ReAllocL(bioBuf->Length()
- + copyBuffer->Length());
- }
- bioBuf->Des().Append(*copyBuffer);
- //bioBuf->Des().Append(_L("\n"));
- }
- }while (err != KErrEof);
-
- CleanupStack::PopAndDestroy(); // Destroy the copyBuffer.
- CleanupStack::Pop();// Remove the bioBuf.
-
- file.Close();
- return bioBuf;
-}
-
-TMsvId TestUniDataModelVCalPlugin::CreateBIOEntryL(TDesC& aText,
- TBIOMessageType aMessageType)
-{
- // Ensure that we have a valid service ID to work with:
- TMsvId iBioServiceId;
-
- iBioServiceId = SetBIOServiceIdL();
-
- HBufC* localBuffer = aText.AllocL();
- CleanupStack::PushL(localBuffer);
-
- TPtr messDes = localBuffer->Des();
-
- if (aMessageType != EBiovCardMessage && aMessageType
- != EBiovCalenderMessage)
- {
- // convert \r\n to \n since this is what is expected from SMS when not vCard data
- for (TInt i = 0; i < messDes.Length(); i++)
- {
- if (messDes[i] == (TText) '\r' && i < messDes.Length() - 1
- && messDes[i + 1] == (TText) '\n')
- messDes.Delete(i, 1);
- }
- }
-
- // Create and fill a CRichText object for the jobbie:
- CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL();
- CleanupStack::PushL(paraFormatLayer);
- CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL();
- CleanupStack::PushL(charFormatLayer);
- CRichText* richText = CRichText::NewL(paraFormatLayer, charFormatLayer);
- CleanupStack::PushL(richText);
-
- TInt pos = richText->DocumentLength();
- richText->InsertL(pos, messDes);
-
- TMsvEntry newBioEntry;
- newBioEntry.SetNew(ETrue);
- newBioEntry.SetComplete(EFalse);
- newBioEntry.SetUnread(ETrue);
- newBioEntry.SetVisible(ETrue);
- newBioEntry.SetReadOnly(EFalse);
- newBioEntry.SetFailed(EFalse);
- newBioEntry.SetOperation(EFalse);
- newBioEntry.SetMultipleRecipients(EFalse);
- newBioEntry.SetAttachment(EFalse);
- newBioEntry.iMtm = KUidBIOMessageTypeMtm;
- newBioEntry.iType = KUidMsvMessageEntry;
- newBioEntry.iServiceId = iBioServiceId;
- TTime now;
- now.UniversalTime();
- newBioEntry.iDate = now;
-
- TTime unixEpoch(KUnixEpoch);
- TTimeIntervalSeconds seconds;
- TTime timeStamp = newBioEntry.iDate;
- timeStamp.SecondsFrom(unixEpoch, seconds);
- retTimeStamp.setTime_t(seconds.Int());
-
- newBioEntry.iDescription.Set(richText->Read(0, richText->DocumentLength()));
- TBufC<KTelephoneNumberMaxLength> telNumber;
-
- QString recepient(TEST_MSG_FROM1);
- tempNumber = XQConversions::qStringToS60Desc(recepient);
-
- telNumber = tempNumber->Des();
- newBioEntry.iDetails.Set(telNumber);
-
- SetForMtmTypeL(newBioEntry, aMessageType);
-
- newBioEntry.iSize = richText->DocumentLength();// msgSize;
- CreateBioEntryClientSideL(newBioEntry, *richText);
-
- CleanupStack::PopAndDestroy(4); // richText, charFormatLayer, paraFormatLayer, localBuffer
- return newBioEntry.Id();
-}
-
-void TestUniDataModelVCalPlugin::CreateBioEntryClientSideL(TMsvEntry& aEntry,
- CRichText& aBody)
-{
- if (inbox)
- {
- iMsvEntry->SetEntryL(KMsvGlobalInBoxIndexEntryId);
- }
- else if (drafts)
- {
- iMsvEntry->SetEntryL(KMsvDraftEntryId);
- }
- // Get the global inbox.
-
- iMsvEntry->CreateL(aEntry);
- iMsvEntry->SetEntryL(aEntry.Id());
-
- // Save all the changes
- CMsvStore* store = iMsvEntry->EditStoreL();
- CleanupStack::PushL(store);
-
- if (store->HasBodyTextL())
- {
- store->DeleteBodyTextL();
- }
-
- CPlainText* pText = CPlainText::NewL();
- CleanupStack::PushL(pText);
-
- if (inbox)
- {
- CSmsHeader* smsHeader = CSmsHeader::NewL(CSmsPDU::ESmsDeliver, *pText);
- CleanupStack::PushL(smsHeader);
- smsHeader->SetFromAddressL(*tempNumber);
- smsHeader->StoreL(*store);
-
- }
- else if (drafts)
- {
-
- QString recepient(TEST_MSG_FROM1);
- QString recepient2(TEST_MSG_FROM2);
- QString alias(TEST_MSG_ALIAS1);
-
- HBufC* addr = XQConversions::qStringToS60Desc(recepient);
- HBufC* addr2 = XQConversions::qStringToS60Desc(recepient2);
- HBufC* alias1 = XQConversions::qStringToS60Desc(alias);
-
- CSmsHeader* smsHeader = CSmsHeader::NewL(CSmsPDU::ESmsSubmit, *pText);
- CleanupStack::PushL(smsHeader);
-
- CSmsNumber* number1 = CSmsNumber::NewL(); // create the instance
- CleanupStack::PushL(number1);
-
- number1->SetNameL(TPtrC());
- number1->SetAddressL(*addr);
- smsHeader->Recipients().AppendL(number1);
- CleanupStack::Pop(number1);
-
- CSmsNumber* number2 = CSmsNumber::NewL();
- CleanupStack::PushL(number2);
-
- number2->SetNameL(*alias1);
- number2->SetAddressL(*addr2);
-
- smsHeader->Recipients().AppendL(number2);
- CleanupStack::Pop(number2);
- smsHeader->StoreL(*store);
-
- }
-
- store->StoreBodyTextL(aBody);
- store->CommitL();
-
- CleanupStack::PopAndDestroy(3); //store - close the store
-
- aEntry.SetComplete(ETrue);
- // Update the entry
- iMsvEntry->ChangeL(aEntry);
- iMsvEntry->SetEntryL(KMsvRootIndexEntryId);
-}
-
-TMsvId TestUniDataModelVCalPlugin::SetBIOServiceIdL()
-{
- // Haven't found an entry so create a BIO Message service:
- TMsvEntry bioServiceEntry;
- bioServiceEntry.iMtm = KUidBIOMessageTypeMtm;
- bioServiceEntry.iType = KUidMsvServiceEntry;
- bioServiceEntry.SetVisible(EFalse);
- bioServiceEntry.iDate.UniversalTime();
- bioServiceEntry.iDescription.Set(_L("BIO Message Service ")); // Is there such a thing?
- bioServiceEntry.iDetails.Set(_L("BIO Message Service"));
-
- TMsvId newBIOServiceId;
-
- iMsvEntry->SetEntryL(KMsvRootIndexEntryId);
- iMsvEntry->CreateL(bioServiceEntry); // Needs to be a child of the root!
- newBIOServiceId = bioServiceEntry.Id();
-
- return newBIOServiceId;
-}
-
-void TestUniDataModelVCalPlugin::SetForMtmTypeL(TMsvEntry& aEntry,
- TBIOMessageType aType)
-{
- TInt index;
-
- aEntry.iBioType = KUidBIOVCalenderMsg;
-
- // Set other TMsvEntry fields if we have a BIO message type
- if (aType != ENoMessage)
- {
- aEntry.SetMtmData2(0);
- aEntry.SetMtmData3(0);
- }
-
- // set description from BIF file
- iBioDb->GetBioIndexWithMsgIDL(TUid::Uid(aEntry.iBioType), index);
- if (index == KErrNotFound)
- User::Leave(KErrNotFound);
- aEntry.iDescription.Set(iBioDb->BifReader(index).Description());
-}
-
-void MsgObserver::HandleSessionEventL(TMsvSessionEvent /*aEvent*/,
- TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/)
-{
-}
Binary file messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/BioMtm.rsc has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/data/TestUniDataModelVCalPlugin.cfg Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,1 @@
+TestUniDataModelVCalPlugin
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/data/TestUniDataModelVCalPlugin.pl Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,182 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+#!/usr/bin/perl -w
+use warnings;
+use strict;
+
+my $TOTALCASES = 0;
+my $TOTALPASSED = 0;
+my $TOTALRUN = 0;
+my $TOTALFAILED = 0;
+my $TOTALSKIPPED = 0;
+
+sub parse_line
+{
+ my $line = $_[0];
+ my @parts = split (" ", $line);
+ my $passed = $parts[1];
+ my $failed = $parts[3];
+ my $skipped = $parts[5];
+
+ my $total = $passed + $failed + $skipped;
+ my $passrate = $passed * 100 / $total;
+ my $passrateround = sprintf("%.0f",$passrate);
+ my $runrate = ($total - $skipped)*100/$total;
+ my $runrateround = sprintf("%.0f",$runrate);
+
+ $TOTALCASES += $total;
+ $TOTALPASSED += $passed;
+ $TOTALRUN += ($total - $skipped);
+ $TOTALFAILED += $failed;
+ $TOTALSKIPPED += $skipped;
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$passed\n";
+ printf MYFILE "</td>\n";
+
+ if($failed > 0)
+ {
+ printf MYFILE "<td style=\"font-weight:bold;color:red\">\n";
+ printf MYFILE "$failed\n";
+ printf MYFILE "</td>\n";
+ }
+ else
+ {
+ printf MYFILE "<td>\n";
+ printf MYFILE "$failed\n";
+ printf MYFILE "</td>\n";
+ }
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$skipped\n";
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$total\n";
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "<td>\n";
+ printf MYFILE ("$passrateround %%\n");
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$runrateround %%\n";
+ printf MYFILE "</td>\n";
+
+
+}
+
+sub parse_file
+ {
+ my $pattern = "Totals";
+ my $file = $_[0];
+ open (FILE,$file);
+
+ while (my $line= <FILE>)
+ {
+ chomp ($line);
+ if ($line =~ m/$pattern/)
+ {
+ parse_line $line;
+ }
+ }
+ close(FILE);
+ }
+
+
+sub generate_report
+ {
+ open (MYFILE, '>/epoc32/winscw/c/logs/messagingtestsuite/report.html');
+ printf MYFILE "<html>\n";
+ printf MYFILE "<body>\n";
+ printf MYFILE "<head>\n";
+ printf MYFILE "<title>MsgApp Test Suite Reports</title>";
+ printf MYFILE "</head>\n";
+ printf MYFILE "<h2 align = center>Messaging101 Test Suite Report</h2>\n";
+ printf MYFILE "<table border = 2 cellpadding = 10 align = center>\n";
+ printf MYFILE "<tr style = \" background-color:lavender \">\n";
+ printf MYFILE "<th>Module</th>\n";
+ printf MYFILE "<th style = color:green>Passed</th>\n";
+ printf MYFILE "<th style = color:red>Failed</th>\n";
+ printf MYFILE "<th style = color:chocolate>Skipped</th>\n";
+ printf MYFILE "<th>Total Cases</th>\n";
+ printf MYFILE "<th>Pass Rate</th>\n";
+ printf MYFILE "<th>Run Rate</th>\n";
+ printf MYFILE "</tr>\n";
+
+
+ my @files = </epoc32/winscw/c/logs/messagingtestsuite/*.txt>;
+ foreach my $file (@files)
+ {
+ my @splitedpath = split("/",$file);
+ my $filename = $splitedpath[-1];
+ my $length = length($filename);
+ my $name = substr($filename,11,$length-15);
+ printf MYFILE "<tr>\n";
+ printf MYFILE "<td>\n";
+ printf MYFILE "<a HREF=$filename style = text-decoration:none><b>$name</b></a>\n";
+ printf MYFILE "</td>\n";
+
+ parse_file $file;
+
+ printf MYFILE "</tr>\n";
+ }
+
+ printf MYFILE "<tr style= \"font-weight:bold; color:white; background-color:gray\">\n";
+ printf MYFILE "<td>\n";
+ printf MYFILE "<b>Overall</b>\n";
+ printf MYFILE "</td>\n";
+
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$TOTALPASSED\n";
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$TOTALFAILED\n";
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$TOTALSKIPPED\n";
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "<td>\n";
+ printf MYFILE "$TOTALCASES\n";
+ printf MYFILE "</td>\n";
+
+ my $passrate = $TOTALPASSED*100/$TOTALCASES;
+ my $passrateround = sprintf("%.0f",$passrate);
+ printf MYFILE "<td>\n";
+ printf MYFILE "$passrateround%%\n";
+ printf MYFILE "</td>\n";
+
+ my $runrate = ($TOTALCASES - $TOTALSKIPPED)*100/$TOTALCASES;
+ my $runrateround = sprintf("%.0f",$runrate);
+ printf MYFILE "<td>\n";
+ printf MYFILE "$runrateround%%\n";
+ printf MYFILE "</td>\n";
+
+ printf MYFILE "</tr>\n";
+
+ printf MYFILE "</table>\n";
+ printf MYFILE "</body>\n";
+ printf MYFILE "</html>\n";
+
+ close (MYFILE);
+ }
+
+
+generate_report;
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/inc/testunidatamodelvcalplugin.h Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#ifndef TEST_UNI_DATA_MODEL_VCAL_PLUGIN_H
+#define TEST_UNI_DATA_MODEL_VCAL_PLUGIN_H
+
+#ifdef BUILD_TEST_DLL
+#define TEST_EXPORT Q_DECL_EXPORT
+#else
+#define TEST_EXPORT Q_DECL_IMPORT
+#endif
+
+#include <QObject>
+#include <txtetext.h>
+#include <txtrich.h>
+#include <mtclreg.h>
+#include <mtclbase.h>
+#include <msvids.h>
+#include <smsclnt.h>
+#include <smuthdr.h>
+#include <QDateTime>
+#include <e32math.h>
+
+
+#include <bsp.h>
+
+const TInt32 KUidBIOVCalenderMsg = {0x10005533}; // VCalender diary
+
+class UniDataModelPluginInterface;
+class UniDataModelLoader;
+class MsgObserver;
+class S60QConversions;
+class ConvergedMessage;
+class CBIODatabase;
+class ConvergedMessgageAddress;
+
+typedef enum
+ { // GENERATE A MESSAGE USING....
+ ENoMessage, // .. error cases
+ EBioIapSettingsMessage, // .. IAP grammar, includes Internet settings
+ // Email settings, and logon scripts,
+ EBioEnpMessage, // .. Email Notification grammar.
+ EBioRingTonesMessage, // .. Ringing Tones binary data
+ EBioOpLogoMessage, // .. Logo for Operator service
+ EBioCompBusCardMessage, // .. Compact Business Card data
+ EBiovCardMessage, // .. virtual business card data
+ EBiovCalenderMessage, // .. vCalender data
+ EBioWAPSettingsMessage, // .. wap settings
+ EBioWPRVSettingsMessage // .. wprv settings
+ } TBIOMessageType;
+
+
+class TEST_EXPORT TestUniDataModelVCalPlugin : public QObject
+{
+Q_OBJECT
+
+private slots:
+ //called by frame work.
+ void initTestCase();//called before the first testfunction is executed.
+ void init();//called before each testfunction is executed.
+
+ //test cases.
+ void testInBoxVCalMessage();
+ void testDraftsVCalMessage();
+ void testUnusedAPIs();
+ void cleanup();//called after every testfunction.
+ void cleanupTestCase();//called after the last testfunction was executed.
+
+private:
+
+ TMsvId CreateBIOEntryL(TDesC& aText, TBIOMessageType aMessageType);
+ void CreateBioEntryClientSideL(TMsvEntry& aEntry, CRichText& aBody);
+ HBufC* ReadFromFileL(const TDesC& aFile);
+ void SetSessionPath(const TDesC& aSessionPath);
+ TMsvId CreateBIOEntryFromFileL(const TDesC& aFilename,
+ TBIOMessageType aMessageType);
+ TBIOMessageType SetMessageType(const TDesC& aFileName);
+ CMsvEntrySelection* GenerateMessagesL();
+ TMsvId SetBIOServiceIdL();
+ void SetForMtmTypeL(TMsvEntry& aEntry, TBIOMessageType aType);
+
+private:
+
+ UniDataModelPluginInterface* pluginInterface;
+ MsgObserver* iObserver;
+ CMsvSession* iMSession;
+ CClientMtmRegistry* iMtmReg;
+ TMsvId messageId;
+ UniDataModelLoader* pluginLoader;
+ QDateTime retTimeStamp;
+ RFs iFs;
+ CDir* iDir;
+ TInt iFilesProcessed;
+ CMsvEntry* iMsvEntry;
+ CBIODatabase* iBioDb;
+ TMsvId newEntryId;
+ HBufC* tempNumber;
+ TBufC<KMaxFileName> currentFile;
+ TBool inbox;
+ TBool drafts;
+};
+
+class MsgObserver : public MMsvSessionObserver
+{
+public:
+ void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2,
+ TAny* aArg3);
+};
+
+#endif //TEST_UNI_DATA_MODEL_VCAL_PLUGIN_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/inc/testunidatamodelvcalplugin.ini Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,8 @@
+//this file is used to provide predefined set of input data.
+
+//eg.
+const char TEST_MSG_RECIEPIENT[] = "Shweta Singh<77>";
+const char TEST_MSG_FROM1[] = "88";
+const char TEST_MSG_ALIAS1[] = "Shweta Singh";
+const char TEST_MSG_FROM2[] = "999";
+const char TEST_MSG_SUBJECT[] = "Hi";
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/src/testunidatamodelvcalplugin.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,682 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+#include <QtTest/QtTest>
+#include <QtDebug>
+#include <QTimer>
+#include <QSignalSpy>
+#include <xqconversions.h>
+#include <bsp.h>
+#include <biodb.h>
+#include <biouids.h>
+#include <biocmtm.h>
+#include "convergedmessageaddress.h"
+
+#include "testunidatamodelvcalplugin.h"
+#include <unidatamodelloader.h>
+#include "testunidatamodelvcalplugin.ini"
+#include "unidatamodelplugininterface.h"
+#include <convergedmessage.h>
+
+const TInt KTelephoneNumberMaxLength = 32;
+_LIT(KBIOTxtFilePath, "C:\\test\\");
+_LIT(KBIOvCalenderPrefix, "vcal*");
+// vCalender
+_LIT(KUnixEpoch, "19700000:000000.000000");
+#define KBioUidValue 0x10001262
+
+const TUid KBioUidValueUid =
+{KBioUidValue};
+
+
+
+
+//out put directory for test results.
+QString OUTPUTDIRECTORY = "c:/logs/TestUniDataModelVCalPlugin";
+//o/p directory for data to be written on temp file.
+QString TEMPDIR = "c:/logs/TestUniDataModelVCalPlugin/testdata";
+//test result O/P file name.
+QString RESULTFILE = "c:/logs/TestUniDataModelVCalPlugin/result_%1.txt";
+// folder named UID3 of TestUniDataModelVCalPlugin inside private folder.
+const QString PRIVATE_DIR("C:/private/Ed034a47");
+
+//factory method to create objects.
+QObject* getObject(QString className)
+{
+ if(className == "TestUniDataModelVCalPlugin" )
+ {
+ return new TestUniDataModelVCalPlugin;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+//creating o/p directory.
+void createOutPutDirectory()
+ {
+ QDir dir;
+ //o/p dir
+ dir.mkdir(OUTPUTDIRECTORY);
+ //tmp dir
+ dir.mkdir(TEMPDIR);
+ // dir inside private folder.
+ dir.mkdir(PRIVATE_DIR);
+ }
+
+//main entry point
+int main(int argc, char *argv[])
+ {
+ int ret = -1;
+ QCoreApplication app(argc, argv);
+
+ //creating output directory.
+ createOutPutDirectory();
+
+ //the configuration file.
+ QFile data("c:/TestUniDataModelVCalPlugin.cfg");
+
+ if (data.open(QFile::ReadOnly))
+ {
+ QTextStream in(&data);
+ while(!in.atEnd())
+ {
+ QStringList args;
+ QString appName = argv[0];
+ args << appName;
+
+ QString option = "-o";
+ args << option;
+
+ QString outFile = RESULTFILE;
+ QString name = in.readLine();
+ outFile = outFile.arg(name);
+ args << outFile;
+
+ QObject* tc = getObject(name);
+
+ if(tc)
+ {
+
+ ret = QTest::qExec(tc, args);
+ delete tc;
+ }
+ }
+ }
+ data.close();
+ return ret;
+ }
+
+
+
+
+
+//---------------------------------------------------------------
+// TestUniDataModelVCalPlugin::init
+//---------------------------------------------------------------
+
+
+void TestUniDataModelVCalPlugin::initTestCase()
+{
+ iObserver = new (ELeave) MsgObserver();
+
+ // Create a new messaging server session..
+ iMSession = CMsvSession::OpenSyncL(*iObserver);
+
+ iMsvEntry = iMSession->GetEntryL(KMsvRootIndexEntryId);
+ newEntryId = 0;
+ pluginLoader = new UniDataModelLoader();
+
+ retTimeStamp = QDateTime::currentDateTime();
+ int err = iFs.Connect();
+ QVERIFY(err == 0);
+ iBioDb = CBIODatabase::NewL(iFs);
+ iFs.SetSessionPath(_L("c:\\"));
+ inbox = EFalse;
+ drafts = EFalse;
+}
+void TestUniDataModelVCalPlugin::cleanupTestCase()
+{
+ delete iMsvEntry;
+ iMsvEntry = NULL;
+ delete iObserver;
+ iObserver = NULL;
+ delete iMSession;
+ iMSession = NULL;
+ delete pluginLoader;
+}
+
+void TestUniDataModelVCalPlugin::init()
+{
+
+}
+
+//---------------------------------------------------------------
+// TestUniDataModelVCalPlugin::cleanup
+//---------------------------------------------------------------
+void TestUniDataModelVCalPlugin::cleanup()
+{
+
+
+}
+
+void TestUniDataModelVCalPlugin::testInBoxVCalMessage()
+{
+ inbox = ETrue;
+ GenerateMessagesL();
+
+ pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::BioMsg);
+ pluginInterface->setMessageId(newEntryId);
+
+ int count = pluginInterface->attachmentCount();
+ QVERIFY(count == 1);
+
+ UniMessageInfoList attachmentlist = pluginInterface->attachmentList();
+ QVERIFY(!attachmentlist.isEmpty());
+
+ UniMessageInfo* att = attachmentlist.at(0);
+ QString path = att->path();
+
+ QString recepient(TEST_MSG_FROM1);
+ QString fromaddress;
+ pluginInterface->fromAddress(fromaddress);
+ QVERIFY(recepient == fromaddress);
+
+ QString body;
+ pluginInterface->body(body);
+ QVERIFY(!body.isEmpty());
+
+ // Compare input message , with the read message
+ RFile origFile;
+ int op = origFile.Open(iFs, currentFile, EFileRead);
+ QVERIFY(op == 0);
+
+ TBuf8<1000> readBuf;
+ HBufC* readBuf16 = HBufC::NewL(2000);
+
+ origFile.Read(readBuf);
+ readBuf16->Des().Copy(readBuf);
+
+ QString orig = XQConversions::s60DescToQString(*readBuf16);
+ origFile.Close();
+
+ HBufC* filepath = XQConversions::qStringToS60Desc(path);
+
+ int size = pluginInterface->messageSize();
+
+ MsgPriority priority = pluginInterface->messagePriority();
+ // Normal priority
+ qDebug() << "prority" << priority;
+ QVERIFY(priority == 1);
+
+ QVERIFY(pluginInterface->timeStamp() == retTimeStamp);
+
+ ConvergedMessageAddressList recipientList;
+ pluginInterface->toRecipientList(recipientList);
+ QVERIFY(recipientList.count() == 0);
+ qDebug() << "recipientList.count" << recipientList.count();
+
+ if (inbox)
+ {
+ iMsvEntry->SetEntryL(KMsvGlobalInBoxIndexEntryId);
+ qDebug() << "SetEntry" ;
+ }
+
+
+}
+
+void TestUniDataModelVCalPlugin::testDraftsVCalMessage()
+{
+ drafts = ETrue;
+ GenerateMessagesL();
+
+ pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::BioMsg);
+ pluginInterface->setMessageId(newEntryId);
+
+ int count = pluginInterface->attachmentCount();
+ QVERIFY(count == 1);
+
+ UniMessageInfoList attachmentlist = pluginInterface->attachmentList();
+ QVERIFY(!attachmentlist.isEmpty());
+
+ UniMessageInfo* att = attachmentlist.at(0);
+ QString path = att->path();
+
+ QString fromaddress;
+ pluginInterface->fromAddress(fromaddress);
+ QVERIFY(!fromaddress.isEmpty()); //added ! shweta
+
+ QString body;
+ pluginInterface->body(body);
+ QVERIFY(!body.isEmpty());
+
+ // Compare input message , with the read message
+ RFile origFile;
+ int op = origFile.Open(iFs, currentFile, EFileRead);
+ QVERIFY(op == 0);
+
+ TBuf8<1000> readBuf;
+ HBufC* readBuf16 = HBufC::NewL(2000);
+
+ origFile.Read(readBuf);
+ readBuf16->Des().Copy(readBuf);
+
+ QString orig = XQConversions::s60DescToQString(*readBuf16);
+ origFile.Close();
+
+ int size = pluginInterface->messageSize();
+
+ MsgPriority priority = pluginInterface->messagePriority();
+ // Normal priority
+ qDebug() << "prority" << priority;
+ QVERIFY(priority == 1);
+
+ QVERIFY(pluginInterface->timeStamp() == retTimeStamp);
+
+ QString recepient(TEST_MSG_FROM1);
+ ConvergedMessageAddressList recipientList;
+ ConvergedMessageAddress alias(recepient);
+
+ recipientList.append(&alias);
+ pluginInterface->toRecipientList(recipientList);
+
+ QVERIFY( recipientList.count() != 0 );
+ qDebug() << "recipientList.count()"<<recipientList.count() ;
+
+ const QString& copy = recipientList[0]->address();
+ qDebug() << "copy = "<<recipientList[0]->address();
+ QVERIFY(recepient == copy);
+ qDebug() << "Receipient Verified";
+
+ if (drafts)
+ {
+ iMsvEntry->SetEntryL(KMsvDraftEntryId);
+ qDebug() << "SetEntry" ;
+ }
+ }
+
+
+
+void TestUniDataModelVCalPlugin::testUnusedAPIs()
+{
+ pluginInterface = pluginLoader->getDataModelPlugin(ConvergedMessage::BioMsg);
+
+ QVERIFY(pluginInterface->objectCount() == 0);
+
+ UniMessageInfoList objectlist = pluginInterface->objectList();
+ QVERIFY(objectlist.isEmpty());
+
+ QVERIFY(pluginInterface->slideCount() == 0);
+
+ UniMessageInfoList slidelist = pluginInterface->slideContent(0);
+ QVERIFY(slidelist.isEmpty());
+
+ QVERIFY(pluginInterface->hasAttachment() == true );
+
+ ConvergedMessageAddressList recipientList;
+
+ pluginInterface->ccRecipientList(recipientList);
+ QVERIFY(recipientList.count() == 0);
+
+ pluginInterface->bccRecipientList(recipientList);
+ QVERIFY(recipientList.count() == 0);
+}
+
+CMsvEntrySelection* TestUniDataModelVCalPlugin::GenerateMessagesL()
+{
+ HBufC* aFileDirectory = KBIOTxtFilePath().AllocL();
+ TMsvId messageId;
+ TBIOMessageType currentMsgType;
+
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection();
+ CleanupStack::PushL(selection);
+
+ TInt err = iFs.GetDir(aFileDirectory->Des(),
+ KEntryAttMatchMask,
+ ESortByName,
+ iDir);
+ if (err == KErrPathNotFound)
+ {
+ TInt makeDirErr = iFs.MkDirAll(aFileDirectory->Des());
+ makeDirErr == KErrNone ? User::Leave(KErrNotFound)
+ : User::Leave(makeDirErr);
+ }
+ else if (err != KErrNone)
+ {
+ User::Leave(err);
+ }
+
+ // Set the session path for the RFs
+ SetSessionPath(aFileDirectory->Des());
+ if (iDir)
+ {
+ delete iDir;
+ iDir = NULL;
+ }
+
+ User::LeaveIfError(iFs.GetDir(_L("*.txt"), KEntryAttNormal, ESortByName, iDir));
+ TInt count = iDir->Count();
+ if (count == 0)
+ {
+ User::Leave(KErrNotFound); // No files to process
+ }
+
+ TBuf<60> outputBuf;
+
+ for (TInt loop = 0; loop < count; loop++)
+ {
+ TEntry as = (*iDir)[0];
+ currentFile = (as.iName);
+ // Not processed all the messages - so keep the current state
+ iFilesProcessed++; // Here because need to update the counter promptly
+ currentMsgType = SetMessageType(currentFile);
+ if (currentMsgType != ENoMessage) // skip any dodgy filenames
+ {
+ messageId = CreateBIOEntryFromFileL(currentFile, currentMsgType);
+ selection->AppendL(messageId);
+ TPtrC tempPtr = (currentFile.Des());
+
+ }
+ }
+ CleanupStack::Pop(); // selection
+
+ return selection;
+}
+
+TBIOMessageType TestUniDataModelVCalPlugin::SetMessageType(
+ const TDesC& aFileName)
+{
+
+ if (aFileName.MatchF(KBIOvCalenderPrefix) == 0)
+ {
+ return EBiovCalenderMessage;
+ }
+
+ return ENoMessage;
+}
+
+TMsvId TestUniDataModelVCalPlugin::CreateBIOEntryFromFileL(
+ const TDesC& aFilename,
+ TBIOMessageType aMessageType)
+{
+ //First use the filename to get the message body,
+ // then convert '\n' to the paragraph delimiters used in proper SMS
+ HBufC* tempBuffer;
+
+ tempBuffer = ReadFromFileL(aFilename);
+ CleanupStack::PushL(tempBuffer);
+
+ newEntryId = CreateBIOEntryL(*tempBuffer, aMessageType);
+
+ // Finished with our local descriptors - free up some memory
+ CleanupStack::PopAndDestroy();
+
+ return newEntryId;
+}
+
+void TestUniDataModelVCalPlugin::SetSessionPath(const TDesC& aSessionPath)
+{
+ iFs.SetSessionPath(aSessionPath);
+}
+
+HBufC* TestUniDataModelVCalPlugin::ReadFromFileL(const TDesC& aFile)
+{
+ RFile file;
+ TBuf8<1024> lineBuffer;
+ TInt err = KErrNone;
+
+ err = file.Open(iFs, aFile, EFileStreamText | EFileRead | EFileShareAny);
+
+ if (err != KErrNone) // Didn't find the file, so leave - should only get valid filenames!
+ {
+ User::Leave(KErrNotFound);
+ }
+
+ HBufC* bioBuf = HBufC::NewLC(65535); // Create a new descriptor on the heap.
+ HBufC* copyBuffer = HBufC::NewLC(1024);
+
+ do // Read in the text from file, and also check if there is a name field:
+ {
+ err = file.Read(lineBuffer);// Read upto 256 chars, '\n' and all...
+ //err = ReadLineL(file,lineBuffer);
+ if (err == KErrNone) // Made a valid read,
+ if (lineBuffer.Length() == 0) // but read 0 chars
+ err = KErrEof; // so set err value to end processing
+
+ if (err == KErrNone)
+ {
+ copyBuffer->Des().Copy(lineBuffer);// Copy, and overwrite existing text
+ if ( (bioBuf->Length() + copyBuffer->Length())
+ > bioBuf->Des().MaxLength())
+ {
+ bioBuf = bioBuf->ReAllocL(bioBuf->Length()
+ + copyBuffer->Length());
+ }
+ bioBuf->Des().Append(*copyBuffer);
+ //bioBuf->Des().Append(_L("\n"));
+ }
+ }while (err != KErrEof);
+
+ CleanupStack::PopAndDestroy(); // Destroy the copyBuffer.
+ CleanupStack::Pop();// Remove the bioBuf.
+
+ file.Close();
+ return bioBuf;
+}
+
+TMsvId TestUniDataModelVCalPlugin::CreateBIOEntryL(TDesC& aText,
+ TBIOMessageType aMessageType)
+{
+ // Ensure that we have a valid service ID to work with:
+ TMsvId iBioServiceId;
+
+ iBioServiceId = SetBIOServiceIdL();
+
+ HBufC* localBuffer = aText.AllocL();
+ CleanupStack::PushL(localBuffer);
+
+ TPtr messDes = localBuffer->Des();
+
+ if (aMessageType != EBiovCardMessage && aMessageType
+ != EBiovCalenderMessage)
+ {
+ // convert \r\n to \n since this is what is expected from SMS when not vCard data
+ for (TInt i = 0; i < messDes.Length(); i++)
+ {
+ if (messDes[i] == (TText) '\r' && i < messDes.Length() - 1
+ && messDes[i + 1] == (TText) '\n')
+ messDes.Delete(i, 1);
+ }
+ }
+
+ // Create and fill a CRichText object for the jobbie:
+ CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL();
+ CleanupStack::PushL(paraFormatLayer);
+ CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL();
+ CleanupStack::PushL(charFormatLayer);
+ CRichText* richText = CRichText::NewL(paraFormatLayer, charFormatLayer);
+ CleanupStack::PushL(richText);
+
+ TInt pos = richText->DocumentLength();
+ richText->InsertL(pos, messDes);
+
+ TMsvEntry newBioEntry;
+ newBioEntry.SetNew(ETrue);
+ newBioEntry.SetComplete(EFalse);
+ newBioEntry.SetUnread(ETrue);
+ newBioEntry.SetVisible(ETrue);
+ newBioEntry.SetReadOnly(EFalse);
+ newBioEntry.SetFailed(EFalse);
+ newBioEntry.SetOperation(EFalse);
+ newBioEntry.SetMultipleRecipients(EFalse);
+ newBioEntry.SetAttachment(EFalse);
+ newBioEntry.iMtm = KUidBIOMessageTypeMtm;
+ newBioEntry.iType = KUidMsvMessageEntry;
+ newBioEntry.iServiceId = iBioServiceId;
+ TTime now;
+ now.UniversalTime();
+ newBioEntry.iDate = now;
+
+ TTime unixEpoch(KUnixEpoch);
+ TTimeIntervalSeconds seconds;
+ TTime timeStamp = newBioEntry.iDate;
+ timeStamp.SecondsFrom(unixEpoch, seconds);
+ retTimeStamp.setTime_t(seconds.Int());
+
+ newBioEntry.iDescription.Set(richText->Read(0, richText->DocumentLength()));
+ TBufC<KTelephoneNumberMaxLength> telNumber;
+
+ QString recepient(TEST_MSG_FROM1);
+ tempNumber = XQConversions::qStringToS60Desc(recepient);
+
+ telNumber = tempNumber->Des();
+ newBioEntry.iDetails.Set(telNumber);
+
+ SetForMtmTypeL(newBioEntry, aMessageType);
+
+ newBioEntry.iSize = richText->DocumentLength();// msgSize;
+ CreateBioEntryClientSideL(newBioEntry, *richText);
+
+ CleanupStack::PopAndDestroy(4); // richText, charFormatLayer, paraFormatLayer, localBuffer
+ return newBioEntry.Id();
+}
+
+void TestUniDataModelVCalPlugin::CreateBioEntryClientSideL(TMsvEntry& aEntry,
+ CRichText& aBody)
+{
+ if (inbox)
+ {
+ iMsvEntry->SetEntryL(KMsvGlobalInBoxIndexEntryId);
+ }
+ else if (drafts)
+ {
+ iMsvEntry->SetEntryL(KMsvDraftEntryId);
+ }
+ // Get the global inbox.
+
+ iMsvEntry->CreateL(aEntry);
+ iMsvEntry->SetEntryL(aEntry.Id());
+
+ // Save all the changes
+ CMsvStore* store = iMsvEntry->EditStoreL();
+ CleanupStack::PushL(store);
+
+ if (store->HasBodyTextL())
+ {
+ store->DeleteBodyTextL();
+ }
+
+ CPlainText* pText = CPlainText::NewL();
+ CleanupStack::PushL(pText);
+
+ if (inbox)
+ {
+ CSmsHeader* smsHeader = CSmsHeader::NewL(CSmsPDU::ESmsDeliver, *pText);
+ CleanupStack::PushL(smsHeader);
+ smsHeader->SetFromAddressL(*tempNumber);
+ smsHeader->StoreL(*store);
+
+ }
+ else if (drafts)
+ {
+
+ QString recepient(TEST_MSG_FROM1);
+ QString recepient2(TEST_MSG_FROM2);
+ QString alias(TEST_MSG_ALIAS1);
+
+ HBufC* addr = XQConversions::qStringToS60Desc(recepient);
+ HBufC* addr2 = XQConversions::qStringToS60Desc(recepient2);
+ HBufC* alias1 = XQConversions::qStringToS60Desc(alias);
+
+ CSmsHeader* smsHeader = CSmsHeader::NewL(CSmsPDU::ESmsSubmit, *pText);
+ CleanupStack::PushL(smsHeader);
+
+ CSmsNumber* number1 = CSmsNumber::NewL(); // create the instance
+ CleanupStack::PushL(number1);
+
+ number1->SetNameL(TPtrC());
+ number1->SetAddressL(*addr);
+ smsHeader->Recipients().AppendL(number1);
+ CleanupStack::Pop(number1);
+
+ CSmsNumber* number2 = CSmsNumber::NewL();
+ CleanupStack::PushL(number2);
+
+ number2->SetNameL(*alias1);
+ number2->SetAddressL(*addr2);
+
+ smsHeader->Recipients().AppendL(number2);
+ CleanupStack::Pop(number2);
+ smsHeader->StoreL(*store);
+
+ }
+
+ store->StoreBodyTextL(aBody);
+ store->CommitL();
+
+ CleanupStack::PopAndDestroy(3); //store - close the store
+
+ aEntry.SetComplete(ETrue);
+ // Update the entry
+ iMsvEntry->ChangeL(aEntry);
+ iMsvEntry->SetEntryL(KMsvRootIndexEntryId);
+}
+
+TMsvId TestUniDataModelVCalPlugin::SetBIOServiceIdL()
+{
+ // Haven't found an entry so create a BIO Message service:
+ TMsvEntry bioServiceEntry;
+ bioServiceEntry.iMtm = KUidBIOMessageTypeMtm;
+ bioServiceEntry.iType = KUidMsvServiceEntry;
+ bioServiceEntry.SetVisible(EFalse);
+ bioServiceEntry.iDate.UniversalTime();
+ bioServiceEntry.iDescription.Set(_L("BIO Message Service ")); // Is there such a thing?
+ bioServiceEntry.iDetails.Set(_L("BIO Message Service"));
+
+ TMsvId newBIOServiceId;
+
+ iMsvEntry->SetEntryL(KMsvRootIndexEntryId);
+ iMsvEntry->CreateL(bioServiceEntry); // Needs to be a child of the root!
+ newBIOServiceId = bioServiceEntry.Id();
+
+ return newBIOServiceId;
+}
+
+void TestUniDataModelVCalPlugin::SetForMtmTypeL(TMsvEntry& aEntry,
+ TBIOMessageType aType)
+{
+ TInt index;
+
+ aEntry.iBioType = KUidBIOVCalenderMsg;
+
+ // Set other TMsvEntry fields if we have a BIO message type
+ if (aType != ENoMessage)
+ {
+ aEntry.SetMtmData2(0);
+ aEntry.SetMtmData3(0);
+ }
+
+ // set description from BIF file
+ iBioDb->GetBioIndexWithMsgIDL(TUid::Uid(aEntry.iBioType), index);
+ if (index == KErrNotFound)
+ User::Leave(KErrNotFound);
+ aEntry.iDescription.Set(iBioDb->BifReader(index).Description());
+}
+
+void MsgObserver::HandleSessionEventL(TMsvSessionEvent /*aEvent*/,
+ TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/)
+{
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/testunidatamodelvcalplugin.pro Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,108 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+QT += testlib
+QT -= gui
+
+TEMPLATE = app
+TARGET = testunidatamodelvcalplugin
+
+CONFIG += hb
+CONFIG += symbian_test
+CONFIG += qtestlib
+
+INCLUDEPATH += .
+INCLUDEPATH += ../../../../../../inc
+INCLUDEPATH += ../../../../../../../inc
+INCLUDEPATH += ../../../../../../../../../../epoc32/include/platform/mw
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+DEFINES += BUILD_TEST_DLL
+
+SOURCES += \
+ src/testunidatamodelvcalplugin.cpp
+
+
+# Input
+HEADERS += \
+ inc/testunidatamodelvcalplugin.h
+
+
+
+SYMBIAN_PLATFORMS = WINSCW ARMV5
+ symbian {
+ TARGET.CAPABILITY = CAP_GENERAL_DLL
+ TARGET.EPOCSTACKSIZE = 0x8000
+ TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
+ TARGET.EPOCALLOWDLLDATA = 1
+ BLD_INF_RULES.prj_exports += "vcal1.txt /epoc32/winscw/c/test/vcal1.txt"
+ BLD_INF_RULES.prj_exports += "BioMtm.rsc /epoc32/winscw/c/resource/messaging/mtm/BioMtm.rsc"
+ BLD_INF_RULES.prj_exports += "data/TestUniDataModelVCalPlugin.cfg c:/TestUniDataModelVCalPlugin.cfg"
+ BLD_INF_RULES.prj_exports += "data/TestUniDataModelVCalPlugin.pl c:/TestUniDataModelVCalPlugin.pl"
+ }
+
+
+packageheader = "$${LITERAL_HASH}{\"testunidatamodelvcalplugin\"},(0xE2815e10),1,0,0,TYPE=SA"
+
+vendorinfo = \
+ "; Localised Vendor name" \
+ "%{\"Nokia\"}" \
+ "; Unique Vendor name" \
+ ":\"Nokia\""
+
+dependencyinfo = \
+ "; Default HW/platform dependencies" \
+ "[0x101F7961],0,0,0,{\"S60ProductID\"}" \
+ "[0x2001E61C],4,6,3,{"Qt"}
+
+default_deployment.pkg_prerules = packageheader \
+ vendorinfo \
+ dependencyinfo
+
+
+#Copy the dependent DLL
+symbian: {
+ addCfg.sources = ./data/TestUniDataModelVCalPlugin.cfg
+ addCfg.path = C:/
+ DEPLOYMENT += addCfg
+
+ addPl.sources = ./data/TestUniDataModelVCalPlugin.pl
+ addPl.path = C:/
+ DEPLOYMENT += addPl
+
+ addP2.sources = ./vcal1.txt
+ addP2.path = C:/
+ DEPLOYMENT += addP2
+
+ }
+
+
+ LIBS += -leuser \
+ -lconvergedmessageutils\
+ -lmsgs \
+ -lsmcm \
+ -lgsmu \
+ -letext \
+ -lmsgs \
+ -lunidatamodelloader\
+ -lQtCore \
+ -lbioc \
+ -lefsrv \
+ -lbiodb \
+ -lxqutils \
+ -lbifu
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/vcal1.txt Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,15 @@
+BEGIN:VCALENDAR
+PRODID:-//Microsoft Corporation//Outlook 9.0 MIMEDIR//EN
+VERSION:1.0
+BEGIN:VEVENT
+DTSTART:20000322T080000Z
+DTEND:20000322T083000Z
+LOCATION;ENCODING=QUOTED-PRINTABLE:Somewhere
+UID:040000008200E00074C5B7101A82E0080000000090BB8A23ED93BF010000000000000000100
+ 00000AB7E96B01EFFD31192E70060084F0B48
+DESCRIPTION;ENCODING=QUOTED-PRINTABLE:=09You will be busy doing something, =
+somewhere at some point.=0D=0A
+SUMMARY;ENCODING=QUOTED-PRINTABLE:My big appointment
+PRIORITY:3
+END:VEVENT
+END:VCALENDAR
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/tsrc.pro Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = subdirs
+
+CONFIG += symbian_test
+
+#Sub .pro files
+SUBDIRS += testunidatamodelvcalplugin/testunidatamodelvcalplugin.pro
+
+
+# Platforms
+SYMBIAN_PLATFORMS = DEFAULT
\ No newline at end of file
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/inc/unimmsdataplugin_p.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/inc/unimmsdataplugin_p.h Sun Jul 25 18:59:19 2010 +0530
@@ -36,7 +36,7 @@
/**
* Symbian specific implementation of the uni MMS plugin
*/
-class UniMMSDataPluginPrivate : public MUniDataModelObserver, public MMsvSessionObserver
+class UniMMSDataPluginPrivate :public CBase, public MUniDataModelObserver, public MMsvSessionObserver
{
public:
/**
@@ -165,11 +165,11 @@
- /**
- * Subject of the message
- * @QString subject
- */
- QString subject();
+ /**
+ * Subject of the message
+ * @QString subject
+ */
+ QString subjectL();
/**
* Session with the Messaging server
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/src/unimmsdataplugin.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/src/unimmsdataplugin.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -23,7 +23,7 @@
UniMMSDataPlugin::UniMMSDataPlugin(QObject* parent) :
QObject(parent)
{
- d_ptr = new UniMMSDataPluginPrivate();
+ QT_TRAP_THROWING( d_ptr = new UniMMSDataPluginPrivate());
}
UniMMSDataPlugin::~UniMMSDataPlugin()
@@ -138,11 +138,14 @@
int error;
TRAP(error,d_ptr->restoreL(mtm));
QDEBUG_WRITE_FORMAT("Exiting restore with error= ",error);
+ qt_symbian_throwIfError(error);
}
QString UniMMSDataPlugin::subject()
{
- return d_ptr->subject();
+ QString subject;
+ TRAPD(err, subject =d_ptr->subjectL());
+ return subject;
}
CMsvSession* UniMMSDataPlugin::session()
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/src/unimmsdataplugin_p.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/src/unimmsdataplugin_p.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -127,7 +127,7 @@
}
-QString UniMMSDataPluginPrivate::subject()
+QString UniMMSDataPluginPrivate::subjectL()
{
TPtrC sub = mMmsClient->SubjectL();
return XQConversions::s60DescToQString(sub);
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/inc/unismsdataplugin_p.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/inc/unismsdataplugin_p.h Sun Jul 25 18:59:19 2010 +0530
@@ -32,7 +32,7 @@
/**
* Symbian specific implementation of the uni SMS plugin
*/
-class UniSMSDataPluginPrivate :public MMsvSessionObserver
+class UniSMSDataPluginPrivate :public CBase, public MMsvSessionObserver
{
public:
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/src/unismsdataplugin.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/src/unismsdataplugin.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -30,7 +30,8 @@
UniSMSDataPlugin::UniSMSDataPlugin(QObject* parent) :
QObject(parent)
{
- d_ptr = new UniSMSDataPluginPrivate(this);
+ QT_TRAP_THROWING(d_ptr = new UniSMSDataPluginPrivate(this));
+
}
//---------------------------------------------------------------
--- a/messagingapp/msgutils/unieditorutils/bwins/editorgenutilsu.def Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgutils/unieditorutils/bwins/editorgenutilsu.def Sun Jul 25 18:59:19 2010 +0530
@@ -10,21 +10,22 @@
?DoCancel@CMuiuOperationWait@@MAEXXZ @ 9 NONAME ; void CMuiuOperationWait::DoCancel(void)
?MaxMmsMsgSizeL@UniEditorGenUtils@@QAEHXZ @ 10 NONAME ; int UniEditorGenUtils::MaxMmsMsgSizeL(void)
??_ECMuiuOperationWait@@UAE@I@Z @ 11 NONAME ; CMuiuOperationWait::~CMuiuOperationWait(unsigned int)
- ?ReplaceCharacters@UniEditorGenUtils@@QAEXAAVTDes16@@ABVTDesC16@@VTChar@@@Z @ 12 NONAME ; void UniEditorGenUtils::ReplaceCharacters(class TDes16 &, class TDesC16 const &, class TChar)
- ?NumberToBase@UniEditorGenUtils@@QAE?AVTChar@@V2@@Z @ 13 NONAME ; class TChar UniEditorGenUtils::NumberToBase(class TChar)
- ?IsValidEmailAddress@UniEditorGenUtils@@QAEHABVTDesC16@@@Z @ 14 NONAME ; int UniEditorGenUtils::IsValidEmailAddress(class TDesC16 const &)
- ?ConvertDigitsTo@UniEditorGenUtils@@QAEXAAVTDes16@@W4TDigitType@@@Z @ 15 NONAME ; void UniEditorGenUtils::ConvertDigitsTo(class TDes16 &, enum TDigitType)
- ?NewLC@CMuiuOperationWait@@SAPAV1@H@Z @ 16 NONAME ; class CMuiuOperationWait * CMuiuOperationWait::NewLC(int)
- ?RunL@CMuiuOperationWait@@MAEXXZ @ 17 NONAME ; void CMuiuOperationWait::RunL(void)
- ?getFileInfoL@UniEditorGenUtils@@QAEXVQString@@AAHAAV2@AAW4TMsgMediaType@@@Z @ 18 NONAME ; void UniEditorGenUtils::getFileInfoL(class QString, int &, class QString &, enum TMsgMediaType &)
- ?MaxMmsRecipientsL@UniEditorGenUtils@@QAEHXZ @ 19 NONAME ; int UniEditorGenUtils::MaxMmsRecipientsL(void)
- ??1CMuiuOperationWait@@UAE@XZ @ 20 NONAME ; CMuiuOperationWait::~CMuiuOperationWait(void)
- ?VerifyEmailAddressesL@UniEditorGenUtils@@QAEHV?$QList@PAVConvergedMessageAddress@@@@@Z @ 21 NONAME ; int UniEditorGenUtils::VerifyEmailAddressesL(class QList<class ConvergedMessageAddress *>)
- ?WriteEmailOverSmsSettingsL@UniEditorGenUtils@@QAEHABVTDes16@@0ABH@Z @ 22 NONAME ; int UniEditorGenUtils::WriteEmailOverSmsSettingsL(class TDes16 const &, class TDes16 const &, int const &)
- ?ReadEmailOverSmsSettingsL@UniEditorGenUtils@@QAEHAAVTDes16@@0AAH@Z @ 23 NONAME ; int UniEditorGenUtils::ReadEmailOverSmsSettingsL(class TDes16 &, class TDes16 &, int &)
- ?absoluteMaxSmsPartsL@UniEditorGenUtils@@AAEHXZ @ 24 NONAME ; int UniEditorGenUtils::absoluteMaxSmsPartsL(void)
- ?UTF8Size@UniEditorGenUtils@@QAEHVQString@@@Z @ 25 NONAME ; int UniEditorGenUtils::UTF8Size(class QString)
- ?IsPhoneOfflineL@UniEditorGenUtils@@QAEHXZ @ 26 NONAME ; int UniEditorGenUtils::IsPhoneOfflineL(void)
- ??1UniEditorGenUtils@@QAE@XZ @ 27 NONAME ; UniEditorGenUtils::~UniEditorGenUtils(void)
- ?AcceptEmailAddressesL@UniEditorGenUtils@@QAEHXZ @ 28 NONAME ; int UniEditorGenUtils::AcceptEmailAddressesL(void)
+ ??_EUniEditorGenUtils@@UAE@I@Z @ 12 NONAME ; UniEditorGenUtils::~UniEditorGenUtils(unsigned int)
+ ?ReplaceCharacters@UniEditorGenUtils@@QAEXAAVTDes16@@ABVTDesC16@@VTChar@@@Z @ 13 NONAME ; void UniEditorGenUtils::ReplaceCharacters(class TDes16 &, class TDesC16 const &, class TChar)
+ ?NumberToBase@UniEditorGenUtils@@QAE?AVTChar@@V2@@Z @ 14 NONAME ; class TChar UniEditorGenUtils::NumberToBase(class TChar)
+ ?IsValidEmailAddress@UniEditorGenUtils@@QAEHABVTDesC16@@@Z @ 15 NONAME ; int UniEditorGenUtils::IsValidEmailAddress(class TDesC16 const &)
+ ?ConvertDigitsTo@UniEditorGenUtils@@QAEXAAVTDes16@@W4TDigitType@@@Z @ 16 NONAME ; void UniEditorGenUtils::ConvertDigitsTo(class TDes16 &, enum TDigitType)
+ ?NewLC@CMuiuOperationWait@@SAPAV1@H@Z @ 17 NONAME ; class CMuiuOperationWait * CMuiuOperationWait::NewLC(int)
+ ?RunL@CMuiuOperationWait@@MAEXXZ @ 18 NONAME ; void CMuiuOperationWait::RunL(void)
+ ?getFileInfoL@UniEditorGenUtils@@QAEXVQString@@AAHAAV2@AAW4TMsgMediaType@@@Z @ 19 NONAME ; void UniEditorGenUtils::getFileInfoL(class QString, int &, class QString &, enum TMsgMediaType &)
+ ??1UniEditorGenUtils@@UAE@XZ @ 20 NONAME ; UniEditorGenUtils::~UniEditorGenUtils(void)
+ ?MaxMmsRecipientsL@UniEditorGenUtils@@QAEHXZ @ 21 NONAME ; int UniEditorGenUtils::MaxMmsRecipientsL(void)
+ ??1CMuiuOperationWait@@UAE@XZ @ 22 NONAME ; CMuiuOperationWait::~CMuiuOperationWait(void)
+ ?VerifyEmailAddressesL@UniEditorGenUtils@@QAEHV?$QList@PAVConvergedMessageAddress@@@@@Z @ 23 NONAME ; int UniEditorGenUtils::VerifyEmailAddressesL(class QList<class ConvergedMessageAddress *>)
+ ?WriteEmailOverSmsSettingsL@UniEditorGenUtils@@QAEHABVTDes16@@0ABH@Z @ 24 NONAME ; int UniEditorGenUtils::WriteEmailOverSmsSettingsL(class TDes16 const &, class TDes16 const &, int const &)
+ ?ReadEmailOverSmsSettingsL@UniEditorGenUtils@@QAEHAAVTDes16@@0AAH@Z @ 25 NONAME ; int UniEditorGenUtils::ReadEmailOverSmsSettingsL(class TDes16 &, class TDes16 &, int &)
+ ?absoluteMaxSmsPartsL@UniEditorGenUtils@@AAEHXZ @ 26 NONAME ; int UniEditorGenUtils::absoluteMaxSmsPartsL(void)
+ ?UTF8Size@UniEditorGenUtils@@QAEHVQString@@@Z @ 27 NONAME ; int UniEditorGenUtils::UTF8Size(class QString)
+ ?IsPhoneOfflineL@UniEditorGenUtils@@QAEHXZ @ 28 NONAME ; int UniEditorGenUtils::IsPhoneOfflineL(void)
+ ?AcceptEmailAddressesL@UniEditorGenUtils@@QAEHXZ @ 29 NONAME ; int UniEditorGenUtils::AcceptEmailAddressesL(void)
--- a/messagingapp/msgutils/unieditorutils/eabi/editorgenutilsu.def Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgutils/unieditorutils/eabi/editorgenutilsu.def Sun Jul 25 18:59:19 2010 +0530
@@ -20,17 +20,20 @@
_ZN17UniEditorGenUtils8UTF8SizeE7QString @ 19 NONAME
_ZN17UniEditorGenUtilsC1Ev @ 20 NONAME
_ZN17UniEditorGenUtilsC2Ev @ 21 NONAME
- _ZN17UniEditorGenUtilsD1Ev @ 22 NONAME
- _ZN17UniEditorGenUtilsD2Ev @ 23 NONAME
- _ZN18CMuiuOperationWait4RunLEv @ 24 NONAME
- _ZN18CMuiuOperationWait5NewLCEi @ 25 NONAME
- _ZN18CMuiuOperationWait5StartEv @ 26 NONAME
- _ZN18CMuiuOperationWait8DoCancelEv @ 27 NONAME
- _ZN18CMuiuOperationWaitC1Ei @ 28 NONAME
- _ZN18CMuiuOperationWaitC2Ei @ 29 NONAME
- _ZN18CMuiuOperationWaitD0Ev @ 30 NONAME
- _ZN18CMuiuOperationWaitD1Ev @ 31 NONAME
- _ZN18CMuiuOperationWaitD2Ev @ 32 NONAME
- _ZTI18CMuiuOperationWait @ 33 NONAME
- _ZTV18CMuiuOperationWait @ 34 NONAME
+ _ZN17UniEditorGenUtilsD0Ev @ 22 NONAME
+ _ZN17UniEditorGenUtilsD1Ev @ 23 NONAME
+ _ZN17UniEditorGenUtilsD2Ev @ 24 NONAME
+ _ZN18CMuiuOperationWait4RunLEv @ 25 NONAME
+ _ZN18CMuiuOperationWait5NewLCEi @ 26 NONAME
+ _ZN18CMuiuOperationWait5StartEv @ 27 NONAME
+ _ZN18CMuiuOperationWait8DoCancelEv @ 28 NONAME
+ _ZN18CMuiuOperationWaitC1Ei @ 29 NONAME
+ _ZN18CMuiuOperationWaitC2Ei @ 30 NONAME
+ _ZN18CMuiuOperationWaitD0Ev @ 31 NONAME
+ _ZN18CMuiuOperationWaitD1Ev @ 32 NONAME
+ _ZN18CMuiuOperationWaitD2Ev @ 33 NONAME
+ _ZTI17UniEditorGenUtils @ 34 NONAME
+ _ZTI18CMuiuOperationWait @ 35 NONAME
+ _ZTV17UniEditorGenUtils @ 36 NONAME
+ _ZTV18CMuiuOperationWait @ 37 NONAME
--- a/messagingapp/msgutils/unieditorutils/editorgenutils/inc/UniEditorGenUtils.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgutils/unieditorutils/editorgenutils/inc/UniEditorGenUtils.h Sun Jul 25 18:59:19 2010 +0530
@@ -45,7 +45,7 @@
class CMsgMediaResolver;
// CLASS DECLARATION
-class MUIU_UTILS_EXPORT UniEditorGenUtils
+class MUIU_UTILS_EXPORT UniEditorGenUtils :public CBase
{
public:
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -28,8 +28,7 @@
QObject(parent)
{
int error;
- TRAP( error, d_ptr = CUniEditorMmsPluginPrivate::NewL());
- QDEBUG_WRITE_FORMAT("UniEditorMmsPlugin returning with ",error);
+ QT_TRAP_THROWING( d_ptr = CUniEditorMmsPluginPrivate::NewL());
}
//---------------------------------------------------------------
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmsreadfile.h Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,471 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#ifndef MMSREADFILE_H
-#define MMSREADFILE_H
-
-// INCLUDES
-#include <e32base.h>
-#include <badesca.h>
-#include <f32file.h>
-#include <msvstd.h>
-
-// forward references
-class CMmsAttaStructure;
-class CMmsHeaders;
-class CEikonEnv;
-class CMmsClientMtm;
-
-// Out-of-range value for any MMS header with assigned number
-// Used in coverage tests to get coverage for "default" branches
-// in "case" statements.
-const TInt KMmsTestIllegalValue = 255;
-
-//
-// TEST KEY WORDS
-// Extended to include all MMS headers to allow generation of arbitrary PDUs
-// Content type header cannot be separately defined,
-// it will always be "multipat/mixed" or "multipart/related"
-_LIT8( KTestEndOfFile, "EOF" );
-_LIT8( KTestNewMessage, "MESSAGE BEGIN" );
-//------------------------------------------------
-_LIT8( KTestMessageType, "MESSAGE-TYPE" ); //X-Mms-Message-Type
-_LIT8( KTestDate, "DATE" ); // Date
-_LIT8( KTestFrom, "FROM" ); // From
-_LIT8( KTestTo, "TO" ); // To
-_LIT8( KTestCc, "CC" ); // Cc
-_LIT8( KTestBcc, "BCC" ); // Bcc
-_LIT8( KTestSubject, "SUBJECT" ); // Subject
-_LIT8( KTestExpiryRel, "EXPIRY-REL" ); // X-Mms-Expiry, relative
-_LIT8( KTestExpiryAbs, "EXPIRY-ABS" ); // X-Mms-Expiry, absolute
-_LIT8( KTestDeliveryTimeRel, "DELIVERY-TIME-REL" ); // X-Mms-Delivery-Time, relative
-_LIT8( KTestDeliveryTimeAbs, "DELIVERY-TIME-ABS" ); // X-Mms-Delivery-Time, absolute
-_LIT8( KTestPriority, "PRIORITY" ); // X-Mms-Priority
-_LIT8( KTestSenderVisibility, "SENDER-VISIBILITY" ); // X-Mms-Sender-Visibility
-_LIT8( KTestDeliveryReport, "DELIVERY-REPORT" ); // X-Mms-Delivery-Report
-_LIT8( KTestReadReply, "READ-REPLY" ); // X-Mms-Read-Report
-// ---------------------------------------------------
-_LIT8( KTestNewAttachment, "ATTACHMENT" );
-_LIT8( KTestAttachmentType, "ATTACHMENTTYPE" );
-_LIT8( KTestAttachmentName, "ATTACHMENTNAME" );
-_LIT8( KTestAttachmentContLoc, "ATTACHMENTCONTLOC" );
-_LIT8( KTestAttachmentCharset, "ATTACHMENTCHARSET" );
-_LIT8( KTestAttachmentCid, "ATTACHMENTCID" );
-_LIT8( KTestAttachmentRoot, "ATTACHMENTROOT" );
-// content-type and x-type parameters for attachments
-// should appear in name-value pairs.
-// Test program is not responsible for verifying illegal scripts
-_LIT8( KTestAttContTypeParamName, "ContTypeParamName" );
-_LIT8( KTestAttContTypeParamValue, "ContTypeParamValue" );
-_LIT8( KTestAttXTypeParamName, "X-TypeParamName" );
-_LIT8( KTestAttXTypeParamValue, "X-TypeParamValue" );
-// -----------------------------------------------------
-_LIT8( KTestMessageClass, "MESSAGE-CLASS" ); // X-Mms-Message-Class
-_LIT8( KTestDelivRepSendAllow, "DELIV-REP-SEND-ALLOW" ); // X-Mms-Report-Allowed
-_LIT8( KTestAcceptAdvertis, "ACCEPT-ADVERTISEMENTS" );
-_LIT8( KTestRetryCount, "RETRY-COUNT" );
-_LIT8( KTestRetryInterval, "RETRY-INTERVAL" );
-// -------------------------------------------------
-_LIT8( KTestAlias, "ALIAS" );
-_LIT8( KTestFromAlias, "FROMALIAS" );
-_LIT8( KTestToAlias, "TOALIAS" );
-_LIT8( KTestCcAlias, "CCALIAS" );
-_LIT8( KTestBccAlias, "BCCALIAS" );
-// -------------------------------------------------
-// more Message headers to allow testing all possible PDUs and
-// MMS 1.1 headers
-_LIT8( KTestReplyCharging, "REPLY-CHARGING" ); // X-Mms-Reply-Charging
-_LIT8( KTestReplyChargAbs, "REPLY-CHARG-DEADLINE-ABS" ); // X-Mms-Reply-Charging, absolute
-_LIT8( KTestReplyChargRel, "REPLY-CHARG-DEADLINE-REL" ); // X-Mms-Reply-Charging, relative
-_LIT8( KTestReplyChargSize, "REPLY-CHARG-SIZE" ); // X-Mms-Reply-Charging-Size (octets)
-_LIT8( KTestReplyChargID, "REPLY-CHARGING-ID" ); // X-Mms-Reply-Charging-ID
-_LIT8( KTestTID, "TID" );
-_LIT8( KTestContentLocation, "CONTLOC" ); // X-Mms-Content-Location
-// The following three must appear as triplets.
-// index must be first, address and date may appear in any order
-_LIT8( KTestPreviouslySentIndex, "PREVIOUSINDEX" ); // forwarded count for X-Mms-PreviouslySent headers
-_LIT8( KTestPreviouslySentBy, "PREV-SENT-BY" ); // X-Mms-Previously-Sent-By
-_LIT8( KTestPreviouslySentDate, "PREV-SENT-DATE" ); // X-Mms-Previously-Sent-Date
-//---
-_LIT8( KTestMessageId, "MESSAGE-ID" ); // Message-ID
-_LIT8( KTestMessageSize, "MESSAGE-SIZE" ); // X-Mms-Message-Size (octets)
-_LIT8( KTestVersion, "MMS-VERSION" ); // X-MMS-Version (hex:, 10 = 1.0, 11 = 1.1 etc. )
-_LIT8( KTestReadStatus, "READ-STATUS" ); // X-Mms-Read-Status
-_LIT8( KTestResponseStatus, "RESPONSE-STATUS" ); // X-Mms-Response-Status
-_LIT8( KTestResponseText, "RESPONSE-TEXT" ); // X-Mms-Response-Text
-_LIT8( KTestRetrieveStatus, "RETRIEVE-STATUS" ); // X-Mms-Retrieve-Status
-_LIT8( KTestRetrieveText, "RETRIEVE-TEXT" ); // X-Mms-Retrieve-Text
-_LIT8( KTestStatus, "STATUS" ); // X-Mms-Status
-// -------------------------------------------------
-// MMS 1.2 headers
-_LIT8( KTestAttribute, "ATTRIBUTE" ); // X-Mms-Attribute
-// The value should be one of the following:
-// BCC, CC, CONTENT, CONTENT-TYPE, DATE, DELIVERY-REPORT, DELIVERY-TIME-ABS,
-// EXPIRY-ABS, FROM, MESSAGE-CLASS, MESSAGE-ID, MESSAGE-SIZE, PRIORITY,
-// READ-REPLY, SUBJECT, TO, REPLY-CHARGING, REPLY-CHARGING-ID,
-// REPLY-CHARG-DEADLINE-ABS, REPLY-CHARG-SIZE, PREV-SENT-BY,
-// PREV-SENT-DATE, ADDITIONAL-HEADERS
-_LIT8( KTestDistributionIndicator, "DISTRIBUTION-INDICATOR" ); // X-Mms-Distribution-Indicator
-_LIT8( KTestLimit, "LIMIT" ); // X-Mms-Limit
-_LIT8( KTestMessageQuota, "MESSAGE-QUOTA" ); // X-Mms-Mbox-Quota, message number
-_LIT8( KTestSizeQuota, "SIZE-QUOTA" ); // X-Mms-Mbox-Quota, size quota
-_LIT8( KTestMessageTotal, "MESSAGE-TOTAL" ); // X-Mms-Mbox-Totals, message number
-_LIT8( KTestSizeTotal, "SIZE-TOTAL" ); // X-Mms-Mbox-Totals, total size
-_LIT8( KTestMessageCount, "MESSAGE-COUNT" ); // X-Mms-Message-Count
-_LIT8( KTestAddKeyword, "ADD-KEYWORD" ); // X-Mms-MM-Flags
-_LIT8( KTestRemoveKeyword, "REMOVE-KEYWORD" ); // X-Mms-MM-Flags
-_LIT8( KTestFilterKeyword, "FILTER-KEYWORD" ); // X-Mms-MM-FLags
-_LIT8( KTestMMState, "MESSAGE-STATE" ); // X-Mms-MM-State
-_LIT8( KTestQuota, "QUOTA" ); // X-Mms-Quotas
-_LIT8( KTestStart, "START" ); // X-Mms-Start
-_LIT8( KTestStore, "STORE" ); // X-Mms-Store
-_LIT8( KTestStored, "STORED" ); // X-Mms-Stored
-_LIT8( KTestStoreStatus, "STORE-STATUS" ); // X-Mms-Store-Status
-_LIT8( KTestStoreStatusText, "STORE-STATUS-TEXT" ); // X-Mms-Store-Status-Text
-_LIT8( KTestTotals, "TOTALS" ); // X-Mms-Totals
-// Delete confirmation header structure
-// This consists of index, content location, response status and response status text.
-// All three values are not always necessary for each index, but at least content-location
-// and response status should be present.
-// The index retains its value until a new index is encountered.
-_LIT8( KTestDeleteInfoIndex, "DELETESTATUSINDEX" ); // index for next delete info fields
-// This header must precede content-location, response-status and response-text fields
-// in a delete confirmation. Index retains its value until a new index is encountered.
-
-// Element descriptor header not implemented
-
-// Application id headers
-// These will officially be supported in MMS encapsulation version 1.3
-// Java has non-standard support even earlier
-
-_LIT8( KTestApplicId, "APPLIC-ID" ); // X-Mms-Applic-ID
-_LIT8( KTestReplyApplicId, "REPLY-APPLIC-ID" ); // X-Mms-Reply-Applic-ID
-_LIT8( KTestApplicInfo, "AUX-APPLIC-INFO" ); // X-Mms-Aux-Applic-Info
-
-// Since Encapsulation 1.3
-_LIT8( KTestContentClass, "CONTENT-CLASS" ); // X-Mms-Content-Class
-_LIT8( KTestDrmContent, "DRM-CONTENT" ); // X-Mms-DRM-Content
-_LIT8( KTestAdaptationAllowed, "ADAPTATION-ALLOWED" ); // X-Mms-Adaptation-Allowed
-_LIT8( KTestRecommendedRetrievalMode, "REC-RETRIEVAL-MODE" ); // X-Mms-Recommended-Retrieval-Mode
-_LIT8( KTestRecRetrievalModeText, "REC-RETR-MODE-TEXT" ); // X-Mms-Recommended-Retrieval-Mode-Text
-_LIT8( KTestReplaceId, "REPLACE-ID" ); // X-Mms-Replace-ID
-_LIT8( KTestStatusText, "STATUS-TEXT" ); // X-Mms-Status-Text
-_LIT8( KTestCancelId, "CANCEL-ID" ); // X-Mms-Cancel-ID
-_LIT8( KTestCancelStatus, "CANCEL-STATUS" ); // X-Mms-Cancel-Status
-
-// DATA TYPES
-#define aSet 1
-#define aReset 0
-#define PartCount 100
-#define MaxAttaCount 10
-#define DefaultBufLen 256
-#define MaxRecipients 5
-
-// status returned by ReadRow
-enum TTestReadStatus
- {
- ETestUnknown,
- ETestNewMessage,
- ETestNewAttachment,
- ETestEof, // End of file
- ETestMessageType,
- ETestDate,
- ETestFrom,
- ETestTo,
- ETestCc,
- ETestBcc,
- ETestAlias,
- ETestFromAlias,
- ETestToAlias,
- ETestCcAlias,
- ETestBccAlias,
- ETestSubject,
- ETestExpiryRel,
- ETestExpiryAbs,
- ETestDeliveryTimeRel,
- ETestDeliveryTimeAbs,
- ETestPriority,
- ETestSenderVisibility,
- ETestDeliveryReport,
- ETestReadReply,
- ETestAttachmentType,
-// ETestAttachmentName,
- ETestAttachmentCharset,
- ETestAttachmentCid,
- ETestAttachmentRoot,
- ETestSettings,
- ETestMessageClass,
- ETestDelivReportSendAllow,
- ETestSingleMessageClass,
- ETestReplyCharging,
- ETestReplyChargAbs,
- ETestReplyChargRel,
- ETestReplyChargSize,
- ETestReplyChargID,
- ETestTID,
- ETestContentLocation,
- ETestPreviouslySentIndex,
- ETestPreviouslySentBy,
- ETestPreviouslySentDate,
- ETestMessageId,
- ETestMessageSize,
- ETestVersion,
- ETestReadStatus,
- ETestResponseStatus,
- ETestResponseText,
- ETestRetrieveStatus,
- ETestRetrieveText,
- ETestStatus,
- ETestAttribute,
- ETestDistributionIndicator,
- ETestLimit,
- ETestMessageQuota,
- ETestSizeQuota,
- ETestMessageTotal,
- ETestSizeTotal,
- ETestMessageCount,
- ETestAddKeyword,
- ETestRemoveKeyword,
- ETestFilterKeyword,
- ETestMMState,
- ETestQuota,
- ETestStart,
- ETestStore,
- ETestStored,
- ETestStoreStatus,
- ETestStoreStatusText,
- ETestTotals,
- ETestDeleteInfoIndex,
- ETestApplicId,
- ETestReplyApplicId,
- ETestApplicInfo,
- ETestContentClass,
- ETestDrmContent,
- ETestAdaptationAllowed,
- ETestRecommendedRetrievalMode,
- ETestRecRetrievalModeText,
- ETestReplaceId,
- ETestStatusText,
- ETestCancelId,
- ETestCancelStatus,
- ETestAttaRecommendedName,
- ETestAttachmentContLoc,
- ETestAttContTypeParamName,
- ETestAttContTypeParamValue,
- ETestAttXTypeParamName,
- ETestAttXTypeParamValue
-
- };
-
-// VALUE KEYWORDS
-_LIT( KPersonal, "Personal" );
-_LIT( KAdvertisement, "Advertisement" );
-_LIT( KInformational, "Informational" );
-_LIT( KAuto, "Auto" );
-_LIT( KLow, "Low" );
-_LIT( KNormal, "Normal" );
-_LIT( KHigh, "High" );
-_LIT( KHide, "Hide" );
-_LIT( KShow, "Show" );
-_LIT( KYes, "Yes" );
-_LIT( KNo, "No" );
-_LIT( KOn, "On" );
-_LIT( KOff, "Off" );
-_LIT( KDeferred, "Deferred" );
-_LIT( KExpired, "Expired" );
-_LIT( KRetrieved, "Retrieved" );
-_LIT( KRejected, "Rejected" );
-_LIT( KUnrecognized, "Unrecognized" );
-_LIT( KIndeterminate, "Indeterminate" );
-_LIT( KForwarded, "Forwarded" );
-_LIT( KUnreachable, "Unreachable" );
-_LIT( KDraft, "Draft");
-_LIT( KSent, "Sent" );
-_LIT( KNew, "New" );
-// X-Mms-Message-Type
-_LIT( KSendReq, "SendReq" );
-_LIT( KSendConf, "SendConf" );
-_LIT( KNotifInd, "NotifInd" );
-_LIT( KNotifResp, "NotifResp" );
-_LIT( KRetrConf, "RetrConf" );
-_LIT( KAckInd, "AckInd" );
-_LIT( KDelInd, "DelInd" );
-_LIT( KReadReqInd, "ReadReqInd" );
-_LIT( KReadOrigInd, "ReadOrigInd" );
-_LIT( KForwardRec, "ForwardReq" );
-_LIT( KForwardConf, "ForwardConf" );
-_LIT( KMBoxStoreReq, "MBoxStoreReq" );
-_LIT( KMBoxStoreConf, "MBoxStoreConf" );
-_LIT( KMBoxViewReq, "MBoxViewReq" );
-_LIT( KMBoxViewConf, "MBoxViewConf" );
-_LIT( KMBoxUploadReq, "MBoxUploadReq" );
-_LIT( KMBoxUploadConf, "MBoxUploadConf" );
-_LIT( KMBoxDeleteReq, "MBoxDeleteReq" );
-_LIT( KMBoxDeleteConf, "MBoxDeleteConf" );
-_LIT( KMBoxDescr, "MBoxDescr" );
-_LIT( KDeleteReq, "DeleteReq" );
-_LIT( KDeleteConf, "DeleteConf" );
-_LIT( KCancelReq, "CancelReq" );
-_LIT( KCancelResp, "CancelConf" );
-// X-Mms-Read-Status
-_LIT( KRead, "Read" );
-_LIT( KDelNotRead, "DeletedNotRead" );
-// X-Mms-Reply-Charging
-_LIT( KRequested, "Requested" );
-_LIT( KReqTextOnly, "ReqTextOnly" );
-_LIT( KAccepted, "Accepted" );
-_LIT( KAccTextOnly, "AccTextOnly" );
-// X-Mms-Cancel-Status (only receival of request, not actual cancellation)
-_LIT( KCancelSuccessful, "CancelSuccess" );
-_LIT( KCancelCorrupted, "CancelCorrupted" );
-// X-Mms-Content-Class
-_LIT( KText, "Text" );
-_LIT( KImageBasic, "ImageBasic" );
-_LIT( KImageRich, "ImageRich" );
-_LIT( KVideoBasic, "VideoBasic" );
-_LIT( KVideoRich, "VideoRich" );
-_LIT( KMegaPixel, "MegaPixel" );
-_LIT( KContentBasic, "ContentBasic" );
-_LIT( KContentRich, "ContentRich" );
-// X-Mms-Recommended-Retrieval-Mode
-_LIT( KManual, "Manual" );
-
-//X-Mms-ResponseStatus
-// legacy values
-_LIT( KOk, "OK" );
-_LIT( KErrUnspecified, "Unspecified" );
-_LIT( KErrServiceDenied, "ServiceDenied" );
-_LIT( KErrMessageFormatCorrupt, "FormatCorrupt" );
-_LIT( KErrAddressUnresolved, "AddressUnresolved" );
-_LIT( KErrMessageNotFound, "MessageNotFound" );
-_LIT( KErrNetworkProblem, "NetworkProblem" );
-_LIT( KErrContentNotAccepted, "ContentNotAccepted" );
-_LIT( KErrUnsupportedMessage, "UnsupportedMessage" );
-// values since 1.1 (and 1.2)
-_LIT( KErrTransient, "TransientFailure" );
-_LIT( KErrTransientAddressUnresolved, "TransientAddressUnresolved" );
-_LIT( KErrTransientNotFound, "TransientMessageNotFound" );
-_LIT( KErrTransientNetworkproblem, "TransientNetworkProblem" );
-_LIT( KErrTransientPartialSuccess, "PartialSuccess" );
-_LIT( KErrPermanent, "PermanentFailure" );
-_LIT( KErrPermanentServiceDenied, "PermanentServiceDenied" );
-_LIT( KErrPermanentMessageFormatCorrupt, "PermanentFormatCorrupt" );
-_LIT( KErrPermanentAddressUnresolved, "PermanentAddressUnresolved" );
-_LIT( KErrPermanentNotFound, "PermanentMessageNotFound" );
-_LIT( KErrPermanentContentNotAccepted, "PermanentContentNotAccepted" );
-_LIT( KErrReplyChargingLimitNotMet, "ReplyChargingLimitNotMet" );
-_LIT( KErrReplyChargingRequestNotAccepted, "ReplyChargingRequestNotAccepted" );
-_LIT( KErrReplyChargingForwardingDenied, "ReplyChargingForwardingDenied" );
-_LIT( KErrReplyChargingNotSupported, "ReplyChargingNotSupported" );
-_LIT( KErrAddressHidingNotSupported, "AddressHidingNotSupported" );
-_LIT( KErrPermanentLackOfPrepaid, "PermanentLackOfPrepaid" );
-//X-Mms-RetrieveStatus (one extra value)
-_LIT( KErrRetrieveContentUnsupported, "PermanentContentUnsupported" );
-//X-Mms-Store-Status (one extra value)
-_LIT( KErrMMBoxFull, "MMBoxFull" );
-
-_LIT8( KTestContent, "Content" ); // For attribute list only
-_LIT8( KTestAdditionalHeaders, "ADDITIONAL-HEADERS" ); // For attribute list only
-_LIT8( KTestDeliveryTime, "DELIVERY-TIME"); // for attribute list only
-_LIT8( KTestExpiry, "EXPIRY"); // for attribute list only
-_LIT8( KTestReplyCharg, "REPLY-CHARG-DEADLINE" ); // for attribute list only
-_LIT8( KTestContentType, "CONTENT-TYPE" ); // for attribute list only
-
-/**
-* CMmsReadFile
-*/
-NONSHARABLE_CLASS( CMmsReadFile ):public CBase
- {
- public: // Constructors and destructor
-
- static CMmsReadFile* NewL(RFs& aFs, RFileReadStream& aReadStream ); // Two-phased constructor.
- virtual ~CMmsReadFile(); // Destructor
-
- public: // New functions
-
- TInt CompleteTestL(TInt aMessageCounter, CMmsHeaders& aMmsHeaders);
- TTestReadStatus ReadRowL();
- void CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders );
- TInt FindAlias(TPtrC alias);
- void SetAttaStructure( TBool aOldAttaStructure = EFalse );
-
- protected: // Functions from base classes
-
- private:
-
- CMmsReadFile(); // C++ default constructor.
- // By default constructor is private.
- void ConstructL( RFs& aFs, RFileReadStream& aReadStream );
- void Reset();
-
- public: // data
- TInt iMessageType;
-
-
- private: // Data
-
- RFs iFs;
- RFileReadStream* iReader;
- TBuf<DefaultBufLen> iValueBuffer;
- CDesCArray* iAliasArray; // aliases
- HBufC8* iByteBuffer;
- TTime iDate;
- CArrayPtrFlat<CMmsAttaStructure>* iAttaStructures;
- TInt iAttaCount;
- TInt iAttaRoot;
- TInt iAliasCount;
- TInt iNextMessageType;
- TParse iParse;
- TFileName iFilename;
-
- protected: // Data
- private: // Data
-
- // CArrayFixFlat <TestMessage>* iMessages;
-
- public: // Friend classes
- protected: // Friend classes
- private: // Friend classes
-
- };
-
-
-NONSHARABLE_CLASS( CMmsAttaStructure ):public CBase
- {
- public: // Constructors and destructor
- static CMmsAttaStructure* NewL(); // Two-phased constructor.
- virtual ~CMmsAttaStructure(); // Destructor
- private:
- CMmsAttaStructure(); // C++ default constructor.
- // By default constructor is private.
- void ConstructL();
-
- public: // Data
- HBufC8* iAtta;
- HBufC8* iAttaName; // content location
- HBufC8* iAttaType;
- HBufC8* iAttaCid;
- TInt iAttaCharset;
- HBufC* iAttaRecommendedName; // recommended filename
- CDesC8ArrayFlat* iContentTypeParams; // zero or more "parameter"
- CDesC8ArrayFlat* iXTypeParams; // zero or more X-Type "parameters"
-
- };
-
-
-#endif // MMSREADFILE_H
-
-// End of File
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmstestbed.h Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#ifndef MMSTESTBED_H
-#define MMSTESTBED_H
-
-#ifdef BUILD_MMSTESTBED_DLL
-#define MMSTESTBED_EXPORT Q_DECL_EXPORT
-#else
-#define MMSTESTBED_EXPORT Q_DECL_IMPORT
-#endif
-
-#include <QObject>
-#include <QString>
-
-#include <msvids.h> //for consts like KMsvNullIndexEntryIdValue
-#include <MSVAPI.H>
-#include <MTCLREG.H>
-#include <mmsclient.h>
-//#include <mmsservercommon.h>
-
-class CTestUiTimer;
-class CMsvSession;
-class CMmsClientMtm;
-class CMmsSettings;
-class CMmsHeaders;
-class CLogEvent;
-class CLogViewEvent;
-class CLogFilter;
-class CLogClient;
-
-class MMSTESTBED_EXPORT MmsTestBed : public QObject, public MMsvSessionObserver
- {
- Q_OBJECT
-
-public:
- /**
- *
- */
- MmsTestBed();
- ~MmsTestBed();
- void setConnectionLocal(bool value);
- void fromOutboxToMmsc();
- void fromMmscToInbox();
- /**
- * cleanup MMS service
- */
- void cleanupAndCreateNewService();
- void deleteNotifications();
- void restoreFactorySettings();
- void setFetchingState( TMmsReceivingMode aState );
- void sendFromFile();
- void sendOneByOne();
- void sendNotifications();
- void copyDrafts();
- void garbageCollection(TUint32 aReason = 0x00000001); //0x00000001 == KMmsReasonBoot
- void messageVariation();
- void cancelSendScheduling();
- void scheduledSend(TMsvId aBoxId, TInt aDelay = 5);
- void deleteSendSchedule();
- void cancelFetchScheduling();
- void fetchForced(TInt aDelay = 5);
- void deleteFetchSchedule();
- void doAFetchCycle();
- void createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry);
- void cleanOutbox();
- void cleanInbox();
- void cleanSent();
- void cleanDrafts();
- void cleanAll();
- void reply();
- void replyToAll();
- void forward();
- void sendReadReport(); // send a read report
- int fromOutboxToMmscWithMemoryFailure(); // returns memory failure count
- int fromMmscToInboxWithMemoryFailure(); // returns memory failure count
- void sendViaClient();
- void scheduledFetch(TInt aDelay = 5);
- void fetchForcedImmediate();
- void getEventType();
- void addEventType();
- void deleteEventType();
- void cleanLog();
- void setOnline(bool value);
- void generateDeliveryReport( CMmsHeaders* aMmsHeaders );
- void sendDeliveryReport();
-
-signals:
- void entryCreatedInDraft(long int id);
- void entryMovedToOutbox(long int id);
- void entryMovedToSent(long int id);
- void entryCreatedInInbox(long int id);
-
-protected:
- /**
- * From MMsvSessionObserver
- */
- void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
- TAny* aArg2, TAny* aArg3);
-
-private:
- void findDefaultL();
- void createMmsService();
- void cleanup();
- void deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry);
- void testFile(TFileName& aFilePath, TInt aCommand = 0, TMsvId aBox = KMsvGlobalOutBoxIndexEntryId);
- void addMMBoxDescriptions();
- void encodeMessageFromDrafts();
- TMsvId findMMSFolder();
- bool checkLogClient();
- int getLogEntries();
-
-private:
- //data
- CTestUiTimer* iTimer;
- CMsvOperationActiveSchedulerWait* iWait;
- CMsvSession* iSession;
- CClientMtmRegistry* iClientMtmRegistry;
- CMmsClientMtm* iMmsClient;
- CMmsSettings* iSettings;
- CMmsHeaders* iMmsHeaders;
- TMsvId iServiceId;
- TMsvId iDefaultServiceId;
- TMsvSessionEvent iEvent;
- RFs iFs;
- TFileName iFilename;
- TFileName iCurrentFile;
- TFileName iCurrentPath;
- TParse iParse; // parse buffer as member to save stack space
- CBufFlat* iEncodeBuffer;
- CMsvEntrySelection* iMsvEntrySelection;
- CLogEvent* iLogEvent;
- CLogClient* iLogClient;
- CLogViewEvent* iLogView;
- CLogFilter* iLogFilter;
- };
-
-#endif // MMSTESTBED_H
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmstestbed.hrh Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#include <bldvariant.hrh>
-
-
-#ifndef MMSTESTBED_HRH
-#define MMSTESTBED_HRH
-
-enum
-{
- EAppMainOk = 1,
- EAppMainCancel,
- //
- EMenufrmCmdCascadeTest,
- ECleanup,
- ECleanOutbox,
- ESaveSettings,
- ELoadSettings,
- ECleanInbox,
- EShowIn,
- EShowOut,
- EOutToMMSC,
- EMMSCToIn,
- ESendScheduled,
- EReceiveScheduled,
- EShowSent,
- ECleanSent,
- EStartMyNotifier,
- EGetEventType,
- EAddEventType,
- EDeleteEventType,
- EViewLog,
- ECleanLog,
- EShowWapAccessPoints,
- ESelectWapAccessPoint,
- EShowConnectionMode,
- EShowIAP,
- EConnectToIAP,
- EDeleteSendSchedule,
- EDeleteReceiveSchedule,
- EDeleteNotifications,
- ERestoreFactorySettings,
- ECreateFromFile,
- EShowNotifications,
- ESendDeliveryReport,
- EShowDrafts,
- ECleanDrafts,
- ECleanAll,
- EFetchingDeferred,
- EFetchingOn,
- ESendFromFile,
- ESwitchToLocal,
- ESwitchToGlobal,
- EDecodeLoggingOn,
- EDecodeLoggingOff,
- EBinaryDumpOn,
- EBinaryDumpOff,
- ESendNotification,
- ECreateToInbox,
- ECreateToSentItems,
- ESendFromDrafts,
- EFindMMSFolder,
- ESendOneByOne,
- ECreateToDrafts,
- ESendViaClient,
- ESendMemFail,
- EFetchMemFail,
- EReceiveForced,
- ECreateHeadersFromFile,
- ESwitchToOffline,
- ESwitchToOnline,
- ECopyDrafts,
- ECreateNotification,
- EReply,
- EReplyToAll,
- EForward,
- EFetchingManual,
- EFirstBoot,
- ENoFirstBoot,
- EFindNetworkStatus,
- ESendReadReport,
- ECreateMMBoxViewConf,
- EGetMMBoxView,
- ECleanMMBox,
- EShowMMBox
-};
-
-#define ETestLabel1 1
-#define ETestLabel2 2
-#define ETestLabel3 3
-#define ETestLabel4 4
-
-#define EServiceList 2
-
-
-enum TTestBedDlgCtrlIds
- {
- ETestEditField = 1
- };
-
-enum TEditServiceControls
- {
- EFolderLabel = 1,
- EEditUri
-// EEditServiceFolder,
-// ENameLabel,
-// EEditServiceName,
-// ENumberLabel,
-// EEditServiceNumber
- };
-
-enum
- {
- EFsViewDialogId = 1
- };
-
-#endif
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmsteststaticutils.h Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,203 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#ifndef MMSTESTSTATICUTILS_H
-#define MMSTESTSTATICUTILS_H
-
-#include <e32std.h>
-#include <msvstd.h>
-#include <badesca.h>
-
-#include "mmsconst.h"
-
-class RFs;
-class CMsvSession;
-class CMmsEncode;
-class CMmsHeaders;
-
-#ifdef __WINS__
-_LIT( KRootPath, "c:\\" );
-#else
-// This is removable disk.
-// drive letter should not be hard coded, must be investigated further
-// We use c: for a while for the tests (to be cahnged later)
-_LIT( KRootPath, "c:\\" );
-//_LIT( KRootPath, "e:\\" );
-#endif
-
-// directory where mmbox descriptions are created
-_LIT( KMmsMMBoxDescriptionDirectory, "C:\\mmsmmboxdescriptions\\");
-// directory where created headers are dumped
-_LIT( KMmsDumpDirectory, "C:\\mmsdump\\");
-// content type of MMS PDUs
-_LIT8( KMmsMimeType, "application/vnd.wap.mms-message" );
-
-_LIT( KWild, "*" );
-
-
-/**
- * joined array structure
- *
- */
-NONSHARABLE_CLASS( TMmsJoinedArrays ): public MDesCArray
- {
-public:
- TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2);
- TInt MdcaCount() const;
- TPtrC16 MdcaPoint(TInt aIndex) const;
-private:
- CDesCArray* const & iArray1;
- CDesCArray* const & iArray2;
- };
-
-/**
- * static utility functions
- *
- */
-class TMmsTestUtils
- {
-
-public:
-
- /**
- *
- */
- TMmsTestUtils();
-
- /**
- * read phone number for sending messages
- *
- * @param aFileName full path for filename
- * @param aFs file system handle
- * @return allocated pointer containing the name
- * The caller must delete the pointer when no longer needed
- */
- static HBufC* ReadContactFromFileL( TDesC& aFileName, RFs& aFs );
-
- static void DecodeLoggingOnL();
- static void DecodeLoggingOffL();
- static void BinaryDumpOnL();
- static void BinaryDumpOffL();
-
- /**
- * Clean all temporary directories used in local mode.
- * Does not delete the directories, only the contents
- *
- * @param aFs file system handle
- */
- static void CleanDirectoryL( RFs& aFs );
-
- /**
- * Dump a binary message
- *
- * @param aBuffer buffer containing the binary message
- * @param aFilename full path of the directory whenre the dump goes
- * @param aParse reference to parser (to save stack space)
- * @param aFs file system handle
- */
- static void Dump(
- CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs );
-
- /**
- * Delete all MMS messages and notifications from a given folder
- *
- * @param aBoxId folder id
- * @param aSession Messaging server session
- */
- static void CleanBoxL(TMsvId aBoxId, CMsvSession& aSession);
-
- /**
- * turn on logging messages sent to email addresses
- */
- static void EmailLoggingOnL();
-
- /**
- * turn off logging messages sent to email addresses
- */
- static void EmailLoggingOffL();
-
- /**
- * load list of children into selection and return count
- *
- * @param aBoxId folder id
- * @param aMsvEntrySelection reference to a pointer that will contain the list of child ids
- * caller is responsible of deleting the pointer afterwards.
- * Pointer may be NULL at entry, and a new pointer will be allocated
- * @param aSession messge server session
- * @param aMessageType child MTM type, default is multimedia message
- * @return number of entries in selection
- */
- static TInt CountChildrenL(
- TMsvId aBoxId,
- CMsvEntrySelection*& aMsvEntrySelection,
- CMsvSession& aSession,
- TUid aMessageType = KUidMsgTypeMultimedia);
-
- /**
- * Create a folder entry
- *
- * @param aSession messge server session
- * @param aParentFolder the parent folder
- * @param aFolderName name of the folder
- * @param aFolderId will contain the if of the new folder if creation was successful
- */
- static void CreateFolderEntryL(
- CMsvSession& aSession,
- TMsvId aParentFolder,
- const TDesC& aFolderName,
- TMsvId& aFolderId );
-
- /**
- * Create an MMS notification from data in buffer
- * @param aNotificationFolder mms notification folder (target folder)
- * @param aServiceId id of MMS service
- * @param aEncodeBuffer buffer that contains the data
- * @param aSession message server session
- * @return id of the created notification
- */
- static TMsvId CreateNotificationEntryL(
- TMsvId aNotificationFolder,
- TMsvId aServiceId,
- CBufFlat* aEncodeBuffer,
- CMsvSession& aSession );
-
- /**
- * Encode an MMS notification into buffer
- * @param aUrl url of the notification for local messages a filepath
- * @param aSize size of the message
- * @param aMmsHeaders MMS headers structure for creating the notification
- * @param aMmsEncoder reference to CMmsEncode class
- * @param aEncodeBuffer flat buffer that will contain the encoded notification
- */
- static void FormNotification(
- TDesC8& aUrl,
- TInt aSize,
- CMmsHeaders& aMmsHeaders,
- CMmsEncode& aMmsEncoder,
- CBufFlat* aEncodeBuffer );
-
-
- static TBool IsDrive(const TDesC& aFileName);
- static TBool IsDir(const TDesC& aFileName, RFs& aFs);
- static TBool IsFile(const TDesC& aFileName, RFs& aFs);
-
-
-private:
-
- };
-
-
-#endif // MMSTESTSTATICUTILS_H
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmstestuitimer.h Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#ifndef C_TESTUITIMER_H
-#define C_TESTUITIMER_H
-
-
-#include <e32base.h>
-
-#define KPeriod 10000 // period of timer
-
-/**
- * timer for test programs
- */
-NONSHARABLE_CLASS( CTestUiTimer ): public CTimer
- {
-public:
-
- static CTestUiTimer* NewL();
- virtual ~CTestUiTimer();
-
- void RunL();
- void DoCancel();
- void ConstructL();
- void IssueRequest();
- void TimeoutOperation(CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds);
-
-private:
- CTestUiTimer();
-
-public:
- TTimeIntervalMicroSeconds32 period;
-
-private: // data
- CActive* iObject;
- };
-
-#endif // C_TESTUITIMER_H
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/mmstestbed.pro Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-QT += testlib
-QT -= gui
-
-TEMPLATE = lib
-
-TARGET = mmstestbed
-
-INCLUDEPATH += .
-INCLUDEPATH += inc
-INCLUDEPATH += ../../inc
-INCLUDEPATH += ../../../../../../../mmsengine/inc
-INCLUDEPATH += ../../../../../../../mmsengine/mmscodec/inc
-INCLUDEPATH += ../../../../../../../mmsengine/mmshttptransport/inc
-INCLUDEPATH += ../../../../../../../mmsengine/mmsmessage/inc
-INCLUDEPATH += ../../../../../../../mmsengine/mmsconninit/inc
-#INCLUDEPATH += ../../../mmsengine/mmscodec/inc
-INCLUDEPATH += ../../../../../../../mmsengine/mmsserver/inc
-INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
-
-DEFINES += BUILD_MMSTESTBED_DLL
-
-SOURCES += src/mmstestbed.cpp \
- src/mmsteststaticutils.cpp \
- src/mmsreadfile.cpp \
- src/mmstestuitimer.cpp
-
-HEADERS += inc/mmstestbed.h \
- inc/mmsteststaticutils.h \
- inc/mmsreadfile.h \
- inc/mmstestuitimer.h \
- inc/mmstestbed.hrh
-
-SYMBIAN_PLATFORMS = WINSCW ARMV5
-
-symbian {
- TARGET.CAPABILITY = CAP_GENERAL_DLL
- TARGET.EPOCSTACKSIZE = 0x8000
- TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
- TARGET.EPOCALLOWDLLDATA = 1
- }
-
-# Build.inf rules
-BLD_INF_RULES.prj_exports += \
- "$${LITERAL_HASH}include <platform_paths.hrh>"
-
-LIBS += -lmsgs \
- -lmmsmessage \
- -lmmsconninit \
- -lmmscodec \
- -lmmsserversettings \
- -lcentralrepository \
- -lapparc \
- -lbafl \
- -lefsrv \
- -lesock \
- -lestor \
- -leuser \
- -llogcli \
- -llogwrap \
- -lapgrfx \
- -lapmime
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/src/mmsreadfile.cpp Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1799 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-// INCLUDE FILES
-#include <e32base.h>
-#include <badesca.h>
-#include <e32def.h>
-#include <s32file.h>
-#include <msvids.h>
-#include <mtmdef.h>
-//#include <eikenv.h>
-#include <apgcli.h>
-#include <CMsvMimeHeaders.h>
-#include <AknNoteWrappers.h>
-
-#include <mmsservercommon.h>
-#include "mmsconst.h"
-#include "mmsclient.h"
-#include "mmsheaders.h"
-#include "mmsreadfile.h"
-#include "mmsmmboxviewheaders.h"
-#include "mmsmmboxmessageheaders.h"
-#include "mmsmmboxflags.h"
-#include "mmssettings.h"
-
-
-// EXTERNAL DATA STRUCTURES
-
-// EXTERNAL FUNCTION PROTOTYPES
-
-// CONSTANTS
-const TInt KMmsGranularity = 8;
-_LIT( K1970, "19700000:000000.000000" ); // 1-Jan 1970 0:00:00
-
-
-// MACROS
-
-// LOCAL CONSTANTS AND MACROS
-
-// MODULE DATA STRUCTURES
-
-// LOCAL FUNCTION PROTOTYPES
-
-// ==================== LOCAL FUNCTIONS ====================
-
-
-// ================= MEMBER FUNCTIONS =======================
-
-
-// C++ default constructor can NOT contain any code, that
-// might leave.
-//
-CMmsReadFile::CMmsReadFile()
- {
- // all member variables in a class derived from CBase
- // are automatically set to 0.
- }
-
-
-//
-void CMmsReadFile::ConstructL(RFs& aFs, RFileReadStream& aReadStream )
- {
- // iRowBuffer = HBufC8::NewMaxL( 500 ); // Max row length!!!!
- iFs = aFs;
- iReader = &aReadStream;
- iByteBuffer = HBufC8::NewL( DefaultBufLen );
- iAliasArray = new ( ELeave ) CDesCArrayFlat( KMmsGranularity );
- iAttaStructures = new ( ELeave ) CArrayPtrFlat<CMmsAttaStructure>( KMmsGranularity );
- Reset();
- }
-
-// Two-phased constructor.
-CMmsReadFile* CMmsReadFile::NewL(RFs& aFs, RFileReadStream& aReadStream )
- {
- CMmsReadFile* self = new ( ELeave ) CMmsReadFile();
- CleanupStack::PushL( self );
- self->ConstructL( aFs, aReadStream );
- CleanupStack::Pop();
- return self;
- }
-
-
-// Destructor
-CMmsReadFile::~CMmsReadFile()
- {
- Reset(); // resets and destroys all array data
- if (iAliasArray != NULL) iAliasArray->Reset();
- delete iByteBuffer;
- delete iAliasArray;
- delete iAttaStructures;
- }
-
-void CMmsReadFile::Reset()
- {
- // reset all arrays
- if (iAttaStructures != NULL) iAttaStructures->ResetAndDestroy();
- iAttaCount = 0;
- iAttaRoot = 0;
- }
-
-// ---------------------------------------------------------
-// CMmsReadFile()::CompleteTest
-// ---------------------------------------------------------
-//
-TInt CMmsReadFile::CompleteTestL( TInt aMessageCounter, CMmsHeaders& aMmsHeaders )
-{
- Reset(); // new message
-
- TUint32 val;
- TUint limit = 1000000;
- TUint sizeLimit = 1000 * 1024; //max message size 1000 kB!
- TUint allLimit = 999999;
- TInt error;
- TRadix radix = EDecimal;
- TLex16 lex;
- TTestReadStatus readStatus = ETestUnknown;
- CMmsAttaStructure* oneAtta = NULL;
- TInt index;
- TTime y1970( K1970 );
- TTimeIntervalMicroSeconds interval;
- TTime date;
- TInt order = 0;
- TInt16 shortInteger = 0;
-
- //iso luuppi, joka kiertää ja lukee kunnes EOF tule vastaan
- //Big Loop, which passes around and read until the EOF
-
- iMessageType = iNextMessageType;
- while(readStatus != ETestEof)
- {
- readStatus = ReadRowL();
- if ( readStatus == ETestEof )
- {
- return(-1);
- }
- if ( readStatus == ETestUnknown )
- {
- // A line containing only comments, or an unknown tag
- // As using the scripts to test settings is no longer supported,
- // any old keywords used to test CMmsSettings class are ignored
- continue;
- }
- if( readStatus == ETestNewMessage )
- {
- iNextMessageType = readStatus;
- if(aMessageCounter++)
- {
- return(NULL);
- }
- else
- {
- iMessageType = iNextMessageType;
- continue;
- }
- }
- if ( iMessageType == ETestNewMessage)
- {
- switch(readStatus)
- {
- case ETestFrom:
- aMmsHeaders.SetSenderL( iValueBuffer );
- break;
- case ETestFromAlias:
- index = FindAlias(iValueBuffer);
- if(index >= 0)
- {
- aMmsHeaders.SetSenderL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ) );
- }
- break;
- case ETestTo:
- aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientTo );
- break;
- case ETestToAlias:
- index = FindAlias(iValueBuffer);
- if(index >= 0)
- {
- aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsTo );
- }
- break;
- case ETestCc:
- aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientCc );
- break;
- case ETestCcAlias:
- index = FindAlias(iValueBuffer);
- if(index >= 0)
- {
- aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsCc );
- }
- break;
- case ETestBcc:
- aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientBcc );
- break;
- case ETestBccAlias:
- index = FindAlias(iValueBuffer);
- if(index >= 0)
- {
- aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsBcc );
- }
- break;
- case ETestSubject:
- aMmsHeaders.SetSubjectL( iValueBuffer );
- break;
- case ETestExpiryRel:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetExpiryInterval( val );
- }
- break;
- case ETestExpiryAbs:
- error = iDate.Set(iValueBuffer);
- interval = iDate.MicroSecondsFrom( y1970 );
- // expiry date in seconds from 1.1.1970.
- aMmsHeaders.SetExpiryDate( (interval.Int64())/1000000 );
- break;
- case ETestDeliveryTimeRel:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetDeliveryTimeInterval( val );
- }
- break;
- case ETestDeliveryTimeAbs:
- error = iDate.Set(iValueBuffer);
- interval = iDate.MicroSecondsFrom( y1970 );
- aMmsHeaders.SetDeliveryDate( (interval.Int64())/1000000 );
- break;
- case ETestDate:
- error = iDate.Set(iValueBuffer);
- interval = iDate.MicroSecondsFrom( y1970 );
- aMmsHeaders.SetDate( (interval.Int64())/1000000 );
- case ETestPriority:
- val = 0;
- if ((iValueBuffer.CompareF(KLow)) == 0)
- {
- val = EMmsPriorityLow;
- }
- else if ((iValueBuffer.CompareF(KNormal)) == 0)
- {
- val = EMmsPriorityNormal;
- }
- else if ((iValueBuffer.CompareF(KHigh)) == 0)
- {
- val = EMmsPriorityHigh;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetMessagePriority( val );
- break;
- case ETestSenderVisibility:
- val = 0;
- if ((iValueBuffer.CompareF(KHide)) == 0)
- {
- val = EMmsSenderVisibilityHide;
- }
- else if ((iValueBuffer.CompareF(KShow)) == 0)
- {
- val = EMmsSenderVisibilityShow;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetSenderVisibility( val );
- break;
- case ETestDeliveryReport:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = EMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = EMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetDeliveryReport( val );
- break;
- case ETestDelivReportSendAllow:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = EMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = EMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetReportAllowed( val );
- break;
-
- case ETestReadReply:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = EMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = EMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetReadReply( val );
- break;
- case ETestNewAttachment:
- oneAtta = CMmsAttaStructure::NewL();
- iAttaStructures->AppendL(oneAtta);
- oneAtta->iAtta->Des().Copy( iValueBuffer );
- iAttaCount++;
- break;
- case ETestAttachmentType:
- if (oneAtta != NULL)
- {
- oneAtta->iAttaType->Des().Copy( iValueBuffer );
- }
- break;
- case ETestAttachmentContLoc:
- if (oneAtta != NULL)
- {
- oneAtta->iAttaName->Des().Copy( iValueBuffer );
- }
- break;
- case ETestAttaRecommendedName:
- if (oneAtta != NULL)
- {
- oneAtta->iAttaRecommendedName->Des().Copy( iValueBuffer );
- }
- break;
- case ETestAttachmentCharset:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- if (oneAtta != NULL)
- {
- oneAtta->iAttaCharset = val;
- }
- }
- break;
- case ETestAttachmentCid:
- if (oneAtta != NULL)
- {
- oneAtta->iAttaCid->Des().Copy(iValueBuffer);
- }
- break;
- case ETestAttContTypeParamName:
- iByteBuffer->Des().Copy( iValueBuffer );
- if (oneAtta != NULL)
- {
- oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
- }
- break;
- case ETestAttContTypeParamValue:
- iByteBuffer->Des().Copy( iValueBuffer );
- if (oneAtta != NULL)
- {
- oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
- }
- break;
- case ETestAttXTypeParamName:
- iByteBuffer->Des().Copy( iValueBuffer );
- if (oneAtta != NULL)
- {
- oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
- }
- break;
- case ETestAttXTypeParamValue:
- iByteBuffer->Des().Copy( iValueBuffer );
- if (oneAtta != NULL)
- {
- oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
- }
- break;
- case ETestAttachmentRoot:
- iAttaRoot = iAttaCount;
- break;
- case ETestAlias:
- // all aliases are global even if they appear
- // in the middle of a message
- iAliasArray->AppendL( iValueBuffer );
- iAliasCount++;
- break;
- case ETestMessageClass: // should be handled!
- val = EMmsClassPersonal;
- if ((iValueBuffer.CompareF(KPersonal)) == 0)
- {
- val = EMmsClassPersonal;
- }
- else if ((iValueBuffer.CompareF(KAdvertisement)) == 0)
- {
- val = EMmsClassAdvertisement;
- }
- else if ((iValueBuffer.CompareF(KInformational)) == 0)
- {
- val = EMmsClassInformational;
- }
- else if ((iValueBuffer.CompareF(KAuto)) == 0)
- {
- val = EMmsClassAuto;
- }
- else
- {
- val = (TMmsMessageClass)KMmsTestIllegalValue;
- }
- aMmsHeaders.SetMessageClass( val );
- break;
- case ETestReplyCharging:
- val = 0;
- if ((iValueBuffer.CompareF(KRequested)) == 0)
- {
- val = KMmsReplyChargingRequested;
- }
- else if ((iValueBuffer.CompareF(KReqTextOnly)) == 0)
- {
- val = KMmsReplyChargingRequestedTextOnly;
- }
- else if ((iValueBuffer.CompareF(KAccepted)) == 0)
- {
- val = KMmsReplyChargingAccepted;
- }
- else if ((iValueBuffer.CompareF(KAccTextOnly)) == 0)
- {
- val = KMmsReplyChargingAcceptedTextOnly;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetReplyCharging( val );
- break;
- case ETestReplyChargAbs:
- error = date.Set(iValueBuffer);
- if ( error == KErrNone )
- {
- interval = date.MicroSecondsFrom( y1970 );
- aMmsHeaders.SetReplyChargingDate( (interval.Int64())/1000000 );
- }
- break;
- case ETestReplyChargRel:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetReplyChargingInterval( val );
- }
- break;
- case ETestReplyChargSize:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,sizeLimit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetReplyChargingSize( val );
- }
- break;
- case ETestReplyChargID:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetReplyChargingIdL( iByteBuffer->Des() );
- break;
- case ETestTID:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetTidL( iByteBuffer->Des() );
- break;
- case ETestContentLocation:
- iByteBuffer->Des().Copy( iValueBuffer );
- if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
- aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf ||
- aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteReq )
- {
- aMmsHeaders.MMBoxMessageHeadersL().ContentLocationList().AppendL( iByteBuffer->Des() );
- }
- else if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
- {
- aMmsHeaders.InsertDeleteContentLocationL( order, iByteBuffer->Des() );
- }
- else
- {
- aMmsHeaders.SetContentLocationL( iByteBuffer->Des() );
- }
- break;
- case ETestPreviouslySentIndex:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- order = val;
- break;
- case ETestPreviouslySentBy:
- aMmsHeaders.InsertPreviouslySentByL( order, iValueBuffer );
- break;
- case ETestPreviouslySentDate:
- error = date.Set(iValueBuffer);
- if ( error == KErrNone )
- {
- interval = date.MicroSecondsFrom( y1970 );
- aMmsHeaders.InsertPreviouslySentDateL( order, (interval.Int64())/1000000 );
- }
- break;
- case ETestMessageId:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetMessageIdL( iByteBuffer->Des() );
- break;
- case ETestMessageSize:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,sizeLimit);
- if (error == KErrNone)
- {
- aMmsHeaders.SetMessageSize( val );
- }
- break;
- case ETestVersion:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,EHex,limit);
- shortInteger = TInt16( val );
- if (error == KErrNone)
- {
- aMmsHeaders.SetMmsVersion( shortInteger );
- }
- break;
- case ETestReadStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KRead)) == 0)
- {
- val = KMmsReadStatusRead;
- }
- else if ((iValueBuffer.CompareF(KDelNotRead)) == 0)
- {
- val = KMmsReadStatusDeletedWithoutBeingRead;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetReadStatus( val );
- break;
- case ETestResponseStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KOk)) == 0)
- {
- val = KMmsStatusOk;
- }
- else if ((iValueBuffer.CompareF(KErrUnspecified)) == 0)
- {
- val = KMmsErrorUnspecified;
- }
- else if ((iValueBuffer.CompareF(KErrServiceDenied)) == 0)
- {
- val = KMmsErrorServiceDenied;
- }
- else if ((iValueBuffer.CompareF(KErrMessageFormatCorrupt)) == 0)
- {
- val = KMmsErrorMessageFormatCorrupt;
- }
- else if ((iValueBuffer.CompareF(KErrAddressUnresolved)) == 0)
- {
- val = KMmsErrorSendingAddressUnresolved;
- }
- else if ((iValueBuffer.CompareF(KErrMessageNotFound)) == 0)
- {
- val = KMmsErrorMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrNetworkProblem)) == 0)
- {
- val = KMmsErrorNetworkProblem;
- }
- else if ((iValueBuffer.CompareF(KErrContentNotAccepted)) == 0)
- {
- val = KMmsErrorNoContentAccepted;
- }
- else if ((iValueBuffer.CompareF(KErrUnsupportedMessage)) == 0)
- {
- val = KMmsErrorUnsupportedMessage;
- }
- else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
- {
- val = KMmsErrorTransientFailure;
- }
- else if ((iValueBuffer.CompareF(KErrTransientAddressUnresolved)) == 0)
- {
- val = KMmsErrorTransientSendingAddressUnresolved;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
- {
- val = KMmsErrorTransientMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
- {
- val = KMmsErrorTransientNetworkProblem;
- }
- else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
- {
- val = KMmsErrorPermanentFailure;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
- {
- val = KMmsErrorPermanentServiceDenied;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
- {
- val = KMmsErrorPermanentMessageFormatCorrupt;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentAddressUnresolved)) == 0)
- {
- val = KMmsErrorPermanentSendingAddressUnresolved;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
- {
- val = KMmsErrorPermanentMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentContentNotAccepted)) == 0)
- {
- val = KMmsErrorPermanentContentNotAccepted;
- }
- else if ((iValueBuffer.CompareF(KErrReplyChargingLimitNotMet)) == 0)
- {
- val = KMmsErrorPermanentReplyChargingLimitationsNotMet;
- }
- else if ((iValueBuffer.CompareF(KErrReplyChargingRequestNotAccepted)) == 0)
- {
- val = KMmsErrorPermanentReplyChargingRequestNotAccepted;
- }
- else if ((iValueBuffer.CompareF(KErrReplyChargingForwardingDenied)) == 0)
- {
- val = KMmsErrorPermanentReplyChargingForwardingDenied;
- }
- else if ((iValueBuffer.CompareF(KErrReplyChargingNotSupported)) == 0)
- {
- val = KMmsErrorPermanentReplyChargingNotSupported;
- }
- else if ((iValueBuffer.CompareF(KErrTransientPartialSuccess)) == 0)
- {
- val = KMmsErrorTransientPartialSuccess;
- }
- else if ((iValueBuffer.CompareF(KErrAddressHidingNotSupported)) == 0)
- {
- val = KMmsErrorPermanentAddressHidingNotSupported;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
- {
- aMmsHeaders.InsertDeleteStatusL( order, val );
- }
- else
- {
- aMmsHeaders.SetResponseStatus( val );
- }
- break;
- case ETestResponseText:
- if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
- {
- aMmsHeaders.InsertDeleteResponseTextL( order, iValueBuffer );
- }
- else
- {
- aMmsHeaders.SetResponseTextL( iValueBuffer );
- }
- break;
- case ETestRetrieveStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KOk)) == 0)
- {
- val = KMmsStatusOk;
- }
- else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
- {
- val = KMmsErrorTransientFailure;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
- {
- val = KMmsErrorReceiveTransientMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
- {
- val = KMmsErrorReceiveTransientNetworkProblem;
- }
- else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
- {
- val = KMmsErrorPermanentFailure;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
- {
- val = KMmsErrorPermanentServiceDenied;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
- {
- val = KMmsErrorReceivePermanentMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrRetrieveContentUnsupported)) == 0)
- {
- val = KMmsErrorReceivePermanentContentUnsupported;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetResponseStatus( val );
- break;
- case ETestRetrieveText:
- aMmsHeaders.SetResponseTextL( iValueBuffer );
- break;
- case ETestStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KDeferred)) == 0)
- {
- val = KMmsMessageStatusDeferred;
- }
- else if ((iValueBuffer.CompareF(KExpired)) == 0)
- {
- val = KMmsMessageStatusExpired;
- }
- else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
- {
- val = KMmsMessageStatusRetrieved;
- }
- else if ((iValueBuffer.CompareF(KRejected)) == 0)
- {
- val = KMmsMessageStatusRejected;
- }
- else if ((iValueBuffer.CompareF(KUnrecognized)) == 0)
- {
- val = KMmsMessageStatusUnrecognized;
- }
- else if ((iValueBuffer.CompareF(KIndeterminate)) == 0)
- {
- val = KMmsMessageStatusIndeterminate;
- }
- else if ((iValueBuffer.CompareF(KForwarded)) == 0)
- {
- val = KMmsMessageStatusForwarded;
- }
- else if ((iValueBuffer.CompareF(KUnreachable)) == 0)
- {
- val = KMmsMessageStatusUnreachable;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetStatus( val );
- break;
- case ETestMessageType:
- val = 0;
- if ((iValueBuffer.CompareF(KSendReq)) == 0)
- {
- val = KMmsMessageTypeMSendReq;
- }
- else if ((iValueBuffer.CompareF(KSendConf)) == 0)
- {
- val = KMmsMessageTypeMSendConf;
- }
- else if ((iValueBuffer.CompareF(KNotifInd)) == 0)
- {
- val = KMmsMessageTypeMNotificationInd;
- }
- else if ((iValueBuffer.CompareF(KNotifResp)) == 0)
- {
- val = KMmsMessageTypeMNotifyRespInd;
- }
- else if ((iValueBuffer.CompareF(KRetrConf)) == 0)
- {
- val = KMmsMessageTypeMRetrieveConf;
- }
- else if ((iValueBuffer.CompareF(KAckInd)) == 0)
- {
- val = KMmsMessageTypeAcknowledgeInd;
- }
- else if ((iValueBuffer.CompareF(KDelInd)) == 0)
- {
- val = KMmsMessageTypeDeliveryInd;
- }
- else if ((iValueBuffer.CompareF(KReadReqInd)) == 0)
- {
- val = KMmsMessageTypeReadRecInd;
- }
- else if ((iValueBuffer.CompareF(KReadOrigInd)) == 0)
- {
- val = KMmsMessageTypeReadOrigInd;
- }
- else if ((iValueBuffer.CompareF(KForwardRec)) == 0)
- {
- val = KMmsMessageTypeForwardReq;
- }
- else if ((iValueBuffer.CompareF(KForwardConf)) == 0)
- {
- val = KMmsMessageTypeForwardConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxStoreReq)) == 0)
- {
- val = KMmsMessageTypeMboxStoreReq;
- }
- else if ((iValueBuffer.CompareF(KMBoxStoreConf)) == 0)
- {
- val = KMmsMessageTypeMboxStoreConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxViewReq)) == 0)
- {
- val = KMmsMessageTypeMboxViewReq;
- }
- else if ((iValueBuffer.CompareF(KMBoxViewConf)) == 0)
- {
- val = KMmsMessageTypeMboxViewConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxUploadReq)) == 0)
- {
- val = KMmsMessageTypeMBoxUploadReq;
- }
- else if ((iValueBuffer.CompareF(KMBoxUploadConf)) == 0)
- {
- val = KMmsMessageTypeMBoxUploadConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxDeleteReq)) == 0)
- {
- val = KMmsMessageTypeMBoxDeleteReq;
- }
- else if ((iValueBuffer.CompareF(KMBoxDeleteConf)) == 0)
- {
- val = KMmsMessageTypeMBoxDeleteConf;
- }
- else if ((iValueBuffer.CompareF(KMBoxDescr)) == 0)
- {
- val = KMmsMessageTypeMBoxDescr;
- }
- else if ((iValueBuffer.CompareF(KDeleteReq)) == 0)
- {
- val = KMmsMessageTypeDeleteReq;
- }
- else if ((iValueBuffer.CompareF(KDeleteConf)) == 0)
- {
- val = KMmsMessageTypeDeleteConf;
- }
- else if ((iValueBuffer.CompareF(KCancelReq)) == 0)
- {
- val = KMmsMessageTypeCancelReq;
- }
- else if ((iValueBuffer.CompareF(KCancelResp)) == 0)
- {
- val = KMmsMessageTypeCancelConf;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetMessageType( val );
- break;
- case ETestAttribute:
- val = 0;
- iByteBuffer->Des().Copy( iValueBuffer );
- if ((iByteBuffer->Des().CompareF(KTestBcc)) == 0)
- {
- val = KMmsAssignedBcc;
- }
- else if ((iByteBuffer->Des().CompareF(KTestCc)) == 0)
- {
- val = KMmsAssignedCc;
- }
- else if ((iByteBuffer->Des().CompareF(KTestContent)) == 0)
- {
- val = KMmsAssignedContent;
- }
- else if ((iByteBuffer->Des().CompareF(KTestContentType)) == 0)
- {
- val = KMmsAssignedContentType;
- }
- else if ((iByteBuffer->Des().CompareF(KTestDate)) == 0)
- {
- val = KMmsAssignedDate;
- }
- else if ((iByteBuffer->Des().CompareF(KTestDeliveryReport)) == 0)
- {
- val = KMmsAssignedDeliveryReport;
- }
- else if ((iByteBuffer->Des().CompareF(KTestDeliveryTime)) == 0)
- {
- val = KMmsAssignedDeliveryTime;
- }
- else if ((iByteBuffer->Des().CompareF(KTestExpiry)) == 0)
- {
- val = KMmsAssignedExpiry;
- }
- else if ((iByteBuffer->Des().CompareF(KTestFrom)) == 0)
- {
- val = KMmsAssignedFrom;
- }
- else if ((iByteBuffer->Des().CompareF(KTestMessageClass)) == 0)
- {
- val = KMmsAssignedMessageClass;
- }
- else if ((iByteBuffer->Des().CompareF(KTestMessageId)) == 0)
- {
- val = KMmsAssignedMessageId;
- }
- else if ((iByteBuffer->Des().CompareF(KTestMessageSize)) == 0)
- {
- val = KMmsAssignedMessageSize;
- }
- else if ((iByteBuffer->Des().CompareF(KTestPriority)) == 0)
- {
- val = KMmsAssignedPriority;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReadReply)) == 0)
- {
- val = KMmsAssignedReadReply;
- }
- else if ((iByteBuffer->Des().CompareF(KTestSubject)) == 0)
- {
- val = KMmsAssignedSubject;
- }
- else if ((iByteBuffer->Des().CompareF(KTestTo)) == 0)
- {
- val = KMmsAssignedTo;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReplyCharging)) == 0)
- {
- val = KMmsAssignedReplyCharging;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReplyChargID)) == 0)
- {
- val = KMmsAssignedReplyChargingID;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReplyCharg)) == 0)
- {
- val = KMmsAssignedReplyChargingDeadline;
- }
- else if ((iByteBuffer->Des().CompareF(KTestReplyChargSize)) == 0)
- {
- val = KMmsAssignedReplyChargingSize;
- }
- else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentBy)) == 0)
- {
- val = KMmsAssignedPreviouslySentBy;
- }
- else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentDate)) == 0)
- {
- val = KMmsAssignedPreviouslySentDate;
- }
- else if ((iByteBuffer->Des().CompareF(KTestAdditionalHeaders)) == 0)
- {
- val = KMmsAssignedAdditionalHeaders;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxViewHeadersL().AttributeArray().InsertInOrder(val);
- break;
- case ETestDistributionIndicator:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetDistributionIndicator( val );
- break;
- case ETestLimit:
- aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if( error == KErrNone )
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(val);
- }
- break;
- case ETestMessageQuota:
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(val);
- }
- break;
- case ETestSizeQuota:
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(val);
- }
- break;
- case ETestMessageTotal:
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(val);
- }
- break;
- case ETestSizeTotal:
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(val);
- }
- break;
- case ETestMessageCount:
- aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(KMaxTUint32);
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if ( val > allLimit )
- {
- val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
- }
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(val);
- }
- break;
- case ETestAddKeyword:
- aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsAddToken, iValueBuffer);
- break;
- case ETestRemoveKeyword:
- aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsRemoveToken, iValueBuffer);
- break;
- case ETestFilterKeyword:
- aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsFilterToken, iValueBuffer);
- break;
- case ETestMMState:
- val = 0;
- if ((iValueBuffer.CompareF(KDraft)) == 0)
- {
- val = KMmsDraft;
- }
- else if ((iValueBuffer.CompareF(KSent)) == 0)
- {
- val = KMmsSent;
- }
- else if ((iValueBuffer.CompareF(KNew)) == 0)
- {
- val = KMmsNew;
- }
- else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
- {
- val = KMmsRetrieved;
- }
- else if ((iValueBuffer.CompareF(KForwarded)) == 0)
- {
- val = KMmsForwarded;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
- aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf )
- {
- aMmsHeaders.MMBoxViewHeadersL().MMStateArray().InsertInOrder( val );
- }
- else
- {
- aMmsHeaders.MMBoxMessageHeadersL().SetMMState( val );
- }
- break;
- case ETestQuota:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxViewHeadersL().SetMmsQuotas( val );
- break;
- case ETestStart:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- if (error == KErrNone)
- {
- aMmsHeaders.MMBoxViewHeadersL().SetMmsStart(val);
- }
- break;
- case ETestStore:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxMessageHeadersL().SetMmsStore( val );
- break;
- case ETestStored:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxMessageHeadersL().SetMmsStored( val );
- break;
- case ETestStoreStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KOk)) == 0)
- {
- val = KMmsStatusOk;
- }
- else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
- {
- val = KMmsErrorTransientFailure;
- }
- else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
- {
- val = KMmsErrorStoreStatusTransientNetworkProblem;
- }
- else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
- {
- val = KMmsErrorPermanentFailure;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
- {
- val = KMmsErrorPermanentServiceDenied;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
- {
- val = KMmsErrorPermanentMessageFormatCorrupt;
- }
- else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
- {
- val = KMmsErrorStoreStatusPermanentMessageNotFound;
- }
- else if ((iValueBuffer.CompareF(KErrMMBoxFull)) == 0)
- {
- val = KMmsErrorStoreStatusPermanentMmboxFull;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatus( val );
- break;
- case ETestStoreStatusText:
- aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatusTextL( iValueBuffer );
- break;
- case ETestTotals:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.MMBoxViewHeadersL().SetMmsTotals( val );
- break;
-
- case ETestDeleteInfoIndex:
- lex.Assign(iValueBuffer);
- error = lex.Val(val,radix,limit);
- order = val;
- break;
-
- case ETestApplicId:
- aMmsHeaders.SetApplicIdL( iValueBuffer );
- break;
- case ETestReplyApplicId:
- aMmsHeaders.SetReplyApplicIdL( iValueBuffer );
- break;
- case ETestApplicInfo:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetAuxApplicInfoL( iByteBuffer->Des() );
- break;
- case ETestContentClass:
- val = 0;
- if ((iValueBuffer.CompareF(KText)) == 0)
- {
- val = KMmsContentClassText;
- }
- else if ((iValueBuffer.CompareF(KImageBasic)) == 0)
- {
- val = KMmsContentClassImageBasic;
- }
- else if ((iValueBuffer.CompareF(KImageRich)) == 0)
- {
- val = KMmsContentClassImageRich;
- }
- else if ((iValueBuffer.CompareF(KVideoBasic)) == 0)
- {
- val = KMmsContentClassVideoBasic;
- }
- else if ((iValueBuffer.CompareF(KVideoRich)) == 0)
- {
- val = KMmsContentClassVideoRich;
- }
- else if ((iValueBuffer.CompareF(KMegaPixel)) == 0)
- {
- val = KMmsContentClassMegaPixel;
- }
- else if ((iValueBuffer.CompareF(KContentBasic)) == 0)
- {
- val = KMmsContentClassContentBasic;
- }
- else if ((iValueBuffer.CompareF(KContentRich)) == 0)
- {
- val = KMmsContentClassContentRich;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetContentClass( val );
- break;
- case ETestDrmContent:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetDrmContent( val );
- break;
- case ETestAdaptationAllowed:
- val = 0;
- if ((iValueBuffer.CompareF(KYes)) == 0)
- {
- val = KMmsYes;
- }
- else if ((iValueBuffer.CompareF(KNo)) == 0)
- {
- val = KMmsNo;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetAdaptationAllowed( val );
- break;
- case ETestRecommendedRetrievalMode:
- val = 0;
- if ((iValueBuffer.CompareF(KManual)) == 0)
- {
- val = KMmsRecommendedRetrievalModeManual;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetRecommendedRetrievalMode( val );
- break;
- case ETestRecRetrievalModeText:
- aMmsHeaders.SetRecommendedRetrievalModeTextL( iValueBuffer );
- break;
- case ETestReplaceId:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
- break;
- case ETestStatusText:
- aMmsHeaders.SetResponseTextL( iValueBuffer );
- break;
- case ETestCancelId:
- iByteBuffer->Des().Copy( iValueBuffer );
- aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
- break;
- case ETestCancelStatus:
- val = 0;
- if ((iValueBuffer.CompareF(KCancelSuccessful)) == 0)
- {
- val = KMmsCancelRequestSuccessfullyReceived;
- }
- else if ((iValueBuffer.CompareF(KCancelCorrupted)) == 0)
- {
- val = KMmsCancelRequestCorrupted;
- }
- else
- {
- val = KMmsTestIllegalValue;
- }
- aMmsHeaders.SetCancelStatus( val );
- break;
- default:
- break;
- }
- }
- else
- {
- switch(readStatus)
- {
- case ETestAlias:
- iAliasArray->AppendL( iValueBuffer );
- iAliasCount++;
- break;
-
- default:
- break;
- }
-
- }
- }
- return(-1);
-}
-
-// ---------------------------------------------------------
-// CMmsReadFile()::ReadRowL
-// ---------------------------------------------------------
-//
-TTestReadStatus CMmsReadFile::ReadRowL()
- {
-
- TBuf8<DefaultBufLen> RowBuffer;
- TBuf8<32> KeyBuffer;
-
- // READ ONE ROW AND DROP CR+LF FROM THE END OF LINE
- TChar delim( 10 );
- iReader->ReadL( RowBuffer, delim);
- TInt length = RowBuffer.Length();
- if ( RowBuffer.Length() < 2 )
- {
- return ETestEof;
- }
- RowBuffer.Delete(length - 2,2);
-
- // DROP POSSIBLE COMMENT OUT
- TInt pos = RowBuffer.Locate( ';' );
- if ( pos >= 0 ) RowBuffer.Delete( pos, length-pos-2 );
-
- if ( RowBuffer.Length() == 0 )
- {
- // the line contained only comment
- return ETestUnknown;
- }
-
- // First split the row (:)
- pos = RowBuffer.Locate( ':' );
- if (pos > 0)
- {
- TPtrC8 p = RowBuffer.Mid( pos+1 );
- length = p.Length();
- iValueBuffer.Zero();
- for (TInt i=0; i < length; ++i)
- {
- iValueBuffer.Append(p[i]);
- }
- iValueBuffer.Trim();
- TPtrC8 pp = RowBuffer.Left(pos);
- KeyBuffer.CopyUC(pp);
- KeyBuffer.Trim();
- }
- // TRY TO FIND CORRECT TAG
- if ((KeyBuffer.CompareF(KTestNewMessage)) == 0) return(ETestNewMessage);
- if ((KeyBuffer.CompareF(KTestMessageType)) == 0) return ETestMessageType;
- if ((KeyBuffer.CompareF(KTestDate)) == 0) return ETestDate;
- if ((KeyBuffer.CompareF(KTestFrom)) == 0) return ETestFrom;
- if ((KeyBuffer.CompareF(KTestTo)) == 0) return ETestTo;
- if ((KeyBuffer.CompareF(KTestCc)) == 0) return ETestCc;
- if ((KeyBuffer.CompareF(KTestBcc)) == 0) return ETestBcc;
- if ((KeyBuffer.CompareF(KTestSubject)) == 0) return ETestSubject;
- if ((KeyBuffer.CompareF(KTestExpiryRel)) == 0) return ETestExpiryRel;
- if ((KeyBuffer.CompareF(KTestExpiryAbs)) == 0) return ETestExpiryAbs;
- if ((KeyBuffer.CompareF(KTestDeliveryTimeRel)) == 0) return ETestDeliveryTimeRel;
- if ((KeyBuffer.CompareF(KTestDeliveryTimeAbs)) == 0) return ETestDeliveryTimeAbs;
- if ((KeyBuffer.CompareF(KTestPriority)) == 0) return ETestPriority;
- if ((KeyBuffer.CompareF(KTestSenderVisibility)) == 0) return ETestSenderVisibility;
- if ((KeyBuffer.CompareF(KTestDeliveryReport)) == 0) return ETestDeliveryReport;
- if ((KeyBuffer.CompareF(KTestReadReply)) == 0) return ETestReadReply;
- if ((KeyBuffer.CompareF(KTestNewAttachment)) == 0) return ETestNewAttachment;
- if ((KeyBuffer.CompareF(KTestAttachmentName)) == 0) return ETestAttaRecommendedName;
- if ((KeyBuffer.CompareF(KTestAttachmentContLoc)) == 0) return ETestAttachmentContLoc;
- if ((KeyBuffer.CompareF(KTestAttachmentType)) == 0) return ETestAttachmentType;
- if ((KeyBuffer.CompareF(KTestAttachmentCharset)) == 0) return ETestAttachmentCharset;
- if ((KeyBuffer.CompareF(KTestAttachmentCid)) == 0) return ETestAttachmentCid;
- if ((KeyBuffer.CompareF(KTestAttachmentRoot)) == 0) return ETestAttachmentRoot;
- if ((KeyBuffer.CompareF(KTestEndOfFile)) == 0) return ETestEof;
- if ((KeyBuffer.CompareF(KTestMessageClass)) == 0) return ETestMessageClass;
- if ((KeyBuffer.CompareF(KTestDelivRepSendAllow)) == 0) return ETestDelivReportSendAllow;
- if ((KeyBuffer.CompareF(KTestAlias)) == 0 ) return ETestAlias;
- if ((KeyBuffer.CompareF(KTestFromAlias)) == 0 ) return ETestFromAlias;
- if ((KeyBuffer.CompareF(KTestToAlias)) == 0 ) return ETestToAlias;
- if ((KeyBuffer.CompareF(KTestCcAlias)) == 0 ) return ETestCcAlias;
- if ((KeyBuffer.CompareF(KTestBccAlias)) == 0 ) return ETestBccAlias;
- if ((KeyBuffer.CompareF(KTestReplyCharging)) == 0 ) return ETestReplyCharging;
- if ((KeyBuffer.CompareF(KTestReplyChargAbs)) == 0 ) return ETestReplyChargAbs;
- if ((KeyBuffer.CompareF(KTestReplyChargRel)) == 0 ) return ETestReplyChargRel;
- if ((KeyBuffer.CompareF(KTestReplyChargSize)) == 0 ) return ETestReplyChargSize;
- if ((KeyBuffer.CompareF(KTestReplyChargID)) == 0 ) return ETestReplyChargID;
- if ((KeyBuffer.CompareF(KTestTID)) == 0 ) return ETestTID;
- if ((KeyBuffer.CompareF(KTestContentLocation)) == 0 ) return ETestContentLocation;
- if ((KeyBuffer.CompareF(KTestPreviouslySentIndex)) == 0 ) return ETestPreviouslySentIndex;
- if ((KeyBuffer.CompareF(KTestPreviouslySentBy)) == 0 ) return ETestPreviouslySentBy;
- if ((KeyBuffer.CompareF(KTestPreviouslySentDate)) == 0 ) return ETestPreviouslySentDate;
- if ((KeyBuffer.CompareF(KTestMessageId)) == 0 ) return ETestMessageId;
- if ((KeyBuffer.CompareF(KTestMessageSize)) == 0 ) return ETestMessageSize;
- if ((KeyBuffer.CompareF(KTestVersion)) == 0 ) return ETestVersion;
- if ((KeyBuffer.CompareF(KTestReadStatus)) == 0 ) return ETestReadStatus;
- if ((KeyBuffer.CompareF(KTestResponseStatus)) == 0 ) return ETestResponseStatus;
- if ((KeyBuffer.CompareF(KTestResponseText)) == 0 ) return ETestResponseText;
- if ((KeyBuffer.CompareF(KTestRetrieveStatus)) == 0 ) return ETestRetrieveStatus;
- if ((KeyBuffer.CompareF(KTestRetrieveText)) == 0 ) return ETestRetrieveText;
- if ((KeyBuffer.CompareF(KTestStatus)) == 0 ) return ETestStatus;
- if ((KeyBuffer.CompareF(KTestAttribute)) == 0 ) return ETestAttribute;
- if ((KeyBuffer.CompareF(KTestDistributionIndicator)) == 0 ) return ETestDistributionIndicator;
- if ((KeyBuffer.CompareF(KTestLimit)) == 0 ) return ETestLimit;
- if ((KeyBuffer.CompareF(KTestMessageQuota)) == 0 ) return ETestMessageQuota;
- if ((KeyBuffer.CompareF(KTestSizeQuota)) == 0 ) return ETestSizeQuota;
- if ((KeyBuffer.CompareF(KTestMessageTotal)) == 0 ) return ETestMessageTotal;
- if ((KeyBuffer.CompareF(KTestSizeTotal)) == 0 ) return ETestSizeTotal;
- if ((KeyBuffer.CompareF(KTestMessageCount)) == 0 ) return ETestMessageCount;
- if ((KeyBuffer.CompareF(KTestAddKeyword)) == 0 ) return ETestAddKeyword;
- if ((KeyBuffer.CompareF(KTestRemoveKeyword)) == 0 ) return ETestRemoveKeyword;
- if ((KeyBuffer.CompareF(KTestFilterKeyword)) == 0 ) return ETestFilterKeyword;
- if ((KeyBuffer.CompareF(KTestMMState)) == 0 ) return ETestMMState;
- if ((KeyBuffer.CompareF(KTestQuota)) == 0 ) return ETestQuota;
- if ((KeyBuffer.CompareF(KTestStart)) == 0 ) return ETestStart;
- if ((KeyBuffer.CompareF(KTestStore)) == 0 ) return ETestStore;
- if ((KeyBuffer.CompareF(KTestStored)) == 0 ) return ETestStored;
- if ((KeyBuffer.CompareF(KTestStoreStatus)) == 0 ) return ETestStoreStatus;
- if ((KeyBuffer.CompareF(KTestStoreStatusText)) == 0 ) return ETestStoreStatusText;
- if ((KeyBuffer.CompareF(KTestTotals)) == 0 ) return ETestTotals;
- if ((KeyBuffer.CompareF(KTestDeleteInfoIndex)) == 0 ) return ETestDeleteInfoIndex;
- if ((KeyBuffer.CompareF(KTestApplicId)) == 0 ) return ETestApplicId;
- if ((KeyBuffer.CompareF(KTestReplyApplicId)) == 0 ) return ETestReplyApplicId;
- if ((KeyBuffer.CompareF(KTestApplicInfo)) == 0 ) return ETestApplicInfo;
- if ((KeyBuffer.CompareF(KTestContentClass)) == 0 ) return ETestContentClass;
- if ((KeyBuffer.CompareF(KTestDrmContent)) == 0 ) return ETestDrmContent;
- if ((KeyBuffer.CompareF(KTestAdaptationAllowed)) == 0 ) return ETestAdaptationAllowed;
- if ((KeyBuffer.CompareF(KTestRecommendedRetrievalMode)) == 0 ) return ETestRecommendedRetrievalMode;
- if ((KeyBuffer.CompareF(KTestRecRetrievalModeText)) == 0 ) return ETestRecRetrievalModeText;
- if ((KeyBuffer.CompareF(KTestReplaceId)) == 0 ) return ETestReplaceId;
- if ((KeyBuffer.CompareF(KTestStatusText)) == 0 ) return ETestStatusText;
- if ((KeyBuffer.CompareF(KTestCancelId)) == 0 ) return ETestCancelId;
- if ((KeyBuffer.CompareF(KTestCancelStatus)) == 0 ) return ETestCancelStatus;
- if ((KeyBuffer.CompareF(KTestAttContTypeParamName)) == 0 ) return ETestAttContTypeParamName;
- if ((KeyBuffer.CompareF(KTestAttContTypeParamValue)) == 0 ) return ETestAttContTypeParamValue;
- if ((KeyBuffer.CompareF(KTestAttXTypeParamName)) == 0 ) return ETestAttXTypeParamName;
- if ((KeyBuffer.CompareF(KTestAttXTypeParamValue)) == 0 ) return ETestAttXTypeParamValue;
- return ETestUnknown;
- }
-
-// ---------------------------------------------------------
-// CMmsReadFile()::CreateMessageL
-// program build a message from given parts
-// ---------------------------------------------------------
-//
-void CMmsReadFile::CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders )
- {
-
- // Reset inactivity timer to keem viewServer from crashing
- User::ResetInactivityTime();
-
- TInt i;
- TInt error = KErrNone;
- RFile attaFile;
- _LIT8(KLeftAngle, "<");
- _LIT8(KRightAngle, ">");
- // we can't use "seconds from" as it only returns a
- // 32 bit signed integer. If fails in 2038.
- // "microseconds from" returns a 64 bit signed integer
-
- CMsvStore* store = aMmsClient->Entry().EditStoreL();
- CleanupStack::PushL(store);
- aMmsHeaders->StoreL(*store);
- store->CommitL();
- CleanupStack::PopAndDestroy( store );
- store = NULL;
-
- aMmsClient->LoadMessageL(); // read store is needed to do this
-
- store = aMmsClient->Entry().EditStoreL();
- CleanupStack::PushL(store);
- CMsvAttachment* attaInfo = NULL;
- TMsvAttachmentId attaId = 0;
-
- for ( i=0; i < iAttaStructures->Count(); ++i)
- {
- attaId = KMsvNullIndexEntryId;
- iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
-
- error = attaFile.Open( iFs, iFilename, EFileShareReadersOnly | EFileRead );
- User::LeaveIfError( error );
-
- CleanupClosePushL(attaFile);
-
- CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
- CleanupStack::PushL( mimeHeaders );
- TPtrC8 contentType = iAttaStructures->At(i)->iAttaType->Des();
-
- TDataRecognitionResult result;
- result.Reset(); // make sure that it is cleared
-
- if(iAttaStructures->At(i)->iAttaCid->Length())
- {
- TPtr8 attaCID = iAttaStructures->At(i)->iAttaCid->Des();
- if (attaCID.Find(KLeftAngle) == 0 &&
- attaCID.Find(KRightAngle) == attaCID.Length()-1 )
- {
- // remove angle brackets from cid
- attaCID = attaCID.Mid(1,attaCID.Length()-2);
- }
- mimeHeaders->SetContentIdL(attaCID);
- }
-
- if (iAttaStructures->At(i)->iAttaCharset)
- {
- mimeHeaders->SetMimeCharset(iAttaStructures->At(i)->iAttaCharset);
- }
-
- if (iAttaStructures->At(i)->iAttaName->Length())
- {
- iFilename.Copy(iAttaStructures->At(i)->iAttaName->Des());
- }
- iParse.Set( iFilename, NULL, NULL );
- iFilename.Copy( iParse.NameAndExt() );
-
- mimeHeaders->SetContentLocationL( iFilename );
-
- // if Mime type has not been set, use RapaRecognizer
- if ( iAttaStructures->At(i)->iAttaType->Length() == 0 && iFilename.Length() > 0)
- {
- // TO BE IMPLEMENTED
-
- RApaLsSession lsSession;
-
- if ( lsSession.Connect() == KErrNone )
- {
- CleanupClosePushL( lsSession );
-
- iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
- if ( lsSession.RecognizeData( iFilename, TPtrC8(), result ) == KErrNone )
- {
- // Check confidence level. Recognization must be at least
- // "EProbable". We don't accept the result if it is "EPossible"
- // or "EUnlikely" or "ENotRecognized"!
-
- if ( result.iConfidence < CApaDataRecognizerType::EProbable )
- {
- result.Reset(); // clear buffer and try again with longer buffer
- }
-
- TPtrC8 mimeBuf8 = result.iDataType.Des8();
-
- if ( mimeBuf8.Length() == 0 )
- {
- // Open file buffer and try again..
-
- TInt bufSize = 0;
- (void)lsSession.GetMaxDataBufSize( bufSize ); // ignore errors
- if ( bufSize <= 0 )
- {
- bufSize = 30;
- }
- HBufC8* buf = HBufC8::NewLC( bufSize );
- TPtr8 des = buf->Des();
-
- RFile file;
- TInt err=file.Open( iFs, iFilename, EFileShareReadersOnly );
- if ( err == KErrNone )
- {
- err = file.Read( des );
- file.Close();
- if ( err == KErrNone )
- {
- if ( ( lsSession.RecognizeData( iFilename, des, result ) ) == KErrNone )
- {
- mimeBuf8.Set( result.iDataType.Des8() );
- }
- }
-
- }
- CleanupStack::PopAndDestroy(); // buf
- }
- if ( mimeBuf8.Length() > 0 &&
- result.iConfidence >= CApaDataRecognizerType::EProbable )
- {
- contentType.Set( result.iDataType.Des8() );
- }
- }
- CleanupStack::PopAndDestroy(1); // lssession
- }
- }
-
- if ( contentType.Length() > 0 )
- {
- TInt position = contentType.Find( KMmsSlash8 );
- if ( position >= 0 )
- {
- mimeHeaders->SetContentTypeL( contentType.Left( position ) );
- }
- if ( position < contentType.Length() - 1 )
- {
- mimeHeaders->SetContentSubTypeL( contentType.Mid( position + 1 ) );
- }
-// CreateAttachment2L sets the content type to attaInfo
-// attaInfo->SetMimeTypeL( contentType );
- }
-
- if (iAttaStructures->At(i)->iAttaRecommendedName->Length())
- {
- iFilename.Copy(iAttaStructures->At(i)->iAttaRecommendedName->Des());
- iParse.Set( iFilename, NULL, NULL );
- iFilename.Copy( iParse.NameAndExt() );
- mimeHeaders->SetSuggestedFilenameL( iFilename );
- }
-
- TInt j = 0;
- for ( j = 0; j < iAttaStructures->At(i)->iContentTypeParams->MdcaCount(); ++j )
- {
- mimeHeaders->ContentTypeParams().AppendL( iAttaStructures->At(i)->iContentTypeParams->MdcaPoint( j ) );
- }
- for ( j = 0; j < iAttaStructures->At(i)->iXTypeParams->MdcaCount(); ++j )
- {
- mimeHeaders->XTypeParams().AppendL( iAttaStructures->At(i)->iXTypeParams->MdcaPoint( j ) );
- }
-
- attaInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
- // attaInfo does not go onto cleaunpstack because ownership will
- // be transferred to attachment manager.
-
- aMmsClient->CreateAttachment2L(
- *store,
- attaFile,
- contentType,
- *mimeHeaders,
- attaInfo,
- attaId);
- attaInfo = NULL; // ownership transferred
-
- CleanupStack::PopAndDestroy(); // mimeHeaders
- CleanupStack::PopAndDestroy(); // attaFile.Close()
-
- if ( iAttaRoot > 0 && iAttaRoot == ( i + 1 ) )
- {
- aMmsClient->SetMessageRootL( attaId );
- }
- }
-
- store->CommitL();
- CleanupStack::PopAndDestroy(); // store
-
- // This frees all memory and resets all values
- Reset();
- // Reset inactivity timer to keem viewServer from crashing
- User::ResetInactivityTime();
- }
-
-
-// ---------------------------------------------------------
-// CMmsReadFile()::FindAlias
-// program build a message from given parts
-// ---------------------------------------------------------
-//
-TInt CMmsReadFile::FindAlias( TPtrC aAlias )
- {
- TBuf<DefaultBufLen> abuf;
- for( TInt i=0; i < iAliasCount; ++i )
- {
- abuf.Copy( iAliasArray->MdcaPoint(i) );
- abuf.SetLength( abuf.Locate('=') );
- if( ( abuf.CompareF( aAlias ) ) == 0 ) return( i );
- }
- return( -1 );
- }
-
-
-// C++ default constructor can NOT contain any code, that
-// might leave.
-//
-CMmsAttaStructure::CMmsAttaStructure()
- {
- iAtta = NULL;
- iAttaType = NULL;
- iAttaName = NULL;
- iAttaCid = NULL;
- iAttaRecommendedName = NULL;
- }
-
-
-//
-void CMmsAttaStructure::ConstructL()
- {
- iAtta = HBufC8::NewL(DefaultBufLen);
- iAttaType = HBufC8::NewL(DefaultBufLen);
- iAttaName = HBufC8::NewL(DefaultBufLen);
- iAttaCid = HBufC8::NewL(DefaultBufLen);
- iAttaRecommendedName = HBufC::NewL(DefaultBufLen);
- iAttaCharset = 0;
- iXTypeParams = new(ELeave) CDesC8ArrayFlat(4);
- iContentTypeParams = new(ELeave) CDesC8ArrayFlat(4);
-
- }
-
-// Two-phased constructor.
-CMmsAttaStructure* CMmsAttaStructure::NewL()
- {
- CMmsAttaStructure* self = new ( ELeave ) CMmsAttaStructure;
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop();
- return self;
- }
-
-// Destructor
-CMmsAttaStructure::~CMmsAttaStructure()
- {
- delete iAtta;
- delete iAttaName;
- delete iAttaType;
- delete iAttaCid;
- delete iAttaRecommendedName;
- if ( iContentTypeParams )
- {
- iContentTypeParams->Reset();
- }
- delete iContentTypeParams;
- if ( iXTypeParams )
- {
- iXTypeParams->Reset();
- }
- delete iXTypeParams;
- }
-
-
-// End of File
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/src/mmstestbed.cpp Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2357 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#include <mtmdef.h>
-#include <CoreApplicationUIsSDKCRKeys.h>
-#include <mmsheaders.h>
-#include <mmscmds.h>
-#include <mmsencode.h>
-#include <mmscliententry.h>
-#include <logwrap.h>
-#include <logcli.h>
-#include <logview.h>
-#include "mmssettings.h" //use mmssettings.h instead of cmmssettings.h
-#include "mmstestbed.h"
-#include "mmsreadfile.h"
-#include "mmstestuitimer.h"
-#include "mmsteststaticutils.h"
-#include "mmstestbed.hrh"
-
-//constants
-_LIT( KMmsSender, "0601234567" );
-
-MmsTestBed::MmsTestBed()
- {
- //start the timer
- iTimer = CTestUiTimer::NewL();
- iTimer->Cancel();
-
- iWait = CMsvOperationActiveSchedulerWait::NewLC();
- // don't leave iWait on cleanup stack
- CleanupStack::Pop();
-
- //open msvsession
- iSession = CMsvSession::OpenSyncL(*this);
- //create client registry
- iClientMtmRegistry = CClientMtmRegistry::NewL(*iSession);
- //create client mtm
- iMmsClient = (CMmsClientMtm *) iClientMtmRegistry->NewMtmL(
- KUidMsgTypeMultimedia);
-
- User::LeaveIfError( iFs.Connect() );
- iFs.SetSessionPath( KRootPath );
- iSettings = CMmsSettings::NewL();
- iMmsHeaders = CMmsHeaders::NewL(iSettings->MmsVersion());
- findDefaultL();
- iServiceId = iDefaultServiceId;
-
- //validate the settings
- iSettings->ValidateSettings();
-
- iLogEvent = CLogEvent::NewL();
- iLogEvent->SetEventType(KLogMmsEventTypeUid);
- iLogClient = NULL; // we test soon if this is available
- iLogView = NULL; // needs log client
- if ( checkLogClient() )
- {
- // first we generate a general view of all events
- // we'll set the filter when we update the view
- iLogView = CLogViewEvent::NewL( *iLogClient );
- }
- iLogFilter = CLogFilter::NewL();
- // we try to filter MMS events
- iLogFilter->SetEventType(KLogMmsEventTypeUid);
- }
-
-MmsTestBed::~MmsTestBed()
- {
- delete iLogView;
- delete iLogFilter;
- delete iLogClient;
- delete iLogEvent;
- delete iSettings;
- delete iMmsHeaders;
- if(iTimer)
- {
- iTimer->Cancel();
- delete iTimer;
- }
- //delete iMsvEntrySelection;
- delete iMmsClient;
- delete iClientMtmRegistry;
- //delete iClientMtmRegistry;
- delete iSession;
- delete iWait;
- }
-
-void MmsTestBed::setConnectionLocal(bool value)
- {
- //value = true for global off, local on
- //value = false for global on, local off
- iSettings->LoadSettingsL();
- iSettings->SetLocalMode( value );
- iSettings->SaveSettingsL();
- }
-
-void MmsTestBed::fromOutboxToMmsc()
- {
- CMsvEntry* cEntry = NULL;
-
- // Get List of services
- cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
- CleanupStack::PushL(cEntry);
- // Get all mms messages of outbox
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL(
- KUidMsgTypeMultimedia);
- CleanupStack::PushL(selection);
-
- // Change state to "KMsvSendStateUnknown" in case the entry has been suspended earlier
- for (TInt i = 0; i < selection->Count(); ++i)
- {
- cEntry->SetEntryL(selection->At(i));
- TMsvEntry entry = cEntry->Entry();
- entry.SetReadOnly(EFalse);
- entry.SetSendingState(KMsvSendStateUnknown);
- cEntry->ChangeL(entry);
- }
-
- selection->InsertL(0, iServiceId);
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack(parameters);
-
- op = iSession->TransferCommandL(*selection, EMmsSend, paramPack,
- iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending)
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if (iWait->iStatus.Int() != KErrNone)
- {
- //DEBUG(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- CleanupStack::PopAndDestroy(); //cEntry
- }
-
-void MmsTestBed::fromMmscToInbox()
- {
- CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
- CleanupStack::PushL(msvEntrySelection);
-
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- msvEntrySelection->InsertL(0, iServiceId);
- }
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack(parameters);
-
- op = iMmsClient->InvokeAsyncFunctionL(EMmsReceive, *msvEntrySelection,
- paramPack, iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending)
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if (iWait->iStatus.Int() != KErrNone)
- {
- //DEBUG(_L("Testbed tried to receive, return status %d"),iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); //msvEntrySelection
- }
-
-void MmsTestBed::findDefaultL()
- {
- iSettings->LoadSettingsL();
- iDefaultServiceId = iSettings->Service();
- }
-
-void MmsTestBed::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
- TAny* aArg2, TAny* /*aArg3*/)
- {
- iEvent = aEvent;
- if (aEvent == EMsvGeneralError)
- {
- return;
- }
- TMsvId parentId = KMsvNullIndexEntryId;
- if (aArg2 != NULL)
- {
- parentId = *(TMsvId*) aArg2;
- }
-
- CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
- TMsvEntry tEntry;
- TMsvId service;
- TInt error = KErrNone;
- error = iSession->GetEntry(selection->At(0), service, tEntry);
-
- CMsvEntry* cEntry = NULL;
- switch (aEvent)
- {
- case EMsvEntriesCreated:
- {
- if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
- {
- // emit signal for new entry into INBOX
- emit entryCreatedInInbox(tEntry.Id());
- }
- else if (parentId == KMsvDraftEntryIdValue)
- {
- // emit signal for new entry into Draft
- emit entryCreatedInDraft(tEntry.Id());
- }
- else if (parentId == iServiceId)
- {
- // emit signal for new Entry into SERVICE
- }
- else
- {
- // do nothing
- }
- }
- break;
- case EMsvEntriesChanged:
- {
- TMsvId id;
- CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
- if (selection == NULL)
- {
- // no selection, cannot handle
- return;
- }
- id = selection->At(0);
- //DEBUG Entry changed"));
- if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
- {
-/*
- cEntry = iSession->GetEntryL( parentId );
- CleanupStack::PushL( cEntry );
- TRAPD (error, cEntry->SetEntryL( id ));
- if ( error != KErrNone )
- {
- CleanupStack::PopAndDestroy(); // cEntry
- return;
- }
- TMsvEntry tEntry = cEntry->Entry();
- if ( tEntry.Visible() )
- {
- // generate fake delivery report
- CMsvStore* store = cEntry->ReadStoreL();
- CleanupStack::PushL( store );
- CMmsHeaders* mmsHeaders = CMmsHeaders::NewL( iSettings->MmsVersion() );
- CleanupStack::PushL( mmsHeaders );
- mmsHeaders->RestoreL( *store );
- iEncodeBuffer->ResizeL( 0 );
- generateDeliveryReport( mmsHeaders );
- CleanupStack::PopAndDestroy( 2 ); // mmsHeaders, store
- }
- CleanupStack::PopAndDestroy(); // cEntry
-*/
- }
- }
- break;
- case EMsvEntriesDeleted:
- {
- //emit signal for entry deleted
- }
- break;
- case EMsvEntriesMoved:
- {
- if (parentId == KMsvGlobalOutBoxIndexEntryIdValue)
- {
- // entry moved to outbox
- emit entryMovedToOutbox(tEntry.Id());
- }
- else if (parentId == KMsvSentEntryIdValue)
- {
- // entry moved to sent folder
- emit entryMovedToSent(tEntry.Id());
- }
- else
- {
- // do nothing
- }
- }
- break;
- default:
- break;
- }
- }
-
-void MmsTestBed::createMmsService()
- {
- CMmsSettings * settings = CMmsSettings::NewL();
- CleanupStack::PushL( settings );
- settings->CreateNewServiceL( *iSession );
- CleanupStack::PopAndDestroy(); // settings
- return;
- }
-
-void MmsTestBed::cleanup()
- {
- TMsvId entryToBeKilled;
- // Get access to root index
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
-
- entryToBeKilled = iSettings->Service();
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- while (entryToBeKilled != KMsvNullIndexEntryId)
- {
- // delete child of root entry
- deleteEntry(entryToBeKilled, *cEntry);
- entryToBeKilled = iSettings->Service();
- }
-
- CleanupStack::PopAndDestroy(); // cEntry
- // We deleted everything!
- iDefaultServiceId = KMsvNullIndexEntryId;
- iServiceId = KMsvNullIndexEntryId;
- }
-
-void MmsTestBed::deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry)
- {
- aClientEntry.DeleteL(aEntryId);
- }
-
-void MmsTestBed::cleanupAndCreateNewService()
- {
- cleanup();
- // all old service entries have been destroyed, create a new one
- createMmsService();
- }
-
-void MmsTestBed::testFile(TFileName& aFilePath, TInt aCommand /* = 0 */, TMsvId aBox /* = KMsvGlobalOutBoxIndexEntryId */ )
- {
- // update settings in mmsclient
- iMmsClient->RestoreSettingsL();
- iSettings->CopyL( iMmsClient->MmsSettings() );
-
- RFileReadStream readStream;
- readStream.PushL();
-// TMsvId id = KMsvNullIndexEntryId;
- CBufFlat* encodeBuffer = NULL;
- CMmsEncode* encoder = NULL;
-
- // Open the file
- TInt err = readStream.Open(iFs, aFilePath, EFileShareReadersOnly );
- if (err != KErrNone) User::Leave( err );
-
- TInt retCode = 0;
- CMmsReadFile* readFile = NULL;
- readFile = CMmsReadFile::NewL( iFs, readStream );
- CleanupStack::PushL( readFile );
-
- TInt messageCounter = 0;
- CMsvEntry* cEntry = NULL;
-
- while(!retCode)
- {
- // READ MESSAGE TO BUFFERS
- iMmsHeaders->Reset(iSettings);
- // put in some message type just for fun (testing...)
- iMmsHeaders->SetMessageType( KMmsMessageTypeForwardReq );
- retCode = readFile->CompleteTestL( messageCounter++, *iMmsHeaders );
- if(readFile->iMessageType == ETestNewMessage)
- {
- // CREATE MESSAGE ENTRY
- switch ( aCommand )
- {
- case ECreateToInbox:
- case ECreateNotification:
- cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
- break;
- case ECreateToSentItems:
- cEntry = iSession->GetEntryL(KMsvSentEntryId);
- break;
- case ECreateToDrafts:
- cEntry = iSession->GetEntryL(KMsvDraftEntryId);
- break;
- case ECreateHeadersFromFile:
- // here we just encode headers, no message entry
- // the entry is fake.
- break;
- case ECreateMMBoxViewConf:
- if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
- {
- // entry is not created for the description items
- // they become attachments
- cEntry = iSession->GetEntryL(KMsvDraftEntryId);
- }
- break;
- default:
- cEntry = iSession->GetEntryL(aBox);
- break;
- }
-
- // if we are just playing with headers we have no entry
- if ( aCommand != ECreateHeadersFromFile && aCommand != ECreateMMBoxViewConf )
- {
- CleanupStack::PushL(cEntry);
- iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
-
- // CREATE MESSAGE
- iMmsClient->CreateMessageL(iServiceId);
- }
- else if ( aCommand == ECreateMMBoxViewConf )
- {
- if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
- {
- CleanupStack::PushL(cEntry);
- iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
-
- // CREATE MESSAGE
- iMmsClient->CreateMessageL(iServiceId);
- }
- else
- {
- encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
- CleanupStack::PushL( encodeBuffer );
- encoder = CMmsEncode::NewL( iFs );
- CleanupStack::PushL( encoder );
-
- // encode headers to a binary file
- encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
-
- iFilename = KMmsMMBoxDescriptionDirectory;
- TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
-
- CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
- encodeBuffer = NULL;
- encoder = NULL;
- }
- }
- else
- {
- encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
- CleanupStack::PushL( encodeBuffer );
- encoder = CMmsEncode::NewL( iFs );
- CleanupStack::PushL( encoder );
-
- // encode headers to a binary file
- encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
-
- iFilename = KMmsDumpDirectory;
- TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
-
- CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
- encodeBuffer = NULL;
- encoder = NULL;
- }
- }
-
- if ( aCommand != ECreateHeadersFromFile &&
- ( aCommand != ECreateMMBoxViewConf || iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf ) )
- {
- if(readFile->iMessageType == ETestSettings)
- {
- TMsvId ServiceId = iMmsClient->DefaultServiceL();
- iMmsClient->RestoreSettingsL();
- iSettings->CopyL( iMmsClient->MmsSettings() );
- }
-
- TMemoryInfoV1Buf memory;
- UserHal::MemoryInfo( memory );
- TInt available = memory().iFreeRamInBytes;
-// TMmsLogger::Log(_L("Free memory before CreateMessageL %d"), available );
-
- TRAP (err, readFile->CreateMessageL(iMmsClient, iMmsHeaders));
-
- available = memory().iFreeRamInBytes;
-// TMmsLogger::Log(_L("Free memory after CreateMessageL %d"), available );
-
- if(readFile->iMessageType == ETestNewMessage)
- {
- TMsvEntry tEntry = iMmsClient->Entry().Entry();
- TMsvId id = tEntry.Id();
- if ( err == KErrNone )
- {
- // SAVE MESSAGE
- iMmsClient->SaveMessageL();
-
- // If we are creating a MMBox View confirmation,
- // we add all binary files from KMmsMMBoxDirectory
- // as attachments.
-
- if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
- {
- addMMBoxDescriptions();
- }
-
- // reload the entry in case mms client put something into it
- // MESSAGE MUST BE SET VISIBLE
- tEntry = iMmsClient->Entry().Entry();
- if ( iMmsClient->MessageClass() == EMmsClassAdvertisement )
- {
- tEntry.iMtmData1 |= KMmsMessageAdvertisement;
- }
- else if ( iMmsClient->MessageClass() == EMmsClassInformational )
- {
- tEntry.iMtmData1 |= KMmsMessageInformational;
- }
- tEntry.iMtmData1 &= ~KMmsMessageMobileTerminated;
-
- // Test: Set all as editor oriented - except notifications!
- if ( aCommand == ECreateNotification )
- {
- tEntry.iMtm = KUidMsgMMSNotification;
- }
- else
- {
- tEntry.iMtmData1 |= KMmsMessageEditorOriented;
- }
- if ( aCommand == ECreateToInbox )
- {
- tEntry.iMtmData1 |= KMmsMessageMobileTerminated;
- tEntry.SetReadOnly( ETrue );
- tEntry.SetNew( ETrue );
- tEntry.SetUnread( ETrue );
- }
- else if ( aCommand == ECreateToSentItems )
- {
- tEntry.SetReadOnly( ETrue );
- }
- tEntry.SetVisible( ETrue );
- tEntry.SetInPreparation( EFalse );
- TTime now;
- now.UniversalTime();
- tEntry.iDate = now;
- TMsvId entryId = tEntry.Id();
- iMmsClient->Entry().ChangeL( tEntry );
- if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
- {
- // Encode to the directory that is used to fetch MMBox view
- iFilename.Copy( KMmsMMBoxDirectory );
- encodeMessageFromDrafts();
- cEntry->SetEntryL( KMsvDraftEntryId );
- cEntry->DeleteL( entryId );
- }
- }
- else
- {
- //TMmsLogger::Log(_L("CreateMessageL left with error %d"), err );
- iSession->RemoveEntry(id);
- err = KErrNone; // clear error
- }
- CleanupStack::PopAndDestroy(); // cEntry
- cEntry = NULL;
- }
- if(readFile->iMessageType == ETestSettings)
- {
- iMmsClient->SetSettingsL( *iSettings );
- iMmsClient->StoreSettingsL();
- }
- }
- }
-
- CleanupStack::PopAndDestroy(); //readFile
-
- readStream.Close();
- readStream.Pop();
-
- /*
- iMmsClient->SwitchCurrentEntryL(id);
- */
- }
-
-void MmsTestBed::addMMBoxDescriptions()
- {
- // add the contents of KMmsMMBoxDescriptionDirectory as attachments
- CDir* fileList = NULL;
- TInt i = 0; // general counter
- TInt error = KErrNone;
- iCurrentPath = KMmsMMBoxDescriptionDirectory;
-
- iFs.SetSessionPath(iCurrentPath);
-
- TFindFile finder( iFs );
- error = finder.FindWildByPath( KWild, NULL, fileList );
- CleanupStack::PushL( fileList );
- TInt fileCounter = 0;
-
- if ( error == KErrNone )
- {
- fileCounter = fileList->Count();
- }
-
- TEntry entry;
-
- if ( error == KErrNone )
- {
- for ( i = 0; i < fileCounter; ++i )
- {
- // Reset inactivity timer to keep viewServer from crashing
- User::ResetInactivityTime();
- entry = (*fileList)[i]; // name is entry.iName
- iFilename.Copy( iCurrentPath );
- iFilename.Append( entry.iName );
- TPtrC ptr;
- ptr.Set( iFilename );
- iWait->iStatus = KErrNone;
- iMmsClient->AddAttachmentL( ptr, KMmsMimeType, 0, iWait->iStatus );
-
- iWait->Start();
- // The descriptions are cleared after being used
- iFs.Delete( ptr);
- }
- }
-
- iMmsClient->SaveMessageL(); // just in case somthing must be updated
- CleanupStack::PopAndDestroy(); // fileList
- fileList = NULL;
- }
-
-void MmsTestBed::encodeMessageFromDrafts()
- {
- CMmsEncode* encoder = CMmsEncode::NewL( iFs );
- CleanupStack::PushL( encoder );
- // encode a message iMmsClientPoints to
- iMmsClient->LoadMessageL();
- CMsvStore* store = iMmsClient->Entry().ReadStoreL();
- CleanupStack::PushL( store );
- iMmsHeaders->RestoreL( *store );
- CleanupStack::PopAndDestroy(); // store
- store = NULL;
- iWait->iStatus = KErrNone;
-
-// caller sets the directory
-// iFilename = KMmsMessageDumpDirectory;
-
- CMmsClientEntry* entryWrapper = CMmsClientEntry::NewL( iFs, iMmsClient->Entry(), iServiceId );
- CleanupStack::PushL( entryWrapper );
- iEncodeBuffer->ResizeL(0);
- encoder->StartL( *entryWrapper, *iMmsHeaders, *iEncodeBuffer, iWait->iStatus );
- iWait->Start();
- if ( iWait->iStatus == KErrNone )
- {
- TMmsTestUtils::Dump( *iEncodeBuffer, iFilename, iParse, iFs );
- }
- iEncodeBuffer->ResizeL(0);
- CleanupStack::PopAndDestroy(); // entryWrapper
- CleanupStack::PopAndDestroy(); // encoder
- }
-
-void MmsTestBed::deleteNotifications()
- {
- TMsvId mmsFolderId = KMsvNullIndexEntryId;
- mmsFolderId = findMMSFolder();
-
- CMsvEntry* cEntry = NULL;
- // delete all messages from the specified box
- cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
-
- if ( mmsFolderId != KMsvNullIndexEntryId )
- {
- cEntry->SetEntryL(mmsFolderId);
-
- // show invisible entries
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PushL(msvEntrySelection);
-
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- if (msvEntrySelection->Count() > 0)
- {
- CMsvOperation* op = iSession->TransferCommandL(
- *msvEntrySelection,
- EMmsDeleteEntries,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- CleanupStack::PopAndDestroy(); // op
- }
-
- // These cannot be deleted unless we have the a server mtm
- // corresponding to this mtm type.
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- CleanupStack::PopAndDestroy(); //msvEntrySelection
- msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgMMSNotification );
- CleanupStack::PushL(msvEntrySelection);
-
- if (msvEntrySelection->Count() > 0)
- {
- CMsvOperation* op = iSession->TransferCommandL(
- *msvEntrySelection,
- EMmsDeleteEntries,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- CleanupStack::PopAndDestroy(); // op
- }
-
- CleanupStack::PopAndDestroy(); //msvEntrySelection
-
- CleanupStack::PopAndDestroy(); //cEntry
- }
- }
-
-TMsvId MmsTestBed::findMMSFolder()
- {
- return iSettings->NotificationFolder();
- }
-
-void MmsTestBed::restoreFactorySettings()
- {
- iMmsClient->RestoreSettingsL();
- iSettings->CopyL( iMmsClient->MmsSettings() );
- // do not reset access point
- TInt accessPoint = iSettings->AccessPoint( 0 );
- iSettings->RestoreFactorySettingsL( iMmsClient->Session(), EMmsFactorySettingsLevelDeep );
- TInt count = iSettings->AccessPointCount();
- TInt i = 0;
- for ( i = count - 1; i >= 0; --i )
- {
- iSettings->DeleteAccessPointL( i );
- }
- // restore the original access point
- if ( accessPoint > 0 )
- {
- // a negative access point is an error (most likely "KErrNotFound")
- iSettings->AddAccessPointL( accessPoint, 0 );
- }
- iMmsClient->SetSettingsL( *iSettings );
- iMmsClient->StoreSettingsL();
- }
-
-void MmsTestBed::setFetchingState( TMmsReceivingMode aState )
- {
- iMmsClient->RestoreSettingsL();
- iSettings->CopyL( iMmsClient->MmsSettings() );
-
- iSettings->SetReceivingModeHome( aState );
-
- iMmsClient->SetSettingsL( *iSettings );
- iMmsClient->StoreSettingsL();
- }
-
-void MmsTestBed::sendFromFile()
- {
- CMsvOperation * op = NULL;
-
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
- CleanupStack::PushL( cEntry );
-
- CMsvEntrySelection* selection = NULL;
- selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PopAndDestroy(); // cEntry
- CleanupStack::PushL( selection );
-
- TRAPD (error, op = iMmsClient->SendL(*selection, iWait->iStatus));
- if ( error != KErrNone )
- {
- CleanupStack::PopAndDestroy(); // selection
- delete op;
- return;
- }
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(2); // op, selection
- }
-
-void MmsTestBed::sendOneByOne()
- {
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
- CleanupStack::PushL( cEntry );
-
- CMsvEntrySelection* selection = NULL;
- selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PushL( selection );
-
- CMsvEntrySelection* shortSelection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( shortSelection );
-
- TInt i;
-
- for ( i = 0; i < selection->Count(); ++i )
- {
- shortSelection->Reset();
- shortSelection->AppendL( selection->At( i ) );
-
- CMsvOperation * op = NULL;
-
- TTime now;
- now.UniversalTime();
-
- TRAPD (error, op = iMmsClient->SendL(*shortSelection, iWait->iStatus, now ));
- if ( error != KErrNone )
- {
- delete op;
- CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
- return;
- }
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
-
- }
- CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
- }
-
-void MmsTestBed::sendNotifications()
- {
- // Only send one notification!!
-
- TInt error = KErrNone;
-
- if (! TMmsTestUtils::IsFile(iCurrentFile, iFs) )
- {
- //Not a file
- return;
- }
- TMsvId mmsFolder = findMMSFolder();
-
- TEntry entry;
-
-
- // now I think we have a filename
- TEntry orgEntry;
- TUint size = 0;
- error = iFs.Entry( iCurrentFile, orgEntry );
- size = orgEntry.iSize;
-
- //TMmsLogger::Log(_L("- notification %S "), &iCurrentFile);
- if ( size == 0 )
- {
- //empty file
- //TMmsLogger::Log(_L("- empty file"));
- return;
- }
-
- if ( iEncodeBuffer == NULL )
- {
- iEncodeBuffer = CBufFlat::NewL( size );
- }
- else
- {
- iEncodeBuffer->ResizeL( 0 );
- iEncodeBuffer->ResizeL( size );
- }
-
- RFile inFile;
- error = inFile.Open( iFs, iCurrentFile, EFileShareReadersOnly );
- TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
- if ( error == KErrNone )
- {
- error = inFile.Read( ptr, size );
- inFile.Close();
- }
- else
- {
- //Error
- //TMmsLogger::Log(_L("- can't read file"));
- return;
- }
-
- TUint8 byte;
- TUint position = 0;
- TUint32 uintvar = 0;
-
- if ( size > 2 )
- {
- iEncodeBuffer->Read( 1, &byte, 1 );
- if ( byte == 6 ) // PUSH PDU
- {
- // try to find out length of header
- position = 2;
- iEncodeBuffer->Read( position, &byte, 1);
-
- while ( byte & 0x80 && position < size )
- {
- uintvar += ( byte & 0x7f );
- uintvar <<= 7;
- position++;
- iEncodeBuffer->Read( position, &byte, 1 );
- }
-
- // add last byte without shift
- uintvar += byte;
- position++;
- }
- }
-
- position += uintvar;
-
- if ( position < size )
- {
- ptr = iEncodeBuffer->Ptr( position );
- size = ptr.Length();
- }
-
- if ( size == 0 )
- {
- //no MMS stuff
- //TMmsLogger::Log(_L("- no MMS stuff"));
- return;
- }
-
- TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
-
- // Now we have streamed our data into this entry.
- // Now we have an entry that says: local service, MMS MTM
- CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( selection );
- if ( entryId != KMsvNullIndexEntryId )
- {
- selection->AppendL( entryId );
- }
- else
- {
- selection->AppendL( iDefaultServiceId );
- }
-
- TWatcherParameters parameters; // initialized to zero
- parameters.iWatcherId = RThread().Id();
- parameters.iDataPointer = &ptr;
- TWatcherParametersBuf paramPack( parameters );
-
- CMsvOperation * op = NULL;
-
- op = iSession->TransferCommandL(
- *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- User::After(1000000);
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::copyDrafts()
- {
- CMsvEntry* cEntry = NULL;
-// Copies contents of sent folder to drafts for retrying sending.
-
- cEntry = iSession->GetEntryL(KMsvSentEntryId);
- CleanupStack::PushL(cEntry);
- // Get all mms messages in drafts
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
-
- TMsvLocalOperationProgress progress;
- cEntry->CopyL( *selection, KMsvDraftEntryId, progress );
-
- TInt i = 0;
- for ( i = 0; i < selection->Count(); ++i )
- {
- cEntry->SetEntryL( selection->At( i ) );
- TMsvEntry entry = cEntry->Entry();
- entry.SetReadOnly( EFalse );
- cEntry->ChangeL( entry );
- }
-
- CleanupStack::PopAndDestroy(2); // selection, cEntry
- }
-
-void MmsTestBed::garbageCollection(TUint32 aReason)
- {
- CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( selection );
- selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
-
- TMMSGarbageCollectionParameters parameters; // initialized to zero
- parameters.iReasonFlags = aReason;
- TMMSGarbageCollectionParametersBuf paramPack( parameters );
- op = iSession->TransferCommandL(
- *selection, EMmsGarbageCollection, paramPack, iWait->iStatus );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::messageVariation()
- {
- CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( selection );
- selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
-
- op = iSession->TransferCommandL(
- *selection, EMmsMessageGeneration, TPtrC8(), iWait->iStatus );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::cancelSendScheduling()
- {
- CMsvEntry* cEntry = NULL;
- setFetchingState( EMmsReceivingPostpone );
- testFile( iCurrentFile );
- scheduledSend(KMsvGlobalOutBoxIndexEntryIdValue, 10000); // long delay so that we have time to cancel
- deleteSendSchedule();
-
- cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
- cEntry->SetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
- if (iMsvEntrySelection != NULL)
- {
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- }
- iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PopAndDestroy();
- }
-
-void MmsTestBed::scheduledSend(TMsvId aBoxId, TInt aDelay /* = 5 */)
- {
- CMsvEntry* cEntry = NULL;
- TCommandParameters parameters;
- parameters.iInitialDelay = aDelay;
- TCommandParametersBuf paramPack( parameters );
-
- cEntry = iSession->GetEntryL(aBoxId);
- CleanupStack::PushL(cEntry);
- // Get all mms messages of outbox
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
-// selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsScheduledSend,
- *selection,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(2); // cEntry, selection
- }
-
-void MmsTestBed::deleteSendSchedule()
- {
- CMsvEntry* cEntry = NULL;
-
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
- CleanupStack::PushL(cEntry);
- // Get all mms messages of outbox
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
- selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsDeleteSchedule,
- *selection,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(2); // cEntry, selection
- }
-
-void MmsTestBed::cancelFetchScheduling()
- {
- TMsvId mmsFolder = findMMSFolder();
- CMsvEntry* cEntry = NULL;
- setFetchingState( EMmsReceivingPostpone );
- testFile( iCurrentFile );
- fromOutboxToMmsc(); // immediate send (EMmsSend)
-
- // Wait until notification has arrived - may take a while in global mode
- TInt i = 0;
- while ( TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) == 0
- && i < 2000 )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- i++;
- if ( (i/100) * 100 == i )
- {
- //TMmsLogger::Log(_L("%d:th wait cycle"), i );
- }
- CActiveScheduler::Start();
- }
- iTimer->Cancel();
-
- fetchForced( 10000 ); // delay to allow cancelling
- deleteFetchSchedule();
-
- cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
- cEntry->SetEntryL(mmsFolder);
- if (iMsvEntrySelection != NULL)
- {
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- }
- iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PopAndDestroy(); // cEntry
- }
-
-void MmsTestBed::fetchForced(TInt aDelay /* = 5 */)
- {
- TCommandParameters parameters;
- parameters.iInitialDelay = aDelay;
- TCommandParametersBuf paramPack( parameters );
-
- CMsvEntrySelection* selection = new CMsvEntrySelection;
- CleanupStack::PushL( selection );
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- selection->InsertL(0, iServiceId);
- }
- else
- {
- selection->InsertL(0, iDefaultServiceId);
- }
-
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsScheduledReceiveForced,
- *selection,
- paramPack,
- iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::deleteFetchSchedule()
- {
- CMsvEntry* cEntry = NULL;
-
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- TMsvId mmsFolderId = KMsvNullIndexEntryId;
- mmsFolderId = findMMSFolder();
- cEntry = iSession->GetEntryL( mmsFolderId );
- CleanupStack::PushL(cEntry);
- // Get all notifications
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
- selection->InsertL(0, iDefaultServiceId);
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsDeleteSchedule,
- *selection,
- paramPack,
- iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(2); // cEntry, selection
- }
-
-void MmsTestBed::doAFetchCycle()
- {
- // Sends a message from iCurrentFile and lets it come back
- TMsvId mmsFolder = findMMSFolder();
- testFile( iCurrentFile );
- fromOutboxToMmsc(); // immediate send (EMmsSend)
- // fetching will start automatically
-
- TInt i = 0;
- while ( TMmsTestUtils::CountChildrenL( KMsvGlobalInBoxIndexEntryId, iMsvEntrySelection, *iSession ) == 0
- && i < 2000
- && TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) > 0 )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- i++;
- if ( (i/100) * 100 == i )
- {
- //TMmsLogger::Log(_L("%d:th wait cycle"), i );
- }
- CActiveScheduler::Start();
- }
- iTimer->Cancel();
- }
-
-bool MmsTestBed::checkLogClient()
- {
- if ( iLogClient == NULL )
- {
- TRAP_IGNORE( iLogClient = CLogClient::NewL( iFs ) );
- }
- return ( iLogClient != NULL );
- }
-
-int MmsTestBed::getLogEntries()
- {
- TInt count = 0;
- if ( !iLogView )
- {
- return 0;
- }
-
- if ( iLogView->SetFilterL( *iLogFilter, iWait->iStatus ) )
- {
- // should complete with KErrNone
- iWait->Start();
- if ( iWait->iStatus.Int() == KErrNone )
- {
- count = iLogView->CountL();
- }
- }
- return count;
- }
-
-void MmsTestBed::createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry)
- {
- CMsvOperation* opert = aClientEntry.CreateL(aNewEntry, iWait->iStatus);
- iWait->Start();
- if (!opert->iStatus.Int()==KErrNone)
- {
- // what should we do? panic?
- }
-
- TPckgBuf<TMsvLocalOperationProgress> package;
- package.Copy(opert->ProgressL());
- *(TMsvId*)&aNewEntry = package().iId;
-
- delete opert; opert=NULL;
- }
-
-void MmsTestBed::cleanOutbox()
- {
- TMmsTestUtils::CleanBoxL(KMsvGlobalOutBoxIndexEntryId, *iSession);
- }
-
-void MmsTestBed::cleanInbox()
- {
- TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
- }
-
-void MmsTestBed::cleanSent()
- {
- TMmsTestUtils::CleanBoxL(KMsvSentEntryId, *iSession);
- }
-
-void MmsTestBed::cleanDrafts()
- {
- TMmsTestUtils::CleanBoxL(KMsvDraftEntryId, *iSession);
- }
-
-void MmsTestBed::cleanAll()
- {
- cleanInbox();
- cleanOutbox();
- cleanSent();
- cleanDrafts();
- TMmsTestUtils::CleanBoxL( iSettings->MMBoxFolder(), *iSession );
- deleteNotifications();
- }
-
-void MmsTestBed::reply()
- {
- // The first message from inbox is replied to
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
- CleanupStack::PushL(cEntry);
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- if ( iMsvEntrySelection->Count() > 0 )
- {
- TMsvId originalEntry = iMsvEntrySelection->At(0);
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription;
- CMsvOperation * op = NULL;
- op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Create reply, return status %d"), iWait->iStatus.Int());
- }
- else
- {
- TMsvId newEntry = KMsvNullIndexEntryId;
- TPckgBuf<TMsvId> package;
- package.Copy(op->ProgressL());
- newEntry = package();
- if ( newEntry != KMsvNullIndexEntryId )
- {
- cEntry->SetEntryL( newEntry );
- TMsvEntry entry = cEntry->Entry();
- entry.SetInPreparation( EFalse );
- entry.SetVisible( ETrue );
- cEntry->ChangeL(entry);
- }
- }
- CleanupStack::PopAndDestroy(); // op
- }
- CleanupStack::PopAndDestroy(); // cEntry
- }
-
-void MmsTestBed::replyToAll()
- {
- // The first message from inbox is replied to
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
- CleanupStack::PushL(cEntry);
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
-
- if ( iMsvEntrySelection->Count() > 0 )
- {
- TMsvId originalEntry = iMsvEntrySelection->At(0);
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
- KMsvMessagePartRecipient;
- CMsvOperation * op = NULL;
- op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Create reply to all, return status %d"), iWait->iStatus.Int());
- }
- else
- {
- TMsvId newEntry = KMsvNullIndexEntryId;
- TPckgBuf<TMsvId> package;
- package.Copy(op->ProgressL());
- newEntry = package();
- if ( newEntry != KMsvNullIndexEntryId )
- {
- cEntry->SetEntryL( newEntry );
- TMsvEntry entry = cEntry->Entry();
- entry.SetInPreparation( EFalse );
- entry.SetVisible( ETrue );
- cEntry->ChangeL(entry);
- }
- }
- CleanupStack::PopAndDestroy(); // op
- }
- CleanupStack::PopAndDestroy(); // cEntry
- }
-
-void MmsTestBed::forward()
- {
- // The first message from inbox is forwarded
- CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
- CleanupStack::PushL(cEntry);
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
-
- if ( iMsvEntrySelection->Count() > 0 )
- {
- TMsvId originalEntry = iMsvEntrySelection->At(0);
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
- KMsvMessagePartRecipient | KMsvMessagePartAttachments;
- CMsvOperation * op = NULL;
- op = iMmsClient->ForwardL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
- CleanupStack::PushL(op);
- iWait->Start();
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Create forward, return status %d"), iWait->iStatus.Int());
- }
- else
- {
- TMsvId newEntry = KMsvNullIndexEntryId;
- TPckgBuf<TMsvId> package;
- package.Copy(op->ProgressL());
- newEntry = package();
- if ( newEntry != KMsvNullIndexEntryId )
- {
- iMmsClient->SwitchCurrentEntryL( newEntry );
- // Add a sender: 0601234567
- iMmsClient->LoadMessageL();
- iMmsClient->SetSenderL( KMmsSender );
- iMmsClient->SaveMessageL();
- cEntry->SetEntryL( newEntry );
- TMsvEntry entry = cEntry->Entry();
- entry.SetInPreparation( EFalse );
- entry.SetVisible( ETrue );
- cEntry->ChangeL(entry);
- }
- }
- CleanupStack::PopAndDestroy(); // op
- }
- CleanupStack::PopAndDestroy(); // cEntry
- }
-
-void MmsTestBed::sendReadReport()
- {
- // TURN READ REPORTS ON (until available from menu)
- iSettings->LoadSettingsL();
- iSettings->SetReadReplyReportSendingAllowed( ETrue );
- iSettings->SaveSettingsL();
- iMmsClient->RestoreSettingsL();
-
-
- // Read report is sent for the first message in inbox
- CMsvEntry* cEntry = iSession->GetEntryL( KMsvGlobalInBoxIndexEntryId );
- CleanupStack::PushL(cEntry);
- delete iMsvEntrySelection;
- iMsvEntrySelection = NULL;
- iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
-
- if ( iMsvEntrySelection->Count() == 0 )
- {
- return;
- }
- TMsvId originalEntry = iMsvEntrySelection->At( 0 );
-
- // new test using Client MTM
- CMsvOperation * op = NULL;
- op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy( op );
- op = NULL;
-
- // Try sending the read report to current entry
-
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy( op );
- op = NULL;
-
-/*
- cEntry->SetEntryL( originalEntry );
- iMmsHeaders->Reset();
- CMsvStore* store = cEntry->ReadStoreL();
- CleanupStack::PushL( store );
- iMmsHeaders->RestoreL( *store );
- CleanupStack::PopAndDestroy( store );
- store = NULL;
- HBufC8* messageId = HBufC8::NewL( iMmsHeaders->MessageId().Length() );
- CleanupStack::PushL( messageId );
- messageId->Des().Copy( iMmsHeaders->MessageId() );
-
- iMmsClient->SwitchCurrentEntryL( originalEntry );
- iMmsClient->LoadMessageL();
-
- iMmsHeaders->Reset();
- iMmsHeaders->SetMessageType( KMmsMessageTypeReadRecInd );
- // Message id cannot be accessed via MMS Client MTM!
-
- iMmsHeaders->SetMessageIdL( messageId->Des() );
- CleanupStack::PopAndDestroy( messageId );
-
- iMmsHeaders->AddTypedAddresseeL( iMmsClient->Sender(), EMsvRecipientTo );
- // sender must be insert-address-token because we don't know our number
- TTime now;
- now.UniversalTime();
-
- _LIT( K1970, "19700000:000000.000000" ); // 1-Jan 1970 0:00:00
-
- TTime y1970( K1970 );
- TTimeIntervalMicroSeconds interval;
- // we can't use "seconds from" as it only returns a
- // 32 bit signed integer. If fails in 2038.
- // "microseconds from" returns a 64 bit signed integer
- interval = now.MicroSecondsFrom( y1970 );
- // date in iMmsHeaders() in seconds from 1.1.1970.
- iMmsHeaders->SetDate( (interval.Int64() ) / KMmsMillion );
- iMmsHeaders->SetReadStatus( KMmsReadStatusRead );
-
- TMsvId mmsFolderId = KMsvNullIndexEntryId;
- mmsFolderId = FindMMSFolderL();
-
- cEntry->SetEntryL( mmsFolderId );
-
- TMsvEntry entry;
- entry.iType = KUidMsvMessageEntry;
- entry.iMtm = KUidMsgTypeMultimedia;
- entry.SetVisible( ETrue );
- entry.SetInPreparation( EFalse );
- entry.iServiceId = KMsvLocalServiceIndexEntryId;
- entry.iRelatedId = iDefaultServiceId;
- entry.iMtmData1 = KMmsMessageReadRecInd;
- cEntry->CreateL( entry );
- TMsvId entryId = entry.Id();
-
- cEntry->SetEntryL( entryId );
-
- store = cEntry->EditStoreL();
- CleanupStack::PushL( store );
- iMmsHeaders->StoreL( *store );
- store->CommitL();
- CleanupStack::PopAndDestroy( store );
- store = NULL;
-
- CMsvEntrySelection* selection = new ( ELeave ) CMsvEntrySelection;
- CleanupStack::PushL( selection );
- selection->InsertL(0, entryId);
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- op = iSession->TransferCommandL(*selection,EMmsScheduledReadReport,paramPack,iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy( op );
- CleanupStack::PopAndDestroy( selection );
-*/
- CleanupStack::PopAndDestroy( cEntry );
- }
-
-int MmsTestBed::fromOutboxToMmscWithMemoryFailure()
- {
- TInt error = KErrNone;
- TInt messageCount = 0;
- TInt failureCount = 0;
- do {
- CMsvEntry* cEntry = NULL;
-
- // Get List of services
- cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
- CleanupStack::PushL(cEntry);
- // Get all mms messages of outbox
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
- failureCount++;
- // These are failures that fail in Message server.
- if ( failureCount >= 63 && failureCount <= 64 )
- {
- failureCount = 65;
- }
- cEntry->SetEntryL( iServiceId );
- TMsvEntry entry = cEntry->Entry();
- entry.iMtmData3 &= 0x0000000FF;
- entry.iMtmData3 |= failureCount << 8;
- cEntry->ChangeL( entry );
-
- selection->InsertL(0, iServiceId);
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- TRAP (error, op = iSession->TransferCommandL(*selection,EMmsSend,paramPack,iWait->iStatus));
-
- if ( error == KErrNone )
- {
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- error = iWait->iStatus.Int();
- if ( iWait->iStatus.Int() != KErrNoMemory )
- {
- //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
- }
- }
-
- CleanupStack::PopAndDestroy(); // op
- }
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // selection
- CleanupStack::PopAndDestroy(); // cEntry
- selection = NULL;
- cEntry = NULL;
- cEntry = iSession->GetEntryL( KMsvGlobalOutBoxIndexEntryIdValue );
- CleanupStack::PushL(cEntry);
- selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- messageCount = selection->Count();
- delete selection;
- selection = 0;
- CleanupStack::PopAndDestroy(); //cEntry
- }
- while ( error == KErrNoMemory || messageCount > 0 );
- return failureCount;
- }
-
-int MmsTestBed::fromMmscToInboxWithMemoryFailure()
- {
- TInt error = KErrNone;
- TInt failureCount = 0;
- TInt messageCount = 0;
- TMsvId mmsFolderId = KMsvNullIndexEntryId;
- mmsFolderId = findMMSFolder();
-
- do {
- // Inbox must be cleaned if failure makes message to be fetched more than once.
- // should not happen, but this test is quite stressful, and perfect result
- // cannot be guaranteed.
- // What is expected:
- // 1. Program does not crash
- // 2. After sufficient number of retries the message is fetched and notification deleted.
- TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
- CMsvEntry* cEntry = NULL;
- CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
- CleanupStack::PushL(msvEntrySelection);
-
- cEntry = iSession->GetEntryL(iServiceId);
- CleanupStack::PushL(cEntry);
-
- failureCount++;
- // These are failures that fail in Message server.
- if ( failureCount >= 63 && failureCount <= 64 )
- {
- failureCount = 65;
- }
- cEntry->SetEntryL( iServiceId );
-
- TMsvEntry entry = cEntry->Entry();
- entry.iMtmData3 &= 0x0000000FF;
- entry.iMtmData3 |= failureCount << 8;
- cEntry->ChangeL( entry );
-
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- msvEntrySelection->InsertL(0, iServiceId);
- }
-
- CMsvOperation * op = NULL;
- TCommandParameters parameters; // initialized to zero
- TCommandParametersBuf paramPack( parameters );
-
- TRAP (error, op = iMmsClient->InvokeAsyncFunctionL(
- EMmsReceiveForced,
- *msvEntrySelection,
- paramPack,
- iWait->iStatus) );
-
- if ( error == KErrNone )
- {
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- if ( iWait->iStatus.Int() != KErrNone )
- {
- error = iWait->iStatus.Int();
- if ( iWait->iStatus.Int() != KErrNoMemory )
- {
- //TMmsLogger::Log(_L("Testbed tried to receive, return status %d"), iWait->iStatus.Int());
- }
- }
-
- CleanupStack::PopAndDestroy(); // op
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // msvEntrySelection
- CleanupStack::PopAndDestroy(); // cEntry
- msvEntrySelection = NULL;
- cEntry = NULL;
- cEntry = iSession->GetEntryL( mmsFolderId );
- CleanupStack::PushL(cEntry);
- msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- messageCount = msvEntrySelection->Count();
- delete msvEntrySelection;
- msvEntrySelection = 0;
- CleanupStack::PopAndDestroy(); //cEntry
- }
- while ( error == KErrNoMemory || messageCount > 0 );
- if ( error != KErrNoMemory && error != KErrNone )
- {
- //TMmsLogger::Log(_L("Memory failure loop ended with %d"), error);
- }
- return failureCount;
- }
-
-void MmsTestBed::sendViaClient()
- {
- CMsvEntry* cEntry = NULL;
-
- cEntry = iSession->GetEntryL(KMsvDraftEntryId);
- CleanupStack::PushL(cEntry);
- // Get all mms messages in drafts
- CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
- CleanupStack::PushL( selection );
-
- CMsvOperation * op = NULL;
- TTime now;
- now.UniversalTime();
- op = iMmsClient->SendL( *selection, iWait->iStatus, now );
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(2); // cEntry, selection
- }
-
-void MmsTestBed::scheduledFetch(TInt aDelay /* = 5 */)
- {
- TCommandParameters parameters;
- parameters.iInitialDelay = aDelay;
- TCommandParametersBuf paramPack( parameters );
-
- CMsvEntrySelection* selection = new CMsvEntrySelection;
- CleanupStack::PushL( selection );
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- selection->InsertL(0, iServiceId);
- }
- else
- {
- selection->InsertL(0, iDefaultServiceId);
- }
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsScheduledReceive,
- *selection,
- paramPack,
- iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::fetchForcedImmediate()
- {
- TCommandParameters parameters;
- TCommandParametersBuf paramPack( parameters );
-
- CMsvEntrySelection* selection = new CMsvEntrySelection;
- CleanupStack::PushL( selection );
- // if we have a selected service, insert it into selection
- if (iServiceId != KMsvNullIndexEntryId)
- {
- selection->InsertL(0, iServiceId);
- }
- else
- {
- selection->InsertL(0, iDefaultServiceId);
- }
-
-
- CMsvOperation * op = NULL;
- op = iMmsClient->InvokeAsyncFunctionL(
- EMmsReceiveForced,
- *selection,
- paramPack,
- iWait->iStatus);
-
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
-void MmsTestBed::getEventType()
- {
- if ( !checkLogClient() )
- {
- return; // not available
- }
-
- CLogEventType* eventType = CLogEventType::NewL();
- CleanupStack::PushL( eventType );
- eventType->SetUid(iLogEvent->EventType());
- iLogClient->GetEventType( *eventType, iWait->iStatus );
-
- iWait->Start();
- CleanupStack::PopAndDestroy(); // eventType
- }
-
-void MmsTestBed::addEventType()
- {
- if ( !checkLogClient() )
- {
- return; // not available
- }
-
- CLogEventType* eventType = CLogEventType::NewL();
- CleanupStack::PushL( eventType );
- eventType->SetUid(iLogEvent->EventType());
- eventType->SetDescription(_L("Multimedia Message") );
- eventType->SetLoggingEnabled( ETrue );
-
-// iWait->iStatus = KRequestPending;
- iLogClient->AddEventType( *eventType, iWait->iStatus );
- iWait->Start();
- CleanupStack::PopAndDestroy(); // eventType
- }
-
-void MmsTestBed::deleteEventType()
- {
- if ( !checkLogClient() )
- {
- return; // not available
- }
-// iWait->iStatus = KRequestPending;
- iLogClient->DeleteEventType( iLogEvent->EventType(), iWait->iStatus );
- iWait->Start();
- }
-
-void MmsTestBed::cleanLog()
- {
- TInt count = 0;
-
- count = getLogEntries();
-
- TInt i;
- for ( i = 0; i < count; ++i )
- {
- // when a view is created, it will be positioned on the first event
-// iWait->iStatus = KRequestPending;
- iLogClient->DeleteEvent(iLogView->Event().Id(), iWait->iStatus);
- iWait->Start();
-
- if ( iLogView->NextL( iWait->iStatus ) )
- {
- // should complete with KErrNone
- iWait->Start();
- if ( iWait->iStatus.Int() != KErrNone )
- {
- // could not get next event!
- break;
- }
- }
- else
- {
- break; // no more events!
- }
- }
- }
-
-void MmsTestBed::setOnline(bool value)
- {
- //value = true for online mode
- //value = false for offline mode
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KCRUidCoreApplicationUIs ) );
- if( retval == KErrNone )
- {
- repository->Set( KCoreAppUIsNetworkConnectionAllowed, value );
- delete repository;
- }
- }
-
-void MmsTestBed::generateDeliveryReport( CMmsHeaders* aMmsHeaders )
- {
- iEncodeBuffer->ResizeL( 1024 );
-
- TInt position = 0;
-
- // encode message type
- iEncodeBuffer->Write( position, &KMmsAssignedMessageType, 1 );
- position++;
- iEncodeBuffer->Write( position, &KMmsMessageTypeDeliveryInd, 1 );
- position++;
-
- // version
- iEncodeBuffer->Write( position, &KMmsAssignedMmsVersion, 1 );
- position++;
-
- TUint8 version = aMmsHeaders->MmsVersion() | 0x80; // current version as short integer
- iEncodeBuffer->Write( position, &version, 1 );
- position++;
-
- // message id from the headers
- // At least once MMSC did not send us the message id!
- // if message id is missing, we cannot match the entry!
- // This only a fake. Real delivery reports should always
- // contain the message id.
- if ( aMmsHeaders->MessageId().Length() > 0 )
- {
- iEncodeBuffer->Write( position, &KMmsAssignedMessageId, 1 );
- position++;
- iEncodeBuffer->Write( position, &(aMmsHeaders->MessageId()[0]), aMmsHeaders->MessageId().Length() );
- position += aMmsHeaders->MessageId().Length();
- iEncodeBuffer->Write( position, &KMmsNull, 1 );
- position++;
- }
-
- // To is taken from the headers
- iEncodeBuffer->Write( position, &KMmsAssignedTo, 1 );
- position++;
-
- TPtrC recipient;
- if ( aMmsHeaders->ToRecipients().MdcaCount() > 0 &&
- aMmsHeaders->ToRecipients()[0].Length() > 0 )
- {
- recipient.Set( aMmsHeaders->ToRecipients()[0] );
- }
- else if( aMmsHeaders->CcRecipients().MdcaCount() > 0 &&
- aMmsHeaders->CcRecipients()[0].Length() > 0 )
- {
- recipient.Set( aMmsHeaders->CcRecipients()[0] );
- }
- else if( aMmsHeaders->BccRecipients().MdcaCount() > 0 &&
- aMmsHeaders->BccRecipients()[0].Length() > 0 )
- {
- recipient.Set( aMmsHeaders->BccRecipients()[0] );
- }
- else
- {
- recipient.Set( _L("Jasso-Kissa@jii.fi") );
- }
-
- TMmsAddressType addressType = EMmsAddressTypeUnknown;
-
- if ( recipient.Find( KMiuMau ) != KErrNotFound )
- {
- addressType = EMmsAddressTypeEmail;
- }
- else
- {
- addressType = EMmsAddressTypeMobile;
- }
-
- TUint8 character;
- TInt i;
- if ( addressType == EMmsAddressTypeEmail )
- {
- // email address - ASCII ONLY - THIS IS JUST A TEST!
-
- for ( i = 0; i < recipient.Length(); ++i )
- {
- character = TUint8( recipient[i] & 0xff );
- iEncodeBuffer->Write( position, &character, 1 );
- position++;
- }
- iEncodeBuffer->Write( position, &KMmsNull, 1 );
- position++;
-
- }
- else
- {
- // must be a phone number
- // We expect for now that the format is correct as is
- // All legal characters present in a phone number are ASCII
-
- TInt i;
- for ( i = 0; i < recipient.Length(); ++i )
- {
- character = TUint8( recipient[i] & 0xff );
- iEncodeBuffer->Write( position, &character, 1 );
- position++;
- }
- iEncodeBuffer->Write( position, KMmsPlmn, KMmsPlmnLength );
- position += KMmsPlmnLength;
- iEncodeBuffer->Write( position, &KMmsNull, 1 );
- position++;
- }
-
- // date
- iEncodeBuffer->Write( position, &KMmsAssignedDate, 1 );
- position++;
-
- TLocale locale;
- locale.Refresh();
- TInt64 UtcDate;
- TTimeIntervalSeconds universalTimeOffset( locale.UniversalTimeOffset() );
-
- TTime now;
- now.UniversalTime();
- UtcDate = ( now.MicroSecondsFrom( TTime( KMmsYear1970String ) ).Int64() ) / 1000000 ;
-
- UtcDate -= universalTimeOffset.Int();
-
- if ( locale.QueryHomeHasDaylightSavingOn() )
- {
- TTimeIntervalSeconds daylightSaving( 60 * 60 );
- UtcDate -= daylightSaving.Int();
- }
-
- TUint8 len; // number of bytes we will need
- len = 0;
- TUint8 array[8];
-
- TInt64 temp = UtcDate;
-
- for (i = 7; i >= 0; --i)
- {
- array[i] = TInt8( ( I64INT( temp ) ) & 0xFF );
- I64LSR( temp, 8 );
- }
-
- len = 8;
- i = 0;
- while( ( array[i]== 0 ) && ( i < 8 ) )
- {
- i++;
- len--;
- }
-
- // a zero should be coded as short integer.
- // However, if there is a valid reason to code a zero as a long integer,
- // we allow it. The caller should know what he is doing.
- if ( len == 0 )
- {
- len = 1;
- }
- // write short length
- iEncodeBuffer->Write( position, &len, 1 );
- position++;
- // write as many bytes as were non-zero
- iEncodeBuffer->Write( position, &(array[8 - len] ), len );
- position+= len;
- // status
- iEncodeBuffer->Write( position, &KMmsAssignedStatus, 1 );
- position++;
- iEncodeBuffer->Write( position, &KMmsMessageStatusRetrieved, 1 );
- position++;
- // DONE!!!
- iEncodeBuffer->ResizeL( position );
- return;
- }
-
-void MmsTestBed::sendDeliveryReport()
- {
- if ( iEncodeBuffer->Size() == 0 )
- {
- //No delivery report
- return;
- }
-
-
- TMsvId mmsFolder = findMMSFolder();
- CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
- CleanupStack::PushL( selection );
-
- TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
- TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
-
- // Now we have streamed our data into this entry.
- // Now we have an entry that says: local service, MMS MTM
-
- if ( entryId != KMsvNullIndexEntryId )
- {
- selection->AppendL( entryId );
- }
- else
- {
- selection->AppendL( iDefaultServiceId );
- }
-
- TWatcherParameters parameters; // initialized to zero
- parameters.iWatcherId = RThread().Id();
- parameters.iDataPointer = &ptr;
- TWatcherParametersBuf paramPack( parameters );
-
- CMsvOperation * op = NULL;
-
-// iWait->iStatus = KRequestPending;
- op = iSession->TransferCommandL(
- *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
- CleanupStack::PushL(op);
- iWait->Start();
-
- while (iWait->iStatus.Int() == KRequestPending )
- {
- if (!iTimer->IsActive())
- {
- iTimer->IssueRequest();
- }
- CActiveScheduler::Start();
- }
-
- iTimer->Cancel();
-
- CleanupStack::PopAndDestroy(); // op
- CleanupStack::PopAndDestroy(); // selection
- }
-
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/src/mmsteststaticutils.cpp Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,528 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#include <f32file.h>
-#include <centralrepository.h>
-#include <apparc.h>
-#include <msvapi.h>
-#include <msvids.h>
-
-#include "mmsteststaticutils.h"
-#include "mmsconst.h"
-#include "MmsEnginePrivateCRKeys.h"
-#include "mmssettings.h"
-#include "mmsheaders.h"
-#include "mmsservercommon.h"
-#include "mmsencode.h"
-
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-TMmsJoinedArrays::TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2)
-: iArray1(aArray1), iArray2(aArray2)
- {
- }
-
-TInt TMmsJoinedArrays::MdcaCount() const
- {
- TInt count=0;
- if (iArray1)
- count += iArray1->MdcaCount();
- if (iArray2)
- count += iArray2->MdcaCount();
- return count;
- }
-
-TPtrC16 TMmsJoinedArrays::MdcaPoint(TInt aIndex) const
- {
- if (iArray1)
- {
- if (aIndex < iArray1->MdcaCount())
- return iArray1->MdcaPoint(aIndex);
- else
- aIndex -= iArray1->MdcaCount();
- }
- return iArray2->MdcaPoint(aIndex);
- }
-
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-TMmsTestUtils::TMmsTestUtils()
- {
-
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-HBufC* TMmsTestUtils::ReadContactFromFileL( TDesC& aFileName, RFs& aFs )
- {
- RFile file;
- TInt error = KErrNone;
-
- TInt textBufferSize = 256;
- HBufC* textBuffer = HBufC::NewL( textBufferSize );
- TPtr textPtr = textBuffer->Des();
- TFileText textFile;
-
- error = file.Open( aFs, aFileName,
- EFileRead|EFileShareReadersOnly );
-
- if ( error == KErrNone )
- {
- textFile.Set( file );
- error = textFile.Seek( ESeekStart );
- }
-
- if ( error == KErrNone )
- {
- error = textFile.Read( textPtr );
- }
-
- file.Close();
-
- if ( textBuffer->Des().Find( &KMmsByteOrderMark, 1 ) == 0 )
- {
- textBuffer->Des().Copy( textBuffer->Des().Mid( 1 ) );
- }
-
- return textBuffer;
- }
-
-//----------------------------------------------------------------------------------------
-// turn on detailed logging while decoding a message
-//----------------------------------------------------------------------------------------
-//
-void TMmsTestUtils::DecodeLoggingOnL()
- {
- // CenRep for decodelogging
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
- if( retval == KErrNone )
- {
- // Best effort - if cannot access repository, no can do
- TInt temp = 1;
- repository->Set( KMmsEngineDecodeLog, temp );
- delete repository;
- }
- }
-
-//----------------------------------------------------------------------------------------
-// turn off detailed logging while decoding a message
-//----------------------------------------------------------------------------------------
-//
-void TMmsTestUtils::DecodeLoggingOffL()
- {
- // CenRep for decodelogging
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
- if( retval == KErrNone )
- {
- // Best effort - if cannot access repository, no can do
- TInt temp = 0;
- repository->Set( KMmsEngineDecodeLog, temp );
- delete repository;
- }
-
- }
-
-//----------------------------------------------------------------------------------------
-// turn on binary dump of incoming messages
-//----------------------------------------------------------------------------------------
-//
-void TMmsTestUtils::BinaryDumpOnL()
- {
- // CenRep for binarydump setting
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
- if( retval == KErrNone )
- {
- // Best effort - if cannot access repository, no can do
- TInt temp = 1;
- repository->Set( KMmsEngineBinaryDump, temp );
- delete repository;
- }
-
- }
-
-//----------------------------------------------------------------------------------------
-// turn off binary dump of incoming messages
-//----------------------------------------------------------------------------------------
-//
-void TMmsTestUtils::BinaryDumpOffL()
- {
- // CenRep for binarydump setting
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
- if( retval == KErrNone )
- {
- // Best effort - if cannot access repository, no can do
- TInt temp = 0;
- repository->Set( KMmsEngineBinaryDump, temp );
- delete repository;
- }
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-void TMmsTestUtils::CleanDirectoryL( RFs& aFs )
- {
- // Delete the files in the directory
- CFileMan* fileMan = CFileMan::NewL( aFs );
- CleanupStack::PushL( fileMan );
- fileMan->RmDir( KMmsDefaultLocalModeDir );
- fileMan->RmDir( KMmsMMBoxDirectory );
- fileMan->RmDir( KMmsMMBoxDescriptionDirectory );
- CleanupStack::PopAndDestroy(); // fileManager
- // we don't want to throw these away!
- aFs.MkDirAll( KMmsDefaultLocalModeDir );
- aFs.MkDirAll( KMmsMMBoxDirectory );
- aFs.MkDirAll( KMmsMMBoxDescriptionDirectory );
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-void TMmsTestUtils::Dump( CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs )
- {
- TInt error = KErrNone;
- aFs.MkDirAll( aFilename );
- TUint att;
- if ( aFs.Att( aFilename, att ) == KErrNone )
- {
- _LIT( KRelated, "dump.mms");
- aParse.Set( aFilename, &KRelated, NULL );
- aFilename = aParse.FullName();
- error = CApaApplication::GenerateFileName( aFs, aFilename );
- if ( error == KErrNone )
- {
- RFile file;
- error = file.Create( aFs, aFilename, EFileWrite | EFileShareExclusive );
- // for message id generation
- aParse.Set( aFilename, NULL, NULL );
- if ( error == KErrNone )
- {
- // the data is supposed to be in the encode buffer
- TPtr8 ptr = aBuffer.Ptr( 0 );
- file.Write( ptr );
- file.Flush();
- }
-
- // done - close files
- file.Close();
- }
- }
- }
-
-// ---------------------------------------------------------
-//
-// ---------------------------------------------------------
-//
-void TMmsTestUtils::CleanBoxL(TMsvId aBoxId, CMsvSession& aSession)
- {
- CMsvEntry* cEntry = NULL;
- // delete all messages from the specified box
- cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
- cEntry->SetEntryL(aBoxId);
- // show invisible entries
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
- CleanupStack::PushL(msvEntrySelection);
-
- CMsvEntrySelection* selection = NULL;
- cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
- selection = cEntry->ChildrenWithMtmL(KUidMsgMMSNotification);
- CleanupStack::PushL( selection );
- if ( selection->Count() > 0 )
- {
- msvEntrySelection->AppendL( selection->Back( 0 ), selection->Count() );
- }
- CleanupStack::PopAndDestroy(); // selection
-
- int i;
- for (i = 0; i < msvEntrySelection->Count(); ++i)
- {
- CMsvEntry* entry = aSession.GetEntryL( msvEntrySelection->At(i) );
- CleanupStack::PushL( entry );
- TMsvEntry tEntry = entry->Entry();
- tEntry.SetReadOnly(EFalse);
- entry->ChangeL(tEntry);
- cEntry->DeleteL( msvEntrySelection->At(i) );
- CleanupStack::PopAndDestroy( entry );
- }
-
- CleanupStack::PopAndDestroy(msvEntrySelection);
- CleanupStack::PopAndDestroy(cEntry);
- }
-
-//----------------------------------------------------------------------------------------
-// turn on logging email recipients
-//----------------------------------------------------------------------------------------
-void TMmsTestUtils::EmailLoggingOnL()
- {
- // CenRep for binarydump setting
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
- if( retval == KErrNone )
- {
- TInt temp = 1;
- repository->Set( KMmsEngineLogEmailRecipients, temp );
- delete repository;
- }
-
- }
-
-//----------------------------------------------------------------------------------------
-// turn off logging email recipients
-//----------------------------------------------------------------------------------------
-void TMmsTestUtils::EmailLoggingOffL()
- {
- // CenRep for binarydump setting
- CRepository* repository = NULL;
- TInt retval = KErrNone;
- TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
- if( retval == KErrNone )
- {
- TInt temp = 0;
- repository->Set( KMmsEngineLogEmailRecipients, temp );
- delete repository;
- }
-
- }
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TInt TMmsTestUtils::CountChildrenL(TMsvId aBoxId, CMsvEntrySelection*& aMsvEntrySelection, CMsvSession& aSession, TUid aMessageType )
- {
- CMsvEntry* cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
- CleanupStack::PushL(cEntry);
- cEntry->SetEntryL(aBoxId);
- if (aMsvEntrySelection != NULL)
- {
- delete aMsvEntrySelection;
- aMsvEntrySelection = NULL;
- }
- aMsvEntrySelection = cEntry->ChildrenWithMtmL(aMessageType);
- CleanupStack::PopAndDestroy(); // cEntry
- return aMsvEntrySelection->Count();
- }
-
-
-// -----------------------------------------------------------------------------
-// CreateFolderEntryL
-//
-// -----------------------------------------------------------------------------
-//
-void TMmsTestUtils::CreateFolderEntryL(
- CMsvSession& aSession,
- TMsvId aParentFolder,
- const TDesC& aFolderName,
- TMsvId& aFolderId )
- {
- aFolderId = KMsvNullIndexEntryId;
- CMsvEntry* cEntry = aSession.GetEntryL( aParentFolder );
- CleanupStack::PushL( cEntry );
-
- // Create a new folder.
-
- TMsvEntry entry;
- entry.iType = KUidMsvFolderEntry;
- entry.iMtm = KUidMsvLocalServiceMtm;
- entry.iDetails.Set( aFolderName );
- entry.SetVisible( EFalse );
- entry.SetInPreparation( EFalse );
- entry.iServiceId = KMsvLocalServiceIndexEntryId;
- cEntry->CreateL( entry );
- aFolderId = entry.Id();
- CleanupStack::PopAndDestroy( cEntry );
-
- }
-
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TMsvId TMmsTestUtils::CreateNotificationEntryL(
- TMsvId aNotificationFolder,
- TMsvId aServiceId,
- CBufFlat* aEncodeBuffer,
- CMsvSession& aSession )
- {
- TMsvId entryId = KMsvNullIndexEntryId;
- if ( aNotificationFolder == KMsvNullIndexEntryId )
- {
- // no folder no entry
- return entryId;
- }
-
- CMsvEntry* cEntry = aSession.GetEntryL( aNotificationFolder );
- CleanupStack::PushL(cEntry);
-
- TMsvEntry entry;
- entry.iType = KUidMsvMessageEntry;
- entry.iMtm = KUidMsgTypeMultimedia;
- entry.SetVisible( ETrue );
- // If we want to put data here, InPreparation must be set to true first
- entry.SetInPreparation( EFalse );
- entry.iServiceId = KMsvLocalServiceIndexEntryId;
- entry.iRelatedId = aServiceId;
- entry.iMtmData2 = KMmsNotificationBinary;
- cEntry->CreateL( entry );
- entryId = entry.Id();
-
- //
- // Stream
- // 1) length of the data as 32 bit integer
- // 2) pushed message data
- // into created entry's stream
- //
- cEntry->SetEntryL( entryId );
- CMsvStore* store = cEntry->EditStoreL();
- CleanupStack::PushL( store ); // ***
- RMsvWriteStream outs;
- outs.AssignLC( *store, KUidBinaryNotificationStream ); // ***
- TPtrC8 ptr = aEncodeBuffer->Ptr( 0 );
- outs.WriteUint32L( ptr.Length() );
- outs.WriteL( ptr );
- outs.CommitL();
- outs.Close();
- store->CommitL();
-
- CleanupStack::PopAndDestroy( &outs ); // close outs
- CleanupStack::PopAndDestroy( store );
- CleanupStack::PopAndDestroy( cEntry );
-
- return entryId;
-
- }
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-void TMmsTestUtils::FormNotification(
- TDesC8& aUrl,
- TInt aSize,
- CMmsHeaders& aMmsHeaders,
- CMmsEncode& aMmsEncoder,
- CBufFlat* aEncodeBuffer )
- {
- // for test purposes aUrl will contain the filename.
-
- // Reset sets the default encapsulation version
- // The default version has been set from MmsSettings in NewL
- aMmsHeaders.Reset();
-
- // construct the notification into iMmsHeaders, and call encode
-
- aMmsHeaders.SetMessageType( KMmsMessageTypeMNotificationInd );
-
- TTime currentTime;
- currentTime.UniversalTime();
- currentTime.Int64();
-
- TPtrC8 tid;
- TBufC8<KMMSMAXTIDLENGTH> target;
- TInt random = 0;
-
- // we don't generate a true random TID: We generate the
- // TID from the URL so that if we generate a notification
- // twice from the same file, we get the same TID and the
- // same URL. This way we can test the pruning function in
- // server MTM
-
- TInt i;
- for ( i = 0; i < aUrl.Length(); ++i )
- {
- random += aUrl[ i ];
- }
-
- target.Des().Num( random );
- tid.Set( target.Des() );
- aMmsHeaders.SetTidL( tid );
-
- aMmsHeaders.SetMessageClass( EMmsClassPersonal );
- aMmsHeaders.SetMessageSize( aSize );
- const TInt KTenHours = 10 * 60 * 60; // 10 hours relative expiry
- aMmsHeaders.SetExpiryInterval( KTenHours );
- aMmsHeaders.SetContentLocationL( aUrl );
-
- aMmsEncoder.EncodeHeadersL( aMmsHeaders, *aEncodeBuffer );
-
- }
-
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TBool TMmsTestUtils::IsFile(const TDesC& aFileName, RFs& aFs)
- {
- //Is the name a file?
- if (IsDrive(aFileName))
- return EFalse;
- return !(IsDir(aFileName, aFs));
- }
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TBool TMmsTestUtils::IsDir(const TDesC& aFileName, RFs& aFs)
- {
- //Is the name a directory?
- TEntry entry;
- TInt err = aFs.Entry(aFileName, entry);
- if (err)
- return EFalse;
- else
- return entry.IsDir();
- }
-
-//----------------------------------------------------------------------------------------
-//
-//----------------------------------------------------------------------------------------
-TBool TMmsTestUtils::IsDrive(const TDesC& aFileName)
- {
- //horrible little function to figure if the path is just a drive
- TBool retVal = EFalse;
- if (aFileName.Length()==3) //eg "c:\"
- {
- if ((aFileName[1] == ':') && (aFileName[2] == '\\'))
- retVal=ETrue;
- }
- else if (aFileName.Length()==2) //eg "c:"
- {
- if (aFileName[1] == ':')
- retVal=ETrue;
- }
- return retVal;
- }
-
-// end of file
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/src/mmstestuitimer.cpp Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- */
-
-#include "mmstestuitimer.h"
-
-
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CTestUiTimer::CTestUiTimer(): CTimer( 5 )
- {
- period = KPeriod;
- }
-
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::ConstructL()
- {
- CTimer::ConstructL();
- CActiveScheduler::Add(this);
- }
-
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CTestUiTimer* CTestUiTimer::NewL()
- {
- CTestUiTimer* self = new(ELeave) CTestUiTimer();
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CTestUiTimer::~CTestUiTimer()
- {
- }
-
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::IssueRequest()
- {
- // No operation to cancel if this function is called
- iObject = NULL;
- After(period);
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::TimeoutOperation( CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds )
- {
- iObject = aObject;
- TTimeIntervalMicroSeconds32 timeout = aTimeoutInSeconds.Int() * 1000000;
- After( timeout );
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::DoCancel()
- {
- CTimer::DoCancel();
- if ( iObject )
- {
- iObject->Cancel();
- iObject = NULL;
- }
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CTestUiTimer::RunL()
- {
- if ( iObject )
- {
- // If we timeout while holding an active object, we cancel it
- iObject->Cancel();
- iObject = NULL;
- }
- else
- {
- CActiveScheduler::Stop();
- }
- }
-
-// ======== GLOBAL FUNCTIONS ========
-
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/inc/testmmsplugin.h Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,139 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description: Main test class declaration for MMS Plugin
- */
-
-#ifndef TEST_MMS_PLUGIN_H
-#define TEST_MMS_PLUGIN_H
-
-#ifdef BUILD_TEST_DLL
-#define TEST_EXPORT Q_DECL_EXPORT
-#else
-#define TEST_EXPORT Q_DECL_IMPORT
-#endif
-
-#include <QObject>
-#include <QSignalSpy>
-#include <e32const.h>
-
-//Forward Declarations
-class UniEditorMmsPlugin;
-class ConvergedMessage;
-class MmsTestBed;
-
-//Class Declaration: TestMmsPlugin
-class TEST_EXPORT TestMmsPlugin: public QObject
- {
- Q_OBJECT
-
-private slots:
-
- /**
- * Initialises the whole Test
- **/
- void initTestCase();//called before the first testfunction is executed.
-
- /**
- * Initialises each Test Case
- **/
- void init();//called before each testfunction is executed.
-
- /**
- * Creates a MMS messsage with a text attachment
- **/
- void createMMSWithTextAttachment();
-
- /**
- * Tests the MMS message with a text attachment
- **/
- void testMMSWithTextAttachment();
-
- /**
- * Sends the MMS message with a text attachment
- **/
- void sendMMSWithTextAttachment();
-
- /**
- * Tests that the MMS message is sent successfully
- **/
- void testSentMMSWithTextAttachment();
-
- /**
- * Creates a MMS messsage with a text and an Image attachments
- **/
- void createMMSWithTextAndImageAttachment();
-
- /**
- * Tests the MMS message with a text and an Image attachments
- **/
- void testMMSWithTextAndImageAttachment();
-
- /**
- * Sends the MMS message with a text and an Image attachments
- **/
- void sendMMSWithTextAndImageAttachment();
-
- /**
- * Tests that the MMS message is sent successfully
- **/
- void testSentMMSWithTextAndImageAttachment();
-
- /**
- * Cleans up each Test Case
- **/
- void cleanup();
-
- /**
- * Cleans up the whole Test Case
- **/
- void cleanupTestCase();
-
-private: // Data
-
- /**
- * msgPlugin - MMS Message Plug-in
- **/
- UniEditorMmsPlugin* msgPlugin;
-
- /**
- * mmstestbed - MMS Message Simulator
- **/
- MmsTestBed* mmstestbed;
-
- /**
- * spy_draft - Signal Spy for Draft Folder
- **/
- QSignalSpy* spy_draft;
-
- /**
- * spy_outbox - Signal Spy for Outbox Folder
- **/
- QSignalSpy* spy_outbox;
-
- /**
- * spy_sent - Signal Spy for Sent Folder
- **/
- QSignalSpy* spy_sent;
-
- /**
- * spy_inbox - Signal Spy for Inbox Folder
- **/
- QSignalSpy* spy_inbox;
-
- /**
- * mmsMsgId - The MMS message Id
- **/
- long int mmsMsgId;
- };
-#endif //TEST_MMS_PLUGIN_H
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/inc/testmmsplugin.ini Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-//this file is used to provide predefined set of input data.
-
-//eg.
-const char TEST_MSG_SUBJECT[] = "Message Subject";
-const char TEST_SENDER[] = "DummySender<+919860479112>";
-const char TEST_ATTACHMENT4[] = "c:\\SmileyFace.gif";
-const char TEST_ATTACHMENT5[] = "c:\\sample.txt";
-const char TEST_CC[] = "DummyCCAddress<+919860479113>";
-const char TEST_BCC[] = "DummyBCCAddress<+919860479114>";
\ No newline at end of file
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/src/testmmsplugin.cpp Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,415 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description: : Main test class definition for MMS Plugin
- */
-
-#include <QtTest/QtTest>
-#include <QTimer>
-#include <QSignalSpy>
-#include "debugtraces.h"
-#include "testmmsplugin.h"
-#include "convergedmessage.h"
-#include "convergedmessageid.h"
-#include "unieditormmsplugin.h"
-#include "mmstestbed.h"
-#include "testmmsplugin.ini"
-
-//---------------------------------------------------------------
-// TestMmsPlugin::initTestCase
-//---------------------------------------------------------------
-void TestMmsPlugin::initTestCase()
-{
- //Instantiate UniEditorMmsPlugin and verify if it is correctly Instantited.
- msgPlugin = new UniEditorMmsPlugin();
- QVERIFY(msgPlugin != NULL);
-
- //Verify if MMS service is Validated.
- QCOMPARE(msgPlugin->validateService(), 1);
- QCOMPARE(msgPlugin->isServiceValid(), 1);
- msgPlugin->setEncodingSettings(ETrue, ESmsEncodingNone, -1);
- QString str("Hello");
- TInt numOfRemainingChars = 1;
- TInt numOfPDUs = 1;
- TBool unicodeMode = ETrue;
- TSmsEncoding smsEncoding = ESmsEncodingNone;
- QVERIFY(msgPlugin->getNumPDUs(str, numOfRemainingChars, numOfPDUs, unicodeMode, smsEncoding) == true);
-
- //Verify MmsTestBed Instance.
- mmstestbed = new MmsTestBed;
- QVERIFY(mmstestbed != NULL);
-
- //register user defined object to meta system.
- qRegisterMetaType<long int> ("long int");
-
- //set up signalspy to listen to signals emitted by mmstestbed
- spy_draft = new QSignalSpy(mmstestbed, SIGNAL(entryCreatedInDraft(long int)));
- spy_outbox = new QSignalSpy(mmstestbed, SIGNAL(entryMovedToOutbox(long int)));
- spy_sent = new QSignalSpy(mmstestbed, SIGNAL(entryMovedToSent(long int)));
- spy_inbox = new QSignalSpy(mmstestbed, SIGNAL(entryCreatedInInbox(long int)));
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::init
-//---------------------------------------------------------------
-void TestMmsPlugin::init()
-{
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::createMMSWithTextAttachment
-//---------------------------------------------------------------
-void TestMmsPlugin::createMMSWithTextAttachment()
-{
- //Create a Converged Message instance.
- QString subject = TEST_MSG_SUBJECT;
- qint64 timeStamp = QDateTime::currentDateTime().toTime_t();
-
- QString sender(TEST_SENDER);
- ConvergedMessageAddress address(sender);
- ConvergedMessageAttachmentList attachmentList;
-
- //Add a text attachment to attachment list.
- QString attachmentPath = TEST_ATTACHMENT5;
- ConvergedMessageAttachment* attachment =
- new ConvergedMessageAttachment(attachmentPath, ConvergedMessageAttachment::EAttachment);
-
- attachmentList.append(attachment);
-
- //Instantiate a Converged Message object and set service a MMS
- ConvergedMessage msg;
- msg.setMessageType(ConvergedMessage::Mms);
-
- //Set Subject
- msg.setSubject(subject);
-
- msg.setTimeStamp(timeStamp);
-
- //Set recipient.
- msg.addToRecipient(address);
-
- //Add attachments' list
- msg.addAttachments(attachmentList);
- msg.setPriority(ConvergedMessage::Normal);
-
- //Adding CC Address
- QString ccAddress(TEST_CC);
- ConvergedMessageAddress ccAdd(ccAddress);
- msg.addCcRecipient(ccAdd);
-
- //Adding BCC Address
- QString bccAddress(TEST_BCC);
- ConvergedMessageAddress bccAdd(bccAddress);
- msg.addBccRecipient(bccAdd);
-
- //Adding From Address
- QString recipientAddress(TEST_SENDER);
- ConvergedMessageAddress recipientAdd(recipientAddress);
- msg.addFromRecipient(recipientAdd);
-
- //start send and prepare to test send-success or fail
- mmstestbed->cleanAll();
- mmstestbed->setConnectionLocal(true);
-
- //Get a valid MMS message ID and verify that it is valid.
- mmsMsgId = msgPlugin->convertTo(&msg);
- QVERIFY(mmsMsgId != -1);
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::testMMSWithTextAttachment
-//---------------------------------------------------------------
-void TestMmsPlugin::testMMSWithTextAttachment()
-{
- long int mmsDraftMsgId;
-
- //check if draft-folder signal was received...this means message was created in draft
- if( 1 <= spy_draft->count())
- {
- //compare the msgid and verify with the ID given by MMS plugin
- void * temp = const_cast<void*>(spy_draft->at(0).at(0).data());
- mmsDraftMsgId = *reinterpret_cast< long int(*)>(temp);
- QVERIFY(mmsDraftMsgId == mmsMsgId);
-
- //Validate the MMS message with all the values set before.
- ConvergedMessage* draftMsg = msgPlugin->convertFrom(mmsDraftMsgId);
- QVERIFY(draftMsg->subject().compare(QString(TEST_MSG_SUBJECT)) == 0);
- QVERIFY(draftMsg->messageType() == ConvergedMessage::Mms);
- QVERIFY(QString(TEST_SENDER).contains(draftMsg->toAddressList()[0]->address(), Qt::CaseInsensitive) == true);
- QVERIFY(QString(TEST_CC).contains(draftMsg->ccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
- QVERIFY(QString(TEST_BCC).contains(draftMsg->bccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
- QVERIFY(QString(TEST_SENDER).contains(draftMsg->fromAddress()->address(), Qt::CaseInsensitive) == true);
- QVERIFY(draftMsg->attachments().count() == 1);
- QVERIFY(draftMsg->attachments()[0]->attachmentType() == ConvergedMessageAttachment::EAttachment);
- QVERIFY(draftMsg->attachments()[0]->filePath().contains(QString(TEST_ATTACHMENT5).mid(QString(TEST_ATTACHMENT5).indexOf(QString("Sample.txt"), 0, Qt::CaseInsensitive)), Qt::CaseInsensitive) == true);
- }
- else
- {
- QFAIL("testSendReceiveMMS: Failed to create message in Draft");
- //reset connection to 'global on, local off'
- mmstestbed->setConnectionLocal(false);
- }
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::sendMMSWithTextAttachment
-//---------------------------------------------------------------
-void TestMmsPlugin::sendMMSWithTextAttachment()
-{
- //Send the MMS message and verify if it was sent successfully.
- bool sent = msgPlugin->send(mmsMsgId);
- QVERIFY(sent == true);
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::testSentMMSWithTextAttachment
-//---------------------------------------------------------------
-void TestMmsPlugin::testSentMMSWithTextAttachment()
-{
- QTest::qWait(10000); //to ensure path completion
-
- //check if outbox-folder signal was received...this means message was moved to outbox for send
- if( 1 <= spy_outbox->count())
- {
- //compare the msgid
- void * temp = const_cast<void*>(spy_outbox->at(0).at(0).data());
- long int outboxId = *reinterpret_cast< long int(*)>(temp);
- QCOMPARE(outboxId, mmsMsgId);
-
- //push the message from outbox to mmsc(sent folder)
- mmstestbed->fromOutboxToMmsc();
- }
- else
- {
- QFAIL("testSendReceiveMMS: Failed to move message to Outbox");
-
- //reset connection to 'global on, local off'
- mmstestbed->setConnectionLocal(false);
- return;
- }
-
- //check if sent-folder signal was received....this means message was successfully sent scheduled.
- if( 1 <= spy_sent->count())
- {
- //check for send-path
- void * temp = const_cast<void*>(spy_sent->at(0).at(0).data());
- long int sentmsgid = *reinterpret_cast< long int(*)>(temp);
- QCOMPARE(sentmsgid, mmsMsgId);
-
- //issue a fetch request on the sent message, to test the receive path
- mmstestbed->fromMmscToInbox();
- }
- else
- {
- QFAIL("testSendReceiveMMS: Failed to move message to Sent folder");
-
- //reset connection to 'global on, local off'
- mmstestbed->setConnectionLocal(false);
- return;
- }
-
- //check if inbox-folder signal was received....this means message was successfully received at the inbox folder.
- if( spy_inbox->count() <= 0)
- {
- QFAIL("testSendReceiveMMS: Failed to move message to Inbox folder");
-
- //reset connection to 'global on, local off'
- mmstestbed->setConnectionLocal(false);
- }
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::createMMSWithTextAndImageAttachment
-//---------------------------------------------------------------
-void TestMmsPlugin::createMMSWithTextAndImageAttachment()
-{
- //Create a Converged Message instance.
- QString subject = TEST_MSG_SUBJECT;
- qint64 timeStamp = QDateTime::currentDateTime().toTime_t();
-
- QString sender(TEST_SENDER);
- ConvergedMessageAddress address(sender);
- ConvergedMessageAttachmentList attachmentList;
-
- //Add a text attachment to attachment list.
- QString attachmentPath1 = TEST_ATTACHMENT5;
- ConvergedMessageAttachment* attachment =
- new ConvergedMessageAttachment(attachmentPath1, ConvergedMessageAttachment::EInline);
-
- //Add an image attachment to attachment list.
- QString attachmentPath2 = TEST_ATTACHMENT4;
- ConvergedMessageAttachment* attachmentImage =
- new ConvergedMessageAttachment(attachmentPath2, ConvergedMessageAttachment::EAttachment);
-
- attachmentList.append(attachment);
- attachmentList.append(attachmentImage);
-
- //Instantiate a Converged Message object and set service a MMS
- ConvergedMessage msg;
- msg.setMessageType(ConvergedMessage::Mms);
- msg.setSubject(subject);
- msg.setTimeStamp(timeStamp);
- msg.addToRecipient(address);
-
- //Add attachments' list
- msg.addAttachments(attachmentList);
- msg.setPriority(ConvergedMessage::Normal);
-
- //Adding CC Address
- QString ccAddress(TEST_CC);
- ConvergedMessageAddress ccAdd(ccAddress);
- msg.addCcRecipient(ccAdd);
-
- //Adding BCC Address
- QString bccAddress(TEST_BCC);
- ConvergedMessageAddress bccAdd(bccAddress);
- msg.addBccRecipient(bccAdd);
-
- //Adding From Address
- QString recipientAddress(TEST_SENDER);
- ConvergedMessageAddress recipientAdd(recipientAddress);
- msg.addFromRecipient(recipientAdd);
-
- //start send and prepare to test send-success or fail
- mmstestbed->cleanAll();
- mmstestbed->setConnectionLocal(true);
-
- //Get a valid MMS message ID and verify that it is valid.
- mmsMsgId = msgPlugin->convertTo(&msg);
- QVERIFY(mmsMsgId != -1);
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::testMMSWithTextAndImageAttachment
-//---------------------------------------------------------------
-void TestMmsPlugin::testMMSWithTextAndImageAttachment()
-{
- long int mmsDraftMsgId;
-
- //check if draft-folder signal was received...this means message was created in draft
- if( 1 <= spy_draft->count())
- {
- //compare the msgid and verify with the ID given by MMS plugin
- void * temp = const_cast<void*>(spy_draft->at(1).at(0).data());
- mmsDraftMsgId = *reinterpret_cast< long int(*)>(temp);
- QVERIFY(mmsDraftMsgId == mmsMsgId);
-
- //Validate the MMS message with all the values set before.
- ConvergedMessage* draftMsg = msgPlugin->convertFrom(mmsDraftMsgId);
- QVERIFY(draftMsg->subject().compare(QString(TEST_MSG_SUBJECT)) == 0);
- QVERIFY(draftMsg->messageType() == ConvergedMessage::Mms);
- QVERIFY(QString(TEST_SENDER).contains(draftMsg->toAddressList()[0]->address(), Qt::CaseInsensitive) == true);
- QVERIFY(QString(TEST_CC).contains(draftMsg->ccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
- QVERIFY(QString(TEST_BCC).contains(draftMsg->bccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
- QVERIFY(QString(TEST_SENDER).contains(draftMsg->fromAddress()->address(), Qt::CaseInsensitive) == true);
- QVERIFY(draftMsg->attachments().count() == 1);
- QVERIFY(draftMsg->attachments()[0]->attachmentType() == ConvergedMessageAttachment::EAttachment);
- QVERIFY(draftMsg->attachments()[0]->filePath().contains(QString(TEST_ATTACHMENT4).mid(QString(TEST_ATTACHMENT4).indexOf(QString("SmileyFace.gif"), 0, Qt::CaseInsensitive)), Qt::CaseInsensitive) == true);
- }
- else
- {
- QFAIL("testSendReceiveMMS: Failed to create message in Draft");
- //reset connection to 'global on, local off'
- mmstestbed->setConnectionLocal(false);
- }
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::sendMMSWithTextAndImageAttachment
-//---------------------------------------------------------------
-void TestMmsPlugin::sendMMSWithTextAndImageAttachment()
-{
- //Send the MMS message and verify if it was sent successfully.
- bool sent = msgPlugin->send(mmsMsgId);
- QVERIFY(sent == true);
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::testSentMMSWithTextAndImageAttachment
-//---------------------------------------------------------------
-void TestMmsPlugin::testSentMMSWithTextAndImageAttachment()
-{
- QTest::qWait(10000); //to ensure path completion
-
- //check if outbox-folder signal was received...this means message was moved to outbox for send
- if( 1 <= spy_outbox->count())
- {
- //compare the msgid
- void * temp = const_cast<void*>(spy_outbox->at(1).at(0).data());
- long int outboxId = *reinterpret_cast< long int(*)>(temp);
- QCOMPARE(outboxId, mmsMsgId);
-
- //push the message from outbox to mmsc(sent folder)
- mmstestbed->fromOutboxToMmsc();
- }
- else
- {
- QFAIL("testSendReceiveMMS: Failed to move message to Outbox");
-
- //reset connection to 'global on, local off'
- mmstestbed->setConnectionLocal(false);
- return;
- }
-
- //check if sent-folder signal was received....this means message was successfully sent scheduled.
- if( 1 <= spy_sent->count())
- {
- //check for send-path
- void * temp = const_cast<void*>(spy_sent->at(1).at(0).data());
- long int sentmsgid = *reinterpret_cast< long int(*)>(temp);
- QCOMPARE(sentmsgid, mmsMsgId);
-
- //issue a fetch request on the sent message, to test the receive path
- mmstestbed->fromMmscToInbox();
- }
- else
- {
- QFAIL("testSendReceiveMMS: Failed to move message to Sent folder");
-
- //reset connection to 'global on, local off'
- mmstestbed->setConnectionLocal(false);
- return;
- }
-
- //check if inbox-folder signal was received....this means message was successfully received at the inbox folder.
- if( spy_inbox->count() <= 0)
- {
- QFAIL("testSendReceiveMMS: Failed to move message to Inbox folder");
-
- //reset connection to 'global on, local off'
- mmstestbed->setConnectionLocal(false);
- }
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::cleanup
-//---------------------------------------------------------------
-void TestMmsPlugin::cleanup()
-{
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::cleanupTestCase
-//---------------------------------------------------------------
-void TestMmsPlugin::cleanupTestCase()
-{
- //Cleanup
- delete spy_draft;//Signal for Draft Folder
- delete spy_outbox;//Signal for Outbox Folder
- delete spy_sent;//Signal for Sent Folder
- delete spy_inbox;//Signal for inbox Folder
- delete msgPlugin;//MMS Plugin
- delete mmstestbed;//MMS Testbed
-}
-
-//End of File
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/testmmsplugin.pro Tue Jul 13 22:09:22 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-QT += testlib
-QT -= gui
-
-TEMPLATE = lib
-TARGET = test-mms-plugin
-
-INCLUDEPATH += ./inc
-INCLUDEPATH += ../../../../../../../inc
-INCLUDEPATH += ../../../../../unidatautils/unidatamodels/inc
-INCLUDEPATH += ../../../../../s60qconversions/inc
-INCLUDEPATH += ../../../../editorgenutils/inc
-INCLUDEPATH += ../../../../../../../inc
-INCLUDEPATH += ../../../../../../../mmsengine/mmsmessage/inc
-INCLUDEPATH += ../../../../../../../mmsengine/inc
-INCLUDEPATH += ../../../../../unidatautils/unidatamodel/inc
-INCLUDEPATH += ../mmstestbed/inc
-INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
-
-DEFINES += BUILD_TEST_DLL
-
-CONFIG += hb plugin
-
-SOURCES += \
- ./src/testmmsplugin.cpp \
- ../../src/unieditormmsplugin.cpp \
- ../../src/unieditormmsplugin_p.cpp
-
-
-# Input
-HEADERS += \
- ./inc/testmmsplugin.h \
- ../../inc/unieditormmsplugin.h \
- ../../inc/unieditormmsplugin_p.h
-
-
-SYMBIAN_PLATFORMS = WINSCW ARMV5
- symbian {
- TARGET.CAPABILITY = CAP_GENERAL_DLL
- TARGET.EPOCSTACKSIZE = 0x8000
- TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
- TARGET.EPOCALLOWDLLDATA = 1
- }
-
- LIBS += -leuser \
- -lconvergedmessageutils \
- -ls60qconversions \
- -lMsgMedia \
- -leditorgenutils \
- -lcone \
- -leikcoctl \
- -leikcore \
- -leikdlg \
- -lmsgs \
- -letext \
- -lgsmu \
- -lmmsgenutils \
- -lefsrv \
- -lestor \
- -lsmcm \
- -lCommonEngine \
- -lbafl \
- -lCdlEngine \
- -lFeatMgr \
- -lapmime \
- -lapgrfx \
- -lcharconv \
- -lInetProtUtil \
- -lsmildtd \
- -lxmldom \
- -lxmlparser \
- -lcone \
- -lQtCore \
- -letel \
- -lcommdb \
- -lcommsdat \
- -letelmm \
- -lunidatamodelloader \
- -lunidatamodel \
- -lavkon \
- -leikcoctl \
- -leikctl \
- -lform \
- -luiklaf\
- -lmmstestbed \
- -lmmsmessage \
- -lmmsserversettings \
- -lxqutils
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/mmstestbed/bwins/mmstestbedu.def Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,71 @@
+EXPORTS
+ ?cleanSent@MmsTestBed@@QAEXXZ @ 1 NONAME ; void MmsTestBed::cleanSent(void)
+ ?cancelSendScheduling@MmsTestBed@@QAEXXZ @ 2 NONAME ; void MmsTestBed::cancelSendScheduling(void)
+ ?replyToAll@MmsTestBed@@QAEXXZ @ 3 NONAME ; void MmsTestBed::replyToAll(void)
+ ?getLogEntries@MmsTestBed@@AAEHXZ @ 4 NONAME ; int MmsTestBed::getLogEntries(void)
+ ?restoreFactorySettings@MmsTestBed@@QAEXXZ @ 5 NONAME ; void MmsTestBed::restoreFactorySettings(void)
+ ?fromOutboxToMmscWithMemoryFailure@MmsTestBed@@QAEHXZ @ 6 NONAME ; int MmsTestBed::fromOutboxToMmscWithMemoryFailure(void)
+ ?encodeMessageFromDrafts@MmsTestBed@@AAEXXZ @ 7 NONAME ; void MmsTestBed::encodeMessageFromDrafts(void)
+ ?reply@MmsTestBed@@QAEXXZ @ 8 NONAME ; void MmsTestBed::reply(void)
+ ?deleteEntry@MmsTestBed@@AAEXJAAVCMsvEntry@@@Z @ 9 NONAME ; void MmsTestBed::deleteEntry(long, class CMsvEntry &)
+ ?findDefaultL@MmsTestBed@@AAEXXZ @ 10 NONAME ; void MmsTestBed::findDefaultL(void)
+ ?messageVariation@MmsTestBed@@QAEXXZ @ 11 NONAME ; void MmsTestBed::messageVariation(void)
+ ?sendReadReport@MmsTestBed@@QAEXXZ @ 12 NONAME ; void MmsTestBed::sendReadReport(void)
+ ?garbageCollection@MmsTestBed@@QAEXK@Z @ 13 NONAME ; void MmsTestBed::garbageCollection(unsigned long)
+ ?fetchForced@MmsTestBed@@QAEXH@Z @ 14 NONAME ; void MmsTestBed::fetchForced(int)
+ ?scheduledSend@MmsTestBed@@QAEXJH@Z @ 15 NONAME ; void MmsTestBed::scheduledSend(long, int)
+ ?createMmsService@MmsTestBed@@AAEXXZ @ 16 NONAME ; void MmsTestBed::createMmsService(void)
+ ?trUtf8@MmsTestBed@@SA?AVQString@@PBD0H@Z @ 17 NONAME ; class QString MmsTestBed::trUtf8(char const *, char const *, int)
+ ?qt_metacast@MmsTestBed@@UAEPAXPBD@Z @ 18 NONAME ; void * MmsTestBed::qt_metacast(char const *)
+ ?deleteEventType@MmsTestBed@@QAEXXZ @ 19 NONAME ; void MmsTestBed::deleteEventType(void)
+ ??_EMmsTestBed@@UAE@I@Z @ 20 NONAME ; MmsTestBed::~MmsTestBed(unsigned int)
+ ?cleanLog@MmsTestBed@@QAEXXZ @ 21 NONAME ; void MmsTestBed::cleanLog(void)
+ ?createEntry@MmsTestBed@@QAEXAAVTMsvEntry@@AAVCMsvEntry@@@Z @ 22 NONAME ; void MmsTestBed::createEntry(class TMsvEntry &, class CMsvEntry &)
+ ?scheduledFetch@MmsTestBed@@QAEXH@Z @ 23 NONAME ; void MmsTestBed::scheduledFetch(int)
+ ?sendFromFile@MmsTestBed@@QAEXXZ @ 24 NONAME ; void MmsTestBed::sendFromFile(void)
+ ??0MmsTestBed@@QAE@XZ @ 25 NONAME ; MmsTestBed::MmsTestBed(void)
+ ?cleanInbox@MmsTestBed@@QAEXXZ @ 26 NONAME ; void MmsTestBed::cleanInbox(void)
+ ?deleteFetchSchedule@MmsTestBed@@QAEXXZ @ 27 NONAME ; void MmsTestBed::deleteFetchSchedule(void)
+ ?fromMmscToInbox@MmsTestBed@@QAEXXZ @ 28 NONAME ; void MmsTestBed::fromMmscToInbox(void)
+ ?doAFetchCycle@MmsTestBed@@QAEXXZ @ 29 NONAME ; void MmsTestBed::doAFetchCycle(void)
+ ?entryMovedToSent@MmsTestBed@@IAEXJ@Z @ 30 NONAME ; void MmsTestBed::entryMovedToSent(long)
+ ?cleanupAndCreateNewService@MmsTestBed@@QAEXXZ @ 31 NONAME ; void MmsTestBed::cleanupAndCreateNewService(void)
+ ?cleanup@MmsTestBed@@AAEXXZ @ 32 NONAME ; void MmsTestBed::cleanup(void)
+ ?qt_metacall@MmsTestBed@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 33 NONAME ; int MmsTestBed::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?getEventType@MmsTestBed@@QAEXXZ @ 34 NONAME ; void MmsTestBed::getEventType(void)
+ ?sendViaClient@MmsTestBed@@QAEXXZ @ 35 NONAME ; void MmsTestBed::sendViaClient(void)
+ ?setFetchingState@MmsTestBed@@QAEXW4TMmsReceivingMode@@@Z @ 36 NONAME ; void MmsTestBed::setFetchingState(enum TMmsReceivingMode)
+ ?sendNotifications@MmsTestBed@@QAEXXZ @ 37 NONAME ; void MmsTestBed::sendNotifications(void)
+ ?metaObject@MmsTestBed@@UBEPBUQMetaObject@@XZ @ 38 NONAME ; struct QMetaObject const * MmsTestBed::metaObject(void) const
+ ?setOnline@MmsTestBed@@QAEX_N@Z @ 39 NONAME ; void MmsTestBed::setOnline(bool)
+ ?cleanOutbox@MmsTestBed@@QAEXXZ @ 40 NONAME ; void MmsTestBed::cleanOutbox(void)
+ ?checkLogClient@MmsTestBed@@AAE_NXZ @ 41 NONAME ; bool MmsTestBed::checkLogClient(void)
+ ?cleanDrafts@MmsTestBed@@QAEXXZ @ 42 NONAME ; void MmsTestBed::cleanDrafts(void)
+ ?tr@MmsTestBed@@SA?AVQString@@PBD0H@Z @ 43 NONAME ; class QString MmsTestBed::tr(char const *, char const *, int)
+ ?copyDrafts@MmsTestBed@@QAEXXZ @ 44 NONAME ; void MmsTestBed::copyDrafts(void)
+ ?fromMmscToInboxWithMemoryFailure@MmsTestBed@@QAEHXZ @ 45 NONAME ; int MmsTestBed::fromMmscToInboxWithMemoryFailure(void)
+ ?fetchForcedImmediate@MmsTestBed@@QAEXXZ @ 46 NONAME ; void MmsTestBed::fetchForcedImmediate(void)
+ ?deleteSendSchedule@MmsTestBed@@QAEXXZ @ 47 NONAME ; void MmsTestBed::deleteSendSchedule(void)
+ ?staticMetaObject@MmsTestBed@@2UQMetaObject@@B @ 48 NONAME ; struct QMetaObject const MmsTestBed::staticMetaObject
+ ?entryCreatedInDraft@MmsTestBed@@IAEXJ@Z @ 49 NONAME ; void MmsTestBed::entryCreatedInDraft(long)
+ ?generateDeliveryReport@MmsTestBed@@QAEXPAVCMmsHeaders@@@Z @ 50 NONAME ; void MmsTestBed::generateDeliveryReport(class CMmsHeaders *)
+ ?forward@MmsTestBed@@QAEXXZ @ 51 NONAME ; void MmsTestBed::forward(void)
+ ?entryCreatedInInbox@MmsTestBed@@IAEXJ@Z @ 52 NONAME ; void MmsTestBed::entryCreatedInInbox(long)
+ ?fromOutboxToMmsc@MmsTestBed@@QAEXXZ @ 53 NONAME ; void MmsTestBed::fromOutboxToMmsc(void)
+ ?entryMovedToOutbox@MmsTestBed@@IAEXJ@Z @ 54 NONAME ; void MmsTestBed::entryMovedToOutbox(long)
+ ?findMMSFolder@MmsTestBed@@AAEJXZ @ 55 NONAME ; long MmsTestBed::findMMSFolder(void)
+ ??1MmsTestBed@@UAE@XZ @ 56 NONAME ; MmsTestBed::~MmsTestBed(void)
+ ?cleanAll@MmsTestBed@@QAEXXZ @ 57 NONAME ; void MmsTestBed::cleanAll(void)
+ ?getStaticMetaObject@MmsTestBed@@SAABUQMetaObject@@XZ @ 58 NONAME ; struct QMetaObject const & MmsTestBed::getStaticMetaObject(void)
+ ?sendDeliveryReport@MmsTestBed@@QAEXXZ @ 59 NONAME ; void MmsTestBed::sendDeliveryReport(void)
+ ?setConnectionLocal@MmsTestBed@@QAEX_N@Z @ 60 NONAME ; void MmsTestBed::setConnectionLocal(bool)
+ ?sendOneByOne@MmsTestBed@@QAEXXZ @ 61 NONAME ; void MmsTestBed::sendOneByOne(void)
+ ?cancelFetchScheduling@MmsTestBed@@QAEXXZ @ 62 NONAME ; void MmsTestBed::cancelFetchScheduling(void)
+ ?trUtf8@MmsTestBed@@SA?AVQString@@PBD0@Z @ 63 NONAME ; class QString MmsTestBed::trUtf8(char const *, char const *)
+ ?deleteNotifications@MmsTestBed@@QAEXXZ @ 64 NONAME ; void MmsTestBed::deleteNotifications(void)
+ ?testFile@MmsTestBed@@AAEXAAV?$TBuf@$0BAA@@@HJ@Z @ 65 NONAME ; void MmsTestBed::testFile(class TBuf<256> &, int, long)
+ ?HandleSessionEventL@MmsTestBed@@MAEXW4TMsvSessionEvent@MMsvSessionObserver@@PAX11@Z @ 66 NONAME ; void MmsTestBed::HandleSessionEventL(enum MMsvSessionObserver::TMsvSessionEvent, void *, void *, void *)
+ ?tr@MmsTestBed@@SA?AVQString@@PBD0@Z @ 67 NONAME ; class QString MmsTestBed::tr(char const *, char const *)
+ ?addEventType@MmsTestBed@@QAEXXZ @ 68 NONAME ; void MmsTestBed::addEventType(void)
+ ?addMMBoxDescriptions@MmsTestBed@@AAEXXZ @ 69 NONAME ; void MmsTestBed::addMMBoxDescriptions(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/mmstestbed/eabi/mmstestbedu.def Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,72 @@
+EXPORTS
+ _ZN10MmsTestBed10cleanInboxEv @ 1 NONAME
+ _ZN10MmsTestBed10copyDraftsEv @ 2 NONAME
+ _ZN10MmsTestBed10replyToAllEv @ 3 NONAME
+ _ZN10MmsTestBed11cleanDraftsEv @ 4 NONAME
+ _ZN10MmsTestBed11cleanOutboxEv @ 5 NONAME
+ _ZN10MmsTestBed11createEntryER9TMsvEntryR9CMsvEntry @ 6 NONAME
+ _ZN10MmsTestBed11deleteEntryElR9CMsvEntry @ 7 NONAME
+ _ZN10MmsTestBed11fetchForcedEi @ 8 NONAME
+ _ZN10MmsTestBed11qt_metacallEN11QMetaObject4CallEiPPv @ 9 NONAME
+ _ZN10MmsTestBed11qt_metacastEPKc @ 10 NONAME
+ _ZN10MmsTestBed12addEventTypeEv @ 11 NONAME
+ _ZN10MmsTestBed12findDefaultLEv @ 12 NONAME
+ _ZN10MmsTestBed12getEventTypeEv @ 13 NONAME
+ _ZN10MmsTestBed12sendFromFileEv @ 14 NONAME
+ _ZN10MmsTestBed12sendOneByOneEv @ 15 NONAME
+ _ZN10MmsTestBed13doAFetchCycleEv @ 16 NONAME
+ _ZN10MmsTestBed13findMMSFolderEv @ 17 NONAME
+ _ZN10MmsTestBed13getLogEntriesEv @ 18 NONAME
+ _ZN10MmsTestBed13scheduledSendEli @ 19 NONAME
+ _ZN10MmsTestBed13sendViaClientEv @ 20 NONAME
+ _ZN10MmsTestBed14checkLogClientEv @ 21 NONAME
+ _ZN10MmsTestBed14scheduledFetchEi @ 22 NONAME
+ _ZN10MmsTestBed14sendReadReportEv @ 23 NONAME
+ _ZN10MmsTestBed15deleteEventTypeEv @ 24 NONAME
+ _ZN10MmsTestBed15fromMmscToInboxEv @ 25 NONAME
+ _ZN10MmsTestBed16createMmsServiceEv @ 26 NONAME
+ _ZN10MmsTestBed16entryMovedToSentEl @ 27 NONAME
+ _ZN10MmsTestBed16fromOutboxToMmscEv @ 28 NONAME
+ _ZN10MmsTestBed16messageVariationEv @ 29 NONAME
+ _ZN10MmsTestBed16setFetchingStateE17TMmsReceivingMode @ 30 NONAME
+ _ZN10MmsTestBed16staticMetaObjectE @ 31 NONAME DATA 16
+ _ZN10MmsTestBed17garbageCollectionEm @ 32 NONAME
+ _ZN10MmsTestBed17sendNotificationsEv @ 33 NONAME
+ _ZN10MmsTestBed18deleteSendScheduleEv @ 34 NONAME
+ _ZN10MmsTestBed18entryMovedToOutboxEl @ 35 NONAME
+ _ZN10MmsTestBed18sendDeliveryReportEv @ 36 NONAME
+ _ZN10MmsTestBed18setConnectionLocalEb @ 37 NONAME
+ _ZN10MmsTestBed19HandleSessionEventLEN19MMsvSessionObserver16TMsvSessionEventEPvS2_S2_ @ 38 NONAME
+ _ZN10MmsTestBed19deleteFetchScheduleEv @ 39 NONAME
+ _ZN10MmsTestBed19deleteNotificationsEv @ 40 NONAME
+ _ZN10MmsTestBed19entryCreatedInDraftEl @ 41 NONAME
+ _ZN10MmsTestBed19entryCreatedInInboxEl @ 42 NONAME
+ _ZN10MmsTestBed19getStaticMetaObjectEv @ 43 NONAME
+ _ZN10MmsTestBed20addMMBoxDescriptionsEv @ 44 NONAME
+ _ZN10MmsTestBed20cancelSendSchedulingEv @ 45 NONAME
+ _ZN10MmsTestBed20fetchForcedImmediateEv @ 46 NONAME
+ _ZN10MmsTestBed21cancelFetchSchedulingEv @ 47 NONAME
+ _ZN10MmsTestBed22generateDeliveryReportEP11CMmsHeaders @ 48 NONAME
+ _ZN10MmsTestBed22restoreFactorySettingsEv @ 49 NONAME
+ _ZN10MmsTestBed23encodeMessageFromDraftsEv @ 50 NONAME
+ _ZN10MmsTestBed26cleanupAndCreateNewServiceEv @ 51 NONAME
+ _ZN10MmsTestBed32fromMmscToInboxWithMemoryFailureEv @ 52 NONAME
+ _ZN10MmsTestBed33fromOutboxToMmscWithMemoryFailureEv @ 53 NONAME
+ _ZN10MmsTestBed5replyEv @ 54 NONAME
+ _ZN10MmsTestBed7cleanupEv @ 55 NONAME
+ _ZN10MmsTestBed7forwardEv @ 56 NONAME
+ _ZN10MmsTestBed8cleanAllEv @ 57 NONAME
+ _ZN10MmsTestBed8cleanLogEv @ 58 NONAME
+ _ZN10MmsTestBed8testFileER4TBufILi256EEil @ 59 NONAME
+ _ZN10MmsTestBed9cleanSentEv @ 60 NONAME
+ _ZN10MmsTestBed9setOnlineEb @ 61 NONAME
+ _ZN10MmsTestBedC1Ev @ 62 NONAME
+ _ZN10MmsTestBedC2Ev @ 63 NONAME
+ _ZN10MmsTestBedD0Ev @ 64 NONAME
+ _ZN10MmsTestBedD1Ev @ 65 NONAME
+ _ZN10MmsTestBedD2Ev @ 66 NONAME
+ _ZNK10MmsTestBed10metaObjectEv @ 67 NONAME
+ _ZTI10MmsTestBed @ 68 NONAME
+ _ZTV10MmsTestBed @ 69 NONAME
+ _ZThn8_N10MmsTestBed19HandleSessionEventLEN19MMsvSessionObserver16TMsvSessionEventEPvS2_S2_ @ 70 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/mmstestbed/inc/mmsreadfile.h Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,471 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#ifndef MMSREADFILE_H
+#define MMSREADFILE_H
+
+// INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+#include <f32file.h>
+#include <msvstd.h>
+
+// forward references
+class CMmsAttaStructure;
+class CMmsHeaders;
+class CEikonEnv;
+class CMmsClientMtm;
+
+// Out-of-range value for any MMS header with assigned number
+// Used in coverage tests to get coverage for "default" branches
+// in "case" statements.
+const TInt KMmsTestIllegalValue = 255;
+
+//
+// TEST KEY WORDS
+// Extended to include all MMS headers to allow generation of arbitrary PDUs
+// Content type header cannot be separately defined,
+// it will always be "multipat/mixed" or "multipart/related"
+_LIT8( KTestEndOfFile, "EOF" );
+_LIT8( KTestNewMessage, "MESSAGE BEGIN" );
+//------------------------------------------------
+_LIT8( KTestMessageType, "MESSAGE-TYPE" ); //X-Mms-Message-Type
+_LIT8( KTestDate, "DATE" ); // Date
+_LIT8( KTestFrom, "FROM" ); // From
+_LIT8( KTestTo, "TO" ); // To
+_LIT8( KTestCc, "CC" ); // Cc
+_LIT8( KTestBcc, "BCC" ); // Bcc
+_LIT8( KTestSubject, "SUBJECT" ); // Subject
+_LIT8( KTestExpiryRel, "EXPIRY-REL" ); // X-Mms-Expiry, relative
+_LIT8( KTestExpiryAbs, "EXPIRY-ABS" ); // X-Mms-Expiry, absolute
+_LIT8( KTestDeliveryTimeRel, "DELIVERY-TIME-REL" ); // X-Mms-Delivery-Time, relative
+_LIT8( KTestDeliveryTimeAbs, "DELIVERY-TIME-ABS" ); // X-Mms-Delivery-Time, absolute
+_LIT8( KTestPriority, "PRIORITY" ); // X-Mms-Priority
+_LIT8( KTestSenderVisibility, "SENDER-VISIBILITY" ); // X-Mms-Sender-Visibility
+_LIT8( KTestDeliveryReport, "DELIVERY-REPORT" ); // X-Mms-Delivery-Report
+_LIT8( KTestReadReply, "READ-REPLY" ); // X-Mms-Read-Report
+// ---------------------------------------------------
+_LIT8( KTestNewAttachment, "ATTACHMENT" );
+_LIT8( KTestAttachmentType, "ATTACHMENTTYPE" );
+_LIT8( KTestAttachmentName, "ATTACHMENTNAME" );
+_LIT8( KTestAttachmentContLoc, "ATTACHMENTCONTLOC" );
+_LIT8( KTestAttachmentCharset, "ATTACHMENTCHARSET" );
+_LIT8( KTestAttachmentCid, "ATTACHMENTCID" );
+_LIT8( KTestAttachmentRoot, "ATTACHMENTROOT" );
+// content-type and x-type parameters for attachments
+// should appear in name-value pairs.
+// Test program is not responsible for verifying illegal scripts
+_LIT8( KTestAttContTypeParamName, "ContTypeParamName" );
+_LIT8( KTestAttContTypeParamValue, "ContTypeParamValue" );
+_LIT8( KTestAttXTypeParamName, "X-TypeParamName" );
+_LIT8( KTestAttXTypeParamValue, "X-TypeParamValue" );
+// -----------------------------------------------------
+_LIT8( KTestMessageClass, "MESSAGE-CLASS" ); // X-Mms-Message-Class
+_LIT8( KTestDelivRepSendAllow, "DELIV-REP-SEND-ALLOW" ); // X-Mms-Report-Allowed
+_LIT8( KTestAcceptAdvertis, "ACCEPT-ADVERTISEMENTS" );
+_LIT8( KTestRetryCount, "RETRY-COUNT" );
+_LIT8( KTestRetryInterval, "RETRY-INTERVAL" );
+// -------------------------------------------------
+_LIT8( KTestAlias, "ALIAS" );
+_LIT8( KTestFromAlias, "FROMALIAS" );
+_LIT8( KTestToAlias, "TOALIAS" );
+_LIT8( KTestCcAlias, "CCALIAS" );
+_LIT8( KTestBccAlias, "BCCALIAS" );
+// -------------------------------------------------
+// more Message headers to allow testing all possible PDUs and
+// MMS 1.1 headers
+_LIT8( KTestReplyCharging, "REPLY-CHARGING" ); // X-Mms-Reply-Charging
+_LIT8( KTestReplyChargAbs, "REPLY-CHARG-DEADLINE-ABS" ); // X-Mms-Reply-Charging, absolute
+_LIT8( KTestReplyChargRel, "REPLY-CHARG-DEADLINE-REL" ); // X-Mms-Reply-Charging, relative
+_LIT8( KTestReplyChargSize, "REPLY-CHARG-SIZE" ); // X-Mms-Reply-Charging-Size (octets)
+_LIT8( KTestReplyChargID, "REPLY-CHARGING-ID" ); // X-Mms-Reply-Charging-ID
+_LIT8( KTestTID, "TID" );
+_LIT8( KTestContentLocation, "CONTLOC" ); // X-Mms-Content-Location
+// The following three must appear as triplets.
+// index must be first, address and date may appear in any order
+_LIT8( KTestPreviouslySentIndex, "PREVIOUSINDEX" ); // forwarded count for X-Mms-PreviouslySent headers
+_LIT8( KTestPreviouslySentBy, "PREV-SENT-BY" ); // X-Mms-Previously-Sent-By
+_LIT8( KTestPreviouslySentDate, "PREV-SENT-DATE" ); // X-Mms-Previously-Sent-Date
+//---
+_LIT8( KTestMessageId, "MESSAGE-ID" ); // Message-ID
+_LIT8( KTestMessageSize, "MESSAGE-SIZE" ); // X-Mms-Message-Size (octets)
+_LIT8( KTestVersion, "MMS-VERSION" ); // X-MMS-Version (hex:, 10 = 1.0, 11 = 1.1 etc. )
+_LIT8( KTestReadStatus, "READ-STATUS" ); // X-Mms-Read-Status
+_LIT8( KTestResponseStatus, "RESPONSE-STATUS" ); // X-Mms-Response-Status
+_LIT8( KTestResponseText, "RESPONSE-TEXT" ); // X-Mms-Response-Text
+_LIT8( KTestRetrieveStatus, "RETRIEVE-STATUS" ); // X-Mms-Retrieve-Status
+_LIT8( KTestRetrieveText, "RETRIEVE-TEXT" ); // X-Mms-Retrieve-Text
+_LIT8( KTestStatus, "STATUS" ); // X-Mms-Status
+// -------------------------------------------------
+// MMS 1.2 headers
+_LIT8( KTestAttribute, "ATTRIBUTE" ); // X-Mms-Attribute
+// The value should be one of the following:
+// BCC, CC, CONTENT, CONTENT-TYPE, DATE, DELIVERY-REPORT, DELIVERY-TIME-ABS,
+// EXPIRY-ABS, FROM, MESSAGE-CLASS, MESSAGE-ID, MESSAGE-SIZE, PRIORITY,
+// READ-REPLY, SUBJECT, TO, REPLY-CHARGING, REPLY-CHARGING-ID,
+// REPLY-CHARG-DEADLINE-ABS, REPLY-CHARG-SIZE, PREV-SENT-BY,
+// PREV-SENT-DATE, ADDITIONAL-HEADERS
+_LIT8( KTestDistributionIndicator, "DISTRIBUTION-INDICATOR" ); // X-Mms-Distribution-Indicator
+_LIT8( KTestLimit, "LIMIT" ); // X-Mms-Limit
+_LIT8( KTestMessageQuota, "MESSAGE-QUOTA" ); // X-Mms-Mbox-Quota, message number
+_LIT8( KTestSizeQuota, "SIZE-QUOTA" ); // X-Mms-Mbox-Quota, size quota
+_LIT8( KTestMessageTotal, "MESSAGE-TOTAL" ); // X-Mms-Mbox-Totals, message number
+_LIT8( KTestSizeTotal, "SIZE-TOTAL" ); // X-Mms-Mbox-Totals, total size
+_LIT8( KTestMessageCount, "MESSAGE-COUNT" ); // X-Mms-Message-Count
+_LIT8( KTestAddKeyword, "ADD-KEYWORD" ); // X-Mms-MM-Flags
+_LIT8( KTestRemoveKeyword, "REMOVE-KEYWORD" ); // X-Mms-MM-Flags
+_LIT8( KTestFilterKeyword, "FILTER-KEYWORD" ); // X-Mms-MM-FLags
+_LIT8( KTestMMState, "MESSAGE-STATE" ); // X-Mms-MM-State
+_LIT8( KTestQuota, "QUOTA" ); // X-Mms-Quotas
+_LIT8( KTestStart, "START" ); // X-Mms-Start
+_LIT8( KTestStore, "STORE" ); // X-Mms-Store
+_LIT8( KTestStored, "STORED" ); // X-Mms-Stored
+_LIT8( KTestStoreStatus, "STORE-STATUS" ); // X-Mms-Store-Status
+_LIT8( KTestStoreStatusText, "STORE-STATUS-TEXT" ); // X-Mms-Store-Status-Text
+_LIT8( KTestTotals, "TOTALS" ); // X-Mms-Totals
+// Delete confirmation header structure
+// This consists of index, content location, response status and response status text.
+// All three values are not always necessary for each index, but at least content-location
+// and response status should be present.
+// The index retains its value until a new index is encountered.
+_LIT8( KTestDeleteInfoIndex, "DELETESTATUSINDEX" ); // index for next delete info fields
+// This header must precede content-location, response-status and response-text fields
+// in a delete confirmation. Index retains its value until a new index is encountered.
+
+// Element descriptor header not implemented
+
+// Application id headers
+// These will officially be supported in MMS encapsulation version 1.3
+// Java has non-standard support even earlier
+
+_LIT8( KTestApplicId, "APPLIC-ID" ); // X-Mms-Applic-ID
+_LIT8( KTestReplyApplicId, "REPLY-APPLIC-ID" ); // X-Mms-Reply-Applic-ID
+_LIT8( KTestApplicInfo, "AUX-APPLIC-INFO" ); // X-Mms-Aux-Applic-Info
+
+// Since Encapsulation 1.3
+_LIT8( KTestContentClass, "CONTENT-CLASS" ); // X-Mms-Content-Class
+_LIT8( KTestDrmContent, "DRM-CONTENT" ); // X-Mms-DRM-Content
+_LIT8( KTestAdaptationAllowed, "ADAPTATION-ALLOWED" ); // X-Mms-Adaptation-Allowed
+_LIT8( KTestRecommendedRetrievalMode, "REC-RETRIEVAL-MODE" ); // X-Mms-Recommended-Retrieval-Mode
+_LIT8( KTestRecRetrievalModeText, "REC-RETR-MODE-TEXT" ); // X-Mms-Recommended-Retrieval-Mode-Text
+_LIT8( KTestReplaceId, "REPLACE-ID" ); // X-Mms-Replace-ID
+_LIT8( KTestStatusText, "STATUS-TEXT" ); // X-Mms-Status-Text
+_LIT8( KTestCancelId, "CANCEL-ID" ); // X-Mms-Cancel-ID
+_LIT8( KTestCancelStatus, "CANCEL-STATUS" ); // X-Mms-Cancel-Status
+
+// DATA TYPES
+#define aSet 1
+#define aReset 0
+#define PartCount 100
+#define MaxAttaCount 10
+#define DefaultBufLen 256
+#define MaxRecipients 5
+
+// status returned by ReadRow
+enum TTestReadStatus
+ {
+ ETestUnknown,
+ ETestNewMessage,
+ ETestNewAttachment,
+ ETestEof, // End of file
+ ETestMessageType,
+ ETestDate,
+ ETestFrom,
+ ETestTo,
+ ETestCc,
+ ETestBcc,
+ ETestAlias,
+ ETestFromAlias,
+ ETestToAlias,
+ ETestCcAlias,
+ ETestBccAlias,
+ ETestSubject,
+ ETestExpiryRel,
+ ETestExpiryAbs,
+ ETestDeliveryTimeRel,
+ ETestDeliveryTimeAbs,
+ ETestPriority,
+ ETestSenderVisibility,
+ ETestDeliveryReport,
+ ETestReadReply,
+ ETestAttachmentType,
+// ETestAttachmentName,
+ ETestAttachmentCharset,
+ ETestAttachmentCid,
+ ETestAttachmentRoot,
+ ETestSettings,
+ ETestMessageClass,
+ ETestDelivReportSendAllow,
+ ETestSingleMessageClass,
+ ETestReplyCharging,
+ ETestReplyChargAbs,
+ ETestReplyChargRel,
+ ETestReplyChargSize,
+ ETestReplyChargID,
+ ETestTID,
+ ETestContentLocation,
+ ETestPreviouslySentIndex,
+ ETestPreviouslySentBy,
+ ETestPreviouslySentDate,
+ ETestMessageId,
+ ETestMessageSize,
+ ETestVersion,
+ ETestReadStatus,
+ ETestResponseStatus,
+ ETestResponseText,
+ ETestRetrieveStatus,
+ ETestRetrieveText,
+ ETestStatus,
+ ETestAttribute,
+ ETestDistributionIndicator,
+ ETestLimit,
+ ETestMessageQuota,
+ ETestSizeQuota,
+ ETestMessageTotal,
+ ETestSizeTotal,
+ ETestMessageCount,
+ ETestAddKeyword,
+ ETestRemoveKeyword,
+ ETestFilterKeyword,
+ ETestMMState,
+ ETestQuota,
+ ETestStart,
+ ETestStore,
+ ETestStored,
+ ETestStoreStatus,
+ ETestStoreStatusText,
+ ETestTotals,
+ ETestDeleteInfoIndex,
+ ETestApplicId,
+ ETestReplyApplicId,
+ ETestApplicInfo,
+ ETestContentClass,
+ ETestDrmContent,
+ ETestAdaptationAllowed,
+ ETestRecommendedRetrievalMode,
+ ETestRecRetrievalModeText,
+ ETestReplaceId,
+ ETestStatusText,
+ ETestCancelId,
+ ETestCancelStatus,
+ ETestAttaRecommendedName,
+ ETestAttachmentContLoc,
+ ETestAttContTypeParamName,
+ ETestAttContTypeParamValue,
+ ETestAttXTypeParamName,
+ ETestAttXTypeParamValue
+
+ };
+
+// VALUE KEYWORDS
+_LIT( KPersonal, "Personal" );
+_LIT( KAdvertisement, "Advertisement" );
+_LIT( KInformational, "Informational" );
+_LIT( KAuto, "Auto" );
+_LIT( KLow, "Low" );
+_LIT( KNormal, "Normal" );
+_LIT( KHigh, "High" );
+_LIT( KHide, "Hide" );
+_LIT( KShow, "Show" );
+_LIT( KYes, "Yes" );
+_LIT( KNo, "No" );
+_LIT( KOn, "On" );
+_LIT( KOff, "Off" );
+_LIT( KDeferred, "Deferred" );
+_LIT( KExpired, "Expired" );
+_LIT( KRetrieved, "Retrieved" );
+_LIT( KRejected, "Rejected" );
+_LIT( KUnrecognized, "Unrecognized" );
+_LIT( KIndeterminate, "Indeterminate" );
+_LIT( KForwarded, "Forwarded" );
+_LIT( KUnreachable, "Unreachable" );
+_LIT( KDraft, "Draft");
+_LIT( KSent, "Sent" );
+_LIT( KNew, "New" );
+// X-Mms-Message-Type
+_LIT( KSendReq, "SendReq" );
+_LIT( KSendConf, "SendConf" );
+_LIT( KNotifInd, "NotifInd" );
+_LIT( KNotifResp, "NotifResp" );
+_LIT( KRetrConf, "RetrConf" );
+_LIT( KAckInd, "AckInd" );
+_LIT( KDelInd, "DelInd" );
+_LIT( KReadReqInd, "ReadReqInd" );
+_LIT( KReadOrigInd, "ReadOrigInd" );
+_LIT( KForwardRec, "ForwardReq" );
+_LIT( KForwardConf, "ForwardConf" );
+_LIT( KMBoxStoreReq, "MBoxStoreReq" );
+_LIT( KMBoxStoreConf, "MBoxStoreConf" );
+_LIT( KMBoxViewReq, "MBoxViewReq" );
+_LIT( KMBoxViewConf, "MBoxViewConf" );
+_LIT( KMBoxUploadReq, "MBoxUploadReq" );
+_LIT( KMBoxUploadConf, "MBoxUploadConf" );
+_LIT( KMBoxDeleteReq, "MBoxDeleteReq" );
+_LIT( KMBoxDeleteConf, "MBoxDeleteConf" );
+_LIT( KMBoxDescr, "MBoxDescr" );
+_LIT( KDeleteReq, "DeleteReq" );
+_LIT( KDeleteConf, "DeleteConf" );
+_LIT( KCancelReq, "CancelReq" );
+_LIT( KCancelResp, "CancelConf" );
+// X-Mms-Read-Status
+_LIT( KRead, "Read" );
+_LIT( KDelNotRead, "DeletedNotRead" );
+// X-Mms-Reply-Charging
+_LIT( KRequested, "Requested" );
+_LIT( KReqTextOnly, "ReqTextOnly" );
+_LIT( KAccepted, "Accepted" );
+_LIT( KAccTextOnly, "AccTextOnly" );
+// X-Mms-Cancel-Status (only receival of request, not actual cancellation)
+_LIT( KCancelSuccessful, "CancelSuccess" );
+_LIT( KCancelCorrupted, "CancelCorrupted" );
+// X-Mms-Content-Class
+_LIT( KText, "Text" );
+_LIT( KImageBasic, "ImageBasic" );
+_LIT( KImageRich, "ImageRich" );
+_LIT( KVideoBasic, "VideoBasic" );
+_LIT( KVideoRich, "VideoRich" );
+_LIT( KMegaPixel, "MegaPixel" );
+_LIT( KContentBasic, "ContentBasic" );
+_LIT( KContentRich, "ContentRich" );
+// X-Mms-Recommended-Retrieval-Mode
+_LIT( KManual, "Manual" );
+
+//X-Mms-ResponseStatus
+// legacy values
+_LIT( KOk, "OK" );
+_LIT( KErrUnspecified, "Unspecified" );
+_LIT( KErrServiceDenied, "ServiceDenied" );
+_LIT( KErrMessageFormatCorrupt, "FormatCorrupt" );
+_LIT( KErrAddressUnresolved, "AddressUnresolved" );
+_LIT( KErrMessageNotFound, "MessageNotFound" );
+_LIT( KErrNetworkProblem, "NetworkProblem" );
+_LIT( KErrContentNotAccepted, "ContentNotAccepted" );
+_LIT( KErrUnsupportedMessage, "UnsupportedMessage" );
+// values since 1.1 (and 1.2)
+_LIT( KErrTransient, "TransientFailure" );
+_LIT( KErrTransientAddressUnresolved, "TransientAddressUnresolved" );
+_LIT( KErrTransientNotFound, "TransientMessageNotFound" );
+_LIT( KErrTransientNetworkproblem, "TransientNetworkProblem" );
+_LIT( KErrTransientPartialSuccess, "PartialSuccess" );
+_LIT( KErrPermanent, "PermanentFailure" );
+_LIT( KErrPermanentServiceDenied, "PermanentServiceDenied" );
+_LIT( KErrPermanentMessageFormatCorrupt, "PermanentFormatCorrupt" );
+_LIT( KErrPermanentAddressUnresolved, "PermanentAddressUnresolved" );
+_LIT( KErrPermanentNotFound, "PermanentMessageNotFound" );
+_LIT( KErrPermanentContentNotAccepted, "PermanentContentNotAccepted" );
+_LIT( KErrReplyChargingLimitNotMet, "ReplyChargingLimitNotMet" );
+_LIT( KErrReplyChargingRequestNotAccepted, "ReplyChargingRequestNotAccepted" );
+_LIT( KErrReplyChargingForwardingDenied, "ReplyChargingForwardingDenied" );
+_LIT( KErrReplyChargingNotSupported, "ReplyChargingNotSupported" );
+_LIT( KErrAddressHidingNotSupported, "AddressHidingNotSupported" );
+_LIT( KErrPermanentLackOfPrepaid, "PermanentLackOfPrepaid" );
+//X-Mms-RetrieveStatus (one extra value)
+_LIT( KErrRetrieveContentUnsupported, "PermanentContentUnsupported" );
+//X-Mms-Store-Status (one extra value)
+_LIT( KErrMMBoxFull, "MMBoxFull" );
+
+_LIT8( KTestContent, "Content" ); // For attribute list only
+_LIT8( KTestAdditionalHeaders, "ADDITIONAL-HEADERS" ); // For attribute list only
+_LIT8( KTestDeliveryTime, "DELIVERY-TIME"); // for attribute list only
+_LIT8( KTestExpiry, "EXPIRY"); // for attribute list only
+_LIT8( KTestReplyCharg, "REPLY-CHARG-DEADLINE" ); // for attribute list only
+_LIT8( KTestContentType, "CONTENT-TYPE" ); // for attribute list only
+
+/**
+* CMmsReadFile
+*/
+NONSHARABLE_CLASS( CMmsReadFile ):public CBase
+ {
+ public: // Constructors and destructor
+
+ static CMmsReadFile* NewL(RFs& aFs, RFileReadStream& aReadStream ); // Two-phased constructor.
+ virtual ~CMmsReadFile(); // Destructor
+
+ public: // New functions
+
+ TInt CompleteTestL(TInt aMessageCounter, CMmsHeaders& aMmsHeaders);
+ TTestReadStatus ReadRowL();
+ void CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders );
+ TInt FindAlias(TPtrC alias);
+ void SetAttaStructure( TBool aOldAttaStructure = EFalse );
+
+ protected: // Functions from base classes
+
+ private:
+
+ CMmsReadFile(); // C++ default constructor.
+ // By default constructor is private.
+ void ConstructL( RFs& aFs, RFileReadStream& aReadStream );
+ void Reset();
+
+ public: // data
+ TInt iMessageType;
+
+
+ private: // Data
+
+ RFs iFs;
+ RFileReadStream* iReader;
+ TBuf<DefaultBufLen> iValueBuffer;
+ CDesCArray* iAliasArray; // aliases
+ HBufC8* iByteBuffer;
+ TTime iDate;
+ CArrayPtrFlat<CMmsAttaStructure>* iAttaStructures;
+ TInt iAttaCount;
+ TInt iAttaRoot;
+ TInt iAliasCount;
+ TInt iNextMessageType;
+ TParse iParse;
+ TFileName iFilename;
+
+ protected: // Data
+ private: // Data
+
+ // CArrayFixFlat <TestMessage>* iMessages;
+
+ public: // Friend classes
+ protected: // Friend classes
+ private: // Friend classes
+
+ };
+
+
+NONSHARABLE_CLASS( CMmsAttaStructure ):public CBase
+ {
+ public: // Constructors and destructor
+ static CMmsAttaStructure* NewL(); // Two-phased constructor.
+ virtual ~CMmsAttaStructure(); // Destructor
+ private:
+ CMmsAttaStructure(); // C++ default constructor.
+ // By default constructor is private.
+ void ConstructL();
+
+ public: // Data
+ HBufC8* iAtta;
+ HBufC8* iAttaName; // content location
+ HBufC8* iAttaType;
+ HBufC8* iAttaCid;
+ TInt iAttaCharset;
+ HBufC* iAttaRecommendedName; // recommended filename
+ CDesC8ArrayFlat* iContentTypeParams; // zero or more "parameter"
+ CDesC8ArrayFlat* iXTypeParams; // zero or more X-Type "parameters"
+
+ };
+
+
+#endif // MMSREADFILE_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/mmstestbed/inc/mmstestbed.h Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#ifndef MMSTESTBED_H
+#define MMSTESTBED_H
+
+#ifdef BUILD_MMSTESTBED_DLL
+#define MMSTESTBED_EXPORT Q_DECL_EXPORT
+#else
+#define MMSTESTBED_EXPORT Q_DECL_IMPORT
+#endif
+
+#include <QObject>
+#include <QString>
+
+#include <msvids.h> //for consts like KMsvNullIndexEntryIdValue
+#include <MSVAPI.H>
+#include <MTCLREG.H>
+#include <mmsclient.h>
+//#include <mmsservercommon.h>
+
+class CTestUiTimer;
+class CMsvSession;
+class CMmsClientMtm;
+class CMmsSettings;
+class CMmsHeaders;
+class CLogEvent;
+class CLogViewEvent;
+class CLogFilter;
+class CLogClient;
+
+class MMSTESTBED_EXPORT MmsTestBed : public QObject, public MMsvSessionObserver
+ {
+ Q_OBJECT
+
+public:
+ /**
+ *
+ */
+ MmsTestBed();
+ ~MmsTestBed();
+ void setConnectionLocal(bool value);
+ void fromOutboxToMmsc();
+ void fromMmscToInbox();
+ /**
+ * cleanup MMS service
+ */
+ void cleanupAndCreateNewService();
+ void deleteNotifications();
+ void restoreFactorySettings();
+ void setFetchingState( TMmsReceivingMode aState );
+ void sendFromFile();
+ void sendOneByOne();
+ void sendNotifications();
+ void copyDrafts();
+ void garbageCollection(TUint32 aReason = 0x00000001); //0x00000001 == KMmsReasonBoot
+ void messageVariation();
+ void cancelSendScheduling();
+ void scheduledSend(TMsvId aBoxId, TInt aDelay = 5);
+ void deleteSendSchedule();
+ void cancelFetchScheduling();
+ void fetchForced(TInt aDelay = 5);
+ void deleteFetchSchedule();
+ void doAFetchCycle();
+ void createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry);
+ void cleanOutbox();
+ void cleanInbox();
+ void cleanSent();
+ void cleanDrafts();
+ void cleanAll();
+ void reply();
+ void replyToAll();
+ void forward();
+ void sendReadReport(); // send a read report
+ int fromOutboxToMmscWithMemoryFailure(); // returns memory failure count
+ int fromMmscToInboxWithMemoryFailure(); // returns memory failure count
+ void sendViaClient();
+ void scheduledFetch(TInt aDelay = 5);
+ void fetchForcedImmediate();
+ void getEventType();
+ void addEventType();
+ void deleteEventType();
+ void cleanLog();
+ void setOnline(bool value);
+ void generateDeliveryReport( CMmsHeaders* aMmsHeaders );
+ void sendDeliveryReport();
+
+signals:
+ void entryCreatedInDraft(long int id);
+ void entryMovedToOutbox(long int id);
+ void entryMovedToSent(long int id);
+ void entryCreatedInInbox(long int id);
+
+protected:
+ /**
+ * From MMsvSessionObserver
+ */
+ void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
+ TAny* aArg2, TAny* aArg3);
+
+private:
+ void findDefaultL();
+ void createMmsService();
+ void cleanup();
+ void deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry);
+ void testFile(TFileName& aFilePath, TInt aCommand = 0, TMsvId aBox = KMsvGlobalOutBoxIndexEntryId);
+ void addMMBoxDescriptions();
+ void encodeMessageFromDrafts();
+ TMsvId findMMSFolder();
+ bool checkLogClient();
+ int getLogEntries();
+
+private:
+ //data
+ CTestUiTimer* iTimer;
+ CMsvOperationActiveSchedulerWait* iWait;
+ CMsvSession* iSession;
+ CClientMtmRegistry* iClientMtmRegistry;
+ CMmsClientMtm* iMmsClient;
+ CMmsSettings* iSettings;
+ CMmsHeaders* iMmsHeaders;
+ TMsvId iServiceId;
+ TMsvId iDefaultServiceId;
+ TMsvSessionEvent iEvent;
+ RFs iFs;
+ TFileName iFilename;
+ TFileName iCurrentFile;
+ TFileName iCurrentPath;
+ TParse iParse; // parse buffer as member to save stack space
+ CBufFlat* iEncodeBuffer;
+ CMsvEntrySelection* iMsvEntrySelection;
+ CLogEvent* iLogEvent;
+ CLogClient* iLogClient;
+ CLogViewEvent* iLogView;
+ CLogFilter* iLogFilter;
+ };
+
+#endif // MMSTESTBED_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/mmstestbed/inc/mmstestbed.hrh Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#include <bldvariant.hrh>
+
+
+#ifndef MMSTESTBED_HRH
+#define MMSTESTBED_HRH
+
+enum
+{
+ EAppMainOk = 1,
+ EAppMainCancel,
+ //
+ EMenufrmCmdCascadeTest,
+ ECleanup,
+ ECleanOutbox,
+ ESaveSettings,
+ ELoadSettings,
+ ECleanInbox,
+ EShowIn,
+ EShowOut,
+ EOutToMMSC,
+ EMMSCToIn,
+ ESendScheduled,
+ EReceiveScheduled,
+ EShowSent,
+ ECleanSent,
+ EStartMyNotifier,
+ EGetEventType,
+ EAddEventType,
+ EDeleteEventType,
+ EViewLog,
+ ECleanLog,
+ EShowWapAccessPoints,
+ ESelectWapAccessPoint,
+ EShowConnectionMode,
+ EShowIAP,
+ EConnectToIAP,
+ EDeleteSendSchedule,
+ EDeleteReceiveSchedule,
+ EDeleteNotifications,
+ ERestoreFactorySettings,
+ ECreateFromFile,
+ EShowNotifications,
+ ESendDeliveryReport,
+ EShowDrafts,
+ ECleanDrafts,
+ ECleanAll,
+ EFetchingDeferred,
+ EFetchingOn,
+ ESendFromFile,
+ ESwitchToLocal,
+ ESwitchToGlobal,
+ EDecodeLoggingOn,
+ EDecodeLoggingOff,
+ EBinaryDumpOn,
+ EBinaryDumpOff,
+ ESendNotification,
+ ECreateToInbox,
+ ECreateToSentItems,
+ ESendFromDrafts,
+ EFindMMSFolder,
+ ESendOneByOne,
+ ECreateToDrafts,
+ ESendViaClient,
+ ESendMemFail,
+ EFetchMemFail,
+ EReceiveForced,
+ ECreateHeadersFromFile,
+ ESwitchToOffline,
+ ESwitchToOnline,
+ ECopyDrafts,
+ ECreateNotification,
+ EReply,
+ EReplyToAll,
+ EForward,
+ EFetchingManual,
+ EFirstBoot,
+ ENoFirstBoot,
+ EFindNetworkStatus,
+ ESendReadReport,
+ ECreateMMBoxViewConf,
+ EGetMMBoxView,
+ ECleanMMBox,
+ EShowMMBox
+};
+
+#define ETestLabel1 1
+#define ETestLabel2 2
+#define ETestLabel3 3
+#define ETestLabel4 4
+
+#define EServiceList 2
+
+
+enum TTestBedDlgCtrlIds
+ {
+ ETestEditField = 1
+ };
+
+enum TEditServiceControls
+ {
+ EFolderLabel = 1,
+ EEditUri
+// EEditServiceFolder,
+// ENameLabel,
+// EEditServiceName,
+// ENumberLabel,
+// EEditServiceNumber
+ };
+
+enum
+ {
+ EFsViewDialogId = 1
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/mmstestbed/inc/mmsteststaticutils.h Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#ifndef MMSTESTSTATICUTILS_H
+#define MMSTESTSTATICUTILS_H
+
+#include <e32std.h>
+#include <msvstd.h>
+#include <badesca.h>
+
+#include "mmsconst.h"
+
+class RFs;
+class CMsvSession;
+class CMmsEncode;
+class CMmsHeaders;
+
+#ifdef __WINS__
+_LIT( KRootPath, "c:\\" );
+#else
+// This is removable disk.
+// drive letter should not be hard coded, must be investigated further
+// We use c: for a while for the tests (to be cahnged later)
+_LIT( KRootPath, "c:\\" );
+//_LIT( KRootPath, "e:\\" );
+#endif
+
+// directory where mmbox descriptions are created
+_LIT( KMmsMMBoxDescriptionDirectory, "C:\\mmsmmboxdescriptions\\");
+// directory where created headers are dumped
+_LIT( KMmsDumpDirectory, "C:\\mmsdump\\");
+// content type of MMS PDUs
+_LIT8( KMmsMimeType, "application/vnd.wap.mms-message" );
+
+_LIT( KWild, "*" );
+
+
+/**
+ * joined array structure
+ *
+ */
+NONSHARABLE_CLASS( TMmsJoinedArrays ): public MDesCArray
+ {
+public:
+ TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2);
+ TInt MdcaCount() const;
+ TPtrC16 MdcaPoint(TInt aIndex) const;
+private:
+ CDesCArray* const & iArray1;
+ CDesCArray* const & iArray2;
+ };
+
+/**
+ * static utility functions
+ *
+ */
+class TMmsTestUtils
+ {
+
+public:
+
+ /**
+ *
+ */
+ TMmsTestUtils();
+
+ /**
+ * read phone number for sending messages
+ *
+ * @param aFileName full path for filename
+ * @param aFs file system handle
+ * @return allocated pointer containing the name
+ * The caller must delete the pointer when no longer needed
+ */
+ static HBufC* ReadContactFromFileL( TDesC& aFileName, RFs& aFs );
+
+ static void DecodeLoggingOnL();
+ static void DecodeLoggingOffL();
+ static void BinaryDumpOnL();
+ static void BinaryDumpOffL();
+
+ /**
+ * Clean all temporary directories used in local mode.
+ * Does not delete the directories, only the contents
+ *
+ * @param aFs file system handle
+ */
+ static void CleanDirectoryL( RFs& aFs );
+
+ /**
+ * Dump a binary message
+ *
+ * @param aBuffer buffer containing the binary message
+ * @param aFilename full path of the directory whenre the dump goes
+ * @param aParse reference to parser (to save stack space)
+ * @param aFs file system handle
+ */
+ static void Dump(
+ CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs );
+
+ /**
+ * Delete all MMS messages and notifications from a given folder
+ *
+ * @param aBoxId folder id
+ * @param aSession Messaging server session
+ */
+ static void CleanBoxL(TMsvId aBoxId, CMsvSession& aSession);
+
+ /**
+ * turn on logging messages sent to email addresses
+ */
+ static void EmailLoggingOnL();
+
+ /**
+ * turn off logging messages sent to email addresses
+ */
+ static void EmailLoggingOffL();
+
+ /**
+ * load list of children into selection and return count
+ *
+ * @param aBoxId folder id
+ * @param aMsvEntrySelection reference to a pointer that will contain the list of child ids
+ * caller is responsible of deleting the pointer afterwards.
+ * Pointer may be NULL at entry, and a new pointer will be allocated
+ * @param aSession messge server session
+ * @param aMessageType child MTM type, default is multimedia message
+ * @return number of entries in selection
+ */
+ static TInt CountChildrenL(
+ TMsvId aBoxId,
+ CMsvEntrySelection*& aMsvEntrySelection,
+ CMsvSession& aSession,
+ TUid aMessageType = KUidMsgTypeMultimedia);
+
+ /**
+ * Create a folder entry
+ *
+ * @param aSession messge server session
+ * @param aParentFolder the parent folder
+ * @param aFolderName name of the folder
+ * @param aFolderId will contain the if of the new folder if creation was successful
+ */
+ static void CreateFolderEntryL(
+ CMsvSession& aSession,
+ TMsvId aParentFolder,
+ const TDesC& aFolderName,
+ TMsvId& aFolderId );
+
+ /**
+ * Create an MMS notification from data in buffer
+ * @param aNotificationFolder mms notification folder (target folder)
+ * @param aServiceId id of MMS service
+ * @param aEncodeBuffer buffer that contains the data
+ * @param aSession message server session
+ * @return id of the created notification
+ */
+ static TMsvId CreateNotificationEntryL(
+ TMsvId aNotificationFolder,
+ TMsvId aServiceId,
+ CBufFlat* aEncodeBuffer,
+ CMsvSession& aSession );
+
+ /**
+ * Encode an MMS notification into buffer
+ * @param aUrl url of the notification for local messages a filepath
+ * @param aSize size of the message
+ * @param aMmsHeaders MMS headers structure for creating the notification
+ * @param aMmsEncoder reference to CMmsEncode class
+ * @param aEncodeBuffer flat buffer that will contain the encoded notification
+ */
+ static void FormNotification(
+ TDesC8& aUrl,
+ TInt aSize,
+ CMmsHeaders& aMmsHeaders,
+ CMmsEncode& aMmsEncoder,
+ CBufFlat* aEncodeBuffer );
+
+
+ static TBool IsDrive(const TDesC& aFileName);
+ static TBool IsDir(const TDesC& aFileName, RFs& aFs);
+ static TBool IsFile(const TDesC& aFileName, RFs& aFs);
+
+
+private:
+
+ };
+
+
+#endif // MMSTESTSTATICUTILS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/mmstestbed/inc/mmstestuitimer.h Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#ifndef C_TESTUITIMER_H
+#define C_TESTUITIMER_H
+
+
+#include <e32base.h>
+
+#define KPeriod 10000 // period of timer
+
+/**
+ * timer for test programs
+ */
+NONSHARABLE_CLASS( CTestUiTimer ): public CTimer
+ {
+public:
+
+ static CTestUiTimer* NewL();
+ virtual ~CTestUiTimer();
+
+ void RunL();
+ void DoCancel();
+ void ConstructL();
+ void IssueRequest();
+ void TimeoutOperation(CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds);
+
+private:
+ CTestUiTimer();
+
+public:
+ TTimeIntervalMicroSeconds32 period;
+
+private: // data
+ CActive* iObject;
+ };
+
+#endif // C_TESTUITIMER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/mmstestbed/mmstestbed.pro Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,90 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: Project file for mmstestbed
+#
+
+QT += testlib
+QT -= gui
+
+TEMPLATE = lib
+
+TARGET = mmstestbed
+
+INCLUDEPATH += .
+INCLUDEPATH += inc
+INCLUDEPATH += ../../../inc
+INCLUDEPATH += ../../../../../../../../mmsengine/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/mmscodec/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/mmshttptransport/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/mmsmessage/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/mmsconninit/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/mmsserver/inc
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+DEFINES += BUILD_MMSTESTBED_DLL
+
+CONFIG += hb
+CONFIG += symbian_test
+CONFIG += qtestlib
+
+SOURCES += src/mmstestbed.cpp \
+ src/mmsteststaticutils.cpp \
+ src/mmsreadfile.cpp \
+ src/mmstestuitimer.cpp
+
+HEADERS += inc/mmstestbed.h \
+ inc/mmsteststaticutils.h \
+ inc/mmsreadfile.h \
+ inc/mmstestuitimer.h \
+ inc/mmstestbed.hrh
+
+SYMBIAN_PLATFORMS = WINSCW ARMV5
+
+symbian {
+ TARGET.UID3 = 0xE5c588a1
+ TARGET.CAPABILITY = CAP_GENERAL_DLL
+ TARGET.EPOCSTACKSIZE = 0x8000
+ TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
+ TARGET.EPOCALLOWDLLDATA = 1
+ VENDORID = VID_DEFAULT
+ }
+
+#Def File rules
+defBlock = \
+"$${LITERAL_HASH}if defined(EABI)" \
+"DEFFILE eabi/mmstestbedu.def" \
+"$${LITERAL_HASH}else" \
+"DEFFILE bwins/mmstestbedu.def" \
+"$${LITERAL_HASH}endif"
+
+# Build.inf rules
+BLD_INF_RULES.prj_exports += \
+ "$${LITERAL_HASH}include <platform_paths.hrh>"
+
+LIBS += -lmsgs \
+ -lmmsmessage \
+ -lmmsconninit \
+ -lmmscodec \
+ -lmmsserversettings \
+ -lcentralrepository \
+ -lapparc \
+ -lbafl \
+ -lefsrv \
+ -lesock \
+ -lestor \
+ -leuser \
+ -llogcli \
+ -llogwrap \
+ -lapgrfx \
+ -lapmime
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/mmstestbed/src/mmsreadfile.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,1799 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <badesca.h>
+#include <e32def.h>
+#include <s32file.h>
+#include <msvids.h>
+#include <mtmdef.h>
+//#include <eikenv.h>
+#include <apgcli.h>
+#include <CMsvMimeHeaders.h>
+#include <AknNoteWrappers.h>
+
+#include <mmsservercommon.h>
+#include "mmsconst.h"
+#include "mmsclient.h"
+#include "mmsheaders.h"
+#include "mmsreadfile.h"
+#include "mmsmmboxviewheaders.h"
+#include "mmsmmboxmessageheaders.h"
+#include "mmsmmboxflags.h"
+#include "mmssettings.h"
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+const TInt KMmsGranularity = 8;
+_LIT( K1970, "19700000:000000.000000" ); // 1-Jan 1970 0:00:00
+
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// ==================== LOCAL FUNCTIONS ====================
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+CMmsReadFile::CMmsReadFile()
+ {
+ // all member variables in a class derived from CBase
+ // are automatically set to 0.
+ }
+
+
+//
+void CMmsReadFile::ConstructL(RFs& aFs, RFileReadStream& aReadStream )
+ {
+ // iRowBuffer = HBufC8::NewMaxL( 500 ); // Max row length!!!!
+ iFs = aFs;
+ iReader = &aReadStream;
+ iByteBuffer = HBufC8::NewL( DefaultBufLen );
+ iAliasArray = new ( ELeave ) CDesCArrayFlat( KMmsGranularity );
+ iAttaStructures = new ( ELeave ) CArrayPtrFlat<CMmsAttaStructure>( KMmsGranularity );
+ Reset();
+ }
+
+// Two-phased constructor.
+CMmsReadFile* CMmsReadFile::NewL(RFs& aFs, RFileReadStream& aReadStream )
+ {
+ CMmsReadFile* self = new ( ELeave ) CMmsReadFile();
+ CleanupStack::PushL( self );
+ self->ConstructL( aFs, aReadStream );
+ CleanupStack::Pop();
+ return self;
+ }
+
+
+// Destructor
+CMmsReadFile::~CMmsReadFile()
+ {
+ Reset(); // resets and destroys all array data
+ if (iAliasArray != NULL) iAliasArray->Reset();
+ delete iByteBuffer;
+ delete iAliasArray;
+ delete iAttaStructures;
+ }
+
+void CMmsReadFile::Reset()
+ {
+ // reset all arrays
+ if (iAttaStructures != NULL) iAttaStructures->ResetAndDestroy();
+ iAttaCount = 0;
+ iAttaRoot = 0;
+ }
+
+// ---------------------------------------------------------
+// CMmsReadFile()::CompleteTest
+// ---------------------------------------------------------
+//
+TInt CMmsReadFile::CompleteTestL( TInt aMessageCounter, CMmsHeaders& aMmsHeaders )
+{
+ Reset(); // new message
+
+ TUint32 val;
+ TUint limit = 1000000;
+ TUint sizeLimit = 1000 * 1024; //max message size 1000 kB!
+ TUint allLimit = 999999;
+ TInt error;
+ TRadix radix = EDecimal;
+ TLex16 lex;
+ TTestReadStatus readStatus = ETestUnknown;
+ CMmsAttaStructure* oneAtta = NULL;
+ TInt index;
+ TTime y1970( K1970 );
+ TTimeIntervalMicroSeconds interval;
+ TTime date;
+ TInt order = 0;
+ TInt16 shortInteger = 0;
+
+ //iso luuppi, joka kiertää ja lukee kunnes EOF tule vastaan
+ //Big Loop, which passes around and read until the EOF
+
+ iMessageType = iNextMessageType;
+ while(readStatus != ETestEof)
+ {
+ readStatus = ReadRowL();
+ if ( readStatus == ETestEof )
+ {
+ return(-1);
+ }
+ if ( readStatus == ETestUnknown )
+ {
+ // A line containing only comments, or an unknown tag
+ // As using the scripts to test settings is no longer supported,
+ // any old keywords used to test CMmsSettings class are ignored
+ continue;
+ }
+ if( readStatus == ETestNewMessage )
+ {
+ iNextMessageType = readStatus;
+ if(aMessageCounter++)
+ {
+ return(NULL);
+ }
+ else
+ {
+ iMessageType = iNextMessageType;
+ continue;
+ }
+ }
+ if ( iMessageType == ETestNewMessage)
+ {
+ switch(readStatus)
+ {
+ case ETestFrom:
+ aMmsHeaders.SetSenderL( iValueBuffer );
+ break;
+ case ETestFromAlias:
+ index = FindAlias(iValueBuffer);
+ if(index >= 0)
+ {
+ aMmsHeaders.SetSenderL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ) );
+ }
+ break;
+ case ETestTo:
+ aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientTo );
+ break;
+ case ETestToAlias:
+ index = FindAlias(iValueBuffer);
+ if(index >= 0)
+ {
+ aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsTo );
+ }
+ break;
+ case ETestCc:
+ aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientCc );
+ break;
+ case ETestCcAlias:
+ index = FindAlias(iValueBuffer);
+ if(index >= 0)
+ {
+ aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsCc );
+ }
+ break;
+ case ETestBcc:
+ aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientBcc );
+ break;
+ case ETestBccAlias:
+ index = FindAlias(iValueBuffer);
+ if(index >= 0)
+ {
+ aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsBcc );
+ }
+ break;
+ case ETestSubject:
+ aMmsHeaders.SetSubjectL( iValueBuffer );
+ break;
+ case ETestExpiryRel:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetExpiryInterval( val );
+ }
+ break;
+ case ETestExpiryAbs:
+ error = iDate.Set(iValueBuffer);
+ interval = iDate.MicroSecondsFrom( y1970 );
+ // expiry date in seconds from 1.1.1970.
+ aMmsHeaders.SetExpiryDate( (interval.Int64())/1000000 );
+ break;
+ case ETestDeliveryTimeRel:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetDeliveryTimeInterval( val );
+ }
+ break;
+ case ETestDeliveryTimeAbs:
+ error = iDate.Set(iValueBuffer);
+ interval = iDate.MicroSecondsFrom( y1970 );
+ aMmsHeaders.SetDeliveryDate( (interval.Int64())/1000000 );
+ break;
+ case ETestDate:
+ error = iDate.Set(iValueBuffer);
+ interval = iDate.MicroSecondsFrom( y1970 );
+ aMmsHeaders.SetDate( (interval.Int64())/1000000 );
+ case ETestPriority:
+ val = 0;
+ if ((iValueBuffer.CompareF(KLow)) == 0)
+ {
+ val = EMmsPriorityLow;
+ }
+ else if ((iValueBuffer.CompareF(KNormal)) == 0)
+ {
+ val = EMmsPriorityNormal;
+ }
+ else if ((iValueBuffer.CompareF(KHigh)) == 0)
+ {
+ val = EMmsPriorityHigh;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetMessagePriority( val );
+ break;
+ case ETestSenderVisibility:
+ val = 0;
+ if ((iValueBuffer.CompareF(KHide)) == 0)
+ {
+ val = EMmsSenderVisibilityHide;
+ }
+ else if ((iValueBuffer.CompareF(KShow)) == 0)
+ {
+ val = EMmsSenderVisibilityShow;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetSenderVisibility( val );
+ break;
+ case ETestDeliveryReport:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = EMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = EMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetDeliveryReport( val );
+ break;
+ case ETestDelivReportSendAllow:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = EMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = EMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetReportAllowed( val );
+ break;
+
+ case ETestReadReply:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = EMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = EMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetReadReply( val );
+ break;
+ case ETestNewAttachment:
+ oneAtta = CMmsAttaStructure::NewL();
+ iAttaStructures->AppendL(oneAtta);
+ oneAtta->iAtta->Des().Copy( iValueBuffer );
+ iAttaCount++;
+ break;
+ case ETestAttachmentType:
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaType->Des().Copy( iValueBuffer );
+ }
+ break;
+ case ETestAttachmentContLoc:
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaName->Des().Copy( iValueBuffer );
+ }
+ break;
+ case ETestAttaRecommendedName:
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaRecommendedName->Des().Copy( iValueBuffer );
+ }
+ break;
+ case ETestAttachmentCharset:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaCharset = val;
+ }
+ }
+ break;
+ case ETestAttachmentCid:
+ if (oneAtta != NULL)
+ {
+ oneAtta->iAttaCid->Des().Copy(iValueBuffer);
+ }
+ break;
+ case ETestAttContTypeParamName:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if (oneAtta != NULL)
+ {
+ oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
+ }
+ break;
+ case ETestAttContTypeParamValue:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if (oneAtta != NULL)
+ {
+ oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
+ }
+ break;
+ case ETestAttXTypeParamName:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if (oneAtta != NULL)
+ {
+ oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
+ }
+ break;
+ case ETestAttXTypeParamValue:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if (oneAtta != NULL)
+ {
+ oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
+ }
+ break;
+ case ETestAttachmentRoot:
+ iAttaRoot = iAttaCount;
+ break;
+ case ETestAlias:
+ // all aliases are global even if they appear
+ // in the middle of a message
+ iAliasArray->AppendL( iValueBuffer );
+ iAliasCount++;
+ break;
+ case ETestMessageClass: // should be handled!
+ val = EMmsClassPersonal;
+ if ((iValueBuffer.CompareF(KPersonal)) == 0)
+ {
+ val = EMmsClassPersonal;
+ }
+ else if ((iValueBuffer.CompareF(KAdvertisement)) == 0)
+ {
+ val = EMmsClassAdvertisement;
+ }
+ else if ((iValueBuffer.CompareF(KInformational)) == 0)
+ {
+ val = EMmsClassInformational;
+ }
+ else if ((iValueBuffer.CompareF(KAuto)) == 0)
+ {
+ val = EMmsClassAuto;
+ }
+ else
+ {
+ val = (TMmsMessageClass)KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetMessageClass( val );
+ break;
+ case ETestReplyCharging:
+ val = 0;
+ if ((iValueBuffer.CompareF(KRequested)) == 0)
+ {
+ val = KMmsReplyChargingRequested;
+ }
+ else if ((iValueBuffer.CompareF(KReqTextOnly)) == 0)
+ {
+ val = KMmsReplyChargingRequestedTextOnly;
+ }
+ else if ((iValueBuffer.CompareF(KAccepted)) == 0)
+ {
+ val = KMmsReplyChargingAccepted;
+ }
+ else if ((iValueBuffer.CompareF(KAccTextOnly)) == 0)
+ {
+ val = KMmsReplyChargingAcceptedTextOnly;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetReplyCharging( val );
+ break;
+ case ETestReplyChargAbs:
+ error = date.Set(iValueBuffer);
+ if ( error == KErrNone )
+ {
+ interval = date.MicroSecondsFrom( y1970 );
+ aMmsHeaders.SetReplyChargingDate( (interval.Int64())/1000000 );
+ }
+ break;
+ case ETestReplyChargRel:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetReplyChargingInterval( val );
+ }
+ break;
+ case ETestReplyChargSize:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,sizeLimit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetReplyChargingSize( val );
+ }
+ break;
+ case ETestReplyChargID:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetReplyChargingIdL( iByteBuffer->Des() );
+ break;
+ case ETestTID:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetTidL( iByteBuffer->Des() );
+ break;
+ case ETestContentLocation:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
+ aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf ||
+ aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteReq )
+ {
+ aMmsHeaders.MMBoxMessageHeadersL().ContentLocationList().AppendL( iByteBuffer->Des() );
+ }
+ else if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
+ {
+ aMmsHeaders.InsertDeleteContentLocationL( order, iByteBuffer->Des() );
+ }
+ else
+ {
+ aMmsHeaders.SetContentLocationL( iByteBuffer->Des() );
+ }
+ break;
+ case ETestPreviouslySentIndex:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ order = val;
+ break;
+ case ETestPreviouslySentBy:
+ aMmsHeaders.InsertPreviouslySentByL( order, iValueBuffer );
+ break;
+ case ETestPreviouslySentDate:
+ error = date.Set(iValueBuffer);
+ if ( error == KErrNone )
+ {
+ interval = date.MicroSecondsFrom( y1970 );
+ aMmsHeaders.InsertPreviouslySentDateL( order, (interval.Int64())/1000000 );
+ }
+ break;
+ case ETestMessageId:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetMessageIdL( iByteBuffer->Des() );
+ break;
+ case ETestMessageSize:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,sizeLimit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetMessageSize( val );
+ }
+ break;
+ case ETestVersion:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,EHex,limit);
+ shortInteger = TInt16( val );
+ if (error == KErrNone)
+ {
+ aMmsHeaders.SetMmsVersion( shortInteger );
+ }
+ break;
+ case ETestReadStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KRead)) == 0)
+ {
+ val = KMmsReadStatusRead;
+ }
+ else if ((iValueBuffer.CompareF(KDelNotRead)) == 0)
+ {
+ val = KMmsReadStatusDeletedWithoutBeingRead;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetReadStatus( val );
+ break;
+ case ETestResponseStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KOk)) == 0)
+ {
+ val = KMmsStatusOk;
+ }
+ else if ((iValueBuffer.CompareF(KErrUnspecified)) == 0)
+ {
+ val = KMmsErrorUnspecified;
+ }
+ else if ((iValueBuffer.CompareF(KErrServiceDenied)) == 0)
+ {
+ val = KMmsErrorServiceDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrMessageFormatCorrupt)) == 0)
+ {
+ val = KMmsErrorMessageFormatCorrupt;
+ }
+ else if ((iValueBuffer.CompareF(KErrAddressUnresolved)) == 0)
+ {
+ val = KMmsErrorSendingAddressUnresolved;
+ }
+ else if ((iValueBuffer.CompareF(KErrMessageNotFound)) == 0)
+ {
+ val = KMmsErrorMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrNetworkProblem)) == 0)
+ {
+ val = KMmsErrorNetworkProblem;
+ }
+ else if ((iValueBuffer.CompareF(KErrContentNotAccepted)) == 0)
+ {
+ val = KMmsErrorNoContentAccepted;
+ }
+ else if ((iValueBuffer.CompareF(KErrUnsupportedMessage)) == 0)
+ {
+ val = KMmsErrorUnsupportedMessage;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
+ {
+ val = KMmsErrorTransientFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientAddressUnresolved)) == 0)
+ {
+ val = KMmsErrorTransientSendingAddressUnresolved;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
+ {
+ val = KMmsErrorTransientMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
+ {
+ val = KMmsErrorTransientNetworkProblem;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
+ {
+ val = KMmsErrorPermanentFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
+ {
+ val = KMmsErrorPermanentServiceDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
+ {
+ val = KMmsErrorPermanentMessageFormatCorrupt;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentAddressUnresolved)) == 0)
+ {
+ val = KMmsErrorPermanentSendingAddressUnresolved;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
+ {
+ val = KMmsErrorPermanentMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentContentNotAccepted)) == 0)
+ {
+ val = KMmsErrorPermanentContentNotAccepted;
+ }
+ else if ((iValueBuffer.CompareF(KErrReplyChargingLimitNotMet)) == 0)
+ {
+ val = KMmsErrorPermanentReplyChargingLimitationsNotMet;
+ }
+ else if ((iValueBuffer.CompareF(KErrReplyChargingRequestNotAccepted)) == 0)
+ {
+ val = KMmsErrorPermanentReplyChargingRequestNotAccepted;
+ }
+ else if ((iValueBuffer.CompareF(KErrReplyChargingForwardingDenied)) == 0)
+ {
+ val = KMmsErrorPermanentReplyChargingForwardingDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrReplyChargingNotSupported)) == 0)
+ {
+ val = KMmsErrorPermanentReplyChargingNotSupported;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientPartialSuccess)) == 0)
+ {
+ val = KMmsErrorTransientPartialSuccess;
+ }
+ else if ((iValueBuffer.CompareF(KErrAddressHidingNotSupported)) == 0)
+ {
+ val = KMmsErrorPermanentAddressHidingNotSupported;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
+ {
+ aMmsHeaders.InsertDeleteStatusL( order, val );
+ }
+ else
+ {
+ aMmsHeaders.SetResponseStatus( val );
+ }
+ break;
+ case ETestResponseText:
+ if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
+ {
+ aMmsHeaders.InsertDeleteResponseTextL( order, iValueBuffer );
+ }
+ else
+ {
+ aMmsHeaders.SetResponseTextL( iValueBuffer );
+ }
+ break;
+ case ETestRetrieveStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KOk)) == 0)
+ {
+ val = KMmsStatusOk;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
+ {
+ val = KMmsErrorTransientFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
+ {
+ val = KMmsErrorReceiveTransientMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
+ {
+ val = KMmsErrorReceiveTransientNetworkProblem;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
+ {
+ val = KMmsErrorPermanentFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
+ {
+ val = KMmsErrorPermanentServiceDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
+ {
+ val = KMmsErrorReceivePermanentMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrRetrieveContentUnsupported)) == 0)
+ {
+ val = KMmsErrorReceivePermanentContentUnsupported;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetResponseStatus( val );
+ break;
+ case ETestRetrieveText:
+ aMmsHeaders.SetResponseTextL( iValueBuffer );
+ break;
+ case ETestStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KDeferred)) == 0)
+ {
+ val = KMmsMessageStatusDeferred;
+ }
+ else if ((iValueBuffer.CompareF(KExpired)) == 0)
+ {
+ val = KMmsMessageStatusExpired;
+ }
+ else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
+ {
+ val = KMmsMessageStatusRetrieved;
+ }
+ else if ((iValueBuffer.CompareF(KRejected)) == 0)
+ {
+ val = KMmsMessageStatusRejected;
+ }
+ else if ((iValueBuffer.CompareF(KUnrecognized)) == 0)
+ {
+ val = KMmsMessageStatusUnrecognized;
+ }
+ else if ((iValueBuffer.CompareF(KIndeterminate)) == 0)
+ {
+ val = KMmsMessageStatusIndeterminate;
+ }
+ else if ((iValueBuffer.CompareF(KForwarded)) == 0)
+ {
+ val = KMmsMessageStatusForwarded;
+ }
+ else if ((iValueBuffer.CompareF(KUnreachable)) == 0)
+ {
+ val = KMmsMessageStatusUnreachable;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetStatus( val );
+ break;
+ case ETestMessageType:
+ val = 0;
+ if ((iValueBuffer.CompareF(KSendReq)) == 0)
+ {
+ val = KMmsMessageTypeMSendReq;
+ }
+ else if ((iValueBuffer.CompareF(KSendConf)) == 0)
+ {
+ val = KMmsMessageTypeMSendConf;
+ }
+ else if ((iValueBuffer.CompareF(KNotifInd)) == 0)
+ {
+ val = KMmsMessageTypeMNotificationInd;
+ }
+ else if ((iValueBuffer.CompareF(KNotifResp)) == 0)
+ {
+ val = KMmsMessageTypeMNotifyRespInd;
+ }
+ else if ((iValueBuffer.CompareF(KRetrConf)) == 0)
+ {
+ val = KMmsMessageTypeMRetrieveConf;
+ }
+ else if ((iValueBuffer.CompareF(KAckInd)) == 0)
+ {
+ val = KMmsMessageTypeAcknowledgeInd;
+ }
+ else if ((iValueBuffer.CompareF(KDelInd)) == 0)
+ {
+ val = KMmsMessageTypeDeliveryInd;
+ }
+ else if ((iValueBuffer.CompareF(KReadReqInd)) == 0)
+ {
+ val = KMmsMessageTypeReadRecInd;
+ }
+ else if ((iValueBuffer.CompareF(KReadOrigInd)) == 0)
+ {
+ val = KMmsMessageTypeReadOrigInd;
+ }
+ else if ((iValueBuffer.CompareF(KForwardRec)) == 0)
+ {
+ val = KMmsMessageTypeForwardReq;
+ }
+ else if ((iValueBuffer.CompareF(KForwardConf)) == 0)
+ {
+ val = KMmsMessageTypeForwardConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxStoreReq)) == 0)
+ {
+ val = KMmsMessageTypeMboxStoreReq;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxStoreConf)) == 0)
+ {
+ val = KMmsMessageTypeMboxStoreConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxViewReq)) == 0)
+ {
+ val = KMmsMessageTypeMboxViewReq;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxViewConf)) == 0)
+ {
+ val = KMmsMessageTypeMboxViewConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxUploadReq)) == 0)
+ {
+ val = KMmsMessageTypeMBoxUploadReq;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxUploadConf)) == 0)
+ {
+ val = KMmsMessageTypeMBoxUploadConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxDeleteReq)) == 0)
+ {
+ val = KMmsMessageTypeMBoxDeleteReq;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxDeleteConf)) == 0)
+ {
+ val = KMmsMessageTypeMBoxDeleteConf;
+ }
+ else if ((iValueBuffer.CompareF(KMBoxDescr)) == 0)
+ {
+ val = KMmsMessageTypeMBoxDescr;
+ }
+ else if ((iValueBuffer.CompareF(KDeleteReq)) == 0)
+ {
+ val = KMmsMessageTypeDeleteReq;
+ }
+ else if ((iValueBuffer.CompareF(KDeleteConf)) == 0)
+ {
+ val = KMmsMessageTypeDeleteConf;
+ }
+ else if ((iValueBuffer.CompareF(KCancelReq)) == 0)
+ {
+ val = KMmsMessageTypeCancelReq;
+ }
+ else if ((iValueBuffer.CompareF(KCancelResp)) == 0)
+ {
+ val = KMmsMessageTypeCancelConf;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetMessageType( val );
+ break;
+ case ETestAttribute:
+ val = 0;
+ iByteBuffer->Des().Copy( iValueBuffer );
+ if ((iByteBuffer->Des().CompareF(KTestBcc)) == 0)
+ {
+ val = KMmsAssignedBcc;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestCc)) == 0)
+ {
+ val = KMmsAssignedCc;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestContent)) == 0)
+ {
+ val = KMmsAssignedContent;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestContentType)) == 0)
+ {
+ val = KMmsAssignedContentType;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestDate)) == 0)
+ {
+ val = KMmsAssignedDate;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestDeliveryReport)) == 0)
+ {
+ val = KMmsAssignedDeliveryReport;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestDeliveryTime)) == 0)
+ {
+ val = KMmsAssignedDeliveryTime;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestExpiry)) == 0)
+ {
+ val = KMmsAssignedExpiry;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestFrom)) == 0)
+ {
+ val = KMmsAssignedFrom;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestMessageClass)) == 0)
+ {
+ val = KMmsAssignedMessageClass;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestMessageId)) == 0)
+ {
+ val = KMmsAssignedMessageId;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestMessageSize)) == 0)
+ {
+ val = KMmsAssignedMessageSize;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestPriority)) == 0)
+ {
+ val = KMmsAssignedPriority;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReadReply)) == 0)
+ {
+ val = KMmsAssignedReadReply;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestSubject)) == 0)
+ {
+ val = KMmsAssignedSubject;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestTo)) == 0)
+ {
+ val = KMmsAssignedTo;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReplyCharging)) == 0)
+ {
+ val = KMmsAssignedReplyCharging;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReplyChargID)) == 0)
+ {
+ val = KMmsAssignedReplyChargingID;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReplyCharg)) == 0)
+ {
+ val = KMmsAssignedReplyChargingDeadline;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestReplyChargSize)) == 0)
+ {
+ val = KMmsAssignedReplyChargingSize;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentBy)) == 0)
+ {
+ val = KMmsAssignedPreviouslySentBy;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentDate)) == 0)
+ {
+ val = KMmsAssignedPreviouslySentDate;
+ }
+ else if ((iByteBuffer->Des().CompareF(KTestAdditionalHeaders)) == 0)
+ {
+ val = KMmsAssignedAdditionalHeaders;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxViewHeadersL().AttributeArray().InsertInOrder(val);
+ break;
+ case ETestDistributionIndicator:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetDistributionIndicator( val );
+ break;
+ case ETestLimit:
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if( error == KErrNone )
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(val);
+ }
+ break;
+ case ETestMessageQuota:
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(val);
+ }
+ break;
+ case ETestSizeQuota:
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(val);
+ }
+ break;
+ case ETestMessageTotal:
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(val);
+ }
+ break;
+ case ETestSizeTotal:
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(val);
+ }
+ break;
+ case ETestMessageCount:
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(KMaxTUint32);
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if ( val > allLimit )
+ {
+ val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+ }
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(val);
+ }
+ break;
+ case ETestAddKeyword:
+ aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsAddToken, iValueBuffer);
+ break;
+ case ETestRemoveKeyword:
+ aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsRemoveToken, iValueBuffer);
+ break;
+ case ETestFilterKeyword:
+ aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsFilterToken, iValueBuffer);
+ break;
+ case ETestMMState:
+ val = 0;
+ if ((iValueBuffer.CompareF(KDraft)) == 0)
+ {
+ val = KMmsDraft;
+ }
+ else if ((iValueBuffer.CompareF(KSent)) == 0)
+ {
+ val = KMmsSent;
+ }
+ else if ((iValueBuffer.CompareF(KNew)) == 0)
+ {
+ val = KMmsNew;
+ }
+ else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
+ {
+ val = KMmsRetrieved;
+ }
+ else if ((iValueBuffer.CompareF(KForwarded)) == 0)
+ {
+ val = KMmsForwarded;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
+ aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ aMmsHeaders.MMBoxViewHeadersL().MMStateArray().InsertInOrder( val );
+ }
+ else
+ {
+ aMmsHeaders.MMBoxMessageHeadersL().SetMMState( val );
+ }
+ break;
+ case ETestQuota:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsQuotas( val );
+ break;
+ case ETestStart:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ if (error == KErrNone)
+ {
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsStart(val);
+ }
+ break;
+ case ETestStore:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxMessageHeadersL().SetMmsStore( val );
+ break;
+ case ETestStored:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxMessageHeadersL().SetMmsStored( val );
+ break;
+ case ETestStoreStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KOk)) == 0)
+ {
+ val = KMmsStatusOk;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
+ {
+ val = KMmsErrorTransientFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
+ {
+ val = KMmsErrorStoreStatusTransientNetworkProblem;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
+ {
+ val = KMmsErrorPermanentFailure;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
+ {
+ val = KMmsErrorPermanentServiceDenied;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
+ {
+ val = KMmsErrorPermanentMessageFormatCorrupt;
+ }
+ else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
+ {
+ val = KMmsErrorStoreStatusPermanentMessageNotFound;
+ }
+ else if ((iValueBuffer.CompareF(KErrMMBoxFull)) == 0)
+ {
+ val = KMmsErrorStoreStatusPermanentMmboxFull;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatus( val );
+ break;
+ case ETestStoreStatusText:
+ aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatusTextL( iValueBuffer );
+ break;
+ case ETestTotals:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.MMBoxViewHeadersL().SetMmsTotals( val );
+ break;
+
+ case ETestDeleteInfoIndex:
+ lex.Assign(iValueBuffer);
+ error = lex.Val(val,radix,limit);
+ order = val;
+ break;
+
+ case ETestApplicId:
+ aMmsHeaders.SetApplicIdL( iValueBuffer );
+ break;
+ case ETestReplyApplicId:
+ aMmsHeaders.SetReplyApplicIdL( iValueBuffer );
+ break;
+ case ETestApplicInfo:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetAuxApplicInfoL( iByteBuffer->Des() );
+ break;
+ case ETestContentClass:
+ val = 0;
+ if ((iValueBuffer.CompareF(KText)) == 0)
+ {
+ val = KMmsContentClassText;
+ }
+ else if ((iValueBuffer.CompareF(KImageBasic)) == 0)
+ {
+ val = KMmsContentClassImageBasic;
+ }
+ else if ((iValueBuffer.CompareF(KImageRich)) == 0)
+ {
+ val = KMmsContentClassImageRich;
+ }
+ else if ((iValueBuffer.CompareF(KVideoBasic)) == 0)
+ {
+ val = KMmsContentClassVideoBasic;
+ }
+ else if ((iValueBuffer.CompareF(KVideoRich)) == 0)
+ {
+ val = KMmsContentClassVideoRich;
+ }
+ else if ((iValueBuffer.CompareF(KMegaPixel)) == 0)
+ {
+ val = KMmsContentClassMegaPixel;
+ }
+ else if ((iValueBuffer.CompareF(KContentBasic)) == 0)
+ {
+ val = KMmsContentClassContentBasic;
+ }
+ else if ((iValueBuffer.CompareF(KContentRich)) == 0)
+ {
+ val = KMmsContentClassContentRich;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetContentClass( val );
+ break;
+ case ETestDrmContent:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetDrmContent( val );
+ break;
+ case ETestAdaptationAllowed:
+ val = 0;
+ if ((iValueBuffer.CompareF(KYes)) == 0)
+ {
+ val = KMmsYes;
+ }
+ else if ((iValueBuffer.CompareF(KNo)) == 0)
+ {
+ val = KMmsNo;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetAdaptationAllowed( val );
+ break;
+ case ETestRecommendedRetrievalMode:
+ val = 0;
+ if ((iValueBuffer.CompareF(KManual)) == 0)
+ {
+ val = KMmsRecommendedRetrievalModeManual;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetRecommendedRetrievalMode( val );
+ break;
+ case ETestRecRetrievalModeText:
+ aMmsHeaders.SetRecommendedRetrievalModeTextL( iValueBuffer );
+ break;
+ case ETestReplaceId:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
+ break;
+ case ETestStatusText:
+ aMmsHeaders.SetResponseTextL( iValueBuffer );
+ break;
+ case ETestCancelId:
+ iByteBuffer->Des().Copy( iValueBuffer );
+ aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
+ break;
+ case ETestCancelStatus:
+ val = 0;
+ if ((iValueBuffer.CompareF(KCancelSuccessful)) == 0)
+ {
+ val = KMmsCancelRequestSuccessfullyReceived;
+ }
+ else if ((iValueBuffer.CompareF(KCancelCorrupted)) == 0)
+ {
+ val = KMmsCancelRequestCorrupted;
+ }
+ else
+ {
+ val = KMmsTestIllegalValue;
+ }
+ aMmsHeaders.SetCancelStatus( val );
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ switch(readStatus)
+ {
+ case ETestAlias:
+ iAliasArray->AppendL( iValueBuffer );
+ iAliasCount++;
+ break;
+
+ default:
+ break;
+ }
+
+ }
+ }
+ return(-1);
+}
+
+// ---------------------------------------------------------
+// CMmsReadFile()::ReadRowL
+// ---------------------------------------------------------
+//
+TTestReadStatus CMmsReadFile::ReadRowL()
+ {
+
+ TBuf8<DefaultBufLen> RowBuffer;
+ TBuf8<32> KeyBuffer;
+
+ // READ ONE ROW AND DROP CR+LF FROM THE END OF LINE
+ TChar delim( 10 );
+ iReader->ReadL( RowBuffer, delim);
+ TInt length = RowBuffer.Length();
+ if ( RowBuffer.Length() < 2 )
+ {
+ return ETestEof;
+ }
+ RowBuffer.Delete(length - 2,2);
+
+ // DROP POSSIBLE COMMENT OUT
+ TInt pos = RowBuffer.Locate( ';' );
+ if ( pos >= 0 ) RowBuffer.Delete( pos, length-pos-2 );
+
+ if ( RowBuffer.Length() == 0 )
+ {
+ // the line contained only comment
+ return ETestUnknown;
+ }
+
+ // First split the row (:)
+ pos = RowBuffer.Locate( ':' );
+ if (pos > 0)
+ {
+ TPtrC8 p = RowBuffer.Mid( pos+1 );
+ length = p.Length();
+ iValueBuffer.Zero();
+ for (TInt i=0; i < length; ++i)
+ {
+ iValueBuffer.Append(p[i]);
+ }
+ iValueBuffer.Trim();
+ TPtrC8 pp = RowBuffer.Left(pos);
+ KeyBuffer.CopyUC(pp);
+ KeyBuffer.Trim();
+ }
+ // TRY TO FIND CORRECT TAG
+ if ((KeyBuffer.CompareF(KTestNewMessage)) == 0) return(ETestNewMessage);
+ if ((KeyBuffer.CompareF(KTestMessageType)) == 0) return ETestMessageType;
+ if ((KeyBuffer.CompareF(KTestDate)) == 0) return ETestDate;
+ if ((KeyBuffer.CompareF(KTestFrom)) == 0) return ETestFrom;
+ if ((KeyBuffer.CompareF(KTestTo)) == 0) return ETestTo;
+ if ((KeyBuffer.CompareF(KTestCc)) == 0) return ETestCc;
+ if ((KeyBuffer.CompareF(KTestBcc)) == 0) return ETestBcc;
+ if ((KeyBuffer.CompareF(KTestSubject)) == 0) return ETestSubject;
+ if ((KeyBuffer.CompareF(KTestExpiryRel)) == 0) return ETestExpiryRel;
+ if ((KeyBuffer.CompareF(KTestExpiryAbs)) == 0) return ETestExpiryAbs;
+ if ((KeyBuffer.CompareF(KTestDeliveryTimeRel)) == 0) return ETestDeliveryTimeRel;
+ if ((KeyBuffer.CompareF(KTestDeliveryTimeAbs)) == 0) return ETestDeliveryTimeAbs;
+ if ((KeyBuffer.CompareF(KTestPriority)) == 0) return ETestPriority;
+ if ((KeyBuffer.CompareF(KTestSenderVisibility)) == 0) return ETestSenderVisibility;
+ if ((KeyBuffer.CompareF(KTestDeliveryReport)) == 0) return ETestDeliveryReport;
+ if ((KeyBuffer.CompareF(KTestReadReply)) == 0) return ETestReadReply;
+ if ((KeyBuffer.CompareF(KTestNewAttachment)) == 0) return ETestNewAttachment;
+ if ((KeyBuffer.CompareF(KTestAttachmentName)) == 0) return ETestAttaRecommendedName;
+ if ((KeyBuffer.CompareF(KTestAttachmentContLoc)) == 0) return ETestAttachmentContLoc;
+ if ((KeyBuffer.CompareF(KTestAttachmentType)) == 0) return ETestAttachmentType;
+ if ((KeyBuffer.CompareF(KTestAttachmentCharset)) == 0) return ETestAttachmentCharset;
+ if ((KeyBuffer.CompareF(KTestAttachmentCid)) == 0) return ETestAttachmentCid;
+ if ((KeyBuffer.CompareF(KTestAttachmentRoot)) == 0) return ETestAttachmentRoot;
+ if ((KeyBuffer.CompareF(KTestEndOfFile)) == 0) return ETestEof;
+ if ((KeyBuffer.CompareF(KTestMessageClass)) == 0) return ETestMessageClass;
+ if ((KeyBuffer.CompareF(KTestDelivRepSendAllow)) == 0) return ETestDelivReportSendAllow;
+ if ((KeyBuffer.CompareF(KTestAlias)) == 0 ) return ETestAlias;
+ if ((KeyBuffer.CompareF(KTestFromAlias)) == 0 ) return ETestFromAlias;
+ if ((KeyBuffer.CompareF(KTestToAlias)) == 0 ) return ETestToAlias;
+ if ((KeyBuffer.CompareF(KTestCcAlias)) == 0 ) return ETestCcAlias;
+ if ((KeyBuffer.CompareF(KTestBccAlias)) == 0 ) return ETestBccAlias;
+ if ((KeyBuffer.CompareF(KTestReplyCharging)) == 0 ) return ETestReplyCharging;
+ if ((KeyBuffer.CompareF(KTestReplyChargAbs)) == 0 ) return ETestReplyChargAbs;
+ if ((KeyBuffer.CompareF(KTestReplyChargRel)) == 0 ) return ETestReplyChargRel;
+ if ((KeyBuffer.CompareF(KTestReplyChargSize)) == 0 ) return ETestReplyChargSize;
+ if ((KeyBuffer.CompareF(KTestReplyChargID)) == 0 ) return ETestReplyChargID;
+ if ((KeyBuffer.CompareF(KTestTID)) == 0 ) return ETestTID;
+ if ((KeyBuffer.CompareF(KTestContentLocation)) == 0 ) return ETestContentLocation;
+ if ((KeyBuffer.CompareF(KTestPreviouslySentIndex)) == 0 ) return ETestPreviouslySentIndex;
+ if ((KeyBuffer.CompareF(KTestPreviouslySentBy)) == 0 ) return ETestPreviouslySentBy;
+ if ((KeyBuffer.CompareF(KTestPreviouslySentDate)) == 0 ) return ETestPreviouslySentDate;
+ if ((KeyBuffer.CompareF(KTestMessageId)) == 0 ) return ETestMessageId;
+ if ((KeyBuffer.CompareF(KTestMessageSize)) == 0 ) return ETestMessageSize;
+ if ((KeyBuffer.CompareF(KTestVersion)) == 0 ) return ETestVersion;
+ if ((KeyBuffer.CompareF(KTestReadStatus)) == 0 ) return ETestReadStatus;
+ if ((KeyBuffer.CompareF(KTestResponseStatus)) == 0 ) return ETestResponseStatus;
+ if ((KeyBuffer.CompareF(KTestResponseText)) == 0 ) return ETestResponseText;
+ if ((KeyBuffer.CompareF(KTestRetrieveStatus)) == 0 ) return ETestRetrieveStatus;
+ if ((KeyBuffer.CompareF(KTestRetrieveText)) == 0 ) return ETestRetrieveText;
+ if ((KeyBuffer.CompareF(KTestStatus)) == 0 ) return ETestStatus;
+ if ((KeyBuffer.CompareF(KTestAttribute)) == 0 ) return ETestAttribute;
+ if ((KeyBuffer.CompareF(KTestDistributionIndicator)) == 0 ) return ETestDistributionIndicator;
+ if ((KeyBuffer.CompareF(KTestLimit)) == 0 ) return ETestLimit;
+ if ((KeyBuffer.CompareF(KTestMessageQuota)) == 0 ) return ETestMessageQuota;
+ if ((KeyBuffer.CompareF(KTestSizeQuota)) == 0 ) return ETestSizeQuota;
+ if ((KeyBuffer.CompareF(KTestMessageTotal)) == 0 ) return ETestMessageTotal;
+ if ((KeyBuffer.CompareF(KTestSizeTotal)) == 0 ) return ETestSizeTotal;
+ if ((KeyBuffer.CompareF(KTestMessageCount)) == 0 ) return ETestMessageCount;
+ if ((KeyBuffer.CompareF(KTestAddKeyword)) == 0 ) return ETestAddKeyword;
+ if ((KeyBuffer.CompareF(KTestRemoveKeyword)) == 0 ) return ETestRemoveKeyword;
+ if ((KeyBuffer.CompareF(KTestFilterKeyword)) == 0 ) return ETestFilterKeyword;
+ if ((KeyBuffer.CompareF(KTestMMState)) == 0 ) return ETestMMState;
+ if ((KeyBuffer.CompareF(KTestQuota)) == 0 ) return ETestQuota;
+ if ((KeyBuffer.CompareF(KTestStart)) == 0 ) return ETestStart;
+ if ((KeyBuffer.CompareF(KTestStore)) == 0 ) return ETestStore;
+ if ((KeyBuffer.CompareF(KTestStored)) == 0 ) return ETestStored;
+ if ((KeyBuffer.CompareF(KTestStoreStatus)) == 0 ) return ETestStoreStatus;
+ if ((KeyBuffer.CompareF(KTestStoreStatusText)) == 0 ) return ETestStoreStatusText;
+ if ((KeyBuffer.CompareF(KTestTotals)) == 0 ) return ETestTotals;
+ if ((KeyBuffer.CompareF(KTestDeleteInfoIndex)) == 0 ) return ETestDeleteInfoIndex;
+ if ((KeyBuffer.CompareF(KTestApplicId)) == 0 ) return ETestApplicId;
+ if ((KeyBuffer.CompareF(KTestReplyApplicId)) == 0 ) return ETestReplyApplicId;
+ if ((KeyBuffer.CompareF(KTestApplicInfo)) == 0 ) return ETestApplicInfo;
+ if ((KeyBuffer.CompareF(KTestContentClass)) == 0 ) return ETestContentClass;
+ if ((KeyBuffer.CompareF(KTestDrmContent)) == 0 ) return ETestDrmContent;
+ if ((KeyBuffer.CompareF(KTestAdaptationAllowed)) == 0 ) return ETestAdaptationAllowed;
+ if ((KeyBuffer.CompareF(KTestRecommendedRetrievalMode)) == 0 ) return ETestRecommendedRetrievalMode;
+ if ((KeyBuffer.CompareF(KTestRecRetrievalModeText)) == 0 ) return ETestRecRetrievalModeText;
+ if ((KeyBuffer.CompareF(KTestReplaceId)) == 0 ) return ETestReplaceId;
+ if ((KeyBuffer.CompareF(KTestStatusText)) == 0 ) return ETestStatusText;
+ if ((KeyBuffer.CompareF(KTestCancelId)) == 0 ) return ETestCancelId;
+ if ((KeyBuffer.CompareF(KTestCancelStatus)) == 0 ) return ETestCancelStatus;
+ if ((KeyBuffer.CompareF(KTestAttContTypeParamName)) == 0 ) return ETestAttContTypeParamName;
+ if ((KeyBuffer.CompareF(KTestAttContTypeParamValue)) == 0 ) return ETestAttContTypeParamValue;
+ if ((KeyBuffer.CompareF(KTestAttXTypeParamName)) == 0 ) return ETestAttXTypeParamName;
+ if ((KeyBuffer.CompareF(KTestAttXTypeParamValue)) == 0 ) return ETestAttXTypeParamValue;
+ return ETestUnknown;
+ }
+
+// ---------------------------------------------------------
+// CMmsReadFile()::CreateMessageL
+// program build a message from given parts
+// ---------------------------------------------------------
+//
+void CMmsReadFile::CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders )
+ {
+
+ // Reset inactivity timer to keem viewServer from crashing
+ User::ResetInactivityTime();
+
+ TInt i;
+ TInt error = KErrNone;
+ RFile attaFile;
+ _LIT8(KLeftAngle, "<");
+ _LIT8(KRightAngle, ">");
+ // we can't use "seconds from" as it only returns a
+ // 32 bit signed integer. If fails in 2038.
+ // "microseconds from" returns a 64 bit signed integer
+
+ CMsvStore* store = aMmsClient->Entry().EditStoreL();
+ CleanupStack::PushL(store);
+ aMmsHeaders->StoreL(*store);
+ store->CommitL();
+ CleanupStack::PopAndDestroy( store );
+ store = NULL;
+
+ aMmsClient->LoadMessageL(); // read store is needed to do this
+
+ store = aMmsClient->Entry().EditStoreL();
+ CleanupStack::PushL(store);
+ CMsvAttachment* attaInfo = NULL;
+ TMsvAttachmentId attaId = 0;
+
+ for ( i=0; i < iAttaStructures->Count(); ++i)
+ {
+ attaId = KMsvNullIndexEntryId;
+ iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
+
+ error = attaFile.Open( iFs, iFilename, EFileShareReadersOnly | EFileRead );
+ User::LeaveIfError( error );
+
+ CleanupClosePushL(attaFile);
+
+ CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
+ CleanupStack::PushL( mimeHeaders );
+ TPtrC8 contentType = iAttaStructures->At(i)->iAttaType->Des();
+
+ TDataRecognitionResult result;
+ result.Reset(); // make sure that it is cleared
+
+ if(iAttaStructures->At(i)->iAttaCid->Length())
+ {
+ TPtr8 attaCID = iAttaStructures->At(i)->iAttaCid->Des();
+ if (attaCID.Find(KLeftAngle) == 0 &&
+ attaCID.Find(KRightAngle) == attaCID.Length()-1 )
+ {
+ // remove angle brackets from cid
+ attaCID = attaCID.Mid(1,attaCID.Length()-2);
+ }
+ mimeHeaders->SetContentIdL(attaCID);
+ }
+
+ if (iAttaStructures->At(i)->iAttaCharset)
+ {
+ mimeHeaders->SetMimeCharset(iAttaStructures->At(i)->iAttaCharset);
+ }
+
+ if (iAttaStructures->At(i)->iAttaName->Length())
+ {
+ iFilename.Copy(iAttaStructures->At(i)->iAttaName->Des());
+ }
+ iParse.Set( iFilename, NULL, NULL );
+ iFilename.Copy( iParse.NameAndExt() );
+
+ mimeHeaders->SetContentLocationL( iFilename );
+
+ // if Mime type has not been set, use RapaRecognizer
+ if ( iAttaStructures->At(i)->iAttaType->Length() == 0 && iFilename.Length() > 0)
+ {
+ // TO BE IMPLEMENTED
+
+ RApaLsSession lsSession;
+
+ if ( lsSession.Connect() == KErrNone )
+ {
+ CleanupClosePushL( lsSession );
+
+ iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
+ if ( lsSession.RecognizeData( iFilename, TPtrC8(), result ) == KErrNone )
+ {
+ // Check confidence level. Recognization must be at least
+ // "EProbable". We don't accept the result if it is "EPossible"
+ // or "EUnlikely" or "ENotRecognized"!
+
+ if ( result.iConfidence < CApaDataRecognizerType::EProbable )
+ {
+ result.Reset(); // clear buffer and try again with longer buffer
+ }
+
+ TPtrC8 mimeBuf8 = result.iDataType.Des8();
+
+ if ( mimeBuf8.Length() == 0 )
+ {
+ // Open file buffer and try again..
+
+ TInt bufSize = 0;
+ (void)lsSession.GetMaxDataBufSize( bufSize ); // ignore errors
+ if ( bufSize <= 0 )
+ {
+ bufSize = 30;
+ }
+ HBufC8* buf = HBufC8::NewLC( bufSize );
+ TPtr8 des = buf->Des();
+
+ RFile file;
+ TInt err=file.Open( iFs, iFilename, EFileShareReadersOnly );
+ if ( err == KErrNone )
+ {
+ err = file.Read( des );
+ file.Close();
+ if ( err == KErrNone )
+ {
+ if ( ( lsSession.RecognizeData( iFilename, des, result ) ) == KErrNone )
+ {
+ mimeBuf8.Set( result.iDataType.Des8() );
+ }
+ }
+
+ }
+ CleanupStack::PopAndDestroy(); // buf
+ }
+ if ( mimeBuf8.Length() > 0 &&
+ result.iConfidence >= CApaDataRecognizerType::EProbable )
+ {
+ contentType.Set( result.iDataType.Des8() );
+ }
+ }
+ CleanupStack::PopAndDestroy(1); // lssession
+ }
+ }
+
+ if ( contentType.Length() > 0 )
+ {
+ TInt position = contentType.Find( KMmsSlash8 );
+ if ( position >= 0 )
+ {
+ mimeHeaders->SetContentTypeL( contentType.Left( position ) );
+ }
+ if ( position < contentType.Length() - 1 )
+ {
+ mimeHeaders->SetContentSubTypeL( contentType.Mid( position + 1 ) );
+ }
+// CreateAttachment2L sets the content type to attaInfo
+// attaInfo->SetMimeTypeL( contentType );
+ }
+
+ if (iAttaStructures->At(i)->iAttaRecommendedName->Length())
+ {
+ iFilename.Copy(iAttaStructures->At(i)->iAttaRecommendedName->Des());
+ iParse.Set( iFilename, NULL, NULL );
+ iFilename.Copy( iParse.NameAndExt() );
+ mimeHeaders->SetSuggestedFilenameL( iFilename );
+ }
+
+ TInt j = 0;
+ for ( j = 0; j < iAttaStructures->At(i)->iContentTypeParams->MdcaCount(); ++j )
+ {
+ mimeHeaders->ContentTypeParams().AppendL( iAttaStructures->At(i)->iContentTypeParams->MdcaPoint( j ) );
+ }
+ for ( j = 0; j < iAttaStructures->At(i)->iXTypeParams->MdcaCount(); ++j )
+ {
+ mimeHeaders->XTypeParams().AppendL( iAttaStructures->At(i)->iXTypeParams->MdcaPoint( j ) );
+ }
+
+ attaInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
+ // attaInfo does not go onto cleaunpstack because ownership will
+ // be transferred to attachment manager.
+
+ aMmsClient->CreateAttachment2L(
+ *store,
+ attaFile,
+ contentType,
+ *mimeHeaders,
+ attaInfo,
+ attaId);
+ attaInfo = NULL; // ownership transferred
+
+ CleanupStack::PopAndDestroy(); // mimeHeaders
+ CleanupStack::PopAndDestroy(); // attaFile.Close()
+
+ if ( iAttaRoot > 0 && iAttaRoot == ( i + 1 ) )
+ {
+ aMmsClient->SetMessageRootL( attaId );
+ }
+ }
+
+ store->CommitL();
+ CleanupStack::PopAndDestroy(); // store
+
+ // This frees all memory and resets all values
+ Reset();
+ // Reset inactivity timer to keem viewServer from crashing
+ User::ResetInactivityTime();
+ }
+
+
+// ---------------------------------------------------------
+// CMmsReadFile()::FindAlias
+// program build a message from given parts
+// ---------------------------------------------------------
+//
+TInt CMmsReadFile::FindAlias( TPtrC aAlias )
+ {
+ TBuf<DefaultBufLen> abuf;
+ for( TInt i=0; i < iAliasCount; ++i )
+ {
+ abuf.Copy( iAliasArray->MdcaPoint(i) );
+ abuf.SetLength( abuf.Locate('=') );
+ if( ( abuf.CompareF( aAlias ) ) == 0 ) return( i );
+ }
+ return( -1 );
+ }
+
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+CMmsAttaStructure::CMmsAttaStructure()
+ {
+ iAtta = NULL;
+ iAttaType = NULL;
+ iAttaName = NULL;
+ iAttaCid = NULL;
+ iAttaRecommendedName = NULL;
+ }
+
+
+//
+void CMmsAttaStructure::ConstructL()
+ {
+ iAtta = HBufC8::NewL(DefaultBufLen);
+ iAttaType = HBufC8::NewL(DefaultBufLen);
+ iAttaName = HBufC8::NewL(DefaultBufLen);
+ iAttaCid = HBufC8::NewL(DefaultBufLen);
+ iAttaRecommendedName = HBufC::NewL(DefaultBufLen);
+ iAttaCharset = 0;
+ iXTypeParams = new(ELeave) CDesC8ArrayFlat(4);
+ iContentTypeParams = new(ELeave) CDesC8ArrayFlat(4);
+
+ }
+
+// Two-phased constructor.
+CMmsAttaStructure* CMmsAttaStructure::NewL()
+ {
+ CMmsAttaStructure* self = new ( ELeave ) CMmsAttaStructure;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// Destructor
+CMmsAttaStructure::~CMmsAttaStructure()
+ {
+ delete iAtta;
+ delete iAttaName;
+ delete iAttaType;
+ delete iAttaCid;
+ delete iAttaRecommendedName;
+ if ( iContentTypeParams )
+ {
+ iContentTypeParams->Reset();
+ }
+ delete iContentTypeParams;
+ if ( iXTypeParams )
+ {
+ iXTypeParams->Reset();
+ }
+ delete iXTypeParams;
+ }
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/mmstestbed/src/mmstestbed.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,2357 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#include <mtmdef.h>
+#include <CoreApplicationUIsSDKCRKeys.h>
+#include <mmsheaders.h>
+#include <mmscmds.h>
+#include <mmsencode.h>
+#include <mmscliententry.h>
+#include <logwrap.h>
+#include <logcli.h>
+#include <logview.h>
+#include "mmssettings.h" //use mmssettings.h instead of cmmssettings.h
+#include "mmstestbed.h"
+#include "mmsreadfile.h"
+#include "mmstestuitimer.h"
+#include "mmsteststaticutils.h"
+#include "mmstestbed.hrh"
+
+//constants
+_LIT( KMmsSender, "0601234567" );
+
+MmsTestBed::MmsTestBed()
+ {
+ //start the timer
+ iTimer = CTestUiTimer::NewL();
+ iTimer->Cancel();
+
+ iWait = CMsvOperationActiveSchedulerWait::NewLC();
+ // don't leave iWait on cleanup stack
+ CleanupStack::Pop();
+
+ //open msvsession
+ iSession = CMsvSession::OpenSyncL(*this);
+ //create client registry
+ iClientMtmRegistry = CClientMtmRegistry::NewL(*iSession);
+ //create client mtm
+ iMmsClient = (CMmsClientMtm *) iClientMtmRegistry->NewMtmL(
+ KUidMsgTypeMultimedia);
+
+ User::LeaveIfError( iFs.Connect() );
+ iFs.SetSessionPath( KRootPath );
+ iSettings = CMmsSettings::NewL();
+ iMmsHeaders = CMmsHeaders::NewL(iSettings->MmsVersion());
+ findDefaultL();
+ iServiceId = iDefaultServiceId;
+
+ //validate the settings
+ iSettings->ValidateSettings();
+
+ iLogEvent = CLogEvent::NewL();
+ iLogEvent->SetEventType(KLogMmsEventTypeUid);
+ iLogClient = NULL; // we test soon if this is available
+ iLogView = NULL; // needs log client
+ if ( checkLogClient() )
+ {
+ // first we generate a general view of all events
+ // we'll set the filter when we update the view
+ iLogView = CLogViewEvent::NewL( *iLogClient );
+ }
+ iLogFilter = CLogFilter::NewL();
+ // we try to filter MMS events
+ iLogFilter->SetEventType(KLogMmsEventTypeUid);
+ }
+
+MmsTestBed::~MmsTestBed()
+ {
+ delete iLogView;
+ delete iLogFilter;
+ delete iLogClient;
+ delete iLogEvent;
+ delete iSettings;
+ delete iMmsHeaders;
+ if(iTimer)
+ {
+ iTimer->Cancel();
+ delete iTimer;
+ }
+ //delete iMsvEntrySelection;
+ delete iMmsClient;
+ delete iClientMtmRegistry;
+ //delete iClientMtmRegistry;
+ delete iSession;
+ delete iWait;
+ }
+
+void MmsTestBed::setConnectionLocal(bool value)
+ {
+ //value = true for global off, local on
+ //value = false for global on, local off
+ iSettings->LoadSettingsL();
+ iSettings->SetLocalMode( value );
+ iSettings->SaveSettingsL();
+ }
+
+void MmsTestBed::fromOutboxToMmsc()
+ {
+ CMsvEntry* cEntry = NULL;
+
+ // Get List of services
+ cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages of outbox
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL(
+ KUidMsgTypeMultimedia);
+ CleanupStack::PushL(selection);
+
+ // Change state to "KMsvSendStateUnknown" in case the entry has been suspended earlier
+ for (TInt i = 0; i < selection->Count(); ++i)
+ {
+ cEntry->SetEntryL(selection->At(i));
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetReadOnly(EFalse);
+ entry.SetSendingState(KMsvSendStateUnknown);
+ cEntry->ChangeL(entry);
+ }
+
+ selection->InsertL(0, iServiceId);
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack(parameters);
+
+ op = iSession->TransferCommandL(*selection, EMmsSend, paramPack,
+ iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending)
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if (iWait->iStatus.Int() != KErrNone)
+ {
+ //DEBUG(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ CleanupStack::PopAndDestroy(); //cEntry
+ }
+
+void MmsTestBed::fromMmscToInbox()
+ {
+ CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
+ CleanupStack::PushL(msvEntrySelection);
+
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ msvEntrySelection->InsertL(0, iServiceId);
+ }
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack(parameters);
+
+ op = iMmsClient->InvokeAsyncFunctionL(EMmsReceive, *msvEntrySelection,
+ paramPack, iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending)
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if (iWait->iStatus.Int() != KErrNone)
+ {
+ //DEBUG(_L("Testbed tried to receive, return status %d"),iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); //msvEntrySelection
+ }
+
+void MmsTestBed::findDefaultL()
+ {
+ iSettings->LoadSettingsL();
+ iDefaultServiceId = iSettings->Service();
+ }
+
+void MmsTestBed::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
+ TAny* aArg2, TAny* /*aArg3*/)
+ {
+ iEvent = aEvent;
+ if (aEvent == EMsvGeneralError)
+ {
+ return;
+ }
+ TMsvId parentId = KMsvNullIndexEntryId;
+ if (aArg2 != NULL)
+ {
+ parentId = *(TMsvId*) aArg2;
+ }
+
+ CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
+ TMsvEntry tEntry;
+ TMsvId service;
+ TInt error = KErrNone;
+ error = iSession->GetEntry(selection->At(0), service, tEntry);
+
+ CMsvEntry* cEntry = NULL;
+ switch (aEvent)
+ {
+ case EMsvEntriesCreated:
+ {
+ if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
+ {
+ // emit signal for new entry into INBOX
+ emit entryCreatedInInbox(tEntry.Id());
+ }
+ else if (parentId == KMsvDraftEntryIdValue)
+ {
+ // emit signal for new entry into Draft
+ emit entryCreatedInDraft(tEntry.Id());
+ }
+ else if (parentId == iServiceId)
+ {
+ // emit signal for new Entry into SERVICE
+ }
+ else
+ {
+ // do nothing
+ }
+ }
+ break;
+ case EMsvEntriesChanged:
+ {
+ TMsvId id;
+ CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
+ if (selection == NULL)
+ {
+ // no selection, cannot handle
+ return;
+ }
+ id = selection->At(0);
+ //DEBUG Entry changed"));
+ if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
+ {
+/*
+ cEntry = iSession->GetEntryL( parentId );
+ CleanupStack::PushL( cEntry );
+ TRAPD (error, cEntry->SetEntryL( id ));
+ if ( error != KErrNone )
+ {
+ CleanupStack::PopAndDestroy(); // cEntry
+ return;
+ }
+ TMsvEntry tEntry = cEntry->Entry();
+ if ( tEntry.Visible() )
+ {
+ // generate fake delivery report
+ CMsvStore* store = cEntry->ReadStoreL();
+ CleanupStack::PushL( store );
+ CMmsHeaders* mmsHeaders = CMmsHeaders::NewL( iSettings->MmsVersion() );
+ CleanupStack::PushL( mmsHeaders );
+ mmsHeaders->RestoreL( *store );
+ iEncodeBuffer->ResizeL( 0 );
+ generateDeliveryReport( mmsHeaders );
+ CleanupStack::PopAndDestroy( 2 ); // mmsHeaders, store
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+*/
+ }
+ }
+ break;
+ case EMsvEntriesDeleted:
+ {
+ //emit signal for entry deleted
+ }
+ break;
+ case EMsvEntriesMoved:
+ {
+ if (parentId == KMsvGlobalOutBoxIndexEntryIdValue)
+ {
+ // entry moved to outbox
+ emit entryMovedToOutbox(tEntry.Id());
+ }
+ else if (parentId == KMsvSentEntryIdValue)
+ {
+ // entry moved to sent folder
+ emit entryMovedToSent(tEntry.Id());
+ }
+ else
+ {
+ // do nothing
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+void MmsTestBed::createMmsService()
+ {
+ CMmsSettings * settings = CMmsSettings::NewL();
+ CleanupStack::PushL( settings );
+ settings->CreateNewServiceL( *iSession );
+ CleanupStack::PopAndDestroy(); // settings
+ return;
+ }
+
+void MmsTestBed::cleanup()
+ {
+ TMsvId entryToBeKilled;
+ // Get access to root index
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+
+ entryToBeKilled = iSettings->Service();
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ while (entryToBeKilled != KMsvNullIndexEntryId)
+ {
+ // delete child of root entry
+ deleteEntry(entryToBeKilled, *cEntry);
+ entryToBeKilled = iSettings->Service();
+ }
+
+ CleanupStack::PopAndDestroy(); // cEntry
+ // We deleted everything!
+ iDefaultServiceId = KMsvNullIndexEntryId;
+ iServiceId = KMsvNullIndexEntryId;
+ }
+
+void MmsTestBed::deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry)
+ {
+ aClientEntry.DeleteL(aEntryId);
+ }
+
+void MmsTestBed::cleanupAndCreateNewService()
+ {
+ cleanup();
+ // all old service entries have been destroyed, create a new one
+ createMmsService();
+ }
+
+void MmsTestBed::testFile(TFileName& aFilePath, TInt aCommand /* = 0 */, TMsvId aBox /* = KMsvGlobalOutBoxIndexEntryId */ )
+ {
+ // update settings in mmsclient
+ iMmsClient->RestoreSettingsL();
+ iSettings->CopyL( iMmsClient->MmsSettings() );
+
+ RFileReadStream readStream;
+ readStream.PushL();
+// TMsvId id = KMsvNullIndexEntryId;
+ CBufFlat* encodeBuffer = NULL;
+ CMmsEncode* encoder = NULL;
+
+ // Open the file
+ TInt err = readStream.Open(iFs, aFilePath, EFileShareReadersOnly );
+ if (err != KErrNone) User::Leave( err );
+
+ TInt retCode = 0;
+ CMmsReadFile* readFile = NULL;
+ readFile = CMmsReadFile::NewL( iFs, readStream );
+ CleanupStack::PushL( readFile );
+
+ TInt messageCounter = 0;
+ CMsvEntry* cEntry = NULL;
+
+ while(!retCode)
+ {
+ // READ MESSAGE TO BUFFERS
+ iMmsHeaders->Reset(iSettings);
+ // put in some message type just for fun (testing...)
+ iMmsHeaders->SetMessageType( KMmsMessageTypeForwardReq );
+ retCode = readFile->CompleteTestL( messageCounter++, *iMmsHeaders );
+ if(readFile->iMessageType == ETestNewMessage)
+ {
+ // CREATE MESSAGE ENTRY
+ switch ( aCommand )
+ {
+ case ECreateToInbox:
+ case ECreateNotification:
+ cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+ break;
+ case ECreateToSentItems:
+ cEntry = iSession->GetEntryL(KMsvSentEntryId);
+ break;
+ case ECreateToDrafts:
+ cEntry = iSession->GetEntryL(KMsvDraftEntryId);
+ break;
+ case ECreateHeadersFromFile:
+ // here we just encode headers, no message entry
+ // the entry is fake.
+ break;
+ case ECreateMMBoxViewConf:
+ if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ // entry is not created for the description items
+ // they become attachments
+ cEntry = iSession->GetEntryL(KMsvDraftEntryId);
+ }
+ break;
+ default:
+ cEntry = iSession->GetEntryL(aBox);
+ break;
+ }
+
+ // if we are just playing with headers we have no entry
+ if ( aCommand != ECreateHeadersFromFile && aCommand != ECreateMMBoxViewConf )
+ {
+ CleanupStack::PushL(cEntry);
+ iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
+
+ // CREATE MESSAGE
+ iMmsClient->CreateMessageL(iServiceId);
+ }
+ else if ( aCommand == ECreateMMBoxViewConf )
+ {
+ if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ CleanupStack::PushL(cEntry);
+ iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
+
+ // CREATE MESSAGE
+ iMmsClient->CreateMessageL(iServiceId);
+ }
+ else
+ {
+ encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
+ CleanupStack::PushL( encodeBuffer );
+ encoder = CMmsEncode::NewL( iFs );
+ CleanupStack::PushL( encoder );
+
+ // encode headers to a binary file
+ encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
+
+ iFilename = KMmsMMBoxDescriptionDirectory;
+ TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
+
+ CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
+ encodeBuffer = NULL;
+ encoder = NULL;
+ }
+ }
+ else
+ {
+ encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
+ CleanupStack::PushL( encodeBuffer );
+ encoder = CMmsEncode::NewL( iFs );
+ CleanupStack::PushL( encoder );
+
+ // encode headers to a binary file
+ encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
+
+ iFilename = KMmsDumpDirectory;
+ TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
+
+ CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
+ encodeBuffer = NULL;
+ encoder = NULL;
+ }
+ }
+
+ if ( aCommand != ECreateHeadersFromFile &&
+ ( aCommand != ECreateMMBoxViewConf || iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf ) )
+ {
+ if(readFile->iMessageType == ETestSettings)
+ {
+ TMsvId ServiceId = iMmsClient->DefaultServiceL();
+ iMmsClient->RestoreSettingsL();
+ iSettings->CopyL( iMmsClient->MmsSettings() );
+ }
+
+ TMemoryInfoV1Buf memory;
+ UserHal::MemoryInfo( memory );
+ TInt available = memory().iFreeRamInBytes;
+// TMmsLogger::Log(_L("Free memory before CreateMessageL %d"), available );
+
+ TRAP (err, readFile->CreateMessageL(iMmsClient, iMmsHeaders));
+
+ available = memory().iFreeRamInBytes;
+// TMmsLogger::Log(_L("Free memory after CreateMessageL %d"), available );
+
+ if(readFile->iMessageType == ETestNewMessage)
+ {
+ TMsvEntry tEntry = iMmsClient->Entry().Entry();
+ TMsvId id = tEntry.Id();
+ if ( err == KErrNone )
+ {
+ // SAVE MESSAGE
+ iMmsClient->SaveMessageL();
+
+ // If we are creating a MMBox View confirmation,
+ // we add all binary files from KMmsMMBoxDirectory
+ // as attachments.
+
+ if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ addMMBoxDescriptions();
+ }
+
+ // reload the entry in case mms client put something into it
+ // MESSAGE MUST BE SET VISIBLE
+ tEntry = iMmsClient->Entry().Entry();
+ if ( iMmsClient->MessageClass() == EMmsClassAdvertisement )
+ {
+ tEntry.iMtmData1 |= KMmsMessageAdvertisement;
+ }
+ else if ( iMmsClient->MessageClass() == EMmsClassInformational )
+ {
+ tEntry.iMtmData1 |= KMmsMessageInformational;
+ }
+ tEntry.iMtmData1 &= ~KMmsMessageMobileTerminated;
+
+ // Test: Set all as editor oriented - except notifications!
+ if ( aCommand == ECreateNotification )
+ {
+ tEntry.iMtm = KUidMsgMMSNotification;
+ }
+ else
+ {
+ tEntry.iMtmData1 |= KMmsMessageEditorOriented;
+ }
+ if ( aCommand == ECreateToInbox )
+ {
+ tEntry.iMtmData1 |= KMmsMessageMobileTerminated;
+ tEntry.SetReadOnly( ETrue );
+ tEntry.SetNew( ETrue );
+ tEntry.SetUnread( ETrue );
+ }
+ else if ( aCommand == ECreateToSentItems )
+ {
+ tEntry.SetReadOnly( ETrue );
+ }
+ tEntry.SetVisible( ETrue );
+ tEntry.SetInPreparation( EFalse );
+ TTime now;
+ now.UniversalTime();
+ tEntry.iDate = now;
+ TMsvId entryId = tEntry.Id();
+ iMmsClient->Entry().ChangeL( tEntry );
+ if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+ {
+ // Encode to the directory that is used to fetch MMBox view
+ iFilename.Copy( KMmsMMBoxDirectory );
+ encodeMessageFromDrafts();
+ cEntry->SetEntryL( KMsvDraftEntryId );
+ cEntry->DeleteL( entryId );
+ }
+ }
+ else
+ {
+ //TMmsLogger::Log(_L("CreateMessageL left with error %d"), err );
+ iSession->RemoveEntry(id);
+ err = KErrNone; // clear error
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+ cEntry = NULL;
+ }
+ if(readFile->iMessageType == ETestSettings)
+ {
+ iMmsClient->SetSettingsL( *iSettings );
+ iMmsClient->StoreSettingsL();
+ }
+ }
+ }
+
+ CleanupStack::PopAndDestroy(); //readFile
+
+ readStream.Close();
+ readStream.Pop();
+
+ /*
+ iMmsClient->SwitchCurrentEntryL(id);
+ */
+ }
+
+void MmsTestBed::addMMBoxDescriptions()
+ {
+ // add the contents of KMmsMMBoxDescriptionDirectory as attachments
+ CDir* fileList = NULL;
+ TInt i = 0; // general counter
+ TInt error = KErrNone;
+ iCurrentPath = KMmsMMBoxDescriptionDirectory;
+
+ iFs.SetSessionPath(iCurrentPath);
+
+ TFindFile finder( iFs );
+ error = finder.FindWildByPath( KWild, NULL, fileList );
+ CleanupStack::PushL( fileList );
+ TInt fileCounter = 0;
+
+ if ( error == KErrNone )
+ {
+ fileCounter = fileList->Count();
+ }
+
+ TEntry entry;
+
+ if ( error == KErrNone )
+ {
+ for ( i = 0; i < fileCounter; ++i )
+ {
+ // Reset inactivity timer to keep viewServer from crashing
+ User::ResetInactivityTime();
+ entry = (*fileList)[i]; // name is entry.iName
+ iFilename.Copy( iCurrentPath );
+ iFilename.Append( entry.iName );
+ TPtrC ptr;
+ ptr.Set( iFilename );
+ iWait->iStatus = KErrNone;
+ iMmsClient->AddAttachmentL( ptr, KMmsMimeType, 0, iWait->iStatus );
+
+ iWait->Start();
+ // The descriptions are cleared after being used
+ iFs.Delete( ptr);
+ }
+ }
+
+ iMmsClient->SaveMessageL(); // just in case somthing must be updated
+ CleanupStack::PopAndDestroy(); // fileList
+ fileList = NULL;
+ }
+
+void MmsTestBed::encodeMessageFromDrafts()
+ {
+ CMmsEncode* encoder = CMmsEncode::NewL( iFs );
+ CleanupStack::PushL( encoder );
+ // encode a message iMmsClientPoints to
+ iMmsClient->LoadMessageL();
+ CMsvStore* store = iMmsClient->Entry().ReadStoreL();
+ CleanupStack::PushL( store );
+ iMmsHeaders->RestoreL( *store );
+ CleanupStack::PopAndDestroy(); // store
+ store = NULL;
+ iWait->iStatus = KErrNone;
+
+// caller sets the directory
+// iFilename = KMmsMessageDumpDirectory;
+
+ CMmsClientEntry* entryWrapper = CMmsClientEntry::NewL( iFs, iMmsClient->Entry(), iServiceId );
+ CleanupStack::PushL( entryWrapper );
+ iEncodeBuffer->ResizeL(0);
+ encoder->StartL( *entryWrapper, *iMmsHeaders, *iEncodeBuffer, iWait->iStatus );
+ iWait->Start();
+ if ( iWait->iStatus == KErrNone )
+ {
+ TMmsTestUtils::Dump( *iEncodeBuffer, iFilename, iParse, iFs );
+ }
+ iEncodeBuffer->ResizeL(0);
+ CleanupStack::PopAndDestroy(); // entryWrapper
+ CleanupStack::PopAndDestroy(); // encoder
+ }
+
+void MmsTestBed::deleteNotifications()
+ {
+ TMsvId mmsFolderId = KMsvNullIndexEntryId;
+ mmsFolderId = findMMSFolder();
+
+ CMsvEntry* cEntry = NULL;
+ // delete all messages from the specified box
+ cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+
+ if ( mmsFolderId != KMsvNullIndexEntryId )
+ {
+ cEntry->SetEntryL(mmsFolderId);
+
+ // show invisible entries
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PushL(msvEntrySelection);
+
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ if (msvEntrySelection->Count() > 0)
+ {
+ CMsvOperation* op = iSession->TransferCommandL(
+ *msvEntrySelection,
+ EMmsDeleteEntries,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ CleanupStack::PopAndDestroy(); // op
+ }
+
+ // These cannot be deleted unless we have the a server mtm
+ // corresponding to this mtm type.
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ CleanupStack::PopAndDestroy(); //msvEntrySelection
+ msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgMMSNotification );
+ CleanupStack::PushL(msvEntrySelection);
+
+ if (msvEntrySelection->Count() > 0)
+ {
+ CMsvOperation* op = iSession->TransferCommandL(
+ *msvEntrySelection,
+ EMmsDeleteEntries,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ CleanupStack::PopAndDestroy(); // op
+ }
+
+ CleanupStack::PopAndDestroy(); //msvEntrySelection
+
+ CleanupStack::PopAndDestroy(); //cEntry
+ }
+ }
+
+TMsvId MmsTestBed::findMMSFolder()
+ {
+ return iSettings->NotificationFolder();
+ }
+
+void MmsTestBed::restoreFactorySettings()
+ {
+ iMmsClient->RestoreSettingsL();
+ iSettings->CopyL( iMmsClient->MmsSettings() );
+ // do not reset access point
+ TInt accessPoint = iSettings->AccessPoint( 0 );
+ iSettings->RestoreFactorySettingsL( iMmsClient->Session(), EMmsFactorySettingsLevelDeep );
+ TInt count = iSettings->AccessPointCount();
+ TInt i = 0;
+ for ( i = count - 1; i >= 0; --i )
+ {
+ iSettings->DeleteAccessPointL( i );
+ }
+ // restore the original access point
+ if ( accessPoint > 0 )
+ {
+ // a negative access point is an error (most likely "KErrNotFound")
+ iSettings->AddAccessPointL( accessPoint, 0 );
+ }
+ iMmsClient->SetSettingsL( *iSettings );
+ iMmsClient->StoreSettingsL();
+ }
+
+void MmsTestBed::setFetchingState( TMmsReceivingMode aState )
+ {
+ iMmsClient->RestoreSettingsL();
+ iSettings->CopyL( iMmsClient->MmsSettings() );
+
+ iSettings->SetReceivingModeHome( aState );
+
+ iMmsClient->SetSettingsL( *iSettings );
+ iMmsClient->StoreSettingsL();
+ }
+
+void MmsTestBed::sendFromFile()
+ {
+ CMsvOperation * op = NULL;
+
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
+ CleanupStack::PushL( cEntry );
+
+ CMsvEntrySelection* selection = NULL;
+ selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PopAndDestroy(); // cEntry
+ CleanupStack::PushL( selection );
+
+ TRAPD (error, op = iMmsClient->SendL(*selection, iWait->iStatus));
+ if ( error != KErrNone )
+ {
+ CleanupStack::PopAndDestroy(); // selection
+ delete op;
+ return;
+ }
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(2); // op, selection
+ }
+
+void MmsTestBed::sendOneByOne()
+ {
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
+ CleanupStack::PushL( cEntry );
+
+ CMsvEntrySelection* selection = NULL;
+ selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PushL( selection );
+
+ CMsvEntrySelection* shortSelection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( shortSelection );
+
+ TInt i;
+
+ for ( i = 0; i < selection->Count(); ++i )
+ {
+ shortSelection->Reset();
+ shortSelection->AppendL( selection->At( i ) );
+
+ CMsvOperation * op = NULL;
+
+ TTime now;
+ now.UniversalTime();
+
+ TRAPD (error, op = iMmsClient->SendL(*shortSelection, iWait->iStatus, now ));
+ if ( error != KErrNone )
+ {
+ delete op;
+ CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
+ return;
+ }
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+
+ }
+ CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
+ }
+
+void MmsTestBed::sendNotifications()
+ {
+ // Only send one notification!!
+
+ TInt error = KErrNone;
+
+ if (! TMmsTestUtils::IsFile(iCurrentFile, iFs) )
+ {
+ //Not a file
+ return;
+ }
+ TMsvId mmsFolder = findMMSFolder();
+
+ TEntry entry;
+
+
+ // now I think we have a filename
+ TEntry orgEntry;
+ TUint size = 0;
+ error = iFs.Entry( iCurrentFile, orgEntry );
+ size = orgEntry.iSize;
+
+ //TMmsLogger::Log(_L("- notification %S "), &iCurrentFile);
+ if ( size == 0 )
+ {
+ //empty file
+ //TMmsLogger::Log(_L("- empty file"));
+ return;
+ }
+
+ if ( iEncodeBuffer == NULL )
+ {
+ iEncodeBuffer = CBufFlat::NewL( size );
+ }
+ else
+ {
+ iEncodeBuffer->ResizeL( 0 );
+ iEncodeBuffer->ResizeL( size );
+ }
+
+ RFile inFile;
+ error = inFile.Open( iFs, iCurrentFile, EFileShareReadersOnly );
+ TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
+ if ( error == KErrNone )
+ {
+ error = inFile.Read( ptr, size );
+ inFile.Close();
+ }
+ else
+ {
+ //Error
+ //TMmsLogger::Log(_L("- can't read file"));
+ return;
+ }
+
+ TUint8 byte;
+ TUint position = 0;
+ TUint32 uintvar = 0;
+
+ if ( size > 2 )
+ {
+ iEncodeBuffer->Read( 1, &byte, 1 );
+ if ( byte == 6 ) // PUSH PDU
+ {
+ // try to find out length of header
+ position = 2;
+ iEncodeBuffer->Read( position, &byte, 1);
+
+ while ( byte & 0x80 && position < size )
+ {
+ uintvar += ( byte & 0x7f );
+ uintvar <<= 7;
+ position++;
+ iEncodeBuffer->Read( position, &byte, 1 );
+ }
+
+ // add last byte without shift
+ uintvar += byte;
+ position++;
+ }
+ }
+
+ position += uintvar;
+
+ if ( position < size )
+ {
+ ptr = iEncodeBuffer->Ptr( position );
+ size = ptr.Length();
+ }
+
+ if ( size == 0 )
+ {
+ //no MMS stuff
+ //TMmsLogger::Log(_L("- no MMS stuff"));
+ return;
+ }
+
+ TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
+
+ // Now we have streamed our data into this entry.
+ // Now we have an entry that says: local service, MMS MTM
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ if ( entryId != KMsvNullIndexEntryId )
+ {
+ selection->AppendL( entryId );
+ }
+ else
+ {
+ selection->AppendL( iDefaultServiceId );
+ }
+
+ TWatcherParameters parameters; // initialized to zero
+ parameters.iWatcherId = RThread().Id();
+ parameters.iDataPointer = &ptr;
+ TWatcherParametersBuf paramPack( parameters );
+
+ CMsvOperation * op = NULL;
+
+ op = iSession->TransferCommandL(
+ *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ User::After(1000000);
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::copyDrafts()
+ {
+ CMsvEntry* cEntry = NULL;
+// Copies contents of sent folder to drafts for retrying sending.
+
+ cEntry = iSession->GetEntryL(KMsvSentEntryId);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages in drafts
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+
+ TMsvLocalOperationProgress progress;
+ cEntry->CopyL( *selection, KMsvDraftEntryId, progress );
+
+ TInt i = 0;
+ for ( i = 0; i < selection->Count(); ++i )
+ {
+ cEntry->SetEntryL( selection->At( i ) );
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetReadOnly( EFalse );
+ cEntry->ChangeL( entry );
+ }
+
+ CleanupStack::PopAndDestroy(2); // selection, cEntry
+ }
+
+void MmsTestBed::garbageCollection(TUint32 aReason)
+ {
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+
+ TMMSGarbageCollectionParameters parameters; // initialized to zero
+ parameters.iReasonFlags = aReason;
+ TMMSGarbageCollectionParametersBuf paramPack( parameters );
+ op = iSession->TransferCommandL(
+ *selection, EMmsGarbageCollection, paramPack, iWait->iStatus );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::messageVariation()
+ {
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+
+ op = iSession->TransferCommandL(
+ *selection, EMmsMessageGeneration, TPtrC8(), iWait->iStatus );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::cancelSendScheduling()
+ {
+ CMsvEntry* cEntry = NULL;
+ setFetchingState( EMmsReceivingPostpone );
+ testFile( iCurrentFile );
+ scheduledSend(KMsvGlobalOutBoxIndexEntryIdValue, 10000); // long delay so that we have time to cancel
+ deleteSendSchedule();
+
+ cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ cEntry->SetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+ if (iMsvEntrySelection != NULL)
+ {
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ }
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PopAndDestroy();
+ }
+
+void MmsTestBed::scheduledSend(TMsvId aBoxId, TInt aDelay /* = 5 */)
+ {
+ CMsvEntry* cEntry = NULL;
+ TCommandParameters parameters;
+ parameters.iInitialDelay = aDelay;
+ TCommandParametersBuf paramPack( parameters );
+
+ cEntry = iSession->GetEntryL(aBoxId);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages of outbox
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+// selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsScheduledSend,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(2); // cEntry, selection
+ }
+
+void MmsTestBed::deleteSendSchedule()
+ {
+ CMsvEntry* cEntry = NULL;
+
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages of outbox
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsDeleteSchedule,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(2); // cEntry, selection
+ }
+
+void MmsTestBed::cancelFetchScheduling()
+ {
+ TMsvId mmsFolder = findMMSFolder();
+ CMsvEntry* cEntry = NULL;
+ setFetchingState( EMmsReceivingPostpone );
+ testFile( iCurrentFile );
+ fromOutboxToMmsc(); // immediate send (EMmsSend)
+
+ // Wait until notification has arrived - may take a while in global mode
+ TInt i = 0;
+ while ( TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) == 0
+ && i < 2000 )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ i++;
+ if ( (i/100) * 100 == i )
+ {
+ //TMmsLogger::Log(_L("%d:th wait cycle"), i );
+ }
+ CActiveScheduler::Start();
+ }
+ iTimer->Cancel();
+
+ fetchForced( 10000 ); // delay to allow cancelling
+ deleteFetchSchedule();
+
+ cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ cEntry->SetEntryL(mmsFolder);
+ if (iMsvEntrySelection != NULL)
+ {
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ }
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PopAndDestroy(); // cEntry
+ }
+
+void MmsTestBed::fetchForced(TInt aDelay /* = 5 */)
+ {
+ TCommandParameters parameters;
+ parameters.iInitialDelay = aDelay;
+ TCommandParametersBuf paramPack( parameters );
+
+ CMsvEntrySelection* selection = new CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ selection->InsertL(0, iServiceId);
+ }
+ else
+ {
+ selection->InsertL(0, iDefaultServiceId);
+ }
+
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsScheduledReceiveForced,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::deleteFetchSchedule()
+ {
+ CMsvEntry* cEntry = NULL;
+
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ TMsvId mmsFolderId = KMsvNullIndexEntryId;
+ mmsFolderId = findMMSFolder();
+ cEntry = iSession->GetEntryL( mmsFolderId );
+ CleanupStack::PushL(cEntry);
+ // Get all notifications
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, iDefaultServiceId);
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsDeleteSchedule,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(2); // cEntry, selection
+ }
+
+void MmsTestBed::doAFetchCycle()
+ {
+ // Sends a message from iCurrentFile and lets it come back
+ TMsvId mmsFolder = findMMSFolder();
+ testFile( iCurrentFile );
+ fromOutboxToMmsc(); // immediate send (EMmsSend)
+ // fetching will start automatically
+
+ TInt i = 0;
+ while ( TMmsTestUtils::CountChildrenL( KMsvGlobalInBoxIndexEntryId, iMsvEntrySelection, *iSession ) == 0
+ && i < 2000
+ && TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) > 0 )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ i++;
+ if ( (i/100) * 100 == i )
+ {
+ //TMmsLogger::Log(_L("%d:th wait cycle"), i );
+ }
+ CActiveScheduler::Start();
+ }
+ iTimer->Cancel();
+ }
+
+bool MmsTestBed::checkLogClient()
+ {
+ if ( iLogClient == NULL )
+ {
+ TRAP_IGNORE( iLogClient = CLogClient::NewL( iFs ) );
+ }
+ return ( iLogClient != NULL );
+ }
+
+int MmsTestBed::getLogEntries()
+ {
+ TInt count = 0;
+ if ( !iLogView )
+ {
+ return 0;
+ }
+
+ if ( iLogView->SetFilterL( *iLogFilter, iWait->iStatus ) )
+ {
+ // should complete with KErrNone
+ iWait->Start();
+ if ( iWait->iStatus.Int() == KErrNone )
+ {
+ count = iLogView->CountL();
+ }
+ }
+ return count;
+ }
+
+void MmsTestBed::createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry)
+ {
+ CMsvOperation* opert = aClientEntry.CreateL(aNewEntry, iWait->iStatus);
+ iWait->Start();
+ if (!opert->iStatus.Int()==KErrNone)
+ {
+ // what should we do? panic?
+ }
+
+ TPckgBuf<TMsvLocalOperationProgress> package;
+ package.Copy(opert->ProgressL());
+ *(TMsvId*)&aNewEntry = package().iId;
+
+ delete opert; opert=NULL;
+ }
+
+void MmsTestBed::cleanOutbox()
+ {
+ TMmsTestUtils::CleanBoxL(KMsvGlobalOutBoxIndexEntryId, *iSession);
+ }
+
+void MmsTestBed::cleanInbox()
+ {
+ TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
+ }
+
+void MmsTestBed::cleanSent()
+ {
+ TMmsTestUtils::CleanBoxL(KMsvSentEntryId, *iSession);
+ }
+
+void MmsTestBed::cleanDrafts()
+ {
+ TMmsTestUtils::CleanBoxL(KMsvDraftEntryId, *iSession);
+ }
+
+void MmsTestBed::cleanAll()
+ {
+ cleanInbox();
+ cleanOutbox();
+ cleanSent();
+ cleanDrafts();
+ TMmsTestUtils::CleanBoxL( iSettings->MMBoxFolder(), *iSession );
+ deleteNotifications();
+ }
+
+void MmsTestBed::reply()
+ {
+ // The first message from inbox is replied to
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ if ( iMsvEntrySelection->Count() > 0 )
+ {
+ TMsvId originalEntry = iMsvEntrySelection->At(0);
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription;
+ CMsvOperation * op = NULL;
+ op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Create reply, return status %d"), iWait->iStatus.Int());
+ }
+ else
+ {
+ TMsvId newEntry = KMsvNullIndexEntryId;
+ TPckgBuf<TMsvId> package;
+ package.Copy(op->ProgressL());
+ newEntry = package();
+ if ( newEntry != KMsvNullIndexEntryId )
+ {
+ cEntry->SetEntryL( newEntry );
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetInPreparation( EFalse );
+ entry.SetVisible( ETrue );
+ cEntry->ChangeL(entry);
+ }
+ }
+ CleanupStack::PopAndDestroy(); // op
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+ }
+
+void MmsTestBed::replyToAll()
+ {
+ // The first message from inbox is replied to
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+
+ if ( iMsvEntrySelection->Count() > 0 )
+ {
+ TMsvId originalEntry = iMsvEntrySelection->At(0);
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
+ KMsvMessagePartRecipient;
+ CMsvOperation * op = NULL;
+ op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Create reply to all, return status %d"), iWait->iStatus.Int());
+ }
+ else
+ {
+ TMsvId newEntry = KMsvNullIndexEntryId;
+ TPckgBuf<TMsvId> package;
+ package.Copy(op->ProgressL());
+ newEntry = package();
+ if ( newEntry != KMsvNullIndexEntryId )
+ {
+ cEntry->SetEntryL( newEntry );
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetInPreparation( EFalse );
+ entry.SetVisible( ETrue );
+ cEntry->ChangeL(entry);
+ }
+ }
+ CleanupStack::PopAndDestroy(); // op
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+ }
+
+void MmsTestBed::forward()
+ {
+ // The first message from inbox is forwarded
+ CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+
+ if ( iMsvEntrySelection->Count() > 0 )
+ {
+ TMsvId originalEntry = iMsvEntrySelection->At(0);
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
+ KMsvMessagePartRecipient | KMsvMessagePartAttachments;
+ CMsvOperation * op = NULL;
+ op = iMmsClient->ForwardL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
+ CleanupStack::PushL(op);
+ iWait->Start();
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Create forward, return status %d"), iWait->iStatus.Int());
+ }
+ else
+ {
+ TMsvId newEntry = KMsvNullIndexEntryId;
+ TPckgBuf<TMsvId> package;
+ package.Copy(op->ProgressL());
+ newEntry = package();
+ if ( newEntry != KMsvNullIndexEntryId )
+ {
+ iMmsClient->SwitchCurrentEntryL( newEntry );
+ // Add a sender: 0601234567
+ iMmsClient->LoadMessageL();
+ iMmsClient->SetSenderL( KMmsSender );
+ iMmsClient->SaveMessageL();
+ cEntry->SetEntryL( newEntry );
+ TMsvEntry entry = cEntry->Entry();
+ entry.SetInPreparation( EFalse );
+ entry.SetVisible( ETrue );
+ cEntry->ChangeL(entry);
+ }
+ }
+ CleanupStack::PopAndDestroy(); // op
+ }
+ CleanupStack::PopAndDestroy(); // cEntry
+ }
+
+void MmsTestBed::sendReadReport()
+ {
+ // TURN READ REPORTS ON (until available from menu)
+ iSettings->LoadSettingsL();
+ iSettings->SetReadReplyReportSendingAllowed( ETrue );
+ iSettings->SaveSettingsL();
+ iMmsClient->RestoreSettingsL();
+
+
+ // Read report is sent for the first message in inbox
+ CMsvEntry* cEntry = iSession->GetEntryL( KMsvGlobalInBoxIndexEntryId );
+ CleanupStack::PushL(cEntry);
+ delete iMsvEntrySelection;
+ iMsvEntrySelection = NULL;
+ iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+
+ if ( iMsvEntrySelection->Count() == 0 )
+ {
+ return;
+ }
+ TMsvId originalEntry = iMsvEntrySelection->At( 0 );
+
+ // new test using Client MTM
+ CMsvOperation * op = NULL;
+ op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy( op );
+ op = NULL;
+
+ // Try sending the read report to current entry
+
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy( op );
+ op = NULL;
+
+/*
+ cEntry->SetEntryL( originalEntry );
+ iMmsHeaders->Reset();
+ CMsvStore* store = cEntry->ReadStoreL();
+ CleanupStack::PushL( store );
+ iMmsHeaders->RestoreL( *store );
+ CleanupStack::PopAndDestroy( store );
+ store = NULL;
+ HBufC8* messageId = HBufC8::NewL( iMmsHeaders->MessageId().Length() );
+ CleanupStack::PushL( messageId );
+ messageId->Des().Copy( iMmsHeaders->MessageId() );
+
+ iMmsClient->SwitchCurrentEntryL( originalEntry );
+ iMmsClient->LoadMessageL();
+
+ iMmsHeaders->Reset();
+ iMmsHeaders->SetMessageType( KMmsMessageTypeReadRecInd );
+ // Message id cannot be accessed via MMS Client MTM!
+
+ iMmsHeaders->SetMessageIdL( messageId->Des() );
+ CleanupStack::PopAndDestroy( messageId );
+
+ iMmsHeaders->AddTypedAddresseeL( iMmsClient->Sender(), EMsvRecipientTo );
+ // sender must be insert-address-token because we don't know our number
+ TTime now;
+ now.UniversalTime();
+
+ _LIT( K1970, "19700000:000000.000000" ); // 1-Jan 1970 0:00:00
+
+ TTime y1970( K1970 );
+ TTimeIntervalMicroSeconds interval;
+ // we can't use "seconds from" as it only returns a
+ // 32 bit signed integer. If fails in 2038.
+ // "microseconds from" returns a 64 bit signed integer
+ interval = now.MicroSecondsFrom( y1970 );
+ // date in iMmsHeaders() in seconds from 1.1.1970.
+ iMmsHeaders->SetDate( (interval.Int64() ) / KMmsMillion );
+ iMmsHeaders->SetReadStatus( KMmsReadStatusRead );
+
+ TMsvId mmsFolderId = KMsvNullIndexEntryId;
+ mmsFolderId = FindMMSFolderL();
+
+ cEntry->SetEntryL( mmsFolderId );
+
+ TMsvEntry entry;
+ entry.iType = KUidMsvMessageEntry;
+ entry.iMtm = KUidMsgTypeMultimedia;
+ entry.SetVisible( ETrue );
+ entry.SetInPreparation( EFalse );
+ entry.iServiceId = KMsvLocalServiceIndexEntryId;
+ entry.iRelatedId = iDefaultServiceId;
+ entry.iMtmData1 = KMmsMessageReadRecInd;
+ cEntry->CreateL( entry );
+ TMsvId entryId = entry.Id();
+
+ cEntry->SetEntryL( entryId );
+
+ store = cEntry->EditStoreL();
+ CleanupStack::PushL( store );
+ iMmsHeaders->StoreL( *store );
+ store->CommitL();
+ CleanupStack::PopAndDestroy( store );
+ store = NULL;
+
+ CMsvEntrySelection* selection = new ( ELeave ) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ selection->InsertL(0, entryId);
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ op = iSession->TransferCommandL(*selection,EMmsScheduledReadReport,paramPack,iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy( op );
+ CleanupStack::PopAndDestroy( selection );
+*/
+ CleanupStack::PopAndDestroy( cEntry );
+ }
+
+int MmsTestBed::fromOutboxToMmscWithMemoryFailure()
+ {
+ TInt error = KErrNone;
+ TInt messageCount = 0;
+ TInt failureCount = 0;
+ do {
+ CMsvEntry* cEntry = NULL;
+
+ // Get List of services
+ cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages of outbox
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+ failureCount++;
+ // These are failures that fail in Message server.
+ if ( failureCount >= 63 && failureCount <= 64 )
+ {
+ failureCount = 65;
+ }
+ cEntry->SetEntryL( iServiceId );
+ TMsvEntry entry = cEntry->Entry();
+ entry.iMtmData3 &= 0x0000000FF;
+ entry.iMtmData3 |= failureCount << 8;
+ cEntry->ChangeL( entry );
+
+ selection->InsertL(0, iServiceId);
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ TRAP (error, op = iSession->TransferCommandL(*selection,EMmsSend,paramPack,iWait->iStatus));
+
+ if ( error == KErrNone )
+ {
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ error = iWait->iStatus.Int();
+ if ( iWait->iStatus.Int() != KErrNoMemory )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+ }
+ }
+
+ CleanupStack::PopAndDestroy(); // op
+ }
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // selection
+ CleanupStack::PopAndDestroy(); // cEntry
+ selection = NULL;
+ cEntry = NULL;
+ cEntry = iSession->GetEntryL( KMsvGlobalOutBoxIndexEntryIdValue );
+ CleanupStack::PushL(cEntry);
+ selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ messageCount = selection->Count();
+ delete selection;
+ selection = 0;
+ CleanupStack::PopAndDestroy(); //cEntry
+ }
+ while ( error == KErrNoMemory || messageCount > 0 );
+ return failureCount;
+ }
+
+int MmsTestBed::fromMmscToInboxWithMemoryFailure()
+ {
+ TInt error = KErrNone;
+ TInt failureCount = 0;
+ TInt messageCount = 0;
+ TMsvId mmsFolderId = KMsvNullIndexEntryId;
+ mmsFolderId = findMMSFolder();
+
+ do {
+ // Inbox must be cleaned if failure makes message to be fetched more than once.
+ // should not happen, but this test is quite stressful, and perfect result
+ // cannot be guaranteed.
+ // What is expected:
+ // 1. Program does not crash
+ // 2. After sufficient number of retries the message is fetched and notification deleted.
+ TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
+ CMsvEntry* cEntry = NULL;
+ CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
+ CleanupStack::PushL(msvEntrySelection);
+
+ cEntry = iSession->GetEntryL(iServiceId);
+ CleanupStack::PushL(cEntry);
+
+ failureCount++;
+ // These are failures that fail in Message server.
+ if ( failureCount >= 63 && failureCount <= 64 )
+ {
+ failureCount = 65;
+ }
+ cEntry->SetEntryL( iServiceId );
+
+ TMsvEntry entry = cEntry->Entry();
+ entry.iMtmData3 &= 0x0000000FF;
+ entry.iMtmData3 |= failureCount << 8;
+ cEntry->ChangeL( entry );
+
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ msvEntrySelection->InsertL(0, iServiceId);
+ }
+
+ CMsvOperation * op = NULL;
+ TCommandParameters parameters; // initialized to zero
+ TCommandParametersBuf paramPack( parameters );
+
+ TRAP (error, op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsReceiveForced,
+ *msvEntrySelection,
+ paramPack,
+ iWait->iStatus) );
+
+ if ( error == KErrNone )
+ {
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ error = iWait->iStatus.Int();
+ if ( iWait->iStatus.Int() != KErrNoMemory )
+ {
+ //TMmsLogger::Log(_L("Testbed tried to receive, return status %d"), iWait->iStatus.Int());
+ }
+ }
+
+ CleanupStack::PopAndDestroy(); // op
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // msvEntrySelection
+ CleanupStack::PopAndDestroy(); // cEntry
+ msvEntrySelection = NULL;
+ cEntry = NULL;
+ cEntry = iSession->GetEntryL( mmsFolderId );
+ CleanupStack::PushL(cEntry);
+ msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ messageCount = msvEntrySelection->Count();
+ delete msvEntrySelection;
+ msvEntrySelection = 0;
+ CleanupStack::PopAndDestroy(); //cEntry
+ }
+ while ( error == KErrNoMemory || messageCount > 0 );
+ if ( error != KErrNoMemory && error != KErrNone )
+ {
+ //TMmsLogger::Log(_L("Memory failure loop ended with %d"), error);
+ }
+ return failureCount;
+ }
+
+void MmsTestBed::sendViaClient()
+ {
+ CMsvEntry* cEntry = NULL;
+
+ cEntry = iSession->GetEntryL(KMsvDraftEntryId);
+ CleanupStack::PushL(cEntry);
+ // Get all mms messages in drafts
+ CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+ CleanupStack::PushL( selection );
+
+ CMsvOperation * op = NULL;
+ TTime now;
+ now.UniversalTime();
+ op = iMmsClient->SendL( *selection, iWait->iStatus, now );
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(2); // cEntry, selection
+ }
+
+void MmsTestBed::scheduledFetch(TInt aDelay /* = 5 */)
+ {
+ TCommandParameters parameters;
+ parameters.iInitialDelay = aDelay;
+ TCommandParametersBuf paramPack( parameters );
+
+ CMsvEntrySelection* selection = new CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ selection->InsertL(0, iServiceId);
+ }
+ else
+ {
+ selection->InsertL(0, iDefaultServiceId);
+ }
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsScheduledReceive,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::fetchForcedImmediate()
+ {
+ TCommandParameters parameters;
+ TCommandParametersBuf paramPack( parameters );
+
+ CMsvEntrySelection* selection = new CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+ // if we have a selected service, insert it into selection
+ if (iServiceId != KMsvNullIndexEntryId)
+ {
+ selection->InsertL(0, iServiceId);
+ }
+ else
+ {
+ selection->InsertL(0, iDefaultServiceId);
+ }
+
+
+ CMsvOperation * op = NULL;
+ op = iMmsClient->InvokeAsyncFunctionL(
+ EMmsReceiveForced,
+ *selection,
+ paramPack,
+ iWait->iStatus);
+
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
+void MmsTestBed::getEventType()
+ {
+ if ( !checkLogClient() )
+ {
+ return; // not available
+ }
+
+ CLogEventType* eventType = CLogEventType::NewL();
+ CleanupStack::PushL( eventType );
+ eventType->SetUid(iLogEvent->EventType());
+ iLogClient->GetEventType( *eventType, iWait->iStatus );
+
+ iWait->Start();
+ CleanupStack::PopAndDestroy(); // eventType
+ }
+
+void MmsTestBed::addEventType()
+ {
+ if ( !checkLogClient() )
+ {
+ return; // not available
+ }
+
+ CLogEventType* eventType = CLogEventType::NewL();
+ CleanupStack::PushL( eventType );
+ eventType->SetUid(iLogEvent->EventType());
+ eventType->SetDescription(_L("Multimedia Message") );
+ eventType->SetLoggingEnabled( ETrue );
+
+// iWait->iStatus = KRequestPending;
+ iLogClient->AddEventType( *eventType, iWait->iStatus );
+ iWait->Start();
+ CleanupStack::PopAndDestroy(); // eventType
+ }
+
+void MmsTestBed::deleteEventType()
+ {
+ if ( !checkLogClient() )
+ {
+ return; // not available
+ }
+// iWait->iStatus = KRequestPending;
+ iLogClient->DeleteEventType( iLogEvent->EventType(), iWait->iStatus );
+ iWait->Start();
+ }
+
+void MmsTestBed::cleanLog()
+ {
+ TInt count = 0;
+
+ count = getLogEntries();
+
+ TInt i;
+ for ( i = 0; i < count; ++i )
+ {
+ // when a view is created, it will be positioned on the first event
+// iWait->iStatus = KRequestPending;
+ iLogClient->DeleteEvent(iLogView->Event().Id(), iWait->iStatus);
+ iWait->Start();
+
+ if ( iLogView->NextL( iWait->iStatus ) )
+ {
+ // should complete with KErrNone
+ iWait->Start();
+ if ( iWait->iStatus.Int() != KErrNone )
+ {
+ // could not get next event!
+ break;
+ }
+ }
+ else
+ {
+ break; // no more events!
+ }
+ }
+ }
+
+void MmsTestBed::setOnline(bool value)
+ {
+ //value = true for online mode
+ //value = false for offline mode
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KCRUidCoreApplicationUIs ) );
+ if( retval == KErrNone )
+ {
+ repository->Set( KCoreAppUIsNetworkConnectionAllowed, value );
+ delete repository;
+ }
+ }
+
+void MmsTestBed::generateDeliveryReport( CMmsHeaders* aMmsHeaders )
+ {
+ iEncodeBuffer->ResizeL( 1024 );
+
+ TInt position = 0;
+
+ // encode message type
+ iEncodeBuffer->Write( position, &KMmsAssignedMessageType, 1 );
+ position++;
+ iEncodeBuffer->Write( position, &KMmsMessageTypeDeliveryInd, 1 );
+ position++;
+
+ // version
+ iEncodeBuffer->Write( position, &KMmsAssignedMmsVersion, 1 );
+ position++;
+
+ TUint8 version = aMmsHeaders->MmsVersion() | 0x80; // current version as short integer
+ iEncodeBuffer->Write( position, &version, 1 );
+ position++;
+
+ // message id from the headers
+ // At least once MMSC did not send us the message id!
+ // if message id is missing, we cannot match the entry!
+ // This only a fake. Real delivery reports should always
+ // contain the message id.
+ if ( aMmsHeaders->MessageId().Length() > 0 )
+ {
+ iEncodeBuffer->Write( position, &KMmsAssignedMessageId, 1 );
+ position++;
+ iEncodeBuffer->Write( position, &(aMmsHeaders->MessageId()[0]), aMmsHeaders->MessageId().Length() );
+ position += aMmsHeaders->MessageId().Length();
+ iEncodeBuffer->Write( position, &KMmsNull, 1 );
+ position++;
+ }
+
+ // To is taken from the headers
+ iEncodeBuffer->Write( position, &KMmsAssignedTo, 1 );
+ position++;
+
+ TPtrC recipient;
+ if ( aMmsHeaders->ToRecipients().MdcaCount() > 0 &&
+ aMmsHeaders->ToRecipients()[0].Length() > 0 )
+ {
+ recipient.Set( aMmsHeaders->ToRecipients()[0] );
+ }
+ else if( aMmsHeaders->CcRecipients().MdcaCount() > 0 &&
+ aMmsHeaders->CcRecipients()[0].Length() > 0 )
+ {
+ recipient.Set( aMmsHeaders->CcRecipients()[0] );
+ }
+ else if( aMmsHeaders->BccRecipients().MdcaCount() > 0 &&
+ aMmsHeaders->BccRecipients()[0].Length() > 0 )
+ {
+ recipient.Set( aMmsHeaders->BccRecipients()[0] );
+ }
+ else
+ {
+ recipient.Set( _L("Jasso-Kissa@jii.fi") );
+ }
+
+ TMmsAddressType addressType = EMmsAddressTypeUnknown;
+
+ if ( recipient.Find( KMiuMau ) != KErrNotFound )
+ {
+ addressType = EMmsAddressTypeEmail;
+ }
+ else
+ {
+ addressType = EMmsAddressTypeMobile;
+ }
+
+ TUint8 character;
+ TInt i;
+ if ( addressType == EMmsAddressTypeEmail )
+ {
+ // email address - ASCII ONLY - THIS IS JUST A TEST!
+
+ for ( i = 0; i < recipient.Length(); ++i )
+ {
+ character = TUint8( recipient[i] & 0xff );
+ iEncodeBuffer->Write( position, &character, 1 );
+ position++;
+ }
+ iEncodeBuffer->Write( position, &KMmsNull, 1 );
+ position++;
+
+ }
+ else
+ {
+ // must be a phone number
+ // We expect for now that the format is correct as is
+ // All legal characters present in a phone number are ASCII
+
+ TInt i;
+ for ( i = 0; i < recipient.Length(); ++i )
+ {
+ character = TUint8( recipient[i] & 0xff );
+ iEncodeBuffer->Write( position, &character, 1 );
+ position++;
+ }
+ iEncodeBuffer->Write( position, KMmsPlmn, KMmsPlmnLength );
+ position += KMmsPlmnLength;
+ iEncodeBuffer->Write( position, &KMmsNull, 1 );
+ position++;
+ }
+
+ // date
+ iEncodeBuffer->Write( position, &KMmsAssignedDate, 1 );
+ position++;
+
+ TLocale locale;
+ locale.Refresh();
+ TInt64 UtcDate;
+ TTimeIntervalSeconds universalTimeOffset( locale.UniversalTimeOffset() );
+
+ TTime now;
+ now.UniversalTime();
+ UtcDate = ( now.MicroSecondsFrom( TTime( KMmsYear1970String ) ).Int64() ) / 1000000 ;
+
+ UtcDate -= universalTimeOffset.Int();
+
+ if ( locale.QueryHomeHasDaylightSavingOn() )
+ {
+ TTimeIntervalSeconds daylightSaving( 60 * 60 );
+ UtcDate -= daylightSaving.Int();
+ }
+
+ TUint8 len; // number of bytes we will need
+ len = 0;
+ TUint8 array[8];
+
+ TInt64 temp = UtcDate;
+
+ for (i = 7; i >= 0; --i)
+ {
+ array[i] = TInt8( ( I64INT( temp ) ) & 0xFF );
+ I64LSR( temp, 8 );
+ }
+
+ len = 8;
+ i = 0;
+ while( ( array[i]== 0 ) && ( i < 8 ) )
+ {
+ i++;
+ len--;
+ }
+
+ // a zero should be coded as short integer.
+ // However, if there is a valid reason to code a zero as a long integer,
+ // we allow it. The caller should know what he is doing.
+ if ( len == 0 )
+ {
+ len = 1;
+ }
+ // write short length
+ iEncodeBuffer->Write( position, &len, 1 );
+ position++;
+ // write as many bytes as were non-zero
+ iEncodeBuffer->Write( position, &(array[8 - len] ), len );
+ position+= len;
+ // status
+ iEncodeBuffer->Write( position, &KMmsAssignedStatus, 1 );
+ position++;
+ iEncodeBuffer->Write( position, &KMmsMessageStatusRetrieved, 1 );
+ position++;
+ // DONE!!!
+ iEncodeBuffer->ResizeL( position );
+ return;
+ }
+
+void MmsTestBed::sendDeliveryReport()
+ {
+ if ( iEncodeBuffer->Size() == 0 )
+ {
+ //No delivery report
+ return;
+ }
+
+
+ TMsvId mmsFolder = findMMSFolder();
+ CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+ CleanupStack::PushL( selection );
+
+ TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
+ TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
+
+ // Now we have streamed our data into this entry.
+ // Now we have an entry that says: local service, MMS MTM
+
+ if ( entryId != KMsvNullIndexEntryId )
+ {
+ selection->AppendL( entryId );
+ }
+ else
+ {
+ selection->AppendL( iDefaultServiceId );
+ }
+
+ TWatcherParameters parameters; // initialized to zero
+ parameters.iWatcherId = RThread().Id();
+ parameters.iDataPointer = &ptr;
+ TWatcherParametersBuf paramPack( parameters );
+
+ CMsvOperation * op = NULL;
+
+// iWait->iStatus = KRequestPending;
+ op = iSession->TransferCommandL(
+ *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
+ CleanupStack::PushL(op);
+ iWait->Start();
+
+ while (iWait->iStatus.Int() == KRequestPending )
+ {
+ if (!iTimer->IsActive())
+ {
+ iTimer->IssueRequest();
+ }
+ CActiveScheduler::Start();
+ }
+
+ iTimer->Cancel();
+
+ CleanupStack::PopAndDestroy(); // op
+ CleanupStack::PopAndDestroy(); // selection
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/mmstestbed/src/mmsteststaticutils.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,528 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#include <f32file.h>
+#include <centralrepository.h>
+#include <apparc.h>
+#include <msvapi.h>
+#include <msvids.h>
+
+#include "mmsteststaticutils.h"
+#include "mmsconst.h"
+#include "MmsEnginePrivateCRKeys.h"
+#include "mmssettings.h"
+#include "mmsheaders.h"
+#include "mmsservercommon.h"
+#include "mmsencode.h"
+
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+TMmsJoinedArrays::TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2)
+: iArray1(aArray1), iArray2(aArray2)
+ {
+ }
+
+TInt TMmsJoinedArrays::MdcaCount() const
+ {
+ TInt count=0;
+ if (iArray1)
+ count += iArray1->MdcaCount();
+ if (iArray2)
+ count += iArray2->MdcaCount();
+ return count;
+ }
+
+TPtrC16 TMmsJoinedArrays::MdcaPoint(TInt aIndex) const
+ {
+ if (iArray1)
+ {
+ if (aIndex < iArray1->MdcaCount())
+ return iArray1->MdcaPoint(aIndex);
+ else
+ aIndex -= iArray1->MdcaCount();
+ }
+ return iArray2->MdcaPoint(aIndex);
+ }
+
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+TMmsTestUtils::TMmsTestUtils()
+ {
+
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+HBufC* TMmsTestUtils::ReadContactFromFileL( TDesC& aFileName, RFs& aFs )
+ {
+ RFile file;
+ TInt error = KErrNone;
+
+ TInt textBufferSize = 256;
+ HBufC* textBuffer = HBufC::NewL( textBufferSize );
+ TPtr textPtr = textBuffer->Des();
+ TFileText textFile;
+
+ error = file.Open( aFs, aFileName,
+ EFileRead|EFileShareReadersOnly );
+
+ if ( error == KErrNone )
+ {
+ textFile.Set( file );
+ error = textFile.Seek( ESeekStart );
+ }
+
+ if ( error == KErrNone )
+ {
+ error = textFile.Read( textPtr );
+ }
+
+ file.Close();
+
+ if ( textBuffer->Des().Find( &KMmsByteOrderMark, 1 ) == 0 )
+ {
+ textBuffer->Des().Copy( textBuffer->Des().Mid( 1 ) );
+ }
+
+ return textBuffer;
+ }
+
+//----------------------------------------------------------------------------------------
+// turn on detailed logging while decoding a message
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::DecodeLoggingOnL()
+ {
+ // CenRep for decodelogging
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+ if( retval == KErrNone )
+ {
+ // Best effort - if cannot access repository, no can do
+ TInt temp = 1;
+ repository->Set( KMmsEngineDecodeLog, temp );
+ delete repository;
+ }
+ }
+
+//----------------------------------------------------------------------------------------
+// turn off detailed logging while decoding a message
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::DecodeLoggingOffL()
+ {
+ // CenRep for decodelogging
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+ if( retval == KErrNone )
+ {
+ // Best effort - if cannot access repository, no can do
+ TInt temp = 0;
+ repository->Set( KMmsEngineDecodeLog, temp );
+ delete repository;
+ }
+
+ }
+
+//----------------------------------------------------------------------------------------
+// turn on binary dump of incoming messages
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::BinaryDumpOnL()
+ {
+ // CenRep for binarydump setting
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+ if( retval == KErrNone )
+ {
+ // Best effort - if cannot access repository, no can do
+ TInt temp = 1;
+ repository->Set( KMmsEngineBinaryDump, temp );
+ delete repository;
+ }
+
+ }
+
+//----------------------------------------------------------------------------------------
+// turn off binary dump of incoming messages
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::BinaryDumpOffL()
+ {
+ // CenRep for binarydump setting
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+ if( retval == KErrNone )
+ {
+ // Best effort - if cannot access repository, no can do
+ TInt temp = 0;
+ repository->Set( KMmsEngineBinaryDump, temp );
+ delete repository;
+ }
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+void TMmsTestUtils::CleanDirectoryL( RFs& aFs )
+ {
+ // Delete the files in the directory
+ CFileMan* fileMan = CFileMan::NewL( aFs );
+ CleanupStack::PushL( fileMan );
+ fileMan->RmDir( KMmsDefaultLocalModeDir );
+ fileMan->RmDir( KMmsMMBoxDirectory );
+ fileMan->RmDir( KMmsMMBoxDescriptionDirectory );
+ CleanupStack::PopAndDestroy(); // fileManager
+ // we don't want to throw these away!
+ aFs.MkDirAll( KMmsDefaultLocalModeDir );
+ aFs.MkDirAll( KMmsMMBoxDirectory );
+ aFs.MkDirAll( KMmsMMBoxDescriptionDirectory );
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+void TMmsTestUtils::Dump( CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs )
+ {
+ TInt error = KErrNone;
+ aFs.MkDirAll( aFilename );
+ TUint att;
+ if ( aFs.Att( aFilename, att ) == KErrNone )
+ {
+ _LIT( KRelated, "dump.mms");
+ aParse.Set( aFilename, &KRelated, NULL );
+ aFilename = aParse.FullName();
+ error = CApaApplication::GenerateFileName( aFs, aFilename );
+ if ( error == KErrNone )
+ {
+ RFile file;
+ error = file.Create( aFs, aFilename, EFileWrite | EFileShareExclusive );
+ // for message id generation
+ aParse.Set( aFilename, NULL, NULL );
+ if ( error == KErrNone )
+ {
+ // the data is supposed to be in the encode buffer
+ TPtr8 ptr = aBuffer.Ptr( 0 );
+ file.Write( ptr );
+ file.Flush();
+ }
+
+ // done - close files
+ file.Close();
+ }
+ }
+ }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+void TMmsTestUtils::CleanBoxL(TMsvId aBoxId, CMsvSession& aSession)
+ {
+ CMsvEntry* cEntry = NULL;
+ // delete all messages from the specified box
+ cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ cEntry->SetEntryL(aBoxId);
+ // show invisible entries
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+ CleanupStack::PushL(msvEntrySelection);
+
+ CMsvEntrySelection* selection = NULL;
+ cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+ selection = cEntry->ChildrenWithMtmL(KUidMsgMMSNotification);
+ CleanupStack::PushL( selection );
+ if ( selection->Count() > 0 )
+ {
+ msvEntrySelection->AppendL( selection->Back( 0 ), selection->Count() );
+ }
+ CleanupStack::PopAndDestroy(); // selection
+
+ int i;
+ for (i = 0; i < msvEntrySelection->Count(); ++i)
+ {
+ CMsvEntry* entry = aSession.GetEntryL( msvEntrySelection->At(i) );
+ CleanupStack::PushL( entry );
+ TMsvEntry tEntry = entry->Entry();
+ tEntry.SetReadOnly(EFalse);
+ entry->ChangeL(tEntry);
+ cEntry->DeleteL( msvEntrySelection->At(i) );
+ CleanupStack::PopAndDestroy( entry );
+ }
+
+ CleanupStack::PopAndDestroy(msvEntrySelection);
+ CleanupStack::PopAndDestroy(cEntry);
+ }
+
+//----------------------------------------------------------------------------------------
+// turn on logging email recipients
+//----------------------------------------------------------------------------------------
+void TMmsTestUtils::EmailLoggingOnL()
+ {
+ // CenRep for binarydump setting
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
+ if( retval == KErrNone )
+ {
+ TInt temp = 1;
+ repository->Set( KMmsEngineLogEmailRecipients, temp );
+ delete repository;
+ }
+
+ }
+
+//----------------------------------------------------------------------------------------
+// turn off logging email recipients
+//----------------------------------------------------------------------------------------
+void TMmsTestUtils::EmailLoggingOffL()
+ {
+ // CenRep for binarydump setting
+ CRepository* repository = NULL;
+ TInt retval = KErrNone;
+ TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
+ if( retval == KErrNone )
+ {
+ TInt temp = 0;
+ repository->Set( KMmsEngineLogEmailRecipients, temp );
+ delete repository;
+ }
+
+ }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TInt TMmsTestUtils::CountChildrenL(TMsvId aBoxId, CMsvEntrySelection*& aMsvEntrySelection, CMsvSession& aSession, TUid aMessageType )
+ {
+ CMsvEntry* cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
+ CleanupStack::PushL(cEntry);
+ cEntry->SetEntryL(aBoxId);
+ if (aMsvEntrySelection != NULL)
+ {
+ delete aMsvEntrySelection;
+ aMsvEntrySelection = NULL;
+ }
+ aMsvEntrySelection = cEntry->ChildrenWithMtmL(aMessageType);
+ CleanupStack::PopAndDestroy(); // cEntry
+ return aMsvEntrySelection->Count();
+ }
+
+
+// -----------------------------------------------------------------------------
+// CreateFolderEntryL
+//
+// -----------------------------------------------------------------------------
+//
+void TMmsTestUtils::CreateFolderEntryL(
+ CMsvSession& aSession,
+ TMsvId aParentFolder,
+ const TDesC& aFolderName,
+ TMsvId& aFolderId )
+ {
+ aFolderId = KMsvNullIndexEntryId;
+ CMsvEntry* cEntry = aSession.GetEntryL( aParentFolder );
+ CleanupStack::PushL( cEntry );
+
+ // Create a new folder.
+
+ TMsvEntry entry;
+ entry.iType = KUidMsvFolderEntry;
+ entry.iMtm = KUidMsvLocalServiceMtm;
+ entry.iDetails.Set( aFolderName );
+ entry.SetVisible( EFalse );
+ entry.SetInPreparation( EFalse );
+ entry.iServiceId = KMsvLocalServiceIndexEntryId;
+ cEntry->CreateL( entry );
+ aFolderId = entry.Id();
+ CleanupStack::PopAndDestroy( cEntry );
+
+ }
+
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TMsvId TMmsTestUtils::CreateNotificationEntryL(
+ TMsvId aNotificationFolder,
+ TMsvId aServiceId,
+ CBufFlat* aEncodeBuffer,
+ CMsvSession& aSession )
+ {
+ TMsvId entryId = KMsvNullIndexEntryId;
+ if ( aNotificationFolder == KMsvNullIndexEntryId )
+ {
+ // no folder no entry
+ return entryId;
+ }
+
+ CMsvEntry* cEntry = aSession.GetEntryL( aNotificationFolder );
+ CleanupStack::PushL(cEntry);
+
+ TMsvEntry entry;
+ entry.iType = KUidMsvMessageEntry;
+ entry.iMtm = KUidMsgTypeMultimedia;
+ entry.SetVisible( ETrue );
+ // If we want to put data here, InPreparation must be set to true first
+ entry.SetInPreparation( EFalse );
+ entry.iServiceId = KMsvLocalServiceIndexEntryId;
+ entry.iRelatedId = aServiceId;
+ entry.iMtmData2 = KMmsNotificationBinary;
+ cEntry->CreateL( entry );
+ entryId = entry.Id();
+
+ //
+ // Stream
+ // 1) length of the data as 32 bit integer
+ // 2) pushed message data
+ // into created entry's stream
+ //
+ cEntry->SetEntryL( entryId );
+ CMsvStore* store = cEntry->EditStoreL();
+ CleanupStack::PushL( store ); // ***
+ RMsvWriteStream outs;
+ outs.AssignLC( *store, KUidBinaryNotificationStream ); // ***
+ TPtrC8 ptr = aEncodeBuffer->Ptr( 0 );
+ outs.WriteUint32L( ptr.Length() );
+ outs.WriteL( ptr );
+ outs.CommitL();
+ outs.Close();
+ store->CommitL();
+
+ CleanupStack::PopAndDestroy( &outs ); // close outs
+ CleanupStack::PopAndDestroy( store );
+ CleanupStack::PopAndDestroy( cEntry );
+
+ return entryId;
+
+ }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+void TMmsTestUtils::FormNotification(
+ TDesC8& aUrl,
+ TInt aSize,
+ CMmsHeaders& aMmsHeaders,
+ CMmsEncode& aMmsEncoder,
+ CBufFlat* aEncodeBuffer )
+ {
+ // for test purposes aUrl will contain the filename.
+
+ // Reset sets the default encapsulation version
+ // The default version has been set from MmsSettings in NewL
+ aMmsHeaders.Reset();
+
+ // construct the notification into iMmsHeaders, and call encode
+
+ aMmsHeaders.SetMessageType( KMmsMessageTypeMNotificationInd );
+
+ TTime currentTime;
+ currentTime.UniversalTime();
+ currentTime.Int64();
+
+ TPtrC8 tid;
+ TBufC8<KMMSMAXTIDLENGTH> target;
+ TInt random = 0;
+
+ // we don't generate a true random TID: We generate the
+ // TID from the URL so that if we generate a notification
+ // twice from the same file, we get the same TID and the
+ // same URL. This way we can test the pruning function in
+ // server MTM
+
+ TInt i;
+ for ( i = 0; i < aUrl.Length(); ++i )
+ {
+ random += aUrl[ i ];
+ }
+
+ target.Des().Num( random );
+ tid.Set( target.Des() );
+ aMmsHeaders.SetTidL( tid );
+
+ aMmsHeaders.SetMessageClass( EMmsClassPersonal );
+ aMmsHeaders.SetMessageSize( aSize );
+ const TInt KTenHours = 10 * 60 * 60; // 10 hours relative expiry
+ aMmsHeaders.SetExpiryInterval( KTenHours );
+ aMmsHeaders.SetContentLocationL( aUrl );
+
+ aMmsEncoder.EncodeHeadersL( aMmsHeaders, *aEncodeBuffer );
+
+ }
+
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TBool TMmsTestUtils::IsFile(const TDesC& aFileName, RFs& aFs)
+ {
+ //Is the name a file?
+ if (IsDrive(aFileName))
+ return EFalse;
+ return !(IsDir(aFileName, aFs));
+ }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TBool TMmsTestUtils::IsDir(const TDesC& aFileName, RFs& aFs)
+ {
+ //Is the name a directory?
+ TEntry entry;
+ TInt err = aFs.Entry(aFileName, entry);
+ if (err)
+ return EFalse;
+ else
+ return entry.IsDir();
+ }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TBool TMmsTestUtils::IsDrive(const TDesC& aFileName)
+ {
+ //horrible little function to figure if the path is just a drive
+ TBool retVal = EFalse;
+ if (aFileName.Length()==3) //eg "c:\"
+ {
+ if ((aFileName[1] == ':') && (aFileName[2] == '\\'))
+ retVal=ETrue;
+ }
+ else if (aFileName.Length()==2) //eg "c:"
+ {
+ if (aFileName[1] == ':')
+ retVal=ETrue;
+ }
+ return retVal;
+ }
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/mmstestbed/src/mmstestuitimer.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ */
+
+#include "mmstestuitimer.h"
+
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CTestUiTimer::CTestUiTimer(): CTimer( 5 )
+ {
+ period = KPeriod;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::ConstructL()
+ {
+ CTimer::ConstructL();
+ CActiveScheduler::Add(this);
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CTestUiTimer* CTestUiTimer::NewL()
+ {
+ CTestUiTimer* self = new(ELeave) CTestUiTimer();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CTestUiTimer::~CTestUiTimer()
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::IssueRequest()
+ {
+ // No operation to cancel if this function is called
+ iObject = NULL;
+ After(period);
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::TimeoutOperation( CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds )
+ {
+ iObject = aObject;
+ TTimeIntervalMicroSeconds32 timeout = aTimeoutInSeconds.Int() * 1000000;
+ After( timeout );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::DoCancel()
+ {
+ CTimer::DoCancel();
+ if ( iObject )
+ {
+ iObject->Cancel();
+ iObject = NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::RunL()
+ {
+ if ( iObject )
+ {
+ // If we timeout while holding an active object, we cancel it
+ iObject->Cancel();
+ iObject = NULL;
+ }
+ else
+ {
+ CActiveScheduler::Stop();
+ }
+ }
+
+// ======== GLOBAL FUNCTIONS ========
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/testmmsgpluginapp.pro Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,22 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: Project file for testmmsgpluginapp
+#
+
+TEMPLATE = subdirs
+
+SUBDIRS += mmstestbed/mmstestbed.pro
+SUBDIRS += testmmsplugin/testmmsplugin.pro
+
+CONFIG += ordered
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/testmmsplugin/data/TestMMSPluginSample.txt Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,1 @@
+MMSTEST Text
\ No newline at end of file
Binary file messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/testmmsplugin/data/TestMMSPluginSmileyFace.gif has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/testmmsplugin/inc/testmmsplugin.h Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: Main test class declaration for MMS Plugin
+ */
+
+#ifndef TEST_MMS_PLUGIN_H
+#define TEST_MMS_PLUGIN_H
+
+#ifdef BUILD_TEST_DLL
+#define TEST_EXPORT Q_DECL_EXPORT
+#else
+#define TEST_EXPORT Q_DECL_IMPORT
+#endif
+
+#include <QObject>
+#include <QSignalSpy>
+#include <e32const.h>
+
+//Forward Declarations
+class UniEditorMmsPlugin;
+class ConvergedMessage;
+class MmsTestBed;
+
+//Class Declaration: TestMmsPlugin
+class TEST_EXPORT TestMmsPlugin: public QObject
+ {
+ Q_OBJECT
+
+private slots:
+
+ /**
+ * Initialises the whole Test
+ **/
+ void initTestCase();//called before the first testfunction is executed.
+
+ /**
+ * Initialises each Test Case
+ **/
+ void init();//called before each testfunction is executed.
+
+ /**
+ * Creates a MMS messsage with a text attachment
+ **/
+ void createMMSWithTextAttachment();
+
+ /**
+ * Tests the MMS message with a text attachment
+ **/
+ void testMMSWithTextAttachment();
+
+ /**
+ * Sends the MMS message with a text attachment
+ **/
+ void sendMMSWithTextAttachment();
+
+ /**
+ * Tests that the MMS message is sent successfully
+ **/
+ void testSentMMSWithTextAttachment();
+
+ /**
+ * Creates a MMS messsage with a text and an Image attachments
+ **/
+ void createMMSWithTextAndImageAttachment();
+
+ /**
+ * Tests the MMS message with a text and an Image attachments
+ **/
+ void testMMSWithTextAndImageAttachment();
+
+ /**
+ * Sends the MMS message with a text and an Image attachments
+ **/
+ void sendMMSWithTextAndImageAttachment();
+
+ /**
+ * Tests that the MMS message is sent successfully
+ **/
+ void testSentMMSWithTextAndImageAttachment();
+
+ /**
+ * Cleans up each Test Case
+ **/
+ void cleanup();
+
+ /**
+ * Cleans up the whole Test Case
+ **/
+ void cleanupTestCase();
+
+private: // Data
+
+ /**
+ * msgPlugin - MMS Message Plug-in
+ **/
+ UniEditorMmsPlugin* msgPlugin;
+
+ /**
+ * mmstestbed - MMS Message Simulator
+ **/
+ MmsTestBed* mmstestbed;
+
+ /**
+ * spy_draft - Signal Spy for Draft Folder
+ **/
+ QSignalSpy* spy_draft;
+
+ /**
+ * spy_outbox - Signal Spy for Outbox Folder
+ **/
+ QSignalSpy* spy_outbox;
+
+ /**
+ * spy_sent - Signal Spy for Sent Folder
+ **/
+ QSignalSpy* spy_sent;
+
+ /**
+ * spy_inbox - Signal Spy for Inbox Folder
+ **/
+ QSignalSpy* spy_inbox;
+
+ /**
+ * mmsMsgId - The MMS message Id
+ **/
+ long int mmsMsgId;
+ };
+#endif //TEST_MMS_PLUGIN_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/testmmsplugin/inc/testmmsplugin.ini Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,20 @@
+//this file is used to provide predefined set of input data.
+
+//eg.
+const char TEST_MSG_SUBJECT[] = "Message Subject";
+const char TEST_SENDER[] = "DummySender<+919860479112>";
+const char TEST_ATTACHMENT4[] = "c:\\data\\TestMMSPluginSmileyFace.gif";
+const char TEST_ATTACHMENT5[] = "c:\\data\\TestMMSPluginSample.txt";
+const char TEST_CC[] = "DummyCCAddress<+919860479113>";
+const char TEST_BCC[] = "DummyBCCAddress<+919860479114>";
+
+//out put directory for test results.
+QString OUTPUTDIRECTORY = "c:/logs/TestMmsPlugin";
+//o/p directory for data to be written on temp file.
+QString TEMPDIR = "c:/logs/TestMmsPlugin/testdata";
+//test result O/P file name.
+QString RESULTFILE = "c:/logs/TestMmsPlugin/result_%1.txt";
+// folder named UID3 of msgapptestsuite inside private folder.
+const QString PRIVATE_DIR("C:/private/E274bf60");
+//application class name
+const QString appClassName("TestMmsPlugin");
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/testmmsplugin/src/testmmsplugin.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,479 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: : Main test class definition for MMS Plugin
+ */
+
+#include <QtTest/QtTest>
+#include <QTimer>
+#include <QSignalSpy>
+#include "debugtraces.h"
+#include "testmmsplugin.h"
+#include "convergedmessage.h"
+#include "convergedmessageid.h"
+#include "unieditormmsplugin.h"
+#include "mmstestbed.h"
+#include "testmmsplugin.ini"
+
+//---------------------------------------------------------------
+// TestMmsPlugin::initTestCase
+//---------------------------------------------------------------
+void TestMmsPlugin::initTestCase()
+{
+ //Instantiate UniEditorMmsPlugin and verify if it is correctly Instantited.
+ msgPlugin = new UniEditorMmsPlugin();
+ QVERIFY(msgPlugin != NULL);
+
+ //Verify if MMS service is Validated.
+ QCOMPARE(msgPlugin->validateService(), 1);
+ QCOMPARE(msgPlugin->isServiceValid(), 1);
+ msgPlugin->setEncodingSettings(ETrue, ESmsEncodingNone, -1);
+ QString str("Hello");
+ TInt numOfRemainingChars = 1;
+ TInt numOfPDUs = 1;
+ TBool unicodeMode = ETrue;
+ TSmsEncoding smsEncoding = ESmsEncodingNone;
+ QVERIFY(msgPlugin->getNumPDUs(str, numOfRemainingChars, numOfPDUs, unicodeMode, smsEncoding) == true);
+
+ //Verify MmsTestBed Instance.
+ mmstestbed = new MmsTestBed;
+ QVERIFY(mmstestbed != NULL);
+
+ //register user defined object to meta system.
+ qRegisterMetaType<long int> ("long int");
+
+ //set up signalspy to listen to signals emitted by mmstestbed
+ spy_draft = new QSignalSpy(mmstestbed, SIGNAL(entryCreatedInDraft(long int)));
+ spy_outbox = new QSignalSpy(mmstestbed, SIGNAL(entryMovedToOutbox(long int)));
+ spy_sent = new QSignalSpy(mmstestbed, SIGNAL(entryMovedToSent(long int)));
+ spy_inbox = new QSignalSpy(mmstestbed, SIGNAL(entryCreatedInInbox(long int)));
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::init
+//---------------------------------------------------------------
+void TestMmsPlugin::init()
+{
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::createMMSWithTextAttachment
+//---------------------------------------------------------------
+void TestMmsPlugin::createMMSWithTextAttachment()
+{
+ //Create a Converged Message instance.
+ QString subject = TEST_MSG_SUBJECT;
+ qint64 timeStamp = QDateTime::currentDateTime().toTime_t();
+
+ QString sender(TEST_SENDER);
+ ConvergedMessageAddress address(sender);
+ ConvergedMessageAttachmentList attachmentList;
+
+ //Add a text attachment to attachment list.
+ QString attachmentPath = TEST_ATTACHMENT5;
+ ConvergedMessageAttachment* attachment =
+ new ConvergedMessageAttachment(attachmentPath, ConvergedMessageAttachment::EAttachment);
+
+ attachmentList.append(attachment);
+
+ //Instantiate a Converged Message object and set service a MMS
+ ConvergedMessage msg;
+ msg.setMessageType(ConvergedMessage::Mms);
+
+ //Set Subject
+ msg.setSubject(subject);
+
+ msg.setTimeStamp(timeStamp);
+
+ //Set recipient.
+ msg.addToRecipient(address);
+
+ //Add attachments' list
+ msg.addAttachments(attachmentList);
+ msg.setPriority(ConvergedMessage::Normal);
+
+ //Adding CC Address
+ QString ccAddress(TEST_CC);
+ ConvergedMessageAddress ccAdd(ccAddress);
+ msg.addCcRecipient(ccAdd);
+
+ //Adding BCC Address
+ QString bccAddress(TEST_BCC);
+ ConvergedMessageAddress bccAdd(bccAddress);
+ msg.addBccRecipient(bccAdd);
+
+ //Adding From Address
+ QString recipientAddress(TEST_SENDER);
+ ConvergedMessageAddress recipientAdd(recipientAddress);
+ msg.addFromRecipient(recipientAdd);
+
+ //start send and prepare to test send-success or fail
+ mmstestbed->cleanAll();
+ mmstestbed->setConnectionLocal(true);
+
+ //Get a valid MMS message ID and verify that it is valid.
+ mmsMsgId = msgPlugin->convertTo(&msg);
+ QVERIFY(mmsMsgId != -1);
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::testMMSWithTextAttachment
+//---------------------------------------------------------------
+void TestMmsPlugin::testMMSWithTextAttachment()
+{
+ long int mmsDraftMsgId;
+
+ //check if draft-folder signal was received...this means message was created in draft
+ if( 1 <= spy_draft->count())
+ {
+ //compare the msgid and verify with the ID given by MMS plugin
+ void * temp = const_cast<void*>(spy_draft->at(0).at(0).data());
+ mmsDraftMsgId = *reinterpret_cast< long int(*)>(temp);
+ QVERIFY(mmsDraftMsgId == mmsMsgId);
+
+ //Validate the MMS message with all the values set before.
+ ConvergedMessage* draftMsg = msgPlugin->convertFrom(mmsDraftMsgId);
+ QVERIFY(draftMsg->subject().compare(QString(TEST_MSG_SUBJECT)) == 0);
+ QVERIFY(draftMsg->messageType() == ConvergedMessage::Mms);
+ QVERIFY(QString(TEST_SENDER).contains(draftMsg->toAddressList()[0]->address(), Qt::CaseInsensitive) == true);
+ QVERIFY(QString(TEST_CC).contains(draftMsg->ccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
+ QVERIFY(QString(TEST_BCC).contains(draftMsg->bccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
+ QVERIFY(QString(TEST_SENDER).contains(draftMsg->fromAddress()->address(), Qt::CaseInsensitive) == true);
+ QVERIFY(draftMsg->attachments().count() == 1);
+ QVERIFY(draftMsg->attachments()[0]->attachmentType() == ConvergedMessageAttachment::EAttachment);
+ QVERIFY(draftMsg->attachments()[0]->filePath().contains(QString(TEST_ATTACHMENT5).mid(QString(TEST_ATTACHMENT5).indexOf(QString("Sample.txt"), 0, Qt::CaseInsensitive)), Qt::CaseInsensitive) == true);
+ }
+ else
+ {
+ QFAIL("testSendReceiveMMS: Failed to create message in Draft");
+ //reset connection to 'global on, local off'
+ mmstestbed->setConnectionLocal(false);
+ }
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::sendMMSWithTextAttachment
+//---------------------------------------------------------------
+void TestMmsPlugin::sendMMSWithTextAttachment()
+{
+ //Send the MMS message and verify if it was sent successfully.
+ bool sent = msgPlugin->send(mmsMsgId);
+ QVERIFY(sent == true);
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::testSentMMSWithTextAttachment
+//---------------------------------------------------------------
+void TestMmsPlugin::testSentMMSWithTextAttachment()
+{
+ QTest::qWait(10000); //to ensure path completion
+
+ //check if outbox-folder signal was received...this means message was moved to outbox for send
+ if( 1 <= spy_outbox->count())
+ {
+ //compare the msgid
+ void * temp = const_cast<void*>(spy_outbox->at(0).at(0).data());
+ long int outboxId = *reinterpret_cast< long int(*)>(temp);
+ QCOMPARE(outboxId, mmsMsgId);
+
+ //push the message from outbox to mmsc(sent folder)
+ mmstestbed->fromOutboxToMmsc();
+ }
+ else
+ {
+ QFAIL("testSendReceiveMMS: Failed to move message to Outbox");
+
+ //reset connection to 'global on, local off'
+ mmstestbed->setConnectionLocal(false);
+ return;
+ }
+
+ //check if sent-folder signal was received....this means message was successfully sent scheduled.
+ if( 1 <= spy_sent->count())
+ {
+ //check for send-path
+ void * temp = const_cast<void*>(spy_sent->at(0).at(0).data());
+ long int sentmsgid = *reinterpret_cast< long int(*)>(temp);
+ QCOMPARE(sentmsgid, mmsMsgId);
+
+ //issue a fetch request on the sent message, to test the receive path
+ mmstestbed->fromMmscToInbox();
+ }
+ else
+ {
+ QFAIL("testSendReceiveMMS: Failed to move message to Sent folder");
+
+ //reset connection to 'global on, local off'
+ mmstestbed->setConnectionLocal(false);
+ return;
+ }
+
+ //check if inbox-folder signal was received....this means message was successfully received at the inbox folder.
+ if( spy_inbox->count() <= 0)
+ {
+ QFAIL("testSendReceiveMMS: Failed to move message to Inbox folder");
+
+ //reset connection to 'global on, local off'
+ mmstestbed->setConnectionLocal(false);
+ }
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::createMMSWithTextAndImageAttachment
+//---------------------------------------------------------------
+void TestMmsPlugin::createMMSWithTextAndImageAttachment()
+{
+ //Create a Converged Message instance.
+ QString subject = TEST_MSG_SUBJECT;
+ qint64 timeStamp = QDateTime::currentDateTime().toTime_t();
+
+ QString sender(TEST_SENDER);
+ ConvergedMessageAddress address(sender);
+ ConvergedMessageAttachmentList attachmentList;
+
+ //Add a text attachment to attachment list.
+ QString attachmentPath1 = TEST_ATTACHMENT5;
+ ConvergedMessageAttachment* attachment =
+ new ConvergedMessageAttachment(attachmentPath1, ConvergedMessageAttachment::EInline);
+
+ //Add an image attachment to attachment list.
+ QString attachmentPath2 = TEST_ATTACHMENT4;
+ ConvergedMessageAttachment* attachmentImage =
+ new ConvergedMessageAttachment(attachmentPath2, ConvergedMessageAttachment::EAttachment);
+
+ attachmentList.append(attachment);
+ attachmentList.append(attachmentImage);
+
+ //Instantiate a Converged Message object and set service a MMS
+ ConvergedMessage msg;
+ msg.setMessageType(ConvergedMessage::Mms);
+ msg.setSubject(subject);
+ msg.setTimeStamp(timeStamp);
+ msg.addToRecipient(address);
+
+ //Add attachments' list
+ msg.addAttachments(attachmentList);
+ msg.setPriority(ConvergedMessage::Normal);
+
+ //Adding CC Address
+ QString ccAddress(TEST_CC);
+ ConvergedMessageAddress ccAdd(ccAddress);
+ msg.addCcRecipient(ccAdd);
+
+ //Adding BCC Address
+ QString bccAddress(TEST_BCC);
+ ConvergedMessageAddress bccAdd(bccAddress);
+ msg.addBccRecipient(bccAdd);
+
+ //Adding From Address
+ QString recipientAddress(TEST_SENDER);
+ ConvergedMessageAddress recipientAdd(recipientAddress);
+ msg.addFromRecipient(recipientAdd);
+
+ //start send and prepare to test send-success or fail
+ mmstestbed->cleanAll();
+ mmstestbed->setConnectionLocal(true);
+
+ //Get a valid MMS message ID and verify that it is valid.
+ mmsMsgId = msgPlugin->convertTo(&msg);
+ QVERIFY(mmsMsgId != -1);
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::testMMSWithTextAndImageAttachment
+//---------------------------------------------------------------
+void TestMmsPlugin::testMMSWithTextAndImageAttachment()
+{
+ long int mmsDraftMsgId;
+
+ //check if draft-folder signal was received...this means message was created in draft
+ if( 1 <= spy_draft->count())
+ {
+ //compare the msgid and verify with the ID given by MMS plugin
+ void * temp = const_cast<void*>(spy_draft->at(1).at(0).data());
+ mmsDraftMsgId = *reinterpret_cast< long int(*)>(temp);
+ QVERIFY(mmsDraftMsgId == mmsMsgId);
+
+ //Validate the MMS message with all the values set before.
+ ConvergedMessage* draftMsg = msgPlugin->convertFrom(mmsDraftMsgId);
+ QVERIFY(draftMsg->subject().compare(QString(TEST_MSG_SUBJECT)) == 0);
+ QVERIFY(draftMsg->messageType() == ConvergedMessage::Mms);
+ QVERIFY(QString(TEST_SENDER).contains(draftMsg->toAddressList()[0]->address(), Qt::CaseInsensitive) == true);
+ QVERIFY(QString(TEST_CC).contains(draftMsg->ccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
+ QVERIFY(QString(TEST_BCC).contains(draftMsg->bccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
+ QVERIFY(QString(TEST_SENDER).contains(draftMsg->fromAddress()->address(), Qt::CaseInsensitive) == true);
+ QVERIFY(draftMsg->attachments().count() == 1);
+ QVERIFY(draftMsg->attachments()[0]->attachmentType() == ConvergedMessageAttachment::EAttachment);
+ QVERIFY(draftMsg->attachments()[0]->filePath().contains(QString(TEST_ATTACHMENT4).mid(QString(TEST_ATTACHMENT4).indexOf(QString("SmileyFace.gif"), 0, Qt::CaseInsensitive)), Qt::CaseInsensitive) == true);
+ }
+ else
+ {
+ QFAIL("testSendReceiveMMS: Failed to create message in Draft");
+ //reset connection to 'global on, local off'
+ mmstestbed->setConnectionLocal(false);
+ }
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::sendMMSWithTextAndImageAttachment
+//---------------------------------------------------------------
+void TestMmsPlugin::sendMMSWithTextAndImageAttachment()
+{
+ //Send the MMS message and verify if it was sent successfully.
+ bool sent = msgPlugin->send(mmsMsgId);
+ QVERIFY(sent == true);
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::testSentMMSWithTextAndImageAttachment
+//---------------------------------------------------------------
+void TestMmsPlugin::testSentMMSWithTextAndImageAttachment()
+{
+ QTest::qWait(10000); //to ensure path completion
+
+ //check if outbox-folder signal was received...this means message was moved to outbox for send
+ if( 1 <= spy_outbox->count())
+ {
+ //compare the msgid
+ void * temp = const_cast<void*>(spy_outbox->at(1).at(0).data());
+ long int outboxId = *reinterpret_cast< long int(*)>(temp);
+ QCOMPARE(outboxId, mmsMsgId);
+
+ //push the message from outbox to mmsc(sent folder)
+ mmstestbed->fromOutboxToMmsc();
+ }
+ else
+ {
+ QFAIL("testSendReceiveMMS: Failed to move message to Outbox");
+
+ //reset connection to 'global on, local off'
+ mmstestbed->setConnectionLocal(false);
+ return;
+ }
+
+ //check if sent-folder signal was received....this means message was successfully sent scheduled.
+ if( 1 <= spy_sent->count())
+ {
+ //check for send-path
+ void * temp = const_cast<void*>(spy_sent->at(1).at(0).data());
+ long int sentmsgid = *reinterpret_cast< long int(*)>(temp);
+ QCOMPARE(sentmsgid, mmsMsgId);
+
+ //issue a fetch request on the sent message, to test the receive path
+ mmstestbed->fromMmscToInbox();
+ }
+ else
+ {
+ QFAIL("testSendReceiveMMS: Failed to move message to Sent folder");
+
+ //reset connection to 'global on, local off'
+ mmstestbed->setConnectionLocal(false);
+ return;
+ }
+
+ //check if inbox-folder signal was received....this means message was successfully received at the inbox folder.
+ if( spy_inbox->count() <= 0)
+ {
+ QFAIL("testSendReceiveMMS: Failed to move message to Inbox folder");
+
+ //reset connection to 'global on, local off'
+ mmstestbed->setConnectionLocal(false);
+ }
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::cleanup
+//---------------------------------------------------------------
+void TestMmsPlugin::cleanup()
+{
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::cleanupTestCase
+//---------------------------------------------------------------
+void TestMmsPlugin::cleanupTestCase()
+{
+ //Cleanup
+ delete spy_draft;//Signal for Draft Folder
+ delete spy_outbox;//Signal for Outbox Folder
+ delete spy_sent;//Signal for Sent Folder
+ delete spy_inbox;//Signal for inbox Folder
+ delete msgPlugin;//MMS Plugin
+ delete mmstestbed;//MMS Testbed
+}
+
+//---------------------------------------------------------------
+// getObject
+// factory method to create objects.
+//---------------------------------------------------------------
+QObject* getObject(QString className)
+{
+ if(className == "TestMmsPlugin" )
+ {
+ return new TestMmsPlugin;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+//---------------------------------------------------------------
+// createOutPutDirectory
+// creating o/p directory.
+//---------------------------------------------------------------
+void createOutPutDirectory()
+ {
+ QDir dir;
+ //o/p dir
+ dir.mkdir(OUTPUTDIRECTORY);
+ //tmp dir
+ dir.mkdir(TEMPDIR);
+ // dir inside private folder.
+ dir.mkdir(PRIVATE_DIR);
+ }
+
+//---------------------------------------------------------------
+// main
+// main entry point
+//---------------------------------------------------------------
+int main(int argc, char *argv[])
+ {
+ int ret = -1;
+ QCoreApplication app(argc, argv);
+
+ //creating output directory.
+ createOutPutDirectory();
+
+ QStringList args;
+ QString appName = argv[0];
+ args << appName;
+
+ QString option = "-o";
+ args << option;
+
+ QString outFile = RESULTFILE;
+ outFile = outFile.arg(appClassName);
+ args << outFile;
+
+ QObject* tc = getObject(appClassName);
+
+ if(tc)
+ {
+ ret = QTest::qExec(tc, args);
+ delete tc;
+ }
+ return ret;
+ }
+
+//End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/testmmsplugin/testmmsplugin.pro Sun Jul 25 18:59:19 2010 +0530
@@ -0,0 +1,138 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: Project file for test_mms_plugin
+#
+
+QT += testlib
+QT -= gui
+
+TEMPLATE = app
+TARGET = testmmsplugin
+
+INCLUDEPATH += ./inc
+INCLUDEPATH += ../../../../../../../../inc
+INCLUDEPATH += ../../../../../../unidatautils/unidatamodels/inc
+INCLUDEPATH += ../../../../../editorgenutils/inc
+INCLUDEPATH += ../../../../../../../../inc
+INCLUDEPATH += ../../../../../../../../mmsengine/mmsmessage/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/inc
+INCLUDEPATH += ../../../../../../unidatautils/unidatamodel/inc
+INCLUDEPATH += ../mmstestbed/inc
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+DEFINES += BUILD_TEST_DLL
+
+CONFIG += hb
+CONFIG += symbian_test
+CONFIG += qtestlib
+
+SOURCES += \
+ ./src/testmmsplugin.cpp \
+ ../../../src/unieditormmsplugin.cpp \
+ ../../../src/unieditormmsplugin_p.cpp
+
+# Input
+HEADERS += \
+ ./inc/testmmsplugin.h \
+ ../../../inc/unieditormmsplugin.h \
+ ../../../inc/unieditormmsplugin_p.h
+
+SYMBIAN_PLATFORMS = WINSCW ARMV5
+ symbian {
+ TARGET.UID3 = 0xE274bf60
+ TARGET.CAPABILITY = All -TCB -DRM
+ TARGET.EPOCSTACKSIZE = 0x8000
+ TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
+ VENDORID = VID_DEFAULT
+ BLD_INF_RULES.prj_exports += "data/TestMMSPluginSample.txt c:/data/TestMMSPluginSample.txt"
+ BLD_INF_RULES.prj_exports += "data/TestMMSPluginSmileyFace.gif c:/data/TestMMSPluginSmileyFace.gif"
+ }
+
+LIBS += -leuser \
+ -lconvergedmessageutils \
+ -lMsgMedia \
+ -leditorgenutils \
+ -lcone \
+ -leikcoctl \
+ -leikcore \
+ -leikdlg \
+ -lmsgs \
+ -letext \
+ -lgsmu \
+ -lmmsgenutils \
+ -lefsrv \
+ -lestor \
+ -lsmcm \
+ -lCommonEngine \
+ -lbafl \
+ -lCdlEngine \
+ -lFeatMgr \
+ -lapmime \
+ -lapgrfx \
+ -lcharconv \
+ -lInetProtUtil \
+ -lsmildtd \
+ -lxmldom \
+ -lxmlparser \
+ -lcone \
+ -lQtCore \
+ -letel \
+ -lcommdb \
+ -lcommsdat \
+ -letelmm \
+ -lunidatamodelloader \
+ -lunidatamodel \
+ -lavkon \
+ -leikcoctl \
+ -leikctl \
+ -lform \
+ -luiklaf\
+ -lmmstestbed \
+ -lmmsmessage \
+ -lmmsserversettings \
+ -lxqutils \
+ -lQtContacts
+
+packageheader = "$${LITERAL_HASH}{\"TestMMSPlugin\"},(0xE274bf60),1,0,0,TYPE=SA"
+
+vendorinfo = \
+ "; Localised Vendor name" \
+ "%{\"Nokia\"}" \
+ "; Unique Vendor name" \
+ ":\"Nokia\""
+
+dependencyinfo = \
+ "; Default HW/platform dependencies" \
+ "[0x101F7961],0,0,0,{\"S60ProductID\"}" \
+ "[0x2001E61C],4,6,3,{"Qt"}
+
+default_deployment.pkg_prerules = packageheader \
+ vendorinfo \
+ dependencyinfo
+
+#Copy the dependent DLL
+symbian: {
+ addDll.sources = mmstestbed.dll
+ addDll.path = /sys/bin
+ DEPLOYMENT += addDll
+
+ addFile1.sources = ./data/TestMMSPluginSample.txt
+ addFile1.path = C:/data/
+ DEPLOYMENT += addFile1
+
+ addFile2.sources = ./data/TestMMSPluginSmileyFace.gif
+ addFile2.path = C:/data/
+ DEPLOYMENT += addFile2
+ }
+
\ No newline at end of file
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/tsrc.pro Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/tsrc.pro Sun Jul 25 18:59:19 2010 +0530
@@ -11,12 +11,11 @@
#
# Contributors:
#
-# Description:
+# Description: Project file for testmmsgplugin
#
TEMPLATE = subdirs
-SUBDIRS += mmstestbed/mmstestbed.pro
-SUBDIRS += testmmsgplugin/testmmsplugin.pro
+SUBDIRS += testmmsgpluginapp/testmmsgpluginapp.pro
CONFIG += ordered
\ No newline at end of file
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/inc/unieditorsmsplugin_p.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/inc/unieditorsmsplugin_p.h Sun Jul 25 18:59:19 2010 +0530
@@ -45,7 +45,7 @@
/**
* UniEditorSmsPluginPrivate
*/
-class UniEditorSmsPluginPrivate :public MMsvSessionObserver
+class UniEditorSmsPluginPrivate :public CBase, public MMsvSessionObserver
{
public: // Constructors and destructor
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -35,8 +35,7 @@
QObject(parent),
d_ptr(NULL)
{
- TRAPD(error, d_ptr = UniEditorSmsPluginPrivate::NewL());
- QDEBUG_WRITE_FORMAT("UniEditorSmsPlugin::UniEditorSmsPlugin error = ",error);
+ QT_TRAP_THROWING(d_ptr = UniEditorSmsPluginPrivate::NewL());
}
//---------------------------------------------------------------
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin_p.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin_p.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -1435,6 +1435,9 @@
aText.InsertL( 1, *subject );
aText.InsertL( writePosition-1, KUniSmsEndParenthesis );
}
+
+ CleanupStack::PopAndDestroy( subject );
+
}
// Clears the CSmsHeaders EmailFields for non Email addresses
--- a/messagingapp/shareui/inc/shareuiprivate.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/shareui/inc/shareuiprivate.h Sun Jul 25 18:59:19 2010 +0530
@@ -231,6 +231,12 @@
* Whether to launch the sending application as embedded or not.
*/
bool mIsEmbedded;
+
+ /**
+ * Mapping servicename to the interface descriptor.required to
+ * sort the services.
+ */
+ QMap<QString,XQAiwInterfaceDescriptor > mServiceInterfaceMap;
};
#endif /* __SHARE_UI_PRIVATE_H__ */
--- a/messagingapp/shareui/src/shareuiprivate.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/shareui/src/shareuiprivate.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -31,7 +31,7 @@
#include <HbNotificationDialog>
#include <HbIconItem>
#include <HbTextItem>
-
+#include <HbColorScheme>
#include <xqserviceglobal.h>
#include <xqaiwrequest.h>
#include <xqaiwinterfacedescriptor.h>
@@ -54,6 +54,8 @@
#define LOC_SERVICE_ERROR hbTrId("Service error.")
#define LOC_PROTECTED_CONTENT hbTrId("Protected content.")
+const QString LIST_ITEM_TITLE("qtc_list_item_title_normal");
+
/**
* Constructor.
*/
@@ -84,7 +86,7 @@
delete request;
}
mAiwRequestList.clear();
-
+ mServiceInterfaceMap.clear();
}
/**
@@ -95,106 +97,105 @@
*
*/
bool ShareUiPrivate::init(QStringList& fileList, bool embedded)
- {
+ {
reset();
mIsEmbedded = embedded;
// No input files
- if ( fileList.count() == 0 )
- {
+ if (fileList.count() == 0) {
showNote(LOC_NO_FILES);
- return true;
- }
+ return true;
+ }
#ifdef __SHAREUI_MIME_HANDLING__
// Get the file attributes (MIME and forward lock)
QStringList mimeTypeList;
QStringList forwardStatusList;
getFileAttributes(fileList, mimeTypeList, forwardStatusList);
-
+
// Ignore protected files
QStringList filteredFileList;
QStringList filteredMimeList;
- for ( int i = 0; i < forwardStatusList.count(); i++ )
- {
- if ( forwardStatusList[i].toInt() )
- {
+ for (int i = 0; i < forwardStatusList.count(); i++) {
+ if (forwardStatusList[i].toInt()) {
filteredFileList << fileList[i];
filteredMimeList << mimeTypeList[i];
- }
}
- filteredMimeList.removeDuplicates();
-
+ }
+ filteredMimeList.removeDuplicates();
+
// Some protected content
- if ( fileList.count() != filteredFileList.count() )
- {
- showNote(LOC_PROTECTED_CONTENT);
+ if (fileList.count() != filteredFileList.count()) {
+ showNote(LOC_PROTECTED_CONTENT);
return true;
- }
-
+ }
+
// Only protected content
- if ( filteredFileList.count() == 0 )
- {
+ if (filteredFileList.count() == 0) {
showNote(LOC_NO_FILES);
- return true;
- }
+ return true;
+ }
#endif
#ifdef __SHAREUI_MIME_HANDLING__
- for ( int i = 0; i < filteredFileList.count(); i++ )
- {
+ for (int i = 0; i < filteredFileList.count(); i++) {
mFileList.append(QDir::toNativeSeparators(filteredFileList[i]));
- }
+ }
#else
for ( int i = 0; i < fileList.count(); i++ )
- {
+ {
mFileList.append(QDir::toNativeSeparators(fileList[i]));
- }
+ }
#endif
-
- QList<XQAiwInterfaceDescriptor> serviceDescriptorList =
- mAppManager.list(SERVICE_INTERFACE, SHARE_OP);
- if ( serviceDescriptorList.size() > 0 )
- {
+
+ QList<XQAiwInterfaceDescriptor> serviceDescriptorList = mAppManager.list(SERVICE_INTERFACE,
+ SHARE_OP);
+
+ if (serviceDescriptorList.size() > 0) {
initializeUi();
-
- for ( int i = 0; i < serviceDescriptorList.count() ; i++ )
- {
+ //sorting the services based on service names,
+ //reinserting sorted list into serviceDescriptorList
+ for (int i = 0; i < serviceDescriptorList.count(); i++) {
+ mServiceInterfaceMap.insert(serviceDescriptorList[i].serviceName(),
+ serviceDescriptorList[i]);
+ }
+ QStringList serviceNames = mServiceInterfaceMap.keys();
+ serviceNames.sort();
+ serviceDescriptorList.clear();
+ for (int i = 0; i < serviceNames.count(); i++) {
+ serviceDescriptorList.append(mServiceInterfaceMap.value(serviceNames.at(i)));
+ }
+ for (int i = 0; i < serviceDescriptorList.count(); i++) {
#ifdef __SHAREUI_MIME_HANDLING__
// Filter services based on content type
- QString allowedTypes = serviceDescriptorList[i].customProperty
- (QString("allowed_mime_types"));
- QString blockedTypes = serviceDescriptorList[i].customProperty
- (QString("blocked_mime_types"));
-
+ QString allowedTypes = serviceDescriptorList[i].customProperty(QString(
+ "allowed_mime_types"));
+ QString blockedTypes = serviceDescriptorList[i].customProperty(QString(
+ "blocked_mime_types"));
+
// Check against MIME filters
- if ( ! isContentAllowed( filteredMimeList, allowedTypes ) )
+ if (!isContentAllowed(filteredMimeList, allowedTypes))
continue;
-
- if ( isContentBlocked( filteredMimeList, blockedTypes ) )
- continue;
+
+ if (isContentBlocked(filteredMimeList, blockedTypes))
+ continue;
#endif
HbAction* action = fetchServiceAction(serviceDescriptorList[i]);
- QString iconName = serviceDescriptorList[i].customProperty
- (QString("aiw_action_icon"));
- if ( action )
- {
+ QString iconName = serviceDescriptorList[i].customProperty(QString("aiw_action_icon"));
+ if (action) {
updateShareUiDialogList(action, iconName);
- }
}
-
- if ( mContentItemModel->rowCount() == 0 )
- {
+ }
+ if (mContentItemModel->rowCount() == 0) {
showNote(LOC_NO_SERVICES);
return true;
- }
+ }
mSharePopup->show();
- }
- else
- {
+ }
+ else {
showNote(LOC_NO_SERVICES);
- }
-
+ }
+
return true;
}
@@ -208,6 +209,8 @@
// make it delete itself on close
mSharePopup->setAttribute( Qt::WA_DeleteOnClose, true );
HbTextItem* heading = new HbTextItem(LOC_SEND_SELECTED_ITEM, mSharePopup);
+ QColor color = HbColorScheme::color( LIST_ITEM_TITLE );
+ heading->setTextColor( color );
heading->setAlignment(Qt::AlignCenter);
mSharePopup->setDismissPolicy(HbDialog::TapAnywhere);
mSharePopup->setHeadingWidget(heading);
@@ -486,7 +489,7 @@
HbNotificationDialog* dlg = new HbNotificationDialog();
dlg->setFocusPolicy(Qt::NoFocus);
dlg->setAttribute(Qt::WA_DeleteOnClose, true);
- dlg->setText(text);
+ dlg->setTitle(text);
dlg->show();
}
--- a/messagingapp/smartmessaging/ringbc/inc/ringbc_p.h Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/smartmessaging/ringbc/inc/ringbc_p.h Sun Jul 25 18:59:19 2010 +0530
@@ -21,10 +21,11 @@
#define RINGBC_PRIVATE_H
#include <QString>
+#include <e32base.h>
class RingBCNSMConverter;
-class RingBcPrivate
+class RingBcPrivate :public CBase
{
public:
/**
--- a/messagingapp/smartmessaging/ringbc/src/ringbc.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/smartmessaging/ringbc/src/ringbc.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -35,7 +35,7 @@
RingBc::RingBc()
{
QDEBUG_WRITE("RingBc::RingBc : Enter")
- d_ptr = new RingBcPrivate();
+ QT_TRAP_THROWING(d_ptr = new RingBcPrivate());
QDEBUG_WRITE("RingBc::RingBc : Exit")
}
--- a/messagingapp/smartmessaging/ringbc/src/ringbc_p.cpp Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/smartmessaging/ringbc/src/ringbc_p.cpp Sun Jul 25 18:59:19 2010 +0530
@@ -12,8 +12,7 @@
* Contributors:
*
* Description:
- * A class which takes care of reading the possible new
- * service centres from SIM and adds them to pda-side Sms Settings.
+ *
*
*/
@@ -40,9 +39,7 @@
{
QDEBUG_WRITE("RingBcPrivate::RingBcPrivate : Enter")
-
- TRAP_IGNORE(initL());
-
+ initL();
QDEBUG_WRITE("RingBcPrivate::RingBcPrivate : Exit")
}
@@ -163,6 +160,10 @@
}
CleanupStack::PopAndDestroy(2); // title,fileMan
}
+ else
+ {
+ User::Leave(KErrCorrupt);
+ }
CleanupStack::PopAndDestroy(); // dataBuf
CleanupStack::PopAndDestroy(); //file
--- a/msg_plat/conversation_services_client_api/inc/ccsrequesthandler.h Tue Jul 13 22:09:22 2010 +0530
+++ b/msg_plat/conversation_services_client_api/inc/ccsrequesthandler.h Sun Jul 25 18:59:19 2010 +0530
@@ -216,9 +216,13 @@
* This is a Async API.
*
* @param aClientConversation - class encapsulating Conversation Entry ID
+ * @param aKnownIndex - known index that is fetched
+ * @aPageSize - page size that has to be fetched.
*/
- IMPORT_C void GetConversationsL(
- CCsClientConversation* aClientConversation );
+ IMPORT_C void GetConversationsL(
+ CCsClientConversation* aClientConversation,
+ TInt aKnownIndex,
+ TInt aPageSize);
/**
* Delete a conversation.
@@ -279,8 +283,12 @@
* Data is returned via MCsResultsObserver.
*
* @param aContactId Contact Id.
+ * @param aKnownIndex known index fetched
+ * @param aPageSize page size to be fetched
*/
- IMPORT_C void GetMessagingHistoryL ( TInt aContactId );
+ IMPORT_C void GetMessagingHistoryL(TInt aContactId,
+ TInt aKnownIndex,
+ TInt aPageSize);
/**
* ClearMessagingHistoryL
--- a/msg_plat/conversation_services_client_api/inc/mcsresultsobserver.h Tue Jul 13 22:09:22 2010 +0530
+++ b/msg_plat/conversation_services_client_api/inc/mcsresultsobserver.h Sun Jul 25 18:59:19 2010 +0530
@@ -57,7 +57,8 @@
*/
virtual void Conversations(
- RPointerArray<CCsConversationEntry>& aConversationEntryList) = 0;
+ RPointerArray<CCsConversationEntry>& aConversationEntryList,
+ TInt& aTotalCount) = 0;
};
#endif // __M_CS_RESULTS_OBSERVER_H__