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