|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "IMSMSEND.H" |
|
17 #include "csmtpupsresponsewaiter.h" |
|
18 |
|
19 #include <miut_err.h> |
|
20 #include <msvids.h> |
|
21 #include <smtpset.h> |
|
22 |
|
23 /** |
|
24 Construction method |
|
25 @return a new instance of CSmtpUpsResponseWaiter |
|
26 */ |
|
27 CSmtpUpsResponseWaiter* CSmtpUpsResponseWaiter::NewL() |
|
28 { |
|
29 return new(ELeave)CSmtpUpsResponseWaiter(); |
|
30 } |
|
31 |
|
32 /** |
|
33 Default constructor. |
|
34 */ |
|
35 CSmtpUpsResponseWaiter::CSmtpUpsResponseWaiter() |
|
36 : CMsgActive(EPriorityStandard) |
|
37 { |
|
38 CActiveScheduler::Add(this); |
|
39 } |
|
40 |
|
41 /** |
|
42 Destructor. |
|
43 */ |
|
44 CSmtpUpsResponseWaiter::~CSmtpUpsResponseWaiter() |
|
45 { |
|
46 Cancel(); |
|
47 // Close UPS session |
|
48 iUpsSubsession.Close(); |
|
49 iUpsSession.Close(); |
|
50 } |
|
51 |
|
52 /** |
|
53 Connect to UPS server and check if the client thread has the capability to check to the |
|
54 smtp server. |
|
55 @param iSettings The CImSmtpSettings object. |
|
56 @param aHasCapability TBool indicating if the client has passes the server's check on capability. |
|
57 @param aClientThread The Rthread of the client application. |
|
58 @param aStatus TRequestStatus of the Active Object. |
|
59 @return void. |
|
60 */ |
|
61 void CSmtpUpsResponseWaiter::AuthoriseAndConnectL(const CImSmtpSettings& aSettings, TBool aHasCapability, TThreadId aClientThreadId, TRequestStatus& aStatus) |
|
62 { |
|
63 iDecision = EUpsDecNo; |
|
64 // Connect to UPS service..... |
|
65 User::LeaveIfError(iUpsSession.Connect()); |
|
66 RThread clientThread; |
|
67 User::LeaveIfError(clientThread.Open(aClientThreadId)); |
|
68 CleanupClosePushL(clientThread); |
|
69 User::LeaveIfError(iUpsSubsession.Initialise(iUpsSession, clientThread)); |
|
70 CleanupStack::PopAndDestroy(&clientThread); |
|
71 |
|
72 Queue(aStatus); |
|
73 |
|
74 iUpsSubsession.Authorise(aHasCapability, KUidSMTPService, aSettings.ServerAddress(), iDecision, iStatus); |
|
75 SetActive(); |
|
76 } |
|
77 |
|
78 void CSmtpUpsResponseWaiter::DoRunL() |
|
79 { |
|
80 User::LeaveIfError(iStatus.Int()); |
|
81 if(iDecision != EUpsDecYes && iDecision != EUpsDecSessionYes) |
|
82 { |
|
83 User::Leave(KErrPermissionDenied); |
|
84 } |
|
85 Complete(iStatus.Int()); |
|
86 } |
|
87 |
|
88 void CSmtpUpsResponseWaiter::DoCancel() |
|
89 { |
|
90 iUpsSubsession.CancelPrompt(); |
|
91 |
|
92 CMsgActive::DoCancel(); |
|
93 } |