Esempio n. 1
0
InPacket::InPacket( unsigned char *buf, int len)
	: Packet(buf, &len),
	bodyLength(0)
{
	decryptedBuf = (unsigned char*)malloc(MAX_PACKET_SIZE * sizeof(unsigned char));
	decryptBody(buf, len - QQ_TAIL_LENGTH);
}
Esempio n. 2
0
void CSAEXAppUi::CreateNewSMSMessageL()
    {
    
   	TMsvSelectionOrdering order( KMsvNoGrouping, EMsvSortByDate, ETrue );
    CMsvEntry* folderEntry = CMsvEntry::NewL( *iSession,KMsvDraftEntryId, order );
    CleanupStack::PushL( folderEntry );    
    CMsvEntrySelection* folderSelection = folderEntry->ChildrenWithTypeL(
        KUidMsvMessageEntry );
    CleanupStack::PushL( folderSelection );

	const TInt count( folderSelection->Count() );
	 for ( TInt i( 0 ); i < count; i++ )
	 {
		CMsvEntry *msgEntry; 		
       TMsvId msgEntryId = ( *folderSelection )[ i ];	  
		msgEntry=iSession->GetEntryL( msgEntryId);
		CleanupStack::PushL(msgEntry);

		if( msgEntry!= KErrNone )
		{

				if(true)//msgEntry->Entry().iType)//KUidMsvMessageEntry)
				{				
					CParaFormatLayer* paraLayer = CParaFormatLayer::NewL();
					CleanupStack::PushL(paraLayer); 
					CCharFormatLayer* charLayer = CCharFormatLayer::NewL(); 
					CleanupStack::PushL(charLayer); 
					CRichText* cipherBody = CRichText::NewL(paraLayer, charLayer); 
					CRichText * plainBody=CRichText::NewL(paraLayer, charLayer); 

					CleanupStack::PushL(cipherBody); 
					CleanupStack::PushL(plainBody); 

					CMsvStore* store= msgEntry->ReadStoreL();
					CleanupStack::PushL(store);

					store->RestoreBodyTextL(*cipherBody);

					CSendAs* iSendAs=NULL;   
					iSendAs = CSendAs::NewL(*this);				

					if(iSendAs)
						{
								CleanupStack::PushL(iSendAs);        
								iSendAs->SetMtmL(KUidMsgTypeSMS);        

								if(iSendAs->AvailableServices().Count()<1)
									{
										CEikonEnv::Static()->InfoMsg(_L("No SMS services available."));
										User::Leave(KErrNotFound);
									}
        
								iSendAs->SetService(0); 
        
								User::LeaveIfError(iSendAs->QueryMessageCapability(KUidMtmQueryCanSendMsg, EFalse));
								User::LeaveIfError(iSendAs->QueryMessageCapability(KUidMtmQueryMaxBodySize, ETrue));

        
								iSendAs->CreateMessageL();

								iSendAs->AddRecipientL( iRecipient->Des() );
								//iSendAs->SetSubjectL( KIGainTag ); 
								
								decryptBody(cipherBody,plainBody);								
								iSendAs->SetBodyL(*plainBody);									
								

								User::LeaveIfError(iSendAs->ValidateMessage());
								iSendAs->SaveMessageL(ETrue); // message is saved into Outbox(drafts)

								CleanupStack::PopAndDestroy(1,iSendAs);//plainBody and iSendAs

								
						}		

							CleanupStack::PopAndDestroy(5, paraLayer);	

					}
					else
					{
								CEikonEnv::Static()->AlertWin(_L("No SMS found."));
								User::Leave(KErrNotFound);
					
					}
						CleanupStack::PopAndDestroy(1, msgEntry);	
		}


	 }	 
	 	CleanupStack::PopAndDestroy( 2 ); 	

    }