imservices/ossprotocoladaptation/src/presentitygroups/cossprotocolpresentitygroups.cpp
branchRCL_3
changeset 14 7797b2f86d2b
parent 13 b6f2a363adf7
child 16 cfe5eb8bb9ca
equal deleted inserted replaced
13:b6f2a363adf7 14:7797b2f86d2b
     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 presentity groups implementation
       
    15 *
       
    16 */
       
    17 
       
    18 #include <ximpbase.h>
       
    19 #include <ximpidentity.h>
       
    20 #include <ximpprotocolconnectionhost.h>
       
    21 #include "cossprotocolpresentitygroups.h"
       
    22 #include "csubscribepresentitygroupcontentrequest.h"
       
    23 
       
    24 #include "cossprotocolconnectionmanager.h"
       
    25 #include "mossprotocolconnectionmanager.h"
       
    26 #include "ossprotocolpluginlogger.h"
       
    27 #include "ossprotocolpluginpanics.h"
       
    28 #include "ossprotocolpluginlogger.h"
       
    29 #include "caddpresentitygroupmemberrequest.h" // add conatct request
       
    30 #include "cremovepresentitygroupmemberrequest.h" // remove contact req.
       
    31 // ======== MEMBER FUNCTIONS ========
       
    32 
       
    33 // ---------------------------------------------------------------------------
       
    34 // COSSProtocolpresentitygroups::GetInterface()
       
    35 // ---------------------------------------------------------------------------
       
    36 //
       
    37 TAny* COSSProtocolpresentitygroups::GetInterface ( TInt32 aInterfaceId,
       
    38         TIfGetOps aOptions )
       
    39 	{
       
    40 	LOGGER ( TXT ( "COSSProtocolpresentitygroups::GetInterface() Start" ) );
       
    41 
       
    42 	if ( aInterfaceId == MProtocolPresentityGroups::KInterfaceId )
       
    43 		{
       
    44 		MProtocolPresentityGroups* self = this;
       
    45 		return self;
       
    46 		}
       
    47 
       
    48 	if ( aOptions == MXIMPBase::EPanicIfUnknown )
       
    49 
       
    50 		{
       
    51 		User::Panic ( KOSSProtocolPresentityGroups, KErrExtensionNotSupported );
       
    52 		}
       
    53 
       
    54 	LOGGER ( TXT ( "COSSProtocolpresentitygroups::GetInterface() End" ) );
       
    55 
       
    56 	return NULL;
       
    57 	}
       
    58 
       
    59 
       
    60 // ---------------------------------------------------------------------------
       
    61 // COSSProtocolpresentitygroups::GetInterface()
       
    62 // ---------------------------------------------------------------------------
       
    63 //
       
    64 const TAny* COSSProtocolpresentitygroups::GetInterface ( TInt32 aInterfaceId,
       
    65         TIfGetOps aOptions ) const
       
    66 	{
       
    67 	LOGGER ( TXT ( "COSSProtocolpresentitygroups::GetInterface() Start" ) );
       
    68 
       
    69 	if ( aInterfaceId == MProtocolPresentityGroups::KInterfaceId )
       
    70 		{
       
    71 		const MProtocolPresentityGroups* self = this;
       
    72 		return self;
       
    73 		}
       
    74 
       
    75 	if ( aOptions == MXIMPBase::EPanicIfUnknown )
       
    76 
       
    77 		{
       
    78 		User::Panic ( KOSSProtocolPresentityGroups, KErrExtensionNotSupported );
       
    79 		}
       
    80 
       
    81 	LOGGER ( TXT ( "COSSProtocolpresentitygroups::GetInterface() End" ) );
       
    82 
       
    83 	return NULL;
       
    84 	}
       
    85 
       
    86 
       
    87 // ---------------------------------------------------------------------------
       
    88 // COSSProtocolpresentitygroups::GetInterfaceId()
       
    89 // ---------------------------------------------------------------------------
       
    90 //
       
    91 TInt32 COSSProtocolpresentitygroups::GetInterfaceId() const
       
    92 	{
       
    93 	LOGGER ( TXT ( "COSSProtocolpresentitygroups::GetInterfaceId() Start-End" ) );
       
    94 	return MProtocolPresentityGroups::KInterfaceId;
       
    95 	}
       
    96 
       
    97 
       
    98 // ---------------------------------------------------------------------------
       
    99 // COSSProtocolpresentitygroups::COSSProtocolpresentitygroups()
       
   100 // ---------------------------------------------------------------------------
       
   101 //
       
   102 COSSProtocolpresentitygroups::COSSProtocolpresentitygroups (
       
   103     MOSSProtocolConnectionManager& aConnMan )
       
   104 		: iConnMan ( aConnMan )
       
   105 	{
       
   106 	LOGGER ( TXT ( "Groups::COSSProtocolpresentitygroups() Start-End" ) );
       
   107 	}
       
   108 
       
   109 
       
   110 // ---------------------------------------------------------------------------
       
   111 // COSSProtocolpresentitygroups::ConstructL()
       
   112 // ---------------------------------------------------------------------------
       
   113 //
       
   114 void COSSProtocolpresentitygroups::ConstructL()
       
   115 	{
       
   116 	LOGGER ( TXT ( "COSSProtocolpresentitygroups::ConstructL() Start" ) );
       
   117 	LOGGER ( TXT ( "COSSProtocolpresentitygroups::ConstructL() End" ) );
       
   118 	}
       
   119 
       
   120 
       
   121 // ---------------------------------------------------------------------------
       
   122 // COSSProtocolpresentitygroups::NewL()
       
   123 // ---------------------------------------------------------------------------
       
   124 //
       
   125 COSSProtocolpresentitygroups* COSSProtocolpresentitygroups::NewL (
       
   126     MOSSProtocolConnectionManager& aConnMan )
       
   127 	{
       
   128 	LOGGER ( TXT ( "COSSProtocolpresentitygroups::NewL() Start" ) );
       
   129 
       
   130 	COSSProtocolpresentitygroups* self =
       
   131 	    new ( ELeave ) COSSProtocolpresentitygroups ( aConnMan );
       
   132 	CleanupStack::PushL ( self );
       
   133 	self->ConstructL( );
       
   134 	CleanupStack::Pop ( self );
       
   135 
       
   136 	LOGGER ( TXT ( "COSSProtocolpresentitygroups::NewL() End" ) );
       
   137 	return self;
       
   138 	}
       
   139 
       
   140 
       
   141 // ---------------------------------------------------------------------------
       
   142 // COSSProtocolpresentitygroups::~COSSProtocolpresentitygroups()
       
   143 // ---------------------------------------------------------------------------
       
   144 //
       
   145 COSSProtocolpresentitygroups::~COSSProtocolpresentitygroups()
       
   146 	{
       
   147 	LOGGER ( TXT ( "Groups::~COSSProtocolpresentitygroups() Start" ) );
       
   148 
       
   149 
       
   150 	LOGGER ( TXT ( "Groups::~COSSProtocolpresentitygroups() End" ) );
       
   151 	}
       
   152 
       
   153 
       
   154 
       
   155 // ---------------------------------------------------------------------------
       
   156 // COSSProtocolpresentitygroups::DoSubscribePresentityGroupListL()
       
   157 // ---------------------------------------------------------------------------
       
   158 //
       
   159 void COSSProtocolpresentitygroups::DoSubscribePresentityGroupListL (
       
   160     TXIMPRequestId /*aReqId */)
       
   161 	{
       
   162      // not supported
       
   163 	}
       
   164 
       
   165 
       
   166 // ---------------------------------------------------------------------------
       
   167 // COSSProtocolpresentitygroups::DoUnsubscribePresentityGroupListL()
       
   168 // ---------------------------------------------------------------------------
       
   169 //
       
   170 void COSSProtocolpresentitygroups::DoUnsubscribePresentityGroupListL (
       
   171     TXIMPRequestId /*aReqId*/ )
       
   172 	{
       
   173      //not supported
       
   174 	}
       
   175 
       
   176 
       
   177 // ---------------------------------------------------------------------------
       
   178 // COSSProtocolpresentitygroups::DoCreatePresentityGroupL()
       
   179 // ---------------------------------------------------------------------------
       
   180 //
       
   181 void COSSProtocolpresentitygroups::DoCreatePresentityGroupL (
       
   182     const MXIMPIdentity& /*aIdentity*/,
       
   183     const TDesC16& /*aDisplayName*/,
       
   184     TXIMPRequestId /*aReqId*/ )
       
   185 	{
       
   186 	LOGGER ( TXT ( "Groups::DoCreatePresentityGroupL() Start" ) );
       
   187     //not supported
       
   188 
       
   189 	LOGGER ( TXT ( "Groups::DoCreatePresentityGroupL() End" ) );
       
   190 	}
       
   191 
       
   192 // ---------------------------------------------------------------------------
       
   193 // COSSProtocolpresentitygroups::DoDeletePresentityGroupL()
       
   194 // ---------------------------------------------------------------------------
       
   195 //
       
   196 void COSSProtocolpresentitygroups::DoDeletePresentityGroupL (
       
   197     const MXIMPIdentity& /*Identity*/,
       
   198     TXIMPRequestId /*aReqId*/ )
       
   199 	{
       
   200 	LOGGER ( TXT ( "Groups::DoDeletePresentityGroupL() Start" ) );
       
   201     //not supported
       
   202 
       
   203 	LOGGER ( TXT ( "Groups::DoDeletePresentityGroupL() End" ) );
       
   204 	}
       
   205 
       
   206 // ---------------------------------------------------------------------------
       
   207 // COSSProtocolpresentitygroups::DoUpdatePresentityGroupDisplayNameL()
       
   208 // ---------------------------------------------------------------------------
       
   209 //
       
   210 void COSSProtocolpresentitygroups::DoUpdatePresentityGroupDisplayNameL (
       
   211     const MXIMPIdentity& /*aIdentity*/,
       
   212     const TDesC16& /*aDisplayName*/,
       
   213     TXIMPRequestId /*aReqId*/ )
       
   214 	{
       
   215 	LOGGER ( TXT ( "Groups::DoUpdatePresentityGroupDisplayNameL() Start" ) );
       
   216      
       
   217 	LOGGER ( TXT ( "Groups::DoUpdatePresentityGroupDisplayNameL() End" ) );
       
   218 	}
       
   219 
       
   220 // ---------------------------------------------------------------------------
       
   221 // COSSProtocolpresentitygroups::DoSubscribePresentityGroupContentL()
       
   222 // ---------------------------------------------------------------------------
       
   223 //
       
   224 void COSSProtocolpresentitygroups::DoSubscribePresentityGroupContentL (
       
   225     const MXIMPIdentity& aGroupId,
       
   226     TXIMPRequestId aReqId )
       
   227     {
       
   228     
       
   229     LOGGER ( TXT ( "Groups::DoSubscribePresentityGroupContentL() Start" ) );
       
   230     if( ! iConnMan.GetContactManager().IsFetchContactsFirstTime())
       
   231         {
       
   232         iConnMan.GetContactManager().SetFetchContactsFirstTime(ETrue);
       
   233         CreateDataHandlerL();
       
   234         CSubscribePresentityGroupContentRequest* req =
       
   235         CSubscribePresentityGroupContentRequest::NewLC ( iConnMan, aReqId );
       
   236         req->SubscribePresentityGroupContentL ( aGroupId );
       
   237         CleanupStack::Pop ( req );
       
   238         }
       
   239     //keep a locol copy of the contacts and return to ximp fw
       
   240     else
       
   241         {
       
   242         iConnMan.GetContactManager().ReturnContactsListL();
       
   243         iConnMan.HandleToHost().HandleRequestCompleted ( aReqId, KErrNone );
       
   244         }        
       
   245     LOGGER ( TXT ( "Groups::DoSubscribePresentityGroupContentL() End" ) );
       
   246 	}
       
   247 
       
   248 // ---------------------------------------------------------------------------
       
   249 // COSSProtocolpresentitygroups::DoUnsubscribePresentityGroupContentL()
       
   250 // ---------------------------------------------------------------------------
       
   251 //
       
   252 void COSSProtocolpresentitygroups::DoUnsubscribePresentityGroupContentL (
       
   253     const MXIMPIdentity& /*aGroupId*/,
       
   254     TXIMPRequestId aReqId )
       
   255 	{
       
   256 	LOGGER ( TXT ( "Groups::DoUnsubscribePresentityGroupContentL() Start" ) );
       
   257 
       
   258 	// just complete the request to PrFw Successfully
       
   259 
       
   260 	iConnMan.HandleToHost().HandleRequestCompleted ( aReqId, KErrNone );
       
   261 
       
   262 	LOGGER ( TXT ( "Groups::DoUnsubscribePresentityGroupContentL() End" ) );
       
   263 	}
       
   264 
       
   265 // ---------------------------------------------------------------------------
       
   266 // COSSProtocolpresentitygroups::DoAddPresentityGroupMemberL()
       
   267 // ---------------------------------------------------------------------------
       
   268 //
       
   269 void COSSProtocolpresentitygroups::DoAddPresentityGroupMemberL (
       
   270     const MXIMPIdentity& aGroupId,
       
   271     const MXIMPIdentity& aMemberId,
       
   272     const TDesC16& aMemberDisplayName,
       
   273     TXIMPRequestId aReqId )
       
   274 	{
       
   275 	LOGGER ( TXT ( "Groups::DoAddPresentityGroupMemberL() Start" ) );
       
   276 	
       
   277 	CAddPresentityGroupMemberRequest* addreq =
       
   278 				 CAddPresentityGroupMemberRequest::NewLC(iConnMan, aReqId );
       
   279 				 
       
   280 	addreq->AddPresentityGroupMemberL(aGroupId,aMemberId,aMemberDisplayName);
       
   281 	
       
   282 	CleanupStack::Pop ( addreq );
       
   283 	
       
   284 	LOGGER ( TXT ( "Groups::DoAddPresentityGroupMemberL() End" ) );
       
   285 	}
       
   286 
       
   287 // ---------------------------------------------------------------------------
       
   288 // COSSProtocolpresentitygroups::DoRemovePresentityGroupMemberL()
       
   289 // ---------------------------------------------------------------------------
       
   290 //
       
   291 void COSSProtocolpresentitygroups::DoRemovePresentityGroupMemberL (
       
   292     const MXIMPIdentity& aGroupId,
       
   293     const MXIMPIdentity& aMemberId,
       
   294     TXIMPRequestId aReqId )
       
   295 	{
       
   296 	LOGGER ( TXT ( "Groups::DoRemovePresentityGroupMemberL() Start" ) ) ;
       
   297 	CRemovePresentityGroupMemberRequest* removereq =
       
   298 				 CRemovePresentityGroupMemberRequest::NewLC(iConnMan, aReqId );
       
   299 				 
       
   300 	removereq->RemovePresentityGroupMemberL(aGroupId,aMemberId);
       
   301 	
       
   302 	CleanupStack::Pop ( removereq );
       
   303 	LOGGER ( TXT ( "Groups::DoRemovePresentityGroupMemberL() End" ) );
       
   304 	}
       
   305 
       
   306 // ---------------------------------------------------------------------------
       
   307 // COSSProtocolpresentitygroups::DoUpdatePresentityGroupMemberDisplayNameL()
       
   308 // ---------------------------------------------------------------------------
       
   309 //
       
   310 void COSSProtocolpresentitygroups::DoUpdatePresentityGroupMemberDisplayNameL (
       
   311     const MXIMPIdentity& /*aGroupId*/,
       
   312     const MXIMPIdentity& /*aMemberId*/,
       
   313     const TDesC16& /*aMemberDisplayName*/,
       
   314     TXIMPRequestId /*aReqId*/ )
       
   315 	{
       
   316 	LOGGER ( TXT ( "Groups::DoUpdatePresentityGroupMemberDisplayNameL() Start" ) );
       
   317 	LOGGER ( TXT ( "Groups::DoUpdatePresentityGroupMemberDisplayNameL() End" ) );
       
   318 	}
       
   319 
       
   320 // ---------------------------------------------------------------------------
       
   321 // COSSProtocolpresentitygroups::CreateDataHandler()
       
   322 // ---------------------------------------------------------------------------
       
   323 //
       
   324 void COSSProtocolpresentitygroups::CreateDataHandlerL()
       
   325 	{
       
   326 	LOGGER ( TXT ( "COSSProtocolpresentitygroups::CreateDataHandler() Start" ) );
       
   327 
       
   328 	iConnMan.ManufactureDataHandlerL();
       
   329 
       
   330 	LOGGER ( TXT ( "COSSProtocolpresentitygroups::CreateDataHandler() End" ) );
       
   331 	}
       
   332 
       
   333 // End of file
       
   334