| Start/ | End/ | |||
| True | False | - | Line | Source |
| 1 | /* | |||
| 2 | * =========================================================================== | |||
| 3 | * Name : cvimpstcmdunblockcontact.cpp | |||
| 4 | * Part of : IMUiServiceTab/vimpstcmdprocess | |||
| 5 | * Description : | |||
| 6 | * Version : %version: 8 % | |||
| 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 "cvimpstcmdunblockcontact.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 | // -------------------------------------------------------------------------- | |||
| 35 | // CVIMPSTCmdUnBlockContact::CVIMPSTCmdDeleteContact | |||
| 36 | // -------------------------------------------------------------------------- | |||
| 37 | // | |||
| 4 | 4 | 38 | CVIMPSTCmdUnBlockContact::CVIMPSTCmdUnBlockContact( | |
| 39 | const TInt aCommandId , const TDesC& aContactId, | |||
| 40 | MVIMPSTEngine& aEngine) : | |||
| 41 | iCommandId( aCommandId ), | |||
| 42 | iContactId( aContactId ), | |||
| 43 | iEngine(aEngine) | |||
| 44 | { | |||
| 45 | } | |||
| 46 | ||||
| 47 | // -------------------------------------------------------------------------- | |||
| 48 | // CVIMPSTCmdUnBlockContact::~CVIMPSTCmdUnBlockContact | |||
| 49 | // -------------------------------------------------------------------------- | |||
| 50 | // | |||
| 2 | 2 | 51 | CVIMPSTCmdUnBlockContact::~CVIMPSTCmdUnBlockContact() | |
| 52 | { | |||
| 53 | ||||
| 54 | } | |||
| 55 | ||||
| 56 | // -------------------------------------------------------------------------- | |||
| 57 | // CVIMPSTCmdUnBlockContact::NewL | |||
| 58 | // -------------------------------------------------------------------------- | |||
| 59 | // | |||
| 4 | 0 | 60 | CVIMPSTCmdUnBlockContact* CVIMPSTCmdUnBlockContact::NewL( | |
| 61 | const TInt aCommandId, const TDesC& aContactId, | |||
| 62 | MVIMPSTEngine& aEngine) | |||
| 63 | { | |||
| 64 | CVIMPSTCmdUnBlockContact* self = new (ELeave ) CVIMPSTCmdUnBlockContact( aCommandId ,aContactId, aEngine); | |||
| 65 | self->ConstructL(); //use contsurctL if necessary | |||
| 4 | 66 | return self; | ||
| 67 | } | |||
| 68 | // -------------------------------------------------------------------------- | |||
| 69 | // CVIMPSTCmdUnBlockContact::ConstructL | |||
| 70 | // -------------------------------------------------------------------------- | |||
| 71 | // | |||
| 4 | 4 | 72 | void CVIMPSTCmdUnBlockContact::ConstructL() | |
| 73 | { | |||
| 74 | iError = KErrNotFound; | |||
| 75 | } | |||
| 76 | ||||
| 77 | // -------------------------------------------------------------------------- | |||
| 78 | // CVIMPSTCmdUnBlockContact::ExecuteLD | |||
| 79 | // -------------------------------------------------------------------------- | |||
| 80 | // | |||
| 2 | 2 | 81 | void CVIMPSTCmdUnBlockContact::ExecuteLD() | |
| 82 | { | |||
| 83 | CHAT_DP_FUNC_ENTER("CVIMPSTCmdUnBlockContact::ExecuteLD"); | |||
| 84 | //push to the cleanupstack | |||
| 85 | CleanupStack::PushL( this ); | |||
| 2 | 0 | - | 86 | if(iContactId.Length()) |
| 87 | { | |||
| 88 | //Get Presence SubService | |||
| 89 | MVIMPSTEngineSubService* subService = | |||
| 90 | (iEngine.SubService(TVIMPSTEnums::EPresence)); | |||
| 2 | 0 | - | 91 | if (subService && iEngine.IsBlockSupportedL()) |
| 92 | { | |||
| 93 | MVIMPSTEnginePresenceSubService& presence = | |||
| 94 | MVIMPSTEnginePresenceSubService::Cast (*subService); | |||
| 95 | HBufC* userId = HBufC::NewLC(KPropertyMaxLength); // 2 onto cleanup stack | |||
| 96 | TPtr userIdPtr = userId->Des(); | |||
| 97 | userIdPtr = iContactId; | |||
| 98 | ||||
| 99 | CHAT_DP( D_CHAT_LIT(" -> userId: %s" ), &userIdPtr); | |||
| 100 | iError = presence.RemoveFromBlockListL(*userId); | |||
| 101 | CHAT_DP( D_CHAT_LIT(" -> iError: %d" ), iError); | |||
| 102 | CleanupStack::PopAndDestroy(userId);//2 | |||
| 103 | ||||
| 104 | } | |||
| 105 | } | |||
| 106 | ||||
| 107 | CHAT_DP_FUNC_ENTER("CVIMPSTCmdUnBlockContact:: CommandFinished"); | |||
| 108 | ||||
| 2 | 0 | - | 109 | if(iObserver) |
| 110 | { | |||
| 111 | iObserver->CommandFinishedL(*this); | |||
| 112 | } | |||
| 113 | CHAT_DP_FUNC_ENTER("CVIMPSTCmdUnBlockContact:: CommandFinished"); | |||
| 114 | CleanupStack::PopAndDestroy(); | |||
| 115 | CHAT_DP_FUNC_DONE("CVIMPSTCmdUnBlockContact::ExecuteLD"); | |||
| 116 | } | |||
| 117 | ||||
| 118 | ||||
| 119 | // -------------------------------------------------------------------------- | |||
| 120 | // CVIMPSTCmdUnBlockContact::AddObserver | |||
| 121 | // -------------------------------------------------------------------------- | |||
| 122 | // | |||
| 2 | 2 | 123 | void CVIMPSTCmdUnBlockContact::AddObserver( MVIMPSTCmdObserver& aObserver ) | |
| 124 | { | |||
| 125 | // store the observer to notify the command completion | |||
| 126 | iObserver = &aObserver; | |||
| 127 | } | |||
| 128 | ||||
| 129 | ||||
| 130 | // -------------------------------------------------------------------------- | |||
| 131 | // CVIMPSTCmdUnBlockContact::CommandId | |||
| 132 | // -------------------------------------------------------------------------- | |||
| 133 | // | |||
| 4 | 0 | 134 | TInt CVIMPSTCmdUnBlockContact::CommandId() const | |
| 135 | { | |||
| 4 | 136 | return iCommandId; | ||
| 137 | } | |||
| 138 | ||||
| 139 | // -------------------------------------------------------------------------- | |||
| 140 | // CVIMPSTCmdUnBlockContact::Result | |||
| 141 | // -------------------------------------------------------------------------- | |||
| 142 | // | |||
| 2 | 0 | 143 | TInt CVIMPSTCmdUnBlockContact::Result() const | |
| 144 | { | |||
| 145 | //return valid data regd the command operation | |||
| 2 | 146 | return iError; | ||
| 147 | } | |||
| 148 | ||||
| 149 | // End of File | |||
| ***TER 82% (14/17) of SOURCE FILE cvimpstcmdunblockcontact.cpp | ||||