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