| Start/ | End/ | |||
| True | False | - | Line | Source |
| 1 | /* | |||
| 2 | * =========================================================================== | |||
| 3 | * Name : cvimpstcmdblockcontact.cpp | |||
| 4 | * Part of : IMUiServiceTab/vimpstcmdprocess | |||
| 5 | * Description : | |||
| 6 | * Version : %version: 10 % | |||
| 7 | * | |||
| 8 | * Copyright © 2008 Nokia. All rights reserved. | |||
| 9 | * This material, including documentation and any related computer | |||
| 10 | * programs, is protected by copyright controlled by Nokia. All | |||
| 11 | * rights are reserved. Copying, including reproducing, storing, | |||
| 12 | * adapting or translating, any or all of this material requires the | |||
| 13 | * prior written consent of Nokia. This material also contains | |||
| 14 | * confidential information which may not be disclosed to others | |||
| 15 | * without the prior written consent of Nokia. | |||
| 16 | * ============================================================================ | |||
| 17 | */ | |||
| 18 | ||||
| 19 | // INCLUDE FILES | |||
| 20 | #include "cvimpstcmdblockcontact.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 "cvimpststoragemanagerfactory.h" | |||
| 29 | #include "mvimpststorageserviceview.h" | |||
| 30 | ||||
| 31 | #include "mvimpstenginesubservice.h" | |||
| 32 | #include "mvimpstenginepresencesubservice.h" | |||
| 33 | #include "tvimpstconsts.h" | |||
| 34 | #include "MVIMPSTProcessArray.h" | |||
| 35 | // Constants | |||
| 36 | ||||
| 37 | // -------------------------------------------------------------------------- | |||
| 38 | // CVIMPSTCmdBlockContact::CVIMPSTCmdBlockContact | |||
| 39 | // -------------------------------------------------------------------------- | |||
| 40 | // | |||
| 4 | 4 | 41 | CVIMPSTCmdBlockContact::CVIMPSTCmdBlockContact( | |
| 42 | const TInt aCommandId , const TDesC& aContactId, | |||
| 43 | MVIMPSTProcessArray& aArrayProcess, | |||
| 44 | MVIMPSTEngine& aEngine) : | |||
| 45 | iCommandId( aCommandId ), | |||
| 46 | iContactId( aContactId ), | |||
| 47 | iProcessArray( aArrayProcess ), | |||
| 48 | iEngine(aEngine) | |||
| 49 | { | |||
| 50 | } | |||
| 51 | ||||
| 52 | // -------------------------------------------------------------------------- | |||
| 53 | // CVIMPSTCmdBlockContact::~CVIMPSTCmdBlockContact | |||
| 54 | // -------------------------------------------------------------------------- | |||
| 55 | // | |||
| 2 | 2 | 56 | CVIMPSTCmdBlockContact::~CVIMPSTCmdBlockContact() | |
| 57 | { | |||
| 58 | ||||
| 59 | } | |||
| 60 | ||||
| 61 | // -------------------------------------------------------------------------- | |||
| 62 | // CVIMPSTCmdBlockContact::NewL | |||
| 63 | // -------------------------------------------------------------------------- | |||
| 64 | // | |||
| 4 | 0 | 65 | CVIMPSTCmdBlockContact* CVIMPSTCmdBlockContact::NewL( | |
| 66 | const TInt aCommandId, const TDesC& aContactId, | |||
| 67 | MVIMPSTProcessArray& aArrayProcess, | |||
| 68 | MVIMPSTEngine& aEngine) | |||
| 69 | { | |||
| 70 | CVIMPSTCmdBlockContact* self = new (ELeave ) CVIMPSTCmdBlockContact( aCommandId ,aContactId, aArrayProcess ,aEngine); | |||
| 71 | self->ConstructL(); //use contsurctL if necessary | |||
| 4 | 72 | return self; | ||
| 73 | } | |||
| 74 | // -------------------------------------------------------------------------- | |||
| 75 | // CVIMPSTCmdBlockContact::ConstructL | |||
| 76 | // -------------------------------------------------------------------------- | |||
| 77 | // | |||
| 4 | 4 | 78 | void CVIMPSTCmdBlockContact::ConstructL() | |
| 79 | { | |||
| 80 | iError = KErrNotFound; | |||
| 81 | } | |||
| 82 | ||||
| 83 | // -------------------------------------------------------------------------- | |||
| 84 | // CVIMPSTCmdBlockContact::ExecuteLD | |||
| 85 | // -------------------------------------------------------------------------- | |||
| 86 | // | |||
| 2 | 2 | 87 | void CVIMPSTCmdBlockContact::ExecuteLD() | |
| 88 | { | |||
| 89 | CHAT_DP_FUNC_ENTER("CVIMPSTCmdBlockContact::ExecuteLD"); | |||
| 90 | //push to the cleanupstack | |||
| 91 | CleanupStack::PushL( this ); | |||
| 92 | iError = KErrGeneral; | |||
| 2 | 0 | - | 93 | if(iContactId.Length()) |
| 94 | { | |||
| 95 | //Get Presence SubService | |||
| 96 | MVIMPSTEngineSubService* subService = | |||
| 97 | (iEngine.SubService(TVIMPSTEnums::EPresence)); | |||
| 2 | 0 | - | 98 | if (subService && iEngine.IsBlockSupportedL()) |
| 99 | { | |||
| 100 | MVIMPSTEnginePresenceSubService& presence = | |||
| 101 | MVIMPSTEnginePresenceSubService::Cast (*subService); | |||
| 102 | iError = presence.AddToBlockListL(iContactId); | |||
| 103 | CHAT_DP( D_CHAT_LIT(" -> After iError: %d" ), iError); | |||
| 104 | } | |||
| 105 | } | |||
| 106 | CHAT_DP_FUNC_ENTER("CVIMPSTCmdBlockContact:: CommandFinished"); | |||
| 0 | 2 | - | 107 | if( iError == KErrNone ) |
| 108 | { | |||
| 109 | iProcessArray.RemoveFromUnknonOrInvitationListL( iContactId ,ETrue ); | |||
| 110 | } | |||
| 2 | 0 | - | 111 | if(iObserver) |
| 112 | { | |||
| 113 | iObserver->CommandFinishedL(*this); | |||
| 114 | } | |||
| 115 | CHAT_DP_FUNC_ENTER("CVIMPSTCmdBlockContact:: CommandFinished"); | |||
| 116 | CleanupStack::PopAndDestroy(); | |||
| 117 | CHAT_DP_FUNC_DONE("CVIMPSTCmdBlockContact::ExecuteLD"); | |||
| 118 | } | |||
| 119 | ||||
| 120 | ||||
| 121 | // -------------------------------------------------------------------------- | |||
| 122 | // CVIMPSTCmdBlockContact::AddObserver | |||
| 123 | // -------------------------------------------------------------------------- | |||
| 124 | // | |||
| 2 | 2 | 125 | void CVIMPSTCmdBlockContact::AddObserver( MVIMPSTCmdObserver& aObserver ) | |
| 126 | { | |||
| 127 | // store the observer to notify the command completion | |||
| 128 | iObserver = &aObserver; | |||
| 129 | } | |||
| 130 | ||||
| 131 | ||||
| 132 | // -------------------------------------------------------------------------- | |||
| 133 | // CVIMPSTCmdBlockContact::CommandId | |||
| 134 | // -------------------------------------------------------------------------- | |||
| 135 | // | |||
| 4 | 0 | 136 | TInt CVIMPSTCmdBlockContact::CommandId() const | |
| 137 | { | |||
| 4 | 138 | return iCommandId; | ||
| 139 | } | |||
| 140 | ||||
| 141 | // -------------------------------------------------------------------------- | |||
| 142 | // CVIMPSTCmdBlockContact::Result | |||
| 143 | // -------------------------------------------------------------------------- | |||
| 144 | // | |||
| 2 | 0 | 145 | TInt CVIMPSTCmdBlockContact::Result() const | |
| 146 | { | |||
| 147 | //return valid data regd the command operation | |||
| 2 | 148 | return iError; | ||
| 149 | } | |||
| 150 | ||||
| 151 | // End of File | |||
| ***TER 79% (15/19) of SOURCE FILE cvimpstcmdblockcontact.cpp | ||||