// ----------------------------------------------------------------------------- // CMessageMonitorPlugin::HandleMsgCreatedChangedL // ----------------------------------------------------------------------------- // void CMessageMonitorPlugin::HandleMsgCreatedChangedL( const CMsvEntrySelection& aSelection, const TMsvId aFolderId, const TMsvSessionEvent aEvent ) { WRITELOG("ENTER CMessageMonitorPlugin::HandleMsgCreatedChangedL"); TInt count( aSelection.Count() ); // cycle through every message in the CMsvEntrySelection for ( TInt i=0; i < count; ++i ) { // extract the message server entry from the parameters TMsvId msgId = aSelection[i]; WRITELOG1("msgId: %d", msgId ); TMsvId service = 0; TMsvEntry entry; TInt err = iMsvSession->GetEntry( msgId, service, entry ); WRITELOG1("HandleMsgCreatedChangedL error: %d ", err); THarvesterEventType event = ( aEvent == EMsvEntriesCreated ) || entry.Unread() ? EHarvesterAdd : EHarvesterEdit; // ... we only want to process message entries, that are in the inbox // ... and are valid for adding to Mds. if ( ( !err ) && ( KUidMsvMessageEntry == entry.iType ) && ( KMsvGlobalInBoxIndexEntryId == aFolderId ) && ( entry.Visible() && entry.Complete() && !entry.InPreparation() ) && ( IsValidMessageTypeL( entry, *iMsvSession ) ) ) { HBufC* uri = CreateUriL( entry.iMtm, msgId ); CleanupStack::PushL( uri ); CHarvesterData* hd = CHarvesterData::NewL( uri ); CleanupStack::Pop( uri ); hd->SetEventType( event ); hd->SetBinary( EFalse ); hd->SetTakeSnapshot( EFalse ); iMonitorPluginObserver->MonitorEvent( hd ); } } WRITELOG("END CMessageMonitorPlugin::HandleMsgCreatedChangedL"); }
EXPORT_C void CMsvTestUtils::ListChildrenL(RFile& aFile, CDir& rfcFileList, TInt& aCount, TInt& aEntryCount, TBool aReplace, TBool aOtherFiles) { // Check details of attachments on current context entry // Get list of children IDs CMsvEntrySelection* msvSelection = NULL; TMsvEntry entry; if (iClientServer==EClientSide) { entry = iMsvEntry->Entry(); msvSelection = iMsvEntry->ChildrenL(); } else { entry = iServerEntry->Entry(); msvSelection = new (ELeave) CMsvEntrySelection; iServerEntry->GetChildren(*msvSelection); } CleanupStack::PushL(msvSelection); TInt attachCount = msvSelection->Count(); // For each child .. TPtrC type; SetFolderType(entry, type); TPtrC priority; TMsvPriority temp=entry.Priority(); if(temp==EMsvHighPriority) priority.Set(_L("High ")); else if(temp==EMsvMediumPriority) priority.Set(_L("Medium")); else if(temp==EMsvLowPriority) priority.Set(_L("Low ")); else priority.Set(_L("None ")); TBuf<11> other=_L("------- "); TBuf<6> streams=_L("------"); if ((iClientServer==EClientSide && iMsvEntry->HasStoreL()) || (iClientServer==EServerSide && iServerEntry->HasStoreL())) { CMsvStore* fileStore; fileStore = (iClientServer==EClientSide) ? iMsvEntry->ReadStoreL() : iServerEntry->ReadStoreL(); if(aOtherFiles && fileStore->IsPresentL(KMsvEntryRichTextBody)) { WriteBodyDataL(entry.Id(), iLogsDir, *fileStore, aReplace); streams.Replace(2, 1, _L("B")); } delete fileStore; } if(entry.Attachment()) streams.Replace(3, 1, _L("A")); if (entry.New()) other.Replace(1, 1, _L("N")); if (entry.Unread()) other.Replace(2, 1, _L("U")); if (entry.Complete()) other.Replace(3, 1, _L("C")); TBuf<600> outputLine; // Put details into output string buffer TMsvId current=entry.Id(); if (iClientServer==EClientSide) iMsvEntry->SetEntryL(current); else iServerEntry->SetEntry(current); for(TInt i=0; i<aCount; i++) outputLine.AppendFormat(_L(" ")); outputLine.AppendFormat(TRefByValue<const TDesC>_L("%S, 00%x, Children=%d, Size=%d, Store=%S, P=%S, Other=%S, Det:%S\r\n"), &type, entry.Id(), attachCount, entry.iSize, &streams, &priority, &other, &entry.iDetails); HBufC8* pOutputLine8 = HBufC8::NewLC(outputLine.Length()); pOutputLine8->Des().Copy(outputLine); aFile.Write(pOutputLine8->Des()); CleanupStack::PopAndDestroy(); // pBuf16 for(TInt j=0; j<attachCount; j++) { // Get Context of current message if (iClientServer==EClientSide) iMsvEntry->SetEntryL((*msvSelection)[j]); else iServerEntry->SetEntry((*msvSelection)[j]); aEntryCount++; aCount++; ListChildrenL(aFile, rfcFileList, aCount, aEntryCount, aReplace); aCount--; } CleanupStack::PopAndDestroy(); // msvSelection }