simpledatamodeladapter/simpleimplugin/src/simpleimfeatures.cpp
branchGCC_SURGE
changeset 28 d9861ae9169c
parent 23 77cb48a03620
parent 26 04ca1926b01c
equal deleted inserted replaced
23:77cb48a03620 28:d9861ae9169c
     1 /*
       
     2 * Copyright (c) 2009 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "simpleimfeatures.h"
       
    20 #include "simpleimconversation.h"
       
    21 #include "mpresencepluginconnectionobs.h"
       
    22 #include "simpleimplugindefs.h"
       
    23 #include "simpleimlogger.h"
       
    24 
       
    25 // ======== MEMBER FUNCTIONS ========
       
    26 
       
    27 // ---------------------------------------------------------------------------
       
    28 // CSimpleImFeatures::CSimpleImFeatures()
       
    29 // ---------------------------------------------------------------------------
       
    30 //
       
    31 CSimpleImFeatures::CSimpleImFeatures() : CProtocolImFeatures()
       
    32     {
       
    33     }
       
    34 
       
    35 
       
    36 // ---------------------------------------------------------------------------
       
    37 // CSimpleImFeatures::NewL()
       
    38 // ---------------------------------------------------------------------------
       
    39 //
       
    40 CSimpleImFeatures* CSimpleImFeatures::NewL( TAny* aInitParams )
       
    41     {
       
    42     DP_IMP( "CSimpleImFeatures::NewL()" )
       
    43     
       
    44     CSimpleImFeatures* self = new( ELeave ) CSimpleImFeatures();
       
    45     CleanupStack::PushL( self );
       
    46     self->ConstructL( aInitParams );
       
    47     CleanupStack::Pop( self );
       
    48     
       
    49     return self;
       
    50     }
       
    51 
       
    52 
       
    53 // ---------------------------------------------------------------------------
       
    54 // CSimpleImFeatures::ConstructL
       
    55 // ---------------------------------------------------------------------------
       
    56 //
       
    57 void CSimpleImFeatures::ConstructL( TAny* aInitParams )
       
    58     {    
       
    59     DP_IMP( "CSimpleImFeatures::ConstructL()" )
       
    60     __ASSERT_ALWAYS( aInitParams, User::Leave( KErrArgument ) );
       
    61     
       
    62     TSimpleImPluginInitParams* initParams =
       
    63         static_cast<TSimpleImPluginInitParams*>( aInitParams );
       
    64     
       
    65     iImConversation = CSimpleImConversation::NewL( initParams->iObserver,
       
    66         initParams->iConnection, initParams->iServiceId );
       
    67     }
       
    68 
       
    69 
       
    70 // ---------------------------------------------------------------------------
       
    71 // CSimpleImFeatures::~CSimpleImFeatures
       
    72 // ---------------------------------------------------------------------------
       
    73 //
       
    74 CSimpleImFeatures::~CSimpleImFeatures()
       
    75     {
       
    76     DP_IMP( "CSimpleImFeatures::~CSimpleImFeatures()" )
       
    77     
       
    78     delete iImConversation;
       
    79     }
       
    80 
       
    81 
       
    82 // ---------------------------------------------------------------------------
       
    83 // From MXIMPBase.
       
    84 // CSimpleImFeatures::GetInterface()
       
    85 // ---------------------------------------------------------------------------
       
    86 //
       
    87 TAny* CSimpleImFeatures::GetInterface( TInt32 aInterfaceId,
       
    88         TIfGetOps aOptions )
       
    89     {
       
    90     DP_IMP( "CSimpleImFeatures::GetInterface()" )
       
    91     
       
    92     if ( CProtocolImFeatures::KInterfaceId == aInterfaceId )
       
    93         {
       
    94         DP_IMP( "CSimpleImFeatures::GetInterface() - Found" )
       
    95         CProtocolImFeatures* self = this;
       
    96         return self;
       
    97         }
       
    98     
       
    99     if ( MXIMPBase::EPanicIfUnknown == aOptions )
       
   100         {
       
   101         User::Panic( KSimpleImPluginName, KErrExtensionNotSupported );
       
   102         }
       
   103     
       
   104     return NULL;
       
   105     }
       
   106 
       
   107 
       
   108 // ---------------------------------------------------------------------------
       
   109 // From MXIMPBase.
       
   110 // CSimpleImFeatures::GetInterface() const
       
   111 // ---------------------------------------------------------------------------
       
   112 //
       
   113 const TAny* CSimpleImFeatures::GetInterface( TInt32 aInterfaceId,
       
   114         TIfGetOps aOptions ) const
       
   115     {
       
   116 	DP_IMP( "CSimpleImFeatures::GetInterface() const" )
       
   117 	
       
   118     if ( CProtocolImFeatures::KInterfaceId == aInterfaceId )
       
   119         {
       
   120         DP_IMP( "CSimpleImFeatures::GetInterface() const - Found" )
       
   121         const CProtocolImFeatures* self = this;
       
   122         return self;
       
   123         }
       
   124 
       
   125     if ( MXIMPBase::EPanicIfUnknown == aOptions )
       
   126         {
       
   127         User::Panic( KSimpleImPluginName, KErrExtensionNotSupported );
       
   128         }
       
   129     
       
   130     return NULL;
       
   131     }
       
   132 
       
   133 
       
   134 // ---------------------------------------------------------------------------
       
   135 // From MXIMPBase.
       
   136 // CSimpleImFeatures::GetInterfaceId() const
       
   137 // ---------------------------------------------------------------------------
       
   138 //
       
   139 TInt32 CSimpleImFeatures::GetInterfaceId() const
       
   140     {
       
   141     return CProtocolImFeatures::KInterfaceId;
       
   142     }
       
   143 
       
   144 
       
   145 // ---------------------------------------------------------------------------
       
   146 // From CProtocolImFeatures.
       
   147 // CSimpleImFeatures::ImGroup()
       
   148 // ---------------------------------------------------------------------------
       
   149 //
       
   150 MProtocolImGroup& CSimpleImFeatures::ImGroup()
       
   151     {
       
   152     DP_IMP( "CSimpleImFeatures::ImGroup(), NOT SUPPORTED" )
       
   153     
       
   154     MProtocolImGroup* dummyGroup = NULL;
       
   155     return *dummyGroup;
       
   156     }
       
   157 
       
   158 
       
   159 // ---------------------------------------------------------------------------
       
   160 // From CProtocolImFeatures.
       
   161 // CSimpleImFeatures::ImConversation()
       
   162 // ---------------------------------------------------------------------------
       
   163 //
       
   164 MProtocolImConversation& CSimpleImFeatures::ImConversation()
       
   165     {
       
   166     DP_IMP( "CSimpleImFeatures::ImConversation()" )
       
   167     
       
   168     return *iImConversation;
       
   169     }
       
   170 
       
   171 
       
   172 // ---------------------------------------------------------------------------
       
   173 // From CProtocolImFeatures.
       
   174 // CSimpleImFeatures::ImInvitation()
       
   175 // ---------------------------------------------------------------------------
       
   176 //
       
   177 MProtocolImInvitation& CSimpleImFeatures::ImInvitation()
       
   178     {
       
   179     DP_IMP( "CSimpleImFeatures::ImInvitation(), NOT SUPPORTED" )
       
   180     
       
   181     MProtocolImInvitation* dummyInvitation = NULL;
       
   182     return *dummyInvitation;
       
   183     }
       
   184 
       
   185 
       
   186 // ---------------------------------------------------------------------------
       
   187 // From CProtocolImFeatures.
       
   188 // CSimpleImFeatures::ImSearch()
       
   189 // ---------------------------------------------------------------------------
       
   190 //
       
   191 MProtocolImSearch& CSimpleImFeatures::ImSearch()
       
   192     {
       
   193     DP_IMP( "CSimpleImFeatures::ImSearch(), NOT SUPPORTED" )
       
   194     
       
   195     MProtocolImSearch* dummySearch = NULL;
       
   196     return *dummySearch;
       
   197     }
       
   198 
       
   199 
       
   200 // ---------------------------------------------------------------------------
       
   201 // From CProtocolImFeatures.
       
   202 // CSimpleImFeatures::SetHost()
       
   203 // ---------------------------------------------------------------------------
       
   204 //
       
   205 void CSimpleImFeatures::SetHost( MProtocolImDataHost& aHost )
       
   206     {
       
   207     DP_IMP( "CSimpleImFeatures::SetHost()" )
       
   208     
       
   209     iHost = &aHost ;
       
   210     iImConversation->SetHost( *iHost );
       
   211     }
       
   212 
       
   213 // ---------------------------------------------------------------------------
       
   214 // From CProtocolImFeatures.
       
   215 // CSimpleImFeatures::SupportedSubInterfaces()
       
   216 // ---------------------------------------------------------------------------
       
   217 //
       
   218 TInt CSimpleImFeatures::SupportedSubInterfaces() const
       
   219     {
       
   220     return EProtocolImConversation;
       
   221     }
       
   222 
       
   223 // End of file