|
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 "CTcSIPContext.h" |
|
19 #include "SIPConstants.h" |
|
20 #include "TCmdGetDialogRegistration.h" |
|
21 |
|
22 #include <sipdialog.h> |
|
23 #include <sipdialogassocbase.h> |
|
24 #include <sipregistrationbinding.h> |
|
25 #include <sipregistrationcontext.h> |
|
26 |
|
27 /** |
|
28 * INPUT: |
|
29 * Headers: - |
|
30 * Parameters: - |
|
31 * IDs: InviteDialogId*, SubscribeDialogId* |
|
32 * |
|
33 * OUTPUT: |
|
34 * Parameters: - |
|
35 * IDs: RegistrationId* |
|
36 */ |
|
37 void TCmdGetDialogRegistration::ExecuteL() |
|
38 { |
|
39 // -- Setup --------------------------------------------------------------- |
|
40 |
|
41 // Get SIP objects from registry |
|
42 CSIPDialogAssocBase* dialogAssoc = GetAnyDialogAssocL(); |
|
43 |
|
44 // -- Execution ----------------------------------------------------------- |
|
45 |
|
46 // Get registration context for the diaog, if any |
|
47 const CSIPDialog& dialog = dialogAssoc->Dialog(); |
|
48 MSIPRegistrationContext* context = |
|
49 const_cast< MSIPRegistrationContext* >( dialog.RegistrationContext() ); |
|
50 CSIPRegistrationBinding* registration = |
|
51 static_cast< CSIPRegistrationBinding* >( context ); |
|
52 if( !registration ) |
|
53 { |
|
54 return; |
|
55 } |
|
56 |
|
57 // If the object is not in registry, add it. |
|
58 if( !iContext.Registry().IsRegistered( registration ) ) |
|
59 { |
|
60 iContext.Registry().AddObjectL( registration ); |
|
61 } |
|
62 |
|
63 // -- Response creation --------------------------------------------------- |
|
64 |
|
65 AddIdResponseL( KRegistrationId, registration ); |
|
66 } |
|
67 |
|
68 TBool TCmdGetDialogRegistration::Match( const TTcIdentifier& aId ) |
|
69 { |
|
70 return TTcSIPCommandBase::Match( aId, _L8("GetDialogRegistration") ); |
|
71 } |
|
72 |
|
73 TTcCommandBase* TCmdGetDialogRegistration::CreateL( MTcTestContext& aContext ) |
|
74 { |
|
75 return new( ELeave ) TCmdGetDialogRegistration( aContext ); |
|
76 } |