uiservicetab/vimpstcmdprocess/src/cvimstcmdfriendrequest.cpp
branchRCL_3
changeset 29 9a48e301e94b
equal deleted inserted replaced
28:3104fc151679 29:9a48e301e94b
       
     1 /*
       
     2 * Copyright (c) 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:  command process for friend request
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "cvimstcmdfriendrequest.h"
       
    21 
       
    22 #include "vimpstcmd.hrh"
       
    23 #include "mvimpstcmdobserver.h"
       
    24 
       
    25 #include "uiservicetabtracer.h"
       
    26 
       
    27 #include <e32def.h>
       
    28 #include "mvimpstengine.h"
       
    29 #include "mvimpstenginepresencesubservice.h"
       
    30 #include "mvimpstenginesubservice.h"
       
    31 
       
    32 // Constants
       
    33 
       
    34 // --------------------------------------------------------------------------
       
    35 // CVIMPSTCmdFriendRequest::CVIMPSTCmdFriendRequest
       
    36 // --------------------------------------------------------------------------
       
    37 //
       
    38 CVIMPSTCmdFriendRequest::CVIMPSTCmdFriendRequest( 
       
    39         const TInt aCommandId ,const TDesC& aContactId,
       
    40         MVIMPSTEngine& aEngine) :            
       
    41             iCommandId( aCommandId ),
       
    42             iContactId( aContactId ),
       
    43             iEngine(aEngine)
       
    44     {
       
    45     }
       
    46 
       
    47 // --------------------------------------------------------------------------
       
    48 // CVIMPSTCmdFriendRequest::~CVIMPSTCmdFriendRequest
       
    49 // --------------------------------------------------------------------------
       
    50 //
       
    51 CVIMPSTCmdFriendRequest::~CVIMPSTCmdFriendRequest()
       
    52     {    
       
    53     
       
    54     }
       
    55 
       
    56 // --------------------------------------------------------------------------
       
    57 // CVIMPSTCmdFriendRequest::NewL
       
    58 // --------------------------------------------------------------------------
       
    59 //
       
    60 CVIMPSTCmdFriendRequest* CVIMPSTCmdFriendRequest::NewL( 
       
    61         const TInt aCommandId,const TDesC& aContactId,
       
    62         MVIMPSTEngine& aEngine)
       
    63     {
       
    64     CVIMPSTCmdFriendRequest* self = new (ELeave ) CVIMPSTCmdFriendRequest( aCommandId ,aContactId, aEngine);
       
    65     self->ConstructL(); //use contsurctL if necessary
       
    66     return self;
       
    67     }
       
    68 // --------------------------------------------------------------------------
       
    69 // CVIMPSTCmdFriendRequest::ConstructL
       
    70 // --------------------------------------------------------------------------
       
    71 //
       
    72 void CVIMPSTCmdFriendRequest::ConstructL()
       
    73     {    
       
    74     iError = KErrNone;
       
    75     }
       
    76 
       
    77 // --------------------------------------------------------------------------
       
    78 // CVIMPSTCmdFriendRequest::ExecuteLD
       
    79 // --------------------------------------------------------------------------
       
    80 //
       
    81 void CVIMPSTCmdFriendRequest::ExecuteLD()
       
    82     {
       
    83    
       
    84     TRACER_AUTO;
       
    85     //push to the cleanupstack
       
    86     CleanupStack::PushL( this );     
       
    87     
       
    88     //Get Presence SubService 
       
    89     MVIMPSTEngineSubService* subService =    	   
       
    90    	   			(iEngine.SubService(TVIMPSTEnums::EPresence));
       
    91     
       
    92     if(subService)
       
    93         {
       
    94         MVIMPSTEnginePresenceSubService& presence = 
       
    95         		MVIMPSTEnginePresenceSubService::Cast (*subService);
       
    96         presence.SendPresenceGrantPresentityL(iContactId, ( iCommandId == EFriendAccpeted  ));
       
    97         }
       
    98     
       
    99     
       
   100 
       
   101     if(iObserver)
       
   102         {
       
   103         iObserver->CommandFinishedL(*this);
       
   104         }
       
   105       
       
   106     CleanupStack::PopAndDestroy();  
       
   107     
       
   108     }
       
   109 
       
   110 
       
   111 // --------------------------------------------------------------------------
       
   112 // CVIMPSTCmdFriendRequest::AddObserver
       
   113 // --------------------------------------------------------------------------
       
   114 //
       
   115 void CVIMPSTCmdFriendRequest::AddObserver( MVIMPSTCmdObserver& aObserver )
       
   116     {
       
   117     // store the observer to notify the command completion
       
   118     iObserver = &aObserver;
       
   119     }
       
   120 
       
   121 
       
   122 // --------------------------------------------------------------------------
       
   123 // CVIMPSTCmdFriendRequest::CommandId
       
   124 // --------------------------------------------------------------------------
       
   125 //
       
   126 TInt CVIMPSTCmdFriendRequest::CommandId() const
       
   127     {
       
   128     return iCommandId;  
       
   129     }
       
   130 
       
   131 // --------------------------------------------------------------------------
       
   132 // CVIMPSTCmdFriendRequest::Result
       
   133 // --------------------------------------------------------------------------
       
   134 //
       
   135 TInt CVIMPSTCmdFriendRequest::Result() const
       
   136     {
       
   137     //return valid data regd the command operation
       
   138     return iError;
       
   139     }
       
   140 
       
   141 // End of File