|
1 /* |
|
2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <sipclienttransaction.h> |
|
19 #include <sipmessageelements.h> |
|
20 #include <siprefresh.h> |
|
21 #include <sipregistrationbinding.h> |
|
22 #include <sipsubscribedialogassoc.h> |
|
23 |
|
24 #include "TCmdUpdateRefresh.h" |
|
25 #include "SIPConstants.h" |
|
26 |
|
27 /** |
|
28 * INPUT: |
|
29 * Headers: Content-Type*, Content-Encoding*, Expires* |
|
30 * Parameters: Content* |
|
31 * IDs: RefreshId*, RegistrationId*, SubscribeDialogId* |
|
32 * |
|
33 * OUTPUT: |
|
34 * Parameters: - |
|
35 * IDs: TransactionId |
|
36 */ |
|
37 void TCmdUpdateRefresh::ExecuteL() |
|
38 { |
|
39 // -- Setup --------------------------------------------------------------- |
|
40 |
|
41 // Get SIP objects from registry |
|
42 CSIPRefresh* refresh = GetRefreshL( EFalse ); |
|
43 CSIPRegistrationBinding* registration = GetRegistrationL( EFalse ); |
|
44 CSIPSubscribeDialogAssoc* dialogAssoc = GetSubscribeDialogAssocL( EFalse ); |
|
45 |
|
46 // Get the refresh object from a registration or from a dialog association |
|
47 // if it's not defined as such. |
|
48 if( !refresh ) |
|
49 { |
|
50 if( registration ) |
|
51 { |
|
52 refresh = const_cast< CSIPRefresh* >( registration->SIPRefresh() ); |
|
53 } |
|
54 else if( dialogAssoc ) |
|
55 { |
|
56 refresh = const_cast< CSIPRefresh* >( dialogAssoc->SIPRefresh() ); |
|
57 } |
|
58 else |
|
59 { |
|
60 User::Leave( KTcErrMandatoryIdNotFound ); |
|
61 } |
|
62 } |
|
63 |
|
64 // Extract both headers (that are still left) and content. |
|
65 CSIPMessageElements* elements = ExtractHeadersAndContentLC(); |
|
66 |
|
67 // -- Execution ----------------------------------------------------------- |
|
68 |
|
69 // Start refresh update |
|
70 CSIPClientTransaction* transaction = refresh->UpdateL( elements ); |
|
71 CleanupStack::Pop( elements ); |
|
72 |
|
73 // -- Response creation --------------------------------------------------- |
|
74 |
|
75 AddIdResponseL( KTransactionId, transaction ); |
|
76 } |
|
77 |
|
78 TBool TCmdUpdateRefresh::Match( const TTcIdentifier& aId ) |
|
79 { |
|
80 return TTcSIPCommandBase::Match( aId, _L8("UpdateRefresh") ); |
|
81 } |
|
82 |
|
83 TTcCommandBase* TCmdUpdateRefresh::CreateL( MTcTestContext& aContext ) |
|
84 { |
|
85 return new( ELeave ) TCmdUpdateRefresh( aContext ); |
|
86 } |
|
87 |