imservices/ossprotocoladaptation/src/presenceauthorization/cossprotocolpresenceauthorization.cpp
changeset 46 860cd8a5168c
parent 35 085f765766a0
equal deleted inserted replaced
35:085f765766a0 46:860cd8a5168c
     1 /*
       
     2 * Copyright (c) 2007-2008 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:  Oss Protocol implementation for Presence Framework
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <badesca.h>
       
    20 
       
    21 #include <ximpbase.h>
       
    22 #include <ximpidentity.h>
       
    23 #include <ximpprotocolconnectionhost.h>
       
    24 
       
    25 #include "cossprotocolpresenceauthorization.h"
       
    26 #include "ossprotocolpluginlogger.h"
       
    27 #include "cossprotocolconnectionmanager.h"
       
    28 
       
    29 #include "csubscribepresencegrantrequestlistrequest.h"
       
    30 #include "ossprotocolpluginpanics.h"
       
    31 #include "cpresenceauthuserrequest.h"
       
    32 #include "cwithdrawpresencegrantfrompresentityrequest.h"
       
    33 
       
    34 
       
    35 // ======== MEMBER FUNCTIONS ========
       
    36 
       
    37 // ---------------------------------------------------------------------------
       
    38 // CImpsConnection::GetInterface()
       
    39 // ---------------------------------------------------------------------------
       
    40 //
       
    41 TAny* COssProtocolPresenceAuthorization::GetInterface( TInt32 aInterfaceId,
       
    42                                 TIfGetOps aOptions )
       
    43     {
       
    44     LOGGER ( TXT("COssProtocolPresenceAuthorization::GetInterface() Start") );
       
    45     if( aInterfaceId == MProtocolPresenceAuthorization::KInterfaceId )
       
    46         {
       
    47         MProtocolPresenceAuthorization* self = this;
       
    48         return self;
       
    49         }
       
    50 
       
    51     if( aOptions == MXIMPBase::EPanicIfUnknown ) 
       
    52         {
       
    53         User::Panic( KOSSProtocolPresenceAuthorization, KErrExtensionNotSupported );
       
    54         }
       
    55 	LOGGER ( TXT("COssProtocolPresenceAuthorization::GetInterface() End") );
       
    56     return NULL;
       
    57     }
       
    58 
       
    59 
       
    60 // ---------------------------------------------------------------------------
       
    61 // CImpsConnection::GetInterface()
       
    62 // ---------------------------------------------------------------------------
       
    63 //
       
    64 const TAny* COssProtocolPresenceAuthorization::GetInterface( TInt32 aInterfaceId,
       
    65                                       TIfGetOps aOptions ) const
       
    66     {
       
    67     LOGGER ( TXT("COssProtocolPresenceAuthorization::GetInterface() Start") );
       
    68     if( aInterfaceId == MProtocolPresenceAuthorization::KInterfaceId )
       
    69         {
       
    70         const MProtocolPresenceAuthorization* self = this;
       
    71         return self;
       
    72         }
       
    73 
       
    74     if( aOptions == MXIMPBase::EPanicIfUnknown ) 
       
    75         {
       
    76         User::Panic( KOSSProtocolPresenceAuthorization, KErrExtensionNotSupported );
       
    77         }
       
    78 	LOGGER ( TXT("COssProtocolPresenceAuthorization::GetInterface() End") );
       
    79     return NULL;
       
    80     }
       
    81 
       
    82 
       
    83 // ---------------------------------------------------------------------------
       
    84 // CImpsConnection::NewInstanceLC()
       
    85 // ---------------------------------------------------------------------------
       
    86 //
       
    87 TInt32 COssProtocolPresenceAuthorization::GetInterfaceId() const
       
    88     {
       
    89     LOGGER ( TXT("COssProtocolPresenceAuthorization::GetInterfaceId() Start-End") );
       
    90     return MProtocolPresenceAuthorization::KInterfaceId;
       
    91     }
       
    92 
       
    93 
       
    94 
       
    95 // ---------------------------------------------------------------------------
       
    96 // COssProtocolPresenceAuthorization::COssProtocolPresenceAuthorization()
       
    97 // ---------------------------------------------------------------------------
       
    98 //
       
    99 COssProtocolPresenceAuthorization::COssProtocolPresenceAuthorization(
       
   100 									MOSSProtocolConnectionManager& aConnMan)
       
   101 	:iConnMan(aConnMan)
       
   102     {
       
   103    	LOGGER ( TXT("::COssProtocolPresenceAuthorization() Start-End") );
       
   104     }
       
   105 
       
   106 
       
   107 // ---------------------------------------------------------------------------
       
   108 // COssProtocolPresenceAuthorization::ConstructL()
       
   109 // ---------------------------------------------------------------------------
       
   110 //
       
   111 void COssProtocolPresenceAuthorization::ConstructL()
       
   112     {
       
   113     LOGGER ( TXT("COssProtocolPresenceAuthorization::ConstructL() Start") );                                    
       
   114     LOGGER ( TXT("COssProtocolPresenceAuthorization::ConstructL() End") );
       
   115     }
       
   116 
       
   117 
       
   118 // ---------------------------------------------------------------------------
       
   119 // COssProtocolPresenceAuthorization::NewL()
       
   120 // ---------------------------------------------------------------------------
       
   121 //
       
   122 COssProtocolPresenceAuthorization* COssProtocolPresenceAuthorization::NewL( 
       
   123 						MOSSProtocolConnectionManager& aConnMan )
       
   124     {
       
   125     LOGGER ( TXT("COssProtocolPresenceAuthorization::NewL() Start") );
       
   126 
       
   127     COssProtocolPresenceAuthorization* self = 
       
   128     					new( ELeave ) COssProtocolPresenceAuthorization( aConnMan);
       
   129     CleanupStack::PushL( self );
       
   130     self->ConstructL();
       
   131     CleanupStack::Pop( self );
       
   132 
       
   133     LOGGER ( TXT("COssProtocolPresenceAuthorization::NewL() End") );
       
   134     return self;
       
   135     }
       
   136 
       
   137 
       
   138 // ---------------------------------------------------------------------------
       
   139 // COssProtocolPresenceAuthorization::~COssProtocolPresenceAuthorization()
       
   140 // ---------------------------------------------------------------------------
       
   141 //
       
   142 COssProtocolPresenceAuthorization::~COssProtocolPresenceAuthorization()
       
   143     {
       
   144     LOGGER ( TXT("Authorization::~COssProtocolPresenceAuthorization() Start") );
       
   145     
       
   146         
       
   147 	LOGGER ( TXT("Authorization::~COssProtocolPresenceAuthorization() End") );
       
   148     }
       
   149 
       
   150 
       
   151 // ---------------------------------------------------------------------------
       
   152 // COssProtocolPresenceAuthorization::DoUnsubscribePresenceWatcherListL()
       
   153 // ---------------------------------------------------------------------------
       
   154 //
       
   155 void COssProtocolPresenceAuthorization::DoSubscribePresenceGrantRequestListL( 
       
   156 			TXIMPRequestId aReqId )
       
   157     {
       
   158     LOGGER ( TXT("Authorization::DoSubscribePresenceGrantRequestListL() Start") );
       
   159     if( ! iConnMan.GetContactManager().IsFetchInvitationsForFirstTime() )
       
   160         {
       
   161         iConnMan.GetContactManager().SetFetchInvitationsForFirstTime(ETrue);
       
   162         CreateDataHandlerL();
       
   163 
       
   164         iConnMan.GetAddNotificationHandler().StartListeningL();
       
   165         iConnMan.HandleToHost().HandleRequestCompleted( aReqId, KErrNone );
       
   166         }	
       
   167 	else
       
   168 	    {
       
   169 	    iConnMan.GetContactManager().ReturnInvitationListL();
       
   170 	    iConnMan.HandleToHost().HandleRequestCompleted ( aReqId, KErrNone );
       
   171 	    }
       
   172     
       
   173     LOGGER ( TXT("Authorization::DoSubscribePresenceGrantRequestListL() End") );
       
   174     }
       
   175 
       
   176 // ---------------------------------------------------------------------------
       
   177 // COssProtocolPresenceAuthorization::DoUnsubscribePresenceWatcherListL()
       
   178 // ---------------------------------------------------------------------------
       
   179 //
       
   180 void COssProtocolPresenceAuthorization::DoUnsubscribePresenceGrantRequestListL( 
       
   181 			TXIMPRequestId aReqId )
       
   182     {
       
   183     LOGGER ( TXT("Authorization::DoUnsubscribePresenceGrantRequestListL() Start") );
       
   184   
       
   185     // complete the request successfully
       
   186     iConnMan.HandleToHost().HandleRequestCompleted( aReqId, KErrNone );
       
   187     	
       
   188     LOGGER ( TXT("Authorization::DoUnsubscribePresenceGrantRequestListL() End") );
       
   189     }
       
   190 
       
   191 // ---------------------------------------------------------------------------
       
   192 // COssProtocolPresenceAuthorization::DoGrantPresenceForPresentityL()
       
   193 // ---------------------------------------------------------------------------
       
   194 //
       
   195 void COssProtocolPresenceAuthorization::DoGrantPresenceForPresentityL( 
       
   196 												const MXIMPIdentity& aIdentity,
       
   197                                                 const MPresenceInfoFilter& aPif,
       
   198                                                 TXIMPRequestId aReqId )
       
   199     {
       
   200     LOGGER ( TXT("Authorization::DoGrantPresenceForPresentityL() Start") );
       
   201 	CreateDataHandlerL();
       
   202  		
       
   203  	CPresenceAuthUserRequest* req = 
       
   204  	CPresenceAuthUserRequest::NewLC( iConnMan, aReqId );
       
   205  	
       
   206  	
       
   207 	req->PresenceAuthUserRequestL(aIdentity,aPif);
       
   208 	
       
   209 	CleanupStack::Pop( req );
       
   210     LOGGER ( TXT("Authorization::DoGrantPresenceForPresentityL() End") );
       
   211     }
       
   212 
       
   213 // ---------------------------------------------------------------------------
       
   214 // COssProtocolPresenceAuthorization::DoUpdateGrantPresenceForPresentityL()
       
   215 // ---------------------------------------------------------------------------
       
   216 //
       
   217 void COssProtocolPresenceAuthorization::DoUpdatePresenceGrantPifForPresentityL( 
       
   218 											const MXIMPIdentity&/*aIdentity*/,
       
   219                                             const MPresenceInfoFilter &/*aPif*/,
       
   220                                             TXIMPRequestId /*aReqId*/ )
       
   221     {
       
   222     LOGGER ( TXT("Authorization::DoUpdatePresenceGrantPifForPresentityL() Start") );
       
   223     LOGGER ( TXT("Authorization::DoUpdatePresenceGrantPifForPresentityL() End") );
       
   224     }
       
   225 
       
   226 // ---------------------------------------------------------------------------
       
   227 // COssProtocolPresenceAuthorization::DoUpdateGrantPresenceForPresentityGroupMembersL()
       
   228 // ---------------------------------------------------------------------------
       
   229 //
       
   230 void COssProtocolPresenceAuthorization::DoWithdrawPresenceGrantFromPresentityL( 
       
   231 											const MXIMPIdentity &aIdentity,
       
   232                                             TXIMPRequestId aReqId )
       
   233     {
       
   234     LOGGER ( TXT("Authorization::DoWithdrawPresenceGrantFromPresentityL() Start") );
       
   235     CreateDataHandlerL();
       
   236  		
       
   237  	CWithdrawPresenceGrantFromPresentityRequest* req = 
       
   238  	CWithdrawPresenceGrantFromPresentityRequest::NewLC( iConnMan, aReqId );
       
   239  	
       
   240  	
       
   241 	req->WithdrawPresenceGrantFromPresentityL( aIdentity );
       
   242 	
       
   243 	CleanupStack::Pop( req );
       
   244 
       
   245     
       
   246     LOGGER ( TXT("Authorization::DoWithdrawPresenceGrantFromPresentityL() End") );
       
   247     }
       
   248 
       
   249 // ---------------------------------------------------------------------------
       
   250 // COssProtocolPresenceAuthorization::DoGrantPresenceForPresentityGroupMembersL()
       
   251 // ---------------------------------------------------------------------------
       
   252 //
       
   253 void COssProtocolPresenceAuthorization::DoGrantPresenceForPresentityGroupMembersL( 
       
   254 											const  MXIMPIdentity&/*aIdentity*/,
       
   255                                             const MPresenceInfoFilter& /*aPif*/,
       
   256                                             TXIMPRequestId /*aReqId*/ )
       
   257     {
       
   258     LOGGER ( TXT("Authorization::DoGrantPresenceForPresentityGroupMembersL() Start") );
       
   259     
       
   260     LOGGER ( TXT("Authorization::DoGrantPresenceForPresentityGroupMembersL() End") );
       
   261     }
       
   262 
       
   263 // ---------------------------------------------------------------------------
       
   264 // COssProtocolPresenceAuthorization::DoUpdateGrantPresenceForPresentityGroupMembersL()
       
   265 // ---------------------------------------------------------------------------
       
   266 //
       
   267 void COssProtocolPresenceAuthorization::DoUpdatePresenceGrantPifForPresentityGroupMembersL( 
       
   268 											const MXIMPIdentity&/*aIdentity*/,
       
   269                                             const MPresenceInfoFilter&/*aPif*/,
       
   270                                             TXIMPRequestId /*aReqId*/ )
       
   271     {
       
   272     LOGGER ( TXT("DoUpdatePresenceGrantPifForPresentityGroupMembersL() Start") );
       
   273     
       
   274     LOGGER ( TXT("DoUpdatePresenceGrantPifForPresentityGroupMembersL() End") );
       
   275     }
       
   276 
       
   277 
       
   278 // ---------------------------------------------------------------------------
       
   279 // COssProtocolPresenceAuthorization::DoUpdateGrantPresenceForPresentityGroupMembersL()
       
   280 // ---------------------------------------------------------------------------
       
   281 //
       
   282 void COssProtocolPresenceAuthorization::DoWithdrawPresenceGrantFromPresentityGroupMembersL( 
       
   283 											const MXIMPIdentity&/*aIdentity*/,
       
   284 											TXIMPRequestId /*aReqId*/ )
       
   285     {
       
   286     LOGGER ( TXT("DoWithdrawPresenceGrantFromPresentityGroupMembersL() Start") );
       
   287     
       
   288     LOGGER ( TXT("DoWithdrawPresenceGrantFromPresentityGroupMembersL() End") );
       
   289     }
       
   290 
       
   291 // ---------------------------------------------------------------------------
       
   292 // COssProtocolPresenceAuthorization::DoGrantPresenceForEveryoneL()
       
   293 // ---------------------------------------------------------------------------
       
   294 //
       
   295 void COssProtocolPresenceAuthorization::DoGrantPresenceForEveryoneL( 
       
   296 											const MPresenceInfoFilter& /*aPif*/,
       
   297  											TXIMPRequestId /*aReqId*/ )
       
   298 	{
       
   299 	LOGGER ( TXT("Authorization::DoGrantPresenceForEveryoneL() Start") );
       
   300 	
       
   301     LOGGER ( TXT("Authorization::DoGrantPresenceForEveryoneL() End") );
       
   302 	}
       
   303 
       
   304 // ---------------------------------------------------------------------------
       
   305 // COssProtocolPresenceAuthorization::DoUpdatePresenceGrantPifForEveryoneL()
       
   306 // ---------------------------------------------------------------------------
       
   307 //											 
       
   308 void COssProtocolPresenceAuthorization::DoUpdatePresenceGrantPifForEveryoneL(
       
   309 											const MPresenceInfoFilter& /*aPif*/,
       
   310 						                    TXIMPRequestId /*aReqId*/ )
       
   311 	{
       
   312 	LOGGER ( TXT("Authorization::DoUpdatePresenceGrantPifForEveryoneL() Start") );
       
   313 	
       
   314     LOGGER ( TXT("Authorization::DoUpdatePresenceGrantPifForEveryoneL() End") );
       
   315 	}
       
   316 
       
   317 // ---------------------------------------------------------------------------
       
   318 // COssProtocolPresenceAuthorization::DoWithdrawPresenceGrantFromEveryoneL()
       
   319 // ---------------------------------------------------------------------------
       
   320 //                  
       
   321 void COssProtocolPresenceAuthorization::DoWithdrawPresenceGrantFromEveryoneL( 
       
   322 						TXIMPRequestId /*aReqId*/ )
       
   323 	{
       
   324 	LOGGER ( TXT("Authorization::DoWithdrawPresenceGrantFromEveryoneL() Start") );
       
   325 	
       
   326     LOGGER ( TXT("Authorization::DoWithdrawPresenceGrantFromEveryoneL() End") );
       
   327 	} 
       
   328 	
       
   329 // ---------------------------------------------------------------------------
       
   330 // COssProtocolPresenceAuthorization::DoSubscribePresenceBlockListL()
       
   331 // ---------------------------------------------------------------------------
       
   332 //
       
   333 void COssProtocolPresenceAuthorization::DoSubscribePresenceBlockListL( 
       
   334 						TXIMPRequestId /*aReqId*/ )
       
   335     {
       
   336     LOGGER ( TXT("Authorization::DoSubscribePresenceBlockListL() Start") );
       
   337     
       
   338     LOGGER ( TXT("Authorization::DoSubscribePresenceBlockListL() End") );
       
   339     }
       
   340     
       
   341 
       
   342 // ---------------------------------------------------------------------------
       
   343 // COssProtocolPresenceAuthorization::DoUnsubscribePresenceBlockListL()
       
   344 // ---------------------------------------------------------------------------
       
   345 //
       
   346 void COssProtocolPresenceAuthorization::DoUnsubscribePresenceBlockListL( 
       
   347 				TXIMPRequestId /*aReqId*/ )
       
   348     {
       
   349     LOGGER ( TXT("Authorization::DoUnsubscribePresenceBlockListL() Start") );
       
   350     LOGGER ( TXT("Authorization::DoUnsubscribePresenceBlockListL() End") );
       
   351     }
       
   352 
       
   353 
       
   354 // ---------------------------------------------------------------------------
       
   355 // COssProtocolPresenceAuthorization::DoBlockPresenceForPresentityL()
       
   356 // ---------------------------------------------------------------------------
       
   357 //
       
   358 void COssProtocolPresenceAuthorization::DoBlockPresenceForPresentityL( 
       
   359 											const MXIMPIdentity& /*aPresentityId*/,
       
   360 											TXIMPRequestId /*aReqId*/ )
       
   361     {
       
   362     LOGGER ( TXT("Authorization::DoBlockPresenceForPresentityL() Start") );
       
   363     
       
   364     LOGGER ( TXT("Authorization::DoBlockPresenceForPresentityL() End") );
       
   365     }
       
   366 
       
   367 // ---------------------------------------------------------------------------
       
   368 // COssProtocolPresenceAuthorization::DoCancelPresenceBlockFromPresentityL()
       
   369 // ---------------------------------------------------------------------------
       
   370 //
       
   371 void COssProtocolPresenceAuthorization::DoCancelPresenceBlockFromPresentityL( 
       
   372 											const MXIMPIdentity& /*aPresentityId*/,
       
   373 											TXIMPRequestId /*aReqId*/ )
       
   374     {
       
   375     LOGGER ( TXT("Authorization::DoCancelPresenceBlockFromPresentityL() Start") );
       
   376   
       
   377     LOGGER ( TXT("Authorization::DoCancelPresenceBlockFromPresentityL() End") );
       
   378     }
       
   379 
       
   380 // ---------------------------------------------------------------------------
       
   381 // COssProtocolPresenceAuthorization::CreateDataHandlerL()
       
   382 // ---------------------------------------------------------------------------
       
   383 //
       
   384 void COssProtocolPresenceAuthorization::CreateDataHandlerL()
       
   385 	{
       
   386 	LOGGER ( TXT("Authorization::CreateDataHandler() Start"));
       
   387 	iConnMan.ManufactureDataHandlerL();		
       
   388 	LOGGER ( TXT("Authorization::CreateDataHandler() End"));
       
   389 	}
       
   390 	
       
   391 
       
   392 // End of file
       
   393