imservices/imfeatureplugin/srcimoperations/imconversation/operationreceivemessage.cpp
changeset 51 61fad867f68e
equal deleted inserted replaced
-1:000000000000 51:61fad867f68e
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Concrete im receive message operation
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #include <badesca.h>
       
    20 #include <ximpprotocolconnection.h>
       
    21 #include <protocolimfeatures.h>
       
    22 #include <protocolimconversation.h>
       
    23 #include "imconversationinfoimp.h"
       
    24 #include "operationreceivemessage.h"
       
    25 //#include "ximpoperationbase.h"
       
    26 //#include "ximpidentityimp.h"
       
    27 #include "conversationsubscriptionitem.h"
       
    28 #include "imdatacacheimp.h"
       
    29 
       
    30 #include "ximpobjecthelpers.h"
       
    31 #include "ximprestrictedobjectcollection.h"
       
    32 #include "ximphost.h"
       
    33 //#include "ximpstatusimp.h"
       
    34 //#include "ximprequestcompleteeventimp.h"
       
    35 #include "protocolimdatahostimp.h"
       
    36 #include "imlogutils.h"
       
    37 
       
    38 #include "protocolimdatahost.h"
       
    39 
       
    40 //#include "ximpsubscriptionitem.h"
       
    41 //#include "ximppsccontextimp.h"
       
    42 
       
    43 // ======== MEMBER FUNCTIONS ========
       
    44 
       
    45 // ---------------------------------------------------------------------------
       
    46 // COperationReceiveMessage::COperationReceiveMessage()
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 EXPORT_C COperationReceiveMessage::COperationReceiveMessage()
       
    50     {
       
    51     XImLogger::Log(_L("COperationReceiveMessage::COperationReceiveMessage Started"));
       
    52     XImLogger::Log(_L("COperationReceiveMessage::COperationReceiveMessage Completed"));
       
    53     }
       
    54 
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 // COperationReceiveMessage::ConstructL()
       
    58 // ---------------------------------------------------------------------------
       
    59 //
       
    60 void COperationReceiveMessage::ConstructL( const TDesC8& /*aParamPck */)
       
    61     {
       
    62     XImLogger::Log(_L("COperationReceiveMessage::ConstructL Started"));   
       
    63     XImLogger::Log(_L("COperationReceiveMessage::ConstructL Completed"));
       
    64     }
       
    65 
       
    66 // ---------------------------------------------------------------------------
       
    67 // COperationReceiveMessage::~COperationReceiveMessage()
       
    68 // ---------------------------------------------------------------------------
       
    69 //
       
    70 COperationReceiveMessage::~COperationReceiveMessage()
       
    71     {
       
    72     XImLogger::Log(_L("COperationReceiveMessage::~COperationReceiveMessage Started"));
       
    73     delete iConvInfo;
       
    74     XImLogger::Log(_L("COperationReceiveMessage::~COperationReceiveMessage Completed"));
       
    75     }
       
    76 
       
    77 
       
    78 // ---------------------------------------------------------------------------
       
    79 // COperationReceiveMessage::ProcessL()
       
    80 // ---------------------------------------------------------------------------
       
    81 //
       
    82 void COperationReceiveMessage::ProcessL()
       
    83     {
       
    84 	XImLogger::Log(_L("COperationReceiveMessage::ProcessL Started"));
       
    85 	CXIMPOperationBase::ProcessL();
       
    86 	MXIMPBase* object = NULL;
       
    87 	TBool force =  ETrue; 
       
    88 	
       
    89 	//iObjCollection->GetByType( object, MImConversationInfo::KInterfaceId );
       
    90 	MXIMPRestrictedObjectCollection *objCollection = CXIMPOperationBase::GetObjCollection() ;
       
    91 	
       
    92 	objCollection->GetByType( object, MImConversationInfo::KInterfaceId );
       
    93 	
       
    94 	if( object )
       
    95 		{  
       
    96 		iConvInfo = TXIMPGetImpClassOrPanic< CImConversationInfoImp >::From( *object );	
       
    97 		}
       
    98 	else
       
    99 		{
       
   100 		User::Leave( KErrArgument );
       
   101 		}
       
   102 		
       
   103 			
       
   104 	//CConversationSubscriptionItem& conversationItem = 
       
   105 	//iMyHost->ImDataAccess().ImDataCache().ConversationSubscriptionItemLC();
       
   106 	
       
   107 	//CConversationSubscriptionItem& conversationItem = 
       
   108 	//	iMyHost->GetProtocolHost(0).ImDataCache().ConversationSubscriptionItemLC() ;
       
   109 	
       
   110 	MProtocolImDataHost* imProtocolHost = 
       
   111 					static_cast <MProtocolImDataHost*> (iMyHost->GetProtocolHost(MProtocolImDataHost::KInterfaceId) );
       
   112 	
       
   113 	CConversationSubscriptionItem& conversationItem = 
       
   114 			imProtocolHost->ImDataCache().ConversationSubscriptionItemLC() ;
       
   115 	
       
   116 	conversationItem.SetConversationInfoL( iConvInfo ); 
       
   117 	
       
   118 	iConvInfo = NULL; // set to NULL since ownership is transfered
       
   119 
       
   120 	//conversationItem.SynthesiseSubscriptionEventToL( iContext, force );
       
   121 	conversationItem.SynthesiseSubscriptionEventToL( CXIMPOperationBase::GetContext(), force );
       
   122 	
       
   123 	CleanupStack::PopAndDestroy(); // conversationItem
       
   124 	iMyHost->HandleAdaptationRequestCompleted( iReqId, KErrNone );
       
   125 	XImLogger::Log(_L("COperationReceiveMessage::ProcessL Completed"));
       
   126 	}
       
   127 
       
   128 // ---------------------------------------------------------------------------
       
   129 // COperationReceiveMessage::RequestCompleted()
       
   130 // ---------------------------------------------------------------------------
       
   131 //
       
   132 void COperationReceiveMessage::RequestCompletedL()
       
   133     {
       
   134     XImLogger::Log(_L("COperationReceiveMessage::RequestCompletedL Started"));
       
   135     CXIMPOperationBase::RequestCompletedL();
       
   136 	XImLogger::Log(_L("COperationReceiveMessage::RequestCompletedL Completed"));
       
   137     }
       
   138 
       
   139 // ---------------------------------------------------------------------------
       
   140 // COperationReceiveMessage::Type()
       
   141 // ---------------------------------------------------------------------------
       
   142 //
       
   143 TInt COperationReceiveMessage::Type() const
       
   144     {
       
   145     return NImOps::EHandleReceiveMessage;
       
   146     }
       
   147 
       
   148 
       
   149 // End of file