/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ void CFakeSMSSender::AppendMessageDataL(TMsvId aEntryId,const TDesC& aRecipient) { CMsvEntry* entry = iMsvSession->GetEntryL(aEntryId); CleanupStack::PushL(entry); CSmsClientMtm* MySmsMtm = static_cast<CSmsClientMtm*>(iMtmReg->NewMtmL(KUidMsgTypeSMS)); MySmsMtm->SetCurrentEntryL(entry); CleanupStack::Pop(); //entry entry = NULL; CleanupStack::PushL(MySmsMtm); MySmsMtm->RestoreServiceAndSettingsL(); CMsvStore* srore = MySmsMtm->Entry().EditStoreL(); CleanupStack::PushL(srore); if(srore) { MySmsMtm->SmsHeader().RestoreL(*srore); } CleanupStack::PopAndDestroy(srore); CSmsHeader& header = MySmsMtm->SmsHeader(); if (header.Message().ServiceCenterAddress().Length() == 0) { CSmsSettings* serviceSettings = &(MySmsMtm->ServiceSettings()); const TInt numSCAddresses = serviceSettings->ServiceCenterCount(); if (numSCAddresses) { TInt scIndex=0; scIndex = serviceSettings->DefaultServiceCenter(); if ((scIndex < 0) || (scIndex >= numSCAddresses)) { scIndex = 0; //??? } //get the service center number: TPtrC serviceCentreNumber = serviceSettings->GetServiceCenter(scIndex).Address(); //This can only be used on SMS-SUBMIT type messages. The message PDU //type can be checked by using the CSmsHeader::Type API. header.SetServiceCenterAddressL(serviceCentreNumber); } } MySmsMtm->SmsHeader().SetFromAddressL(aRecipient); MySmsMtm->SaveMessageL(); CleanupStack::PopAndDestroy(1);//MySmsMtm }
// ----------------------------------------------------------------------------- // CMessageMonitorPlugin::HandleMsgMovedL // ----------------------------------------------------------------------------- // void CMessageMonitorPlugin::HandleMsgMovedL( const TMsvId aFolderId1, const TMsvId aFolderId2, const CMsvEntrySelection& aSelection ) { WRITELOG("ENTER CMessageMonitorPlugin::HandleMsgMovedL"); TInt count( aSelection.Count() ); // cycle through every message in the CMsvEntrySelection for ( TInt i=0; i < count; ++i ) { TMsvId msgId = aSelection[i]; WRITELOG1("msgId: %d", msgId ); TMsvId service = 0; TMsvEntry entry; TInt err = iMsvSession->GetEntry( msgId, service, entry ); // if we have a message and it has been moved from the outbox to the sent // items, and it is a valid message if ( ( !err ) && ( KUidMsvMessageEntry == entry.iType ) && ( KMsvSentEntryId == aFolderId1 ) && ( KMsvGlobalOutBoxIndexEntryId == aFolderId2 ) && ( IsValidMessageTypeL( entry, *iMsvSession ) ) ) { HBufC* uri = CreateUriL( entry.iMtm, msgId ); CleanupStack::PushL( uri ); CHarvesterData* hd = CHarvesterData::NewL( uri ); CleanupStack::Pop( uri ); hd->SetEventType( EHarvesterAdd ); hd->SetTakeSnapshot( EFalse ); hd->SetBinary( EFalse ); iMonitorPluginObserver->MonitorEvent( hd ); } #ifdef __WINSCW__ else if (!err && KMsvDraftEntryId == aFolderId2 && KMsvGlobalOutBoxIndexEntryId == aFolderId1 ) { if( entry.iMtm.iUid != KUidMsgTypeMultimedia.iUid ) { CClientMtmRegistry* clientMtmReg; clientMtmReg = CClientMtmRegistry::NewL(*iMsvSession); CleanupStack::PushL(clientMtmReg); CSmsClientMtm* smsMtm = static_cast<CSmsClientMtm*>(clientMtmReg->NewMtmL(KUidMsgTypeSMS)); CleanupStack::PushL(smsMtm); smsMtm->SwitchCurrentEntryL( msgId ); TMsvSelectionOrdering selection; selection.SetShowInvisibleEntries(ETrue); CMsvEntry* parentEntry = CMsvEntry::NewL( smsMtm->Session(), smsMtm->Entry().Entry().Parent(), selection ); CleanupStack::PushL(parentEntry); // Move the message TRAP_IGNORE( parentEntry->MoveL( msgId, KMsvSentEntryId ) ); CleanupStack::PopAndDestroy(3,clientMtmReg); // parentEntry } } #endif } WRITELOG("END CMessageMonitorPlugin::HandleMsgMovedL"); }