1.1 --- a/epoc32/include/imcvsend.inl Wed Mar 31 12:27:01 2010 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,744 +0,0 @@
1.4 -// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 -// All rights reserved.
1.6 -// This component and the accompanying materials are made available
1.7 -// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.8 -// which accompanies this distribution, and is available
1.9 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 -//
1.11 -// Initial Contributors:
1.12 -// Nokia Corporation - initial contribution.
1.13 -//
1.14 -// Contributors:
1.15 -//
1.16 -// Description:
1.17 -//
1.18 -
1.19 -//----------------------------------------------------------------------------------------
1.20 -inline LOCAL_C void AppendCRLF( TDes8& rOutputLine, TInt& rPaddingCount )
1.21 -//----------------------------------------------------------------------------------------
1.22 - {
1.23 - rOutputLine.Append( TPtrC8(KImcvCRLF) );
1.24 - rPaddingCount += KImcvCRLF().Length();
1.25 - }
1.26 -
1.27 -
1.28 -//----------------------------------------------------------------------------------------
1.29 -inline LOCAL_C TInt AddCRLF(TDes8& rOutputLine)
1.30 -//----------------------------------------------------------------------------------------
1.31 - {
1.32 - rOutputLine = KImcvCRLF;
1.33 - return 1;
1.34 - }
1.35 -
1.36 -//----------------------------------------------------------------------------------------
1.37 -inline LOCAL_C void AddCRLF( TDes8& rOutputLine, TInt& rPaddingCount )
1.38 -//----------------------------------------------------------------------------------------
1.39 - {
1.40 - rOutputLine=TPtrC8(KImcvCRLF);
1.41 - rPaddingCount = KImcvCRLF().Length();
1.42 - }
1.43 -
1.44 -//----------------------------------------------------------------------------------------
1.45 -inline LOCAL_C void AddCRLFAtEndOfLine( TDes8& rOutputLine, TInt& rPaddingCount)
1.46 -//----------------------------------------------------------------------------------------
1.47 - {
1.48 - TInt length = rOutputLine.Length();
1.49 - if ( length < 2 || (rOutputLine[length-2] != KImcvCR || rOutputLine[length-1] != KImcvLF) )
1.50 - {
1.51 - rOutputLine.Append( KImcvCRLF );
1.52 - rPaddingCount += 2;
1.53 - }
1.54 - }
1.55 -
1.56 -//----------------------------------------------------------------------------------------
1.57 -inline TBool IsLineCRLF( TDesC8& aOutputLine )
1.58 -//----------------------------------------------------------------------------------------
1.59 - {
1.60 - TInt length = aOutputLine.Length();
1.61 - if ( length < 2 || (aOutputLine[length-2] != KImcvCR || aOutputLine[length-1] != KImcvLF) )
1.62 - return EFalse;
1.63 - return ETrue;
1.64 - }
1.65 -
1.66 -
1.67 -//****************************************************************************************
1.68 -// Class CImEmailTraverser Functions
1.69 -//****************************************************************************************
1.70 -
1.71 -
1.72 -//----------------------------------------------------------------------------------------
1.73 -inline TInt CImEmailTraverser::CurrentEntry()
1.74 -//----------------------------------------------------------------------------------------
1.75 - {
1.76 - return iCurrentEntryList[0];
1.77 - }
1.78 -
1.79 -//----------------------------------------------------------------------------------------
1.80 -inline CMsvEntrySelection& CImEmailTraverser::CurrentList() const
1.81 -//----------------------------------------------------------------------------------------
1.82 - {
1.83 - return *(*iSelectionList)[0];
1.84 - }
1.85 -
1.86 -//----------------------------------------------------------------------------------------
1.87 -inline TBool CImEmailTraverser::DeleteCurrentList()
1.88 -//----------------------------------------------------------------------------------------
1.89 - {
1.90 - if (!LevelExists())
1.91 - return EFalse;
1.92 -
1.93 - delete &CurrentList();
1.94 - iSelectionList->Delete(0);
1.95 - iCurrentEntryList.Delete(0);
1.96 - return ETrue;
1.97 - }
1.98 -
1.99 -//----------------------------------------------------------------------------------------
1.100 -inline void CImEmailTraverser::AddList(CMsvEntrySelection& children)
1.101 -//----------------------------------------------------------------------------------------
1.102 - {
1.103 - iSelectionList->InsertL(0, &children);
1.104 - iCurrentEntryList.InsertL(0, 0);
1.105 - }
1.106 -
1.107 -//----------------------------------------------------------------------------------------
1.108 -inline TBool CImEmailTraverser::LevelExists() const
1.109 -//----------------------------------------------------------------------------------------
1.110 - {
1.111 - return iSelectionList->Count();
1.112 - }
1.113 -
1.114 -//----------------------------------------------------------------------------------------
1.115 -inline TBool CImEmailTraverser::IsBaseLevel() const
1.116 -//----------------------------------------------------------------------------------------
1.117 - {
1.118 - return ThisEntry().Id()==iBaseId ? ETrue: EFalse;;
1.119 - }
1.120 -
1.121 -//----------------------------------------------------------------------------------------
1.122 -inline void CImEmailTraverser::SetBaseEntry()
1.123 -//----------------------------------------------------------------------------------------
1.124 - {
1.125 - iServerEntry.SetEntry(iBaseId);
1.126 - }
1.127 -
1.128 -//----------------------------------------------------------------------------------------
1.129 -inline const TMsvEntry& CImEmailTraverser::ThisEntry() const
1.130 -//----------------------------------------------------------------------------------------
1.131 - {
1.132 - return iServerEntry.Entry();
1.133 - }
1.134 -
1.135 -
1.136 -//****************************************************************************************
1.137 -// Class CImSendMimeEmail Functions
1.138 -//****************************************************************************************
1.139 -
1.140 -//----------------------------------------------------------------------------------------
1.141 -inline void CImSendMimeEmail::Boundary(TDes8& rOutputLine)
1.142 -//----------------------------------------------------------------------------------------
1.143 - {
1.144 - rOutputLine.Append( (*iBoundaryArray)[0] );
1.145 - }
1.146 -
1.147 -//----------------------------------------------------------------------------------------
1.148 -inline TPtrC8 CImSendMimeEmail::Boundary()
1.149 -//----------------------------------------------------------------------------------------
1.150 - {
1.151 - return (*iBoundaryArray)[0];
1.152 - }
1.153 -
1.154 -//----------------------------------------------------------------------------------------
1.155 -inline TInt CImSendMimeEmail::SendBoundaryLine(TDes8& rOutputLine, TInt& rPaddingCount)
1.156 -//----------------------------------------------------------------------------------------
1.157 - {
1.158 - rOutputLine.Append(KImcvMimeBoundaryStartEnd);
1.159 - Boundary( rOutputLine );
1.160 - rPaddingCount += (*iBoundaryArray)[0].Length() + 2;
1.161 - return 1;
1.162 - }
1.163 -
1.164 -
1.165 -// Sets iState to EEndBoundary or EEndOfEmail
1.166 -// returns true if entry found
1.167 -//----------------------------------------------------------------------------------------
1.168 -inline TBool CImSendMimeEmail::Down(TMsvEntry& rEntry)
1.169 -//----------------------------------------------------------------------------------------
1.170 - {
1.171 - TInt ret = iEmailTraverser->DownLevelL() ? ETrue:EFalse;
1.172 -
1.173 - if (ret)
1.174 - rEntry = iEmailTraverser->ThisEntry();
1.175 - return ret;
1.176 - }
1.177 -
1.178 -//----------------------------------------------------------------------------------------
1.179 -inline void CImSendMimeEmail::GetNextEntryL(TMsvEntry& rEntry)
1.180 -//----------------------------------------------------------------------------------------
1.181 - {
1.182 - if ( (iState!=EEndBoundary && iState!=ELineAfterEndBoundary) && Down(rEntry) )
1.183 - iState=EBoundary;
1.184 - else if ( iEmailTraverser->NextEntryL(rEntry) )
1.185 - iState=EBoundary;
1.186 - else if (iEmailTraverser->UpLevelL() )
1.187 - {
1.188 - if (iServerEntry.Entry().iType==KUidMsvMessageEntry && !(iEmailTraverser->IsBaseLevel()))
1.189 - {
1.190 - // Embedded non-mime message
1.191 - iState=EEndBoundary;
1.192 - GetNextEntryL(rEntry);
1.193 - }
1.194 - else
1.195 - iState=EEndBoundary;
1.196 - }
1.197 - else
1.198 - iState=KImCvFinished;
1.199 - }
1.200 -
1.201 -
1.202 -//----------------------------------------------------------------------------------------
1.203 -inline TPtrC8 CImSendMimeEmail::SetBoundaryL(TBool aMultipart)
1.204 -//----------------------------------------------------------------------------------------
1.205 - {
1.206 - if (!aMultipart)
1.207 - return TPtrC8();
1.208 -
1.209 - CreateBoundaryL();
1.210 - return (*iBoundaryArray)[0];
1.211 - }
1.212 -
1.213 -//----------------------------------------------------------------------------------------
1.214 -inline TBool CImSendMimeEmail::CheckForEmbeddedEmailL(const TMsvEntry& aEntry) const
1.215 -//----------------------------------------------------------------------------------------
1.216 - {
1.217 - return (aEntry.iType==KUidMsvMessageEntry);
1.218 - }
1.219 -
1.220 -//----------------------------------------------------------------------------------------
1.221 -inline TBool CImSendMimeEmail::CheckForMultipartEmailL(TMsvEntry& rEntry, TImEmailFolderType& aFolder)
1.222 -//----------------------------------------------------------------------------------------
1.223 - {
1.224 - TMsvEmailEntry emailEntry = (TMsvEmailEntry)rEntry;
1.225 -
1.226 - aFolder = emailEntry.MessageFolderType();
1.227 - if (aFolder==EFolderTypeMixed || aFolder==EFolderTypeDigest ||
1.228 - aFolder==EFolderTypeAlternative || aFolder==EFolderTypeRelated )
1.229 - return ETrue;
1.230 -
1.231 - if ( ! Down(emailEntry) )
1.232 - return EFalse;
1.233 -
1.234 - if ( iEmailTraverser->CurrentList().Count()==1 &&
1.235 - iEmailTraverser->ThisEntry().iType==KUidMsvFolderEntry )
1.236 - {
1.237 - aFolder = ((TMsvEmailEntry&)iEmailTraverser->ThisEntry()).MessageFolderType();
1.238 - iEmailTraverser->UpLevelL();
1.239 - return ETrue;
1.240 - }
1.241 -
1.242 - iEmailTraverser->UpLevelL();
1.243 - return EFalse;
1.244 - }
1.245 -
1.246 -//****************************************************************************************
1.247 -// Class CImSendRfc822Header Functions
1.248 -//****************************************************************************************
1.249 -
1.250 -//----------------------------------------------------------------------------------------
1.251 -inline TInt CImSendRfc822Header::XMailerL(TDes8& rOutputLine)
1.252 -//----------------------------------------------------------------------------------------
1.253 - {
1.254 - rOutputLine = KImcvXMailer;
1.255 - rOutputLine.Append(*iProductName);
1.256 - return 1;
1.257 - }
1.258 -
1.259 -//----------------------------------------------------------------------------------------
1.260 -inline TInt CImSendRfc822Header::MessageIdL( TDes8& rOutputLine )
1.261 -//----------------------------------------------------------------------------------------
1.262 - {
1.263 - if ( !iHeader->ImMsgId().Length() )
1.264 - return 1;
1.265 -
1.266 - PrepareBufferL( TPtrC8(KImcvMessageIdPrompt), iHeader->ImMsgId());
1.267 - return SendOutput( rOutputLine );
1.268 - }
1.269 -
1.270 -//----------------------------------------------------------------------------------------
1.271 -inline TInt CImSendRfc822Header::ToL(TDes8& rOutputLine)
1.272 -//----------------------------------------------------------------------------------------
1.273 - {
1.274 - return DoRecipientsL(rOutputLine, TPtrC8(KImcvToPrompt), iHeader->ToRecipients());
1.275 - }
1.276 -
1.277 -//----------------------------------------------------------------------------------------
1.278 -inline TInt CImSendRfc822Header::CcL(TDes8& rOutputLine)
1.279 -//----------------------------------------------------------------------------------------
1.280 - {
1.281 - return DoRecipientsL(rOutputLine, TPtrC8(KImcvCcPrompt), iHeader->CcRecipients());
1.282 - }
1.283 -
1.284 -//----------------------------------------------------------------------------------------
1.285 -inline TInt CImSendRfc822Header::BccL(TDes8& rOutputLine)
1.286 -//----------------------------------------------------------------------------------------
1.287 - {
1.288 - return DoRecipientsL(rOutputLine, TPtrC8(KImcvBccPrompt), iHeader->BccRecipients());
1.289 - }
1.290 -
1.291 -//----------------------------------------------------------------------------------------
1.292 -inline TInt CImSendRfc822Header::FromL( TDes8& rOutputLine )
1.293 -//----------------------------------------------------------------------------------------
1.294 - {
1.295 - PrepareBufferL( TPtrC8(KImcvFromPrompt), iHeader->From());
1.296 - return SendOutput( rOutputLine );
1.297 - }
1.298 -
1.299 -//----------------------------------------------------------------------------------------
1.300 -inline TInt CImSendRfc822Header::ReplyToL( TDes8& rOutputLine )
1.301 -//----------------------------------------------------------------------------------------
1.302 - {
1.303 - if ( !iHeader->ReplyTo().Length() )
1.304 - return 1;
1.305 -
1.306 - PrepareBufferL( TPtrC8(KImcvReplyToPrompt), iHeader->ReplyTo() );
1.307 - return SendOutput( rOutputLine );
1.308 - }
1.309 -
1.310 -//----------------------------------------------------------------------------------------
1.311 -inline TInt CImSendRfc822Header::SubjectL( TDes8& rOutputLine )
1.312 -//----------------------------------------------------------------------------------------
1.313 - {
1.314 - // If the subject field has already been encoded and stored in iOutputBuffer
1.315 - // then there is no need to encode again.
1.316 - if (!iOutputBuffer)
1.317 - {
1.318 - PrepareBufferL( TPtrC8(KImcvSubjectPrompt), iHeader->Subject() );
1.319 - }
1.320 - return SendOutput( rOutputLine );
1.321 - }
1.322 -
1.323 -
1.324 -//----------------------------------------------------------------------------------------
1.325 -inline TInt CImSendRfc822Header::ReturnReceiptsL(TDes8& rOutputLine)
1.326 -//----------------------------------------------------------------------------------------
1.327 - {
1.328 - // SendReturnReceiptFieldsL() will always return one choice.
1.329 - // In future it can be changed to add more fields
1.330 -
1.331 - TPtrC address;
1.332 - if ( iHeader->ReceiptAddress().Length() )
1.333 - address.Set(iHeader->ReceiptAddress());
1.334 - else if ( iHeader->ReplyTo().Length() )
1.335 - address.Set(iHeader->ReplyTo());
1.336 - else
1.337 - return 1; // No valid a address
1.338 -
1.339 - CDesC8Array* receiptsFields=new (ELeave)CDesC8ArrayFlat(KArrayAllocationNumber);
1.340 - CleanupStack::PushL(receiptsFields);
1.341 - CImcvUtils::SendReturnReceiptFieldsL(*receiptsFields);
1.342 - TInt count=receiptsFields->Count();
1.343 - for (TInt i=0;i<count;i++)
1.344 - PrepareBufferL((*receiptsFields)[i], address);
1.345 -
1.346 - CleanupStack::PopAndDestroy(); //receiptsFields
1.347 - return SendOutput( rOutputLine );
1.348 - }
1.349 -
1.350 -//----------------------------------------------------------------------------------------
1.351 -inline TBool CImSendRfc822Header::FieldIsEmailAddress() const
1.352 -//----------------------------------------------------------------------------------------
1.353 - {
1.354 - return (iState != ESubject);
1.355 - }
1.356 -
1.357 -//----------------------------------------------------------------------------------------
1.358 -inline const TImEmailTransformingInfo& CImSendRfc822Header::TransformingInfo() const
1.359 -//----------------------------------------------------------------------------------------
1.360 - {
1.361 - return iTransformingInfo;
1.362 - }
1.363 -
1.364 -
1.365 -
1.366 -//****************************************************************************************
1.367 -// Class CImSendMimeHeader Functions
1.368 -//****************************************************************************************
1.369 -
1.370 -
1.371 -//----------------------------------------------------------------------------------------
1.372 -inline TInt CImSendMimeHeader::BlankLine(TDes8& rOutputLine) const
1.373 -//----------------------------------------------------------------------------------------
1.374 - {
1.375 - rOutputLine = KNullDesC8;
1.376 - return 1;
1.377 - }
1.378 -
1.379 -//----------------------------------------------------------------------------------------
1.380 -inline TInt CImSendMimeHeader::MimeVersion(TDes8& rOutputLine) const
1.381 -//----------------------------------------------------------------------------------------
1.382 - {
1.383 - rOutputLine = KImcvMimePrompt;
1.384 - rOutputLine.Append(KImcvSpMimeVersion);
1.385 - return 1;
1.386 - }
1.387 -
1.388 -//----------------------------------------------------------------------------------------
1.389 -inline TBool CImSendMimeHeader::ContentType(TDes8& rOutputLine) const
1.390 -//----------------------------------------------------------------------------------------
1.391 - {
1.392 - TBool isText = EFalse;
1.393 - rOutputLine = KImcvContentType;
1.394 - rOutputLine.Append(KImcvSpace);
1.395 -
1.396 - if (((TMsvEmailEntry&)iEntry).VCard())
1.397 - {
1.398 - rOutputLine.Append(KImcvText);
1.399 - rOutputLine.Append( KImcvForwardSlash );
1.400 - rOutputLine.Append(KImcvDirectory);
1.401 - rOutputLine.Append( KImcvSemiColon );
1.402 - rOutputLine.Append( KImcvSpace );
1.403 - rOutputLine.Append( KImcvProfile );
1.404 - rOutputLine.Append( KImcvEquals );
1.405 - rOutputLine.Append( KImcvVCard );
1.406 - isText=ETrue;
1.407 - }
1.408 - else if (((TMsvEmailEntry&)iEntry).VCalendar())
1.409 - {
1.410 - rOutputLine.Append(KImcvText);
1.411 - rOutputLine.Append( KImcvForwardSlash );
1.412 - rOutputLine.Append(KImcvVCalender);
1.413 - isText=ETrue;
1.414 - }
1.415 - else if (iEntry.iType == KUidMsvEmailHtmlEntry)
1.416 - {
1.417 - rOutputLine.Append(KImcvText);
1.418 - rOutputLine.Append( KImcvForwardSlash );
1.419 - rOutputLine.Append(KImcvHtml);
1.420 - isText=ETrue;
1.421 - }
1.422 - else if ( iMimeHeader->ContentType().Length() )
1.423 - {
1.424 - TPtrC8 contentType = iMimeHeader->ContentType();
1.425 - rOutputLine.Append( contentType );
1.426 -
1.427 - TPtrC8 contentSubType = iMimeHeader->ContentSubType();
1.428 - if ( contentSubType.Length() )
1.429 - {
1.430 - rOutputLine.Append( KImcvForwardSlash );
1.431 - rOutputLine.Append( iMimeHeader->ContentSubType() );
1.432 - }
1.433 -
1.434 - isText = contentType.CompareF(KImcvText) ? EFalse : ETrue;
1.435 -
1.436 -
1.437 - // If the content-Type is text/calendar we need to add two
1.438 - // parameters: "method" and "component"
1.439 -// GS : do we need extra parameters for vCal??
1.440 - TPtrC8 parameter;
1.441 -
1.442 - if ( contentType.Length() && contentSubType.Length() )
1.443 - if ( isText && !(contentSubType.CompareF(KImcvICalendar)) )
1.444 - {
1.445 - // METHOD parameter
1.446 - parameter.Set(iMimeHeader->GetContentTypeValue(KImcvICalendarMethod));
1.447 - if ( parameter.Length() )
1.448 - {
1.449 - rOutputLine.Append( KImcvSemiColon );
1.450 - rOutputLine.Append( KImcvSpace );
1.451 - rOutputLine.Append( KImcvICalendarMethod );
1.452 - rOutputLine.Append( KImcvEquals );
1.453 - rOutputLine.Append( parameter );
1.454 - }
1.455 -
1.456 - // COMPONENT parameter
1.457 - parameter.Set(iMimeHeader->GetContentTypeValue(KImcvICalendarComponent));
1.458 - if ( parameter.Length() )
1.459 - {
1.460 - rOutputLine.Append( KImcvSemiColon );
1.461 - rOutputLine.Append( KImcvSpace );
1.462 - rOutputLine.Append( KImcvICalendarComponent );
1.463 - rOutputLine.Append( KImcvEquals );
1.464 - rOutputLine.Append( parameter );
1.465 - }
1.466 - }
1.467 -
1.468 - }
1.469 - else if (iEntry.iType == KUidMsvAttachmentEntry)
1.470 - rOutputLine.Append( KImcvApplOctet );
1.471 - else if (iEntry.iType==KUidMsvEmailTextEntry || (!iIsMultipart && !iEntry.Attachment()))
1.472 - {
1.473 - rOutputLine.Append(KImcvText);
1.474 - rOutputLine.Append( KImcvForwardSlash );
1.475 - rOutputLine.Append(KImcvPlain);
1.476 - isText=ETrue;
1.477 - }
1.478 - else
1.479 - {
1.480 - rOutputLine.SetLength(0);
1.481 - return EFalse;
1.482 - }
1.483 -
1.484 - if (isText)
1.485 - {
1.486 - rOutputLine.Append( KImcvSemiColon );
1.487 - rOutputLine.Append( KImcvSpace );
1.488 - rOutputLine.Append( KImcvCharset );
1.489 - rOutputLine.Append( KImcvEquals );
1.490 - rOutputLine.Append( GetCharsetString() );
1.491 - }
1.492 - else if ( iBoundaryString.Length() )
1.493 - rOutputLine.Append(KImcvSemiColon); // boundary to follow
1.494 -
1.495 - return ETrue;
1.496 - }
1.497 -
1.498 -//----------------------------------------------------------------------------------------
1.499 -inline TBool CImSendMimeHeader::TransferEncoding(TDes8& rOutputLine) const
1.500 -//----------------------------------------------------------------------------------------
1.501 - {
1.502 - TPtrC8 encodingType = EncodingType();
1.503 -
1.504 - if (iEntry.iType!=KUidMsvFolderEntry && encodingType.Length())
1.505 - {
1.506 - rOutputLine = KImcvContentTransferEncoding;
1.507 - rOutputLine.Append(encodingType);
1.508 - return ETrue;
1.509 - }
1.510 -
1.511 - return EFalse;
1.512 - }
1.513 -
1.514 -//----------------------------------------------------------------------------------------
1.515 -inline TInt CImSendMimeHeader::ContentLanguage(TDes8& rOutputLine) const
1.516 -//----------------------------------------------------------------------------------------
1.517 - {
1.518 - rOutputLine = KImcvContentLanguage;
1.519 - rOutputLine.Append(KImcvDefaultLanguage);
1.520 - return 1;
1.521 - }
1.522 -
1.523 -//----------------------------------------------------------------------------------------
1.524 -inline TBool CImSendMimeHeader::Description( TDes8& rOutputLine ) const
1.525 -//----------------------------------------------------------------------------------------
1.526 - {
1.527 - TPtrC8 description = iMimeHeader->ContentDescription();
1.528 -
1.529 - if ( !description.Length() )
1.530 - return EFalse;
1.531 -
1.532 - rOutputLine = KImcvContentDescription;
1.533 - rOutputLine.Append(KImcvSpace);
1.534 - rOutputLine.Append( description );
1.535 - return ETrue;
1.536 - }
1.537 -
1.538 -
1.539 -//----------------------------------------------------------------------------------------
1.540 -inline TInt CImSendMimeHeader::Boundary(TDes8& rOutputLine) const
1.541 -//----------------------------------------------------------------------------------------
1.542 - {
1.543 - rOutputLine.Append(KImcvSpace);
1.544 - rOutputLine.Append(KImcvSpace);
1.545 - rOutputLine.Append(KImcvBoundary);
1.546 - rOutputLine.Append(KImcvEquals);
1.547 - rOutputLine.Append(KImcvQuote);
1.548 - rOutputLine.Append(iBoundaryString);
1.549 - rOutputLine.Append(KImcvQuote);
1.550 - return 1;
1.551 - }
1.552 -
1.553 -//----------------------------------------------------------------------------------------
1.554 -inline TBool CImSendMimeHeader::Disposition( TDes8& rOutputLine, TInt& rAdvance)
1.555 -//----------------------------------------------------------------------------------------
1.556 - {
1.557 - rAdvance++;
1.558 - if (iEntry.iType == KUidMsvFolderEntry)
1.559 - return EFalse;
1.560 -
1.561 - if(iLine==EFirstLine)
1.562 - {
1.563 - TPtrC8 disposition = iMimeHeader->ContentDisposition();
1.564 -
1.565 - // Four cases : (2)disposition explicitly attachment,
1.566 - // (3) Non Multipart message with attachment flag set.
1.567 - // (4) Embedded email
1.568 -
1.569 - if ( iEntry.iType==KUidMsvAttachmentEntry ||
1.570 - disposition==KImcvAttachment ||
1.571 - (!iIsMultipart && iEntry.iType!=KUidMsvMessageEntry && iEntry.Attachment()) )
1.572 - {
1.573 - rOutputLine = KImcvContentDisposition;
1.574 - rOutputLine.Append(KImcvSpace);
1.575 - rOutputLine.Append(KImcvAttachment);
1.576 - rOutputLine.Append(KImcvSemiColon);
1.577 - iLine++;
1.578 - rAdvance--;
1.579 - return ETrue;
1.580 - }
1.581 - else if (iEntry.iType==KUidMsvEmailTextEntry )
1.582 - {
1.583 - rOutputLine = KImcvContentDisposition;
1.584 - rOutputLine.Append(KImcvSpace);
1.585 - rOutputLine.Append(KImcvInline);
1.586 - return ETrue;
1.587 - }
1.588 - else if (iEntry.iType==KUidMsvMessageEntry && iDealingWithAnEmbeddedEmail)
1.589 - {
1.590 - rOutputLine = KImcvContentDisposition;
1.591 - rOutputLine.Append(KImcvSpace);
1.592 - rOutputLine.Append(KImcvAttachment);
1.593 - rOutputLine.Append(KImcvSemiColon);
1.594 - iLine++;
1.595 - rAdvance--;
1.596 - return ETrue;
1.597 - }
1.598 - }
1.599 - else if (iFilename.Length())
1.600 - {
1.601 - rOutputLine.Append(KImcvTab);
1.602 - rOutputLine.Append(KImcvMimeDispositionFilename);
1.603 - AppendFilenameL( rOutputLine );
1.604 - iDealingWithAnEmbeddedEmail = EFalse;
1.605 - return ETrue;
1.606 - }
1.607 -
1.608 - iLine=0;
1.609 - return EFalse;
1.610 - }
1.611 -
1.612 -//----------------------------------------------------------------------------------------
1.613 -inline const TPtrC8 CImSendMimeHeader::EncodingType() const
1.614 -//----------------------------------------------------------------------------------------
1.615 - {
1.616 - switch (iEncodingType)
1.617 - {
1.618 - case EEncodingTypeBASE64:
1.619 - return TPtrC8(KImcvBase64);
1.620 - case EEncodingTypeQP:
1.621 - return TPtrC8(KImcvQuotedPrintable);
1.622 - case EEncodingTypeUU:
1.623 - return TPtrC8(KImcvXUUString);
1.624 - default:
1.625 - return TPtrC8(KImcv7Bit);
1.626 - }
1.627 - }
1.628 -
1.629 -//----------------------------------------------------------------------------------------
1.630 -inline TUint CImSendMimeHeader::CharsetUid() const
1.631 -//----------------------------------------------------------------------------------------
1.632 - {
1.633 - return iCharsetUid;
1.634 - }
1.635 -
1.636 -
1.637 -//****************************************************************************************
1.638 -// Class CImSendRichText Functions
1.639 -//****************************************************************************************
1.640 -
1.641 -//----------------------------------------------------------------------------------------
1.642 -inline TBool CImSendRichText::IsBreakable( TChar ch ) const
1.643 -//----------------------------------------------------------------------------------------
1.644 - {
1.645 - return (ch==' '|| ch=='\t' || ch==CEditableText::EParagraphDelimiter
1.646 - || ch==CEditableText::ENonBreakingSpace );
1.647 - }
1.648 -
1.649 -//----------------------------------------------------------------------------------------
1.650 -inline TInt CImSendRichText::Size() const
1.651 -//----------------------------------------------------------------------------------------
1.652 - {
1.653 - return iBodySize;
1.654 - }
1.655 -
1.656 -//----------------------------------------------------------------------------------------
1.657 -inline TBool CImSendRichText::IsEOL( TChar ch ) const
1.658 -//----------------------------------------------------------------------------------------
1.659 - {
1.660 - return (ch==CEditableText::EParagraphDelimiter
1.661 - || ch==CEditableText::ELineBreak
1.662 - || ch==CEditableText::EPageBreak);
1.663 - }
1.664 -
1.665 -//----------------------------------------------------------------------------------------
1.666 -inline TBool CImSendRichText::IsPlain( TChar aChar ) const
1.667 -//----------------------------------------------------------------------------------------
1.668 - {
1.669 - return (((aChar >= '!') && (aChar <= KImcvSemiColon))
1.670 - || ((aChar >= KImcvRightChevron) && (aChar <= KImcvTilde)));
1.671 - };
1.672 -
1.673 -//----------------------------------------------------------------------------------------
1.674 -inline TUint8 CImSendRichText::ReplacementChar( TChar aControlChar ) const
1.675 -//----------------------------------------------------------------------------------------
1.676 - {
1.677 - if (aControlChar==CEditableText::ETabCharacter)
1.678 - return KImcvTab;
1.679 -
1.680 - if (aControlChar==CEditableText::ENonBreakingHyphen)
1.681 - return KImcvHyphen;
1.682 -
1.683 - if (aControlChar==CEditableText::ENonBreakingSpace)
1.684 - return KImcvSP;
1.685 -
1.686 - return 0;
1.687 - }
1.688 -
1.689 -//----------------------------------------------------------------------------------------
1.690 -inline int CImSendRichText::ConvertLineBreaks( TDes& aSource, TBool aLineBreak) const
1.691 -//----------------------------------------------------------------------------------------
1.692 - {
1.693 - // Need to get rid of 16 bit richtext control characters before moving to 8bit buffer
1.694 - // Therefore convert to the old para delimiter, convert to CRLF later in EncodeRichText.
1.695 - // Its horrible, but what can you do.
1.696 -
1.697 - TInt padding=0;
1.698 - TInt len=aSource.Length();
1.699 - TUint8 repChar;
1.700 - for (TInt i=0; i<len; i++)
1.701 - {
1.702 - repChar=ReplacementChar(aSource[i]);
1.703 - if (repChar)
1.704 - aSource[i]=repChar;
1.705 - else if ( IsEOL(aSource[i]) )
1.706 - {
1.707 - aSource[i]=KImcvCR;
1.708 - aSource.SetLength(i+2);
1.709 - aSource[i+1]=KImcvLF;
1.710 - padding+=1;
1.711 - if (aLineBreak)
1.712 - break;
1.713 - }
1.714 - }
1.715 - return padding;
1.716 - };
1.717 -
1.718 -//****************************************************************************************
1.719 -// Class CImSendFile Functions
1.720 -//****************************************************************************************
1.721 -
1.722 -
1.723 -//----------------------------------------------------------------------------------------
1.724 -inline TInt CImSendFile::Size() const
1.725 -//----------------------------------------------------------------------------------------
1.726 - {
1.727 - return iAttachmentInfo.iSize;
1.728 - }
1.729 -
1.730 -//****************************************************************************************
1.731 -// Class CImCalculateMsgSize Functions
1.732 -//****************************************************************************************
1.733 -
1.734 -//----------------------------------------------------------------------------------------
1.735 -inline TInt CImCalculateMsgSize::MessageSize() const
1.736 -//----------------------------------------------------------------------------------------
1.737 - {
1.738 - return iSize;
1.739 - }
1.740 -
1.741 -//----------------------------------------------------------------------------------------
1.742 -inline void CImCalculateMsgSize::Progress(TInt& rCurrentSize, TInt& rTotalSize)
1.743 -//----------------------------------------------------------------------------------------
1.744 - {
1.745 - rCurrentSize=iSize;
1.746 - rTotalSize=iTotal;
1.747 - }