|
1 /* |
|
2 * Copyright (c) 2005 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: Initial state for MT refer. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <sipcontenttypeheader.h> |
|
23 #include <siprefertoheader.h> |
|
24 #include <sipdialogassocbase.h> |
|
25 #include "mcesipeventhelper.h" |
|
26 #include "mceeventrefermtidlestate.h" |
|
27 #include "mcesip.h" |
|
28 #include "mceeventslogs.h" |
|
29 |
|
30 // ============================ MEMBER FUNCTIONS =============================== |
|
31 |
|
32 // ----------------------------------------------------------------------------- |
|
33 // CMceEventReferMtIdleState::CMceEventReferMtIdleState |
|
34 // C++ default constructor can NOT contain any code, that |
|
35 // might leave. |
|
36 // ----------------------------------------------------------------------------- |
|
37 // |
|
38 CMceEventReferMtIdleState::CMceEventReferMtIdleState() |
|
39 { |
|
40 } |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // CMceEventReferMtIdleState::~CMceEventReferMtIdleState |
|
44 // Destructor |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 CMceEventReferMtIdleState::~CMceEventReferMtIdleState() |
|
48 { |
|
49 } |
|
50 |
|
51 // ----------------------------------------------------------------------------- |
|
52 // CMceEventReferMtIdleState::ProcessReferStateL |
|
53 // Ápply concrete state. |
|
54 // Be noticed that it will be also update, unRefer |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 void CMceEventReferMtIdleState::HandleL( CMceComEvent& /*aEvent*/ ) |
|
58 { |
|
59 User::Leave( KMceEventStateError ); |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // CMceEventReferMtIdleState::HandleReceiveRequestL |
|
64 // Ápply concrete state. |
|
65 // Be noticed that it is receiving notify in the terminated state |
|
66 // ----------------------------------------------------------------------------- |
|
67 // |
|
68 void CMceEventReferMtIdleState::HandleReceiveRequestL( CMceComEvent& aEvent ) |
|
69 { |
|
70 MCEEVENTS_DEBUG("CMceEventReferMtIdleState::HandleReceiveRequestL, Entry"); |
|
71 User::LeaveIfError( aEvent.SIPEvent().Dialog() ? |
|
72 KErrNone : KMceEventStateError ); |
|
73 CSIPServerTransaction& serverTran = aEvent.SIPEvent().Request(); |
|
74 CSIPServerTransaction* serverTranCheck = &serverTran; |
|
75 |
|
76 User::LeaveIfError( serverTranCheck ? KErrNone : KMceEventStateError ); |
|
77 |
|
78 User::LeaveIfError( serverTran.RequestElements() ? KErrNone : KErrCorrupt ); |
|
79 |
|
80 const CSIPMessageElements& msgElem = |
|
81 serverTran.RequestElements()->MessageElements(); |
|
82 |
|
83 // Set the REFER type |
|
84 aEvent.SetReferType( MCESIPEventHelper::ResolveReferTypeL( msgElem ) ); |
|
85 |
|
86 // Gather parameters and notify observer. |
|
87 CDesC8Array* headers = MceSip::UserHeadersToTextArrayL( |
|
88 serverTran, |
|
89 aEvent.SIPEvent().Dialog()->Dialog() ); |
|
90 CleanupStack::PushL( headers ); |
|
91 |
|
92 HBufC8* contenttype= NULL; |
|
93 if( msgElem.ContentType() ) |
|
94 { |
|
95 contenttype=msgElem.ContentType()->ToTextValueL(); |
|
96 } |
|
97 CleanupStack::PushL( contenttype ); |
|
98 |
|
99 HBufC8* content = msgElem.Content().AllocLC(); |
|
100 |
|
101 CSIPHeaderBase* referToHeader= MceSip::FindHeader( |
|
102 msgElem, |
|
103 SIPStrings::StringF(SipStrConsts::EReferToHeader)); |
|
104 User::LeaveIfError( referToHeader ? KErrNone : KErrNotFound ); |
|
105 |
|
106 HBufC8* refer = referToHeader->ToTextValueLC(); |
|
107 |
|
108 aEvent.SIPEvent().IncomingReferL( refer, |
|
109 headers, |
|
110 contenttype, |
|
111 content ); |
|
112 |
|
113 |
|
114 CleanupStack::Pop( refer ); |
|
115 CleanupStack::Pop( content ); |
|
116 CleanupStack::Pop( contenttype ); |
|
117 CleanupStack::Pop( headers ); |
|
118 //move to EstablishingState |
|
119 aEvent.EventContext().SetCurrentStateL( aEvent, |
|
120 KMceEstablishingEventStateIndex ); |
|
121 MCEEVENTS_DEBUG("CMceEventReferMtIdleState::HandleReceiveRequestL, Exit"); |
|
122 } |
|
123 |
|
124 // ----------------------------------------------------------------------------- |
|
125 // CMceEventReferMtIdleState::HandleResponseReceivedL |
|
126 // Ápply concrete state. |
|
127 // Be noticed that it will be also update, unRefer |
|
128 // ----------------------------------------------------------------------------- |
|
129 // |
|
130 void CMceEventReferMtIdleState::HandleResponseReceivedL( |
|
131 CMceComEvent& /*aEvent*/ ) |
|
132 { |
|
133 User::Leave( KMceEventStateError ); |
|
134 } |
|
135 |
|
136 // End of File |