|
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 // Name : CSipAcceptContactStrategy2.cpp |
|
15 // Part of : SIP Client Resolver |
|
16 // Version : 1.0 |
|
17 // |
|
18 |
|
19 |
|
20 |
|
21 #include "CSipAcceptContactStrategy2.h" |
|
22 #include "MSipClients.h" |
|
23 #include "siprequest.h" |
|
24 #include "sipacceptcontactheader.h" |
|
25 #include "CSIPClientResolver2.h" |
|
26 #include "sipstrings.h" |
|
27 #include "sipstrconsts.h" |
|
28 #include "SIPCRLogs.h" |
|
29 |
|
30 // ---------------------------------------------------------------------------- |
|
31 // CSipAcceptContactStrategy2::NewL |
|
32 // ---------------------------------------------------------------------------- |
|
33 // |
|
34 CSipAcceptContactStrategy2* CSipAcceptContactStrategy2::NewL( |
|
35 MSipClients& aSipClients, |
|
36 CSipHeaderStrategyBase* aNextStrategy, |
|
37 CSipHeaderStrategyBase* aNextStrategy2 ) |
|
38 { |
|
39 CSipAcceptContactStrategy2* self = |
|
40 CSipAcceptContactStrategy2::NewLC( aSipClients, |
|
41 aNextStrategy, |
|
42 aNextStrategy2 ); |
|
43 CleanupStack::Pop( self ); |
|
44 return self; |
|
45 } |
|
46 |
|
47 // ---------------------------------------------------------------------------- |
|
48 // CSipAcceptContactStrategy2::NewLC |
|
49 // ---------------------------------------------------------------------------- |
|
50 // |
|
51 CSipAcceptContactStrategy2* CSipAcceptContactStrategy2::NewLC( |
|
52 MSipClients& aSipClients, |
|
53 CSipHeaderStrategyBase* aNextStrategy, |
|
54 CSipHeaderStrategyBase* aNextStrategy2 ) |
|
55 { |
|
56 CSipAcceptContactStrategy2* self = |
|
57 new( ELeave )CSipAcceptContactStrategy2( aSipClients,aNextStrategy, |
|
58 aNextStrategy2 ); |
|
59 CleanupStack::PushL( self ); |
|
60 return self; |
|
61 } |
|
62 |
|
63 // ---------------------------------------------------------------------------- |
|
64 // CSipAcceptContactStrategy2::CSipAcceptContactStrategy2 |
|
65 // ---------------------------------------------------------------------------- |
|
66 // |
|
67 CSipAcceptContactStrategy2::CSipAcceptContactStrategy2( |
|
68 MSipClients& aSipClients, |
|
69 CSipHeaderStrategyBase* aNextStrategy, |
|
70 CSipHeaderStrategyBase* aNextStrategy2) |
|
71 : CSipHeaderStrategyBase( aSipClients,aNextStrategy,aNextStrategy2 ) |
|
72 { |
|
73 iAcceptContactHeaderName = |
|
74 SIPStrings::StringF( SipStrConsts::EAcceptContactHeader ); |
|
75 } |
|
76 |
|
77 // ---------------------------------------------------------------------------- |
|
78 // CSipAcceptContactStrategy2::~CSipAcceptContactStrategy2 |
|
79 // ---------------------------------------------------------------------------- |
|
80 // |
|
81 CSipAcceptContactStrategy2::~CSipAcceptContactStrategy2 () |
|
82 { |
|
83 } |
|
84 |
|
85 // ---------------------------------------------------------------------------- |
|
86 // CSipAcceptContactStrategy2::ApplyL |
|
87 // ---------------------------------------------------------------------------- |
|
88 // |
|
89 CSIPResponse* |
|
90 CSipAcceptContactStrategy2::ApplyL( CSIPRequest& aRequest, |
|
91 RArray<TUid>& aUids, |
|
92 TBool& aContinueSearch, |
|
93 CSIPClientResolver2& aClientResolver2 ) |
|
94 { |
|
95 SIP_CR_LOG("CSipAcceptContactStrategy2::ApplyL") |
|
96 CSIPResponse* response = NULL; |
|
97 // The strategy is applied only for requests that contain Accept-Contact |
|
98 if ( aRequest.HasHeader( iAcceptContactHeaderName ) ) |
|
99 { |
|
100 SIP_CR_LOG("CSipAcceptContactStrategy2::ApplyL Accept-Contact") |
|
101 response = MatchClients2L( aRequest,aUids,aContinueSearch, |
|
102 aClientResolver2 ); |
|
103 } |
|
104 else |
|
105 { |
|
106 SIP_CR_LOG("CSipAcceptContactStrategy2::ApplyL No Accept-Contact") |
|
107 response = NextStrategyL( aRequest,aUids,aContinueSearch, |
|
108 aClientResolver2 ); |
|
109 } |
|
110 return response; |
|
111 } |
|
112 |
|
113 // ---------------------------------------------------------------------------- |
|
114 // CSipAcceptContactStrategy2::MatchResolvedClientsL |
|
115 // ---------------------------------------------------------------------------- |
|
116 // |
|
117 TBool CSipAcceptContactStrategy2::MatchResolvedClientL( |
|
118 CSIPResolvedClient2& aClient, |
|
119 CSIPRequest& aRequest, |
|
120 TUid& aClientUid, |
|
121 const CUri8& aUri8 ) |
|
122 { |
|
123 SIP_CR_LOG("CSipAcceptContactStrategy2::MatchResolvedClientL") |
|
124 return aClient.MatchAcceptContactsL( aRequest.Method(), |
|
125 aUri8, |
|
126 aRequest.AllHeadersL(), |
|
127 aRequest.Content(), |
|
128 ContentType(aRequest), |
|
129 aClientUid ); |
|
130 } |
|
131 |
|
132 |
|
133 |