?? emailtransport.cpp
字號:
// Copyright (c) 2004 - 2007, Symbian Software Ltd. All rights reserved.
#include "emailtransport.h"
// -------- (de)allocation --------
CEmailTransport* CEmailTransport::NewL(TAny* aTransportCreateInfo)
/**
This factory function is defined so the class can be instantiated
via ECOM, which means it can only take a single TAny* argument.
@param aTransportCreateInfo Pointer to an instance of
TTransportCreateInfo, which contains the
data required to allocate the transport.
@return Transport that sends messages to a remote
email account. This is owned by the caller.
*/
{
const TTransportInterfaceCreateInfo& tci =
*reinterpret_cast<TTransportInterfaceCreateInfo*>(aTransportCreateInfo);
return New2L(tci.iObserver, *tci.iAddress, tci.iInitListen);
}
CEmailTransport* CEmailTransport::New2L(
MTransportObserver& aObserver, const TDesC& aAddress, TBool aInitListen)
/**
Helper factory function called from NewL after the latter has extracted
the observer, address, and initial listen status values.
@param aObserver Observer to notify about transport events.
This is managed by the CTransport superclass.
@param aAddress Remote device's address. This should be an
email address.
@param aInitListen If true, this object should start by listening
for an incoming payload. Otherwise, it should
wait for its owner to send a payload to the remote
device.
@return Transport that sends messages to a remote
email account. This is owned by the caller.
*/
{
CEmailTransport* self = new(ELeave) CEmailTransport(aObserver);
CleanupStack::PushL(self);
self->ConstructL(aAddress, aInitListen);
CleanupStack::Pop(self);
return self;
}
CEmailTransport::CEmailTransport(MTransportObserver& aObserver)
/**
This c'tor is defined to pass the supplied observer to the superclass.
@param aObserver Observer to notify about transport events.
This is managed by the CTransport superclass.
*/
: CBodyTextTransport(aObserver, KUidMsgTypeSMTP)
{
// empty.
}
// -------- override CMessageBodyTextTransport --------
void CEmailTransport::DoBuildMessageL()
/**
Override CBodyTextTransport to add a subject field.
*/
{
_LIT(KEmailSubjectLine, "OandX move via email");
iSendAsMessage.SetSubjectL(KEmailSubjectLine);
}
// -------- implement CMessageTransport --------
TBool CEmailTransport::ShouldUseReceivedMtmUid(TUid aMtmUid) const
/**
Implement CMessageTransport by filtering an incoming message
according to whether it is an email. Specifically, this function
accepts the message if it has a POP3 or IMAP4 message type.
@param aMtmUid The incoming message's MTM UID.
@return Whether the supplied MTM describes an email.
*/
{
return (aMtmUid == KUidMsgTypePOP3 || aMtmUid == KUidMsgTypeIMAP4);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -