|
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 <siprefresh.h> |
|
20 #include <sipmessageelements.h> |
|
21 #include <sipsubscribedialogassoc.h> |
|
22 |
|
23 #include "TCmdSendSubscribeWithinDialog.h" |
|
24 #include "SIPConstants.h" |
|
25 |
|
26 /** |
|
27 * INPUT: |
|
28 * Headers: Contact*, Content-Type*, Content-Encoding*, |
|
29 * Event*, Expires* |
|
30 * Parameters: Content*, Refresh* |
|
31 * IDs: InviteDialogId*, SubscribeDialogId* |
|
32 * |
|
33 * OUTPUT: |
|
34 * Parameters: - |
|
35 * IDs: TransactionId, SubscribeDialogId |
|
36 */ |
|
37 void TCmdSendSubscribeWithinDialog::ExecuteL() |
|
38 { |
|
39 // -- Setup --------------------------------------------------------------- |
|
40 |
|
41 // Get SIP objects from registry |
|
42 CSIPDialogAssocBase* dialogAssoc = GetAnyDialogAssocL(); |
|
43 |
|
44 // Extract required headers |
|
45 CSIPEventHeader* eventHeader = ExtractEventHeaderLC(); |
|
46 |
|
47 // Create a new dialog association |
|
48 CSIPSubscribeDialogAssoc* newdialogAssoc = |
|
49 CSIPSubscribeDialogAssoc::NewL( dialogAssoc->Dialog(), |
|
50 eventHeader ); |
|
51 CleanupStack::Pop( eventHeader ); |
|
52 CleanupStack::PushL( newdialogAssoc ); |
|
53 |
|
54 // Conditionally create refresh object |
|
55 CSIPRefresh* refresh = ExtractRefreshLC(); |
|
56 |
|
57 // Extract both headers (that are still left) and content. |
|
58 CSIPMessageElements* elements = ExtractHeadersAndContentLC(); |
|
59 |
|
60 // -- Execution ----------------------------------------------------------- |
|
61 |
|
62 // Start SIP Subscribe transaction. |
|
63 CSIPClientTransaction* transaction = |
|
64 newdialogAssoc->SendSubscribeL( elements, refresh ); |
|
65 CleanupStack::Pop( elements ); |
|
66 if( refresh ) |
|
67 { |
|
68 CleanupStack::Pop( refresh ); |
|
69 } |
|
70 |
|
71 // -- Response creation --------------------------------------------------- |
|
72 |
|
73 AddIdResponseL( KTransactionId, transaction ); |
|
74 CleanupStack::Pop( newdialogAssoc ); |
|
75 AddIdResponseL( KSubscribeDialogId, newdialogAssoc ); |
|
76 } |
|
77 |
|
78 TBool TCmdSendSubscribeWithinDialog::Match( const TTcIdentifier& aId ) |
|
79 { |
|
80 return TTcSIPCommandBase::Match( aId, _L8("SendSubscribeWithinDialog") ); |
|
81 } |
|
82 |
|
83 TTcCommandBase* TCmdSendSubscribeWithinDialog::CreateL( MTcTestContext& aContext ) |
|
84 { |
|
85 return new( ELeave ) TCmdSendSubscribeWithinDialog( aContext ); |
|
86 } |
|
87 |