Exemplo n.º 1
0
EXPORT_C void CImOffLineArrayStore::StoreL(CMsvStore& aMsvStore) const
	{
	RMsvWriteStream out;
	out.AssignLC( aMsvStore, KUidImQueuedOperationList ); 
	ExternalizeL(out);
	out.CommitL();
	CleanupStack::PopAndDestroy();
	}
Exemplo n.º 2
0
/** Writes the object to the specified message store.

The function can leave with the standard stream leave codes.

@param aStore Store to which to write
*/
EXPORT_C void TImEmailTransformingInfo::StoreL( CMsvStore& aStore ) const
	{
	RMsvWriteStream out;
	out.AssignLC( aStore, KUidMsgFileTransformingInfo ); // pushes 'out' to the stack
	ExternalizeL(out);
	out.CommitL();
	CleanupStack::PopAndDestroy();
	}
Exemplo n.º 3
0
EXPORT_C void CImOffLineArrayStore::ExternalizeL(RMsvWriteStream& aWriteStream) const
    {
    TInt nr = iArray->CountOperations();
    aWriteStream.WriteUint16L(iVersion);
    aWriteStream.WriteInt32L(nr);
    
    TInt i;
    for ( i = 0 ; i < nr ; i++)
        {
        iArray->Operation( i ).ExternalizeL(aWriteStream);
        }
    }
Exemplo n.º 4
0
// -----------------------------------------------------------------------------
// CWPPushMessage::StoreL
// -----------------------------------------------------------------------------
//
EXPORT_C void CWPPushMessage::StoreL( CMsvStore& aStore ) const
    {
    TUid uid;
    uid.iUid = KProvisioningMessageStreamUid;

    aStore.Remove( uid );

    RMsvWriteStream stream;
    stream.AssignLC( aStore, uid );
    ExternalizeL( stream );
    CleanupStack::PopAndDestroy(); // stream
    }
Exemplo n.º 5
0
EXPORT_C void CImSSmtpSettings::StoreL(CMsvStore& aMsvStore) const
	{
	RMsvWriteStream out;
	out.AssignLC( aMsvStore, KUidMsvServiceEntry ); // pushes 'out' to the stack
	TRAPD(error, ExternalizeL(out));
	if (error==KErrNone)
		out.CommitL();
	out.Close(); // make sure we close the file
	User::LeaveIfError(error);
	aMsvStore.CommitL();
	CleanupStack::PopAndDestroy();
	}
// -----------------------------------------------------------------------------
// CMmsElementDescriptor::Externalize
// -----------------------------------------------------------------------------
//
void CMmsElementDescriptor::ExternalizeL( RMsvWriteStream& aStream  ) const
    {
    TInt32 length = 0;
    length = ContentReference().Length(); 
    aStream.WriteInt32L( length );
    if ( length > 0 )
        {
        aStream << ContentReference();
        }

    length = 0;
    length = ContentType().Length();
    aStream.WriteInt32L( length );
    if ( length > 0 )
        {
        aStream << ContentType();
        }
    }
Exemplo n.º 7
0
// Static functions that do the whole process in one go:
EXPORT_C  void CObexMtmFileNameExternaliser::ExternaliseAndCommit1FileNameL(CMsvEntry* aEntry, const TDesC16* aFileName)
/**
* Static function to write one and only one filename to the message store, then finalise and commit it. This function
* should be called ONCE ONLY. To externalise more than one filename, instantiate this class and use ExternaliseFileNameL()
* followed by CommitStoreL().
* @param aEntry the entry whose store is to be written to
* @param aFileName The filename to write to the store
* @leave KErrXXX system-wide error codes
*/	
	{
	CMsvStore* messageStore = aEntry->EditStoreL();
	CleanupStack::PushL(messageStore);

	RMsvWriteStream messageWriteStream;
	CleanupClosePushL(messageWriteStream);

	messageWriteStream.AssignL(*messageStore, KObexFileNameStreamUid);

	// write the identifier so we know we are internalizing a stream later
#ifndef TEST_INC042468
	messageWriteStream.WriteInt32L(KObexFileNameStreamFileNameUid);
#endif
	messageWriteStream.WriteInt32L(aFileName->Length());  
	messageWriteStream.WriteL(*aFileName);

#ifndef TEST_INC042468
	messageWriteStream.WriteInt32L(KObexFileNameStreamFileNameUid);
#endif
	messageWriteStream.WriteInt32L(0);		//Mark the end of the filename list

	messageWriteStream.CommitL();

	CleanupStack::PopAndDestroy(); // trigger a call to Close(); on messageWriteStream as well as removing from the stack

	messageStore->CommitL();
	CleanupStack::PopAndDestroy(messageStore);
	}
Exemplo n.º 8
0
EXPORT_C void CImOffLineOperation::ExternalizeL( RMsvWriteStream& aWriteStream ) const
	{
    aWriteStream.WriteInt32L(iOpType);
    aWriteStream.WriteInt32L(iMessageId);
    aWriteStream.WriteInt32L(iTargetMessageId);
    aWriteStream.WriteInt32L(iMtmFunctionId);

    if (iMtmParameters)
        {
        TInt length = iMtmParameters->Length();
        aWriteStream.WriteInt32L(length);
        if (length > 0)
            aWriteStream << TPtrC8(*iMtmParameters);
        }
    else
        {
        aWriteStream.WriteInt32L(0);
        }
	return;
	}
Exemplo n.º 9
0
/* Test to check the new API
** CopyStoreL(TInt aDrive, TMsvOp aOperationId, TRequestStatus& aStatus) 
*/
LOCAL_C void TestCopyStoreOperationL()
	{
	CMsgsTestUtils::SetDriveL(EDriveC);
    
	CSessionObserver* ob = new(ELeave)CSessionObserver;
	CleanupStack::PushL(ob);
       
	// Set session in observer
	CMsvSession* session = CMsvSession::OpenAsyncL(*ob);
	ob->iSession = session; 
	CleanupStack::PushL(session);
    
	CActiveScheduler::Start();
	test(ob->iType==MMsvSessionObserver::EMsvServerReady);
	
	//Create an entry in the mail
	
	CMsvEntry* entry=session->GetEntryL(KMsvDraftEntryId);
	CleanupStack::PushL(entry);
	// create entry to work under
	TMsvEntry folder;
	folder.iType = KUidMsvFolderEntry;
	folder.iMtm = KUidMsvLocalServiceMtm;
	folder.iServiceId = KMsvLocalServiceIndexEntryId;
	_LIT(KTestDescription,"A Description");
	_LIT(KTestDetails,"A Details");
	folder.iDescription.Set(KTestDescription);
	folder.iDetails.Set(KTestDetails);
	entry->CreateL(folder);
	entry->SetEntryL(folder.Id());
	CMsvStore* store=entry->EditStoreL();
	CleanupStack::PushL(store);
	RMsvWriteStream stream;
	stream.AssignLC(*store,TUid::Uid(0x1000));
	stream.WriteL(KTestDescription);
	stream.CommitL();
	store->CommitL();
	CleanupStack::PopAndDestroy(3);
            
	CTestActive* active = new(ELeave)CTestActive;
	CleanupStack::PushL(active);
     
	// Test Copy MailStore 
	active->StartL();
	CMsvOperation* operation = NULL;
	TDriveUnit unit =(EDriveD);
	operation = session->CopyStoreL(unit, active->iStatus);
	test(operation->Mtm() == KUidMsvServerMtm);
	CleanupStack::PushL(operation);
	
	CActiveScheduler::Start();
	
	//Retrieve progress 
	TPckgBuf<TMsvCopyProgress> package;
	package.Copy(operation->ProgressL());
	test(package().iError == KErrNone);
		
	//delete session;
	CleanupStack::PopAndDestroy(4);
		
	//Check that both the source and destination
	//MailStore directory structure is same
	
	CMsgsTestUtils::WaitForServerClose();
	
	CDir 		 *srcDir;
	CDir 	     *destDir;
	_LIT(intro, "Testing the directory structure");
	_LIT(KEntryname,"%S");
	
	theUtils->Printf(intro);
	
	TFileName dest = unit.Name();
	dest.Append(KMsvDefaultFolder2);

	User::LeaveIfError(theUtils->FileSession().GetDir(dest, KEntryAttDir|KEntryAttNormal, ESortByName, destDir));
	
	unit =EDriveC;
	TFileName src = unit.Name();
	src.Append(KMsvDefaultFolder2);

	User::LeaveIfError(theUtils->FileSession().GetDir(src, KEntryAttDir|KEntryAttNormal, ESortByName, srcDir));
	
	TInt counter=0;
	TEntry srcEntry;
	TEntry destEntry;

	while (counter<srcDir->Count())
		{
		srcEntry = (*srcDir)[counter];
		destEntry = (*destDir)[counter];
		//Check the sizes 
		test(srcEntry.iSize == destEntry.iSize);
		//Check the names
		test(srcEntry.iName == destEntry.iName);
		//Print out the names on the log
		theUtils->Printf(KEntryname,&(srcEntry.iName));
		counter++;
		}
		
	delete srcDir;
	delete destDir;
	
	}