imservices/imfeatureplugin/srcimprocessor/protocoldatahostimp.cpp
changeset 51 61fad867f68e
equal deleted inserted replaced
-1:000000000000 51:61fad867f68e
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Im connection host
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 //#include <protocolimdatahost.h>
       
    20 #include <ximpprotocolconnection.h>
       
    21 #include <cprotocolimfeatures.h>
       
    22 #include <imobjectfactory.h>
       
    23 #include <protocolimconversationdatahost.h>
       
    24 #include "ximpapiobjbase.h"
       
    25 #include "imapiobjbase.h"
       
    26 #include "imobjectfactoryimp.h"
       
    27 
       
    28 #include "protocoldatahostimp.h"
       
    29 #include "protocolimdatahostimp.h"
       
    30 #include "protocolimconversationdatahostimp.h"
       
    31 //#include "ximpprotocolrequestcompleteeventimp.h"
       
    32 #include "imlogutils.h"
       
    33 #include <ximpoperationbase.h>
       
    34 #include "imoperationdefs.h"
       
    35 
       
    36 // ======== MEMBER FUNCTIONS ========
       
    37 
       
    38 
       
    39 // This should be variated. Branding variation can be one
       
    40 // possibility. One is to leave adaptation deside how soon
       
    41 // cleanup will be done.
       
    42 // Now 5 sec used for testing purposes. Better value could be
       
    43 // some minutes.
       
    44 
       
    45 // ---------------------------------------------------------------------------
       
    46 // CProtocolDataHostImp::CProtocolDataHostImp()
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 CProtocolDataHostImp::CProtocolDataHostImp( MXIMPHost& aHost )
       
    50 :iHost( aHost )
       
    51     {
       
    52     XImLogger::Log(_L("CProtocolDataHostImp::CProtocolDataHostImp Started"));
       
    53     XImLogger::Log(_L("CProtocolDataHostImp::CProtocolDataHostImp Completed"));
       
    54     }
       
    55 
       
    56 
       
    57 // ---------------------------------------------------------------------------
       
    58 // CProtocolDataHostImp::ConstructL()
       
    59 // ---------------------------------------------------------------------------
       
    60 //
       
    61 void CProtocolDataHostImp::ConstructL()
       
    62     {
       
    63     XImLogger::Log(_L("CProtocolDataHostImp::ConstructL Started"));
       
    64     
       
    65     //iImObjFactory = CImObjectFactoryImp::NewL();
       
    66     //iConvDataHost = CProtocolImConversationDataHostImp::NewL( iHost );
       
    67     iImDataHost = CProtocolImDataHostImp::NewL(iHost) ;
       
    68     XImLogger::Log(_L("CProtocolDataHostImp::ConstructL Completed"));
       
    69     }
       
    70 
       
    71 
       
    72 // ---------------------------------------------------------------------------
       
    73 // CProtocolDataHostImp::NewLC()
       
    74 // ---------------------------------------------------------------------------
       
    75 //
       
    76 EXPORT_C CProtocolDataHostImp* CProtocolDataHostImp::NewLC( MXIMPHost& aHost )
       
    77     {
       
    78     XImLogger::Log(_L("CProtocolDataHostImp::NewLC Started"));
       
    79     CProtocolDataHostImp* self = new( ELeave ) CProtocolDataHostImp( aHost );
       
    80     CleanupStack::PushL( self );
       
    81     self->ConstructL();
       
    82     XImLogger::Log(_L("CProtocolDataHostImp::NewLC Completed"));
       
    83     return self;
       
    84     }
       
    85 
       
    86 // ---------------------------------------------------------------------------
       
    87 // CProtocolDataHostImp::NewL()
       
    88 // ---------------------------------------------------------------------------
       
    89 //
       
    90 EXPORT_C CProtocolDataHostImp* CProtocolDataHostImp::NewL( MXIMPHost& aHost )
       
    91     {
       
    92     XImLogger::Log(_L("CProtocolDataHostImp::NewL Started"));
       
    93     CProtocolDataHostImp* self = new( ELeave ) CProtocolDataHostImp( aHost );
       
    94     CleanupStack::PushL( self );
       
    95     self->ConstructL();
       
    96     CleanupStack::Pop( self );
       
    97     XImLogger::Log(_L("CProtocolDataHostImp::NewL Completed"));
       
    98     return self;
       
    99     }
       
   100 // ---------------------------------------------------------------------------
       
   101 // CProtocolDataHostImp::~CProtocolDataHostImp()
       
   102 // ---------------------------------------------------------------------------
       
   103 //
       
   104 CProtocolDataHostImp::~CProtocolDataHostImp()
       
   105     {
       
   106     XImLogger::Log(_L("CProtocolDataHostImp::~CProtocolDataHostImp Started"));
       
   107     
       
   108     //delete iImObjFactory;
       
   109     //delete iConvDataHost;
       
   110     delete iImDataHost ;
       
   111     XImLogger::Log(_L("CProtocolDataHostImp::~CProtocolDataHostImp Completed"));
       
   112     }
       
   113 
       
   114 // ---------------------------------------------------------------------------
       
   115 // CProtocolDataHostImp::SetHostToProtocol()
       
   116 // ---------------------------------------------------------------------------
       
   117 //
       
   118 void CProtocolDataHostImp::SetHostToProtocol()
       
   119 	{
       
   120 	CProtocolImFeatures* imProtocolFeature = static_cast< CProtocolImFeatures*> 
       
   121 							(iHost.GetConnection().GetProtocolInterface(CProtocolImFeatures::KInterfaceId) );
       
   122 	
       
   123 	if(imProtocolFeature)
       
   124 		{
       
   125 		imProtocolFeature->SetHost(*iImDataHost);	
       
   126 		}
       
   127 	}
       
   128 
       
   129 // ---------------------------------------------------------------------------
       
   130 // CProtocolDataHostImp::GetInterface()
       
   131 // ---------------------------------------------------------------------------
       
   132 //
       
   133 TAny* CProtocolDataHostImp::GetInterface(TInt aInterfaceId)
       
   134 	{
       
   135 	if(aInterfaceId == MProtocolImDataHost::KInterfaceId )
       
   136 		return iImDataHost ;
       
   137 	else
       
   138 		return NULL ;
       
   139 	
       
   140 	}
       
   141 
       
   142 // ---------------------------------------------------------------------------
       
   143 // CProtocolDataHostImp::GetInterface()
       
   144 // ---------------------------------------------------------------------------
       
   145 //
       
   146 TInt CProtocolDataHostImp::GetCleanupOperation() 
       
   147 	{
       
   148 	return NImOps::EIMCleaner ;
       
   149 	}
       
   150 // End of file
       
   151