TBool CSmsReplyToStep::CheckMessageL() { INFO_PRINTF1(_L("Received new message in Inbox - should be status report...")); TMsvSelectionOrdering ordering; ordering.ShowInvisibleEntries(); CMsvEntry* entry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId,ordering); CleanupStack::PushL(entry); CMsvEntrySelection* msvEntrySelection; msvEntrySelection=entry->ChildrenL(); CleanupStack::PushL(msvEntrySelection); // Check how many mesasges there are - should be just 1 TInt count = msvEntrySelection->Count(); INFO_PRINTF3(_L("Number of new messages: %d, should be: %d"), count, 1); // Restore the message CSmsHeader* header = CSmsHeader::NewL(CSmsPDU::ESmsDeliver, *iTestUtils->iRichText); CleanupStack::PushL(header); entry->SetEntryL((*msvEntrySelection)[0]); CMsvStore* store = entry->ReadStoreL(); CleanupStack::PushL(store); header->RestoreL(*store); if(store->HasBodyTextL()) { store->RestoreBodyTextL(*iTestUtils->iRichText); } TBuf<KSmsDescriptionLength> desc; User::LeaveIfError(TSmsUtilities::GetDescription(header->Message(), desc)); //Check for a reply address field CSmsReplyAddressOperations& operations = STATIC_CAST(CSmsReplyAddressOperations&,header->Message().GetOperationsForIEL(CSmsInformationElement::ESmsReplyAddressFormat)); TBool result=operations.ContainsReplyAddressIEL(); CleanupStack::PopAndDestroy(4,entry); return result; }
// --------------------------------------------------------- // MsgStoreHandler::HandleClass0SmsL() // --------------------------------------------------------- // void MsgStoreHandler::HandleClass0SmsL(CMsvEntry* aMsgEntry, TMsvId aMsgId) { CleanupStack::PushL(aMsgEntry); CMsvStore* store = aMsgEntry->ReadStoreL(); CleanupStack::PushL(store); CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL(); CleanupStack::PushL(paraFormatLayer); CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL(); CleanupStack::PushL(charFormatLayer); CRichText* richText = CRichText::NewL(paraFormatLayer, charFormatLayer); CleanupStack::PushL(richText); store->RestoreBodyTextL(*richText); TInt len = richText->DocumentLength(); HBufC* bufBody = HBufC::NewLC(len * 2); // Get Body content of SMS message TPtr bufBodyPtr = bufBody->Des(); richText->Extract(bufBodyPtr, 0, len); //convert bufbody to qstring.. QString body = XQConversions::s60DescToQString(*bufBody); Class0Info class0Info; class0Info.body = body; CleanupStack::PopAndDestroy(bufBody); // Get From address of SMS message CPlainText* nullString = CPlainText::NewL(); CleanupStack::PushL(nullString); CSmsHeader* smsheader = CSmsHeader::NewL(CSmsPDU::ESmsDeliver, *nullString); CleanupStack::PushL(smsheader); smsheader->RestoreL(*store); QString address = XQConversions::s60DescToQString(smsheader->FromAddress()); class0Info.address = address; // Get alias of SMS message QString alias; int count; MsgContactHandler::resolveContactDisplayName(address, alias, count); class0Info.alias = alias; // Get timestamp of SMS message QDateTime timeStamp; TTime time = aMsgEntry->Entry().iDate; TTime unixEpoch(KUnixEpoch); TTimeIntervalSeconds seconds; time.SecondsFrom(unixEpoch, seconds); timeStamp.setTime_t(seconds.Int()); const QString times = timeStamp.toString("dd/MM/yy hh:mm ap"); class0Info.time = times; class0Info.messageId = aMsgId; CleanupStack::PopAndDestroy(7); aMsgEntry = NULL; // Show the SMS message.. iNotifier->ShowClass0Message(class0Info); }