# HG changeset patch # User hgs # Date 1284733573 -19800 # Node ID 860cd8a5168c11417a3deff0c68bd17c2c147ca0 # Parent 085f765766a0cc5f5e76e8bfab1617fe656abfad 201037_04 diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsclient/bsclientdefs.h --- a/brandingserver/bsclient/bsclientdefs.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description:CBSClientdefs.h -* -*/ -#ifndef __BRANDINGDEFS_H__ -#define __BRANDINGDEFS_H__ -#include - - -#endif //__BRANDINGDEFS_H__ - -// END OF FILE - - - - - diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsclient/bselementfactory.cpp --- a/brandingserver/bsclient/bselementfactory.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: bselementfactory.cpp -* -*/ - - -// INCLUDE FILES - -#include "debugtrace.h" -#include "bselementfactory.h" -#include "cbselement.h" - - - -EXPORT_C MBSElement* BSElementFactory::CreateBSElementL( const TDesC8& aElementId, - TBSElementType /*aElementType*/, - TInt aElementData ) - { - return CBSElement::NewL( aElementId, aElementData ); - } - - -EXPORT_C MBSElement* BSElementFactory::CreateBSElementL( const TDesC8& aElementId, - TBSElementType aElementType, - const TDesC& aElementData ) - { - return CBSElement::NewL( aElementId, aElementData, aElementType ); - } - - -EXPORT_C MBSElement* BSElementFactory::CreateBSElementL( const TDesC8& aElementId, - TBSElementType /*aElementType*/, - const TDesC8& aElementData ) - { - return CBSElement::NewL( aElementId, aElementData ); - } - - -EXPORT_C MBSElement* BSElementFactory::CreateBSElementL( const TDesC8& aElementId, - TBSElementType /*aElementType*/, - CBSBitmap* aElementData ) - { - return CBSElement::NewL( aElementId, aElementData ); - } - - - -EXPORT_C MBSElement* BSElementFactory::CreateBSElementL( const TDesC8& aElementId, - TBSElementType /*aElementType*/, - RBSObjOwningPtrArray& aElementData ) - { - return CBSElement::NewL( aElementId, aElementData ); - } - - - - -// END OF FILE - diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsclient/bsprocessstarter.cpp --- a/brandingserver/bsclient/bsprocessstarter.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,405 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: bsprocessstarter.cpp -* -*/ -// INCLUDE FILES -#include "bsprocessstarter.h" -#include -#include - - -// CONSTANTS -_LIT( KEka2ExeDir,"\\sys\\bin\\"); -_LIT( KEka2LaunchMutexExt, "[lMtx]" ); -const TInt KEka2SrvConnTries = 7; -const TInt KEka2SrvConnInitialRetryWait = 500; //MicroSeconds => 0.0005s - - - -// ============================================================== -// ====================== HELPER CLASS ========================== -// ============================================================== - -/** - * RSessionBase accessor to give to the ProcessStarter - * access to RSessionBase::CreateSession(). - */ -class REka2SessionBaseAccessor : public RSessionBase - { - public: // Constructor - inline REka2SessionBaseAccessor() - { - } - - public: // New functions - - /** - * Public access to RSessionBase::CreateSession(). - */ - inline TInt CreateSession( const TDesC& aServer, - const TVersion& aVersion, - TInt aAsyncMessageSlots ) - { - return RSessionBase::CreateSession( aServer, - aVersion, - aAsyncMessageSlots ); - } - }; - - - - - -// ============================================================== -// ====================== PROCESSSTARTER ======================== -// ============================================================== - - -// -------------------------------------------------------------- -// BSProcessStarter::FullExePathForClienLocation() -// -------------------------------------------------------------- -// -void BSProcessStarter::FullExePathForClienLocation( - const TDesC& aExeName, - TFileName& aFullExePath ) - { - //Get drive (C:) where this client code is installed - { - TFileName tmp; - Dll::FileName( tmp ); - aFullExePath.Copy( TParsePtrC( tmp ).Drive() ); - } - - //Build the rest from the exe path - aFullExePath.Append( KEka2ExeDir ); - aFullExePath.Append( aExeName ); - } - - - -// -------------------------------------------------------------- -// BSProcessStarter::StartInstance() -// -------------------------------------------------------------- -// -TInt BSProcessStarter::StartInstance( - const TDesC& aFullExePath, - const TDesC& aCommand, - const TArray< TProcessStartupParam >* aParams ) - { - RMutex launchMutex; - TInt error = KErrNotFound; - - { - // Dynamic mutex name used to allow code share - TName launchMutexName( TParsePtrC( aFullExePath ).Name() ); - launchMutexName.Append( KEka2LaunchMutexExt ); - - // Open or Create mutex to serialize to access to server startup code. - // (race condition safe way) - while( error == KErrNotFound ) - { - error = launchMutex.CreateGlobal( launchMutexName ); - if( error != KErrAlreadyExists ) - { - break; - } - error = launchMutex.OpenGlobal( launchMutexName ); - } - - if( error != KErrNone ) - { - return error; - } - } - - - launchMutex.Wait(); - - //Serialized access - error = BSProcessStarter::DoStartInstance( aFullExePath, - aCommand, - aParams ); - - launchMutex.Signal(); - launchMutex.Close(); - - return error; - } - - - -// -------------------------------------------------------------- -// BSProcessStarter::ConnectToServer() -// -------------------------------------------------------------- -// -TInt BSProcessStarter::ConnectToServer( - const TDesC& aFullExePath, - const TDesC& aCommand, - const TArray< TProcessStartupParam >* aParams, - RSessionBase& aSessionToConnect, - const TDesC& aServerName, - const TVersion& aClientVersion, - TInt aAsyncMessageSlots ) - { - if( aSessionToConnect.Handle() != KNullHandle ) - { - return KErrInUse; - } - - TInt err = KErrNone; - TInt startupWait = KEka2SrvConnInitialRetryWait; - - //Server connect and launch loop - for( TInt trie = 0 ; trie < KEka2SrvConnTries ; trie++ ) - { - REka2SessionBaseAccessor acc; - err = acc.CreateSession( aServerName, - aClientVersion, - aAsyncMessageSlots ); - - if( err == KErrNone ) - { - //session ownership is now on client - aSessionToConnect = acc; - return KErrNone; - } - - else if( ( err == KErrNotFound ) || - ( err == KErrServerTerminated ) ) - { - //Server missing or died when connecting - //Start a new server - err = BSProcessStarter::StartInstance( aFullExePath, - aCommand, - aParams ); - - //If process exist already, then all is fine - //(some other process started it between the origical connect and launch trie) - if( err == KErrAlreadyExists ) - { - err = KErrNone; - } - - //If server process start failed, bail out. - if( err != KErrNone ) - { - return err; - } - - //If this is 2nd or subsequent try, - //give some time for server to startup - if( trie > 0 ) - { - // Code scanner warning : Use of User::After (id:92) - // it is required to be used here - User::After( startupWait ); // CSI: 92 # See above - startupWait = 2 * startupWait; - } - } - - else - { - //Server process start failed. Bail out. - return err; - } - } - - return err; - } - - - -// -------------------------------------------------------------- -// BSProcessStarter::DoStartServerInstance() -// -------------------------------------------------------------- -// -TInt BSProcessStarter::DoStartInstance( - const TDesC& aFullExePath, - const TDesC& aCommand, - const TArray< TProcessStartupParam >* aParams ) - { - TInt error = KErrNone; - - //Create process - RProcess process; - error = process.Create( aFullExePath, aCommand ); - - if( error == KErrNone ) - { - //Set process startup parameters - error = ApplyParameters( aParams, process ); - - //And execute the process and wait it's startup - if( error == KErrNone ) - { - TRequestStatus rendezvousStatus; - process.Rendezvous( rendezvousStatus ); - - process.Resume(); - // Codescanner warning: user of User::WaitForRequest (Id:94) - // it is required to use at server startup - User::WaitForRequest( rendezvousStatus ); // CSI: 94 # See above - error = rendezvousStatus.Int(); - - if( process.ExitType() != EExitPending ) - { - //Something failed in server startup - //Force the error code to be always something - //else than KErrNone - if( error == KErrNone ) - { - error = KErrServerTerminated; - } - } - } - } - - process.Close(); - - return error; - } - - - -// -------------------------------------------------------------- -// BSProcessStarter::ApplyParameters() -// -------------------------------------------------------------- -// -TInt BSProcessStarter::ApplyParameters( - const TArray< TProcessStartupParam >* aParams, - RProcess& aProcess ) - { - TInt error = KErrNone; - if( aParams ) - { - const TInt paramCount = aParams->Count(); - for( TInt ix = 0; ix < paramCount; ix++ ) - { - error = (*aParams)[ ix ].ApplyParam( aProcess ); - if( error != KErrNone ) - { - break; - } - } - } - - return error; - } - - - -// ============================================================== -// ================== TPROCESSSTARTUPPARAM ====================== -// ============================================================== - -// -------------------------------------------------------------- -// TProcessStartupParam::TProcessStartupParam() -// -------------------------------------------------------------- -// -TProcessStartupParam::TProcessStartupParam() - : iType( EUnknown ), - iSlot( KErrNotFound ) - { - } - - -// -------------------------------------------------------------- -// TProcessStartupParam::Set() -// -------------------------------------------------------------- -// -void TProcessStartupParam::Set( TInt aSlot, - const RHandleBase& aHandle ) - { - iType = EHandle; - iSlot = aSlot; - iHandle = &aHandle; - } - - -// -------------------------------------------------------------- -// TProcessStartupParam::Set() -// -------------------------------------------------------------- -// -void TProcessStartupParam::Set( TInt aSlot, - const RSubSessionBase& aSubSession ) - { - iType = ESubSession; - iSlot = aSlot; - iSubSession = &aSubSession; - } - - -// -------------------------------------------------------------- -// TProcessStartupParam::Set() -// -------------------------------------------------------------- -// -void TProcessStartupParam::Set( TInt aSlot, - const TDesC16& aDes ) - { - iType = EDes16; - iSlot = aSlot; - iDes16.Set( aDes ); - } - - -// -------------------------------------------------------------- -// TProcessStartupParam::Set() -// -------------------------------------------------------------- -// -void TProcessStartupParam::Set( TInt aSlot, - const TDesC8& aDes ) - { - iType = EDes8; - iSlot = aSlot; - iDes8.Set( aDes ); - } - - -// -------------------------------------------------------------- -// TProcessStartupParam::Set() -// -------------------------------------------------------------- -// -void TProcessStartupParam::Set( TInt aSlot, - TInt aInt ) - { - iType = EInt; - iSlot = aSlot; - iInt = aInt; - } - - -// -------------------------------------------------------------- -// TProcessStartupParam::ApplyParam() -// -------------------------------------------------------------- -// -TInt TProcessStartupParam::ApplyParam( RProcess& aProcess ) const - { - switch( iType ) - { - case EHandle: return aProcess.SetParameter( iSlot, *iHandle ); - case ESubSession: return aProcess.SetParameter( iSlot, *iSubSession ); - case EDes16: return aProcess.SetParameter( iSlot, iDes16 ); - case EDes8: return aProcess.SetParameter( iSlot, iDes8 ); - case EInt: return aProcess.SetParameter( iSlot, iInt ); - } - - return KErrUnknown; - } - - -// END OF FILE - - - diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsclient/bsprocessstarter.h --- a/brandingserver/bsclient/bsprocessstarter.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: bsprocessstarter.h -* -*/ -#ifndef __PROCESSSTARTER_H__ -#define __PROCESSSTARTER_H__ - -#include -class TProcessStartupParam; - - - -/** - * Generic process starter. - */ -class BSProcessStarter - { - public: // New methods - - static void FullExePathForClienLocation( - const TDesC& aExeName, - TFileName& aFullExePath ); - - static TInt StartInstance( - const TDesC& aFullExePath, - const TDesC& aCommand, - const TArray< TProcessStartupParam >* aParams ); - - static TInt ConnectToServer( - const TDesC& aFullExePath, - const TDesC& aCommand, - const TArray< TProcessStartupParam >* aParams, - RSessionBase& aSessionToConnect, - const TDesC& aServerName, - const TVersion& aClientVersion, - TInt aAsyncMessageSlots ); - - - - private: // Helpers - static TInt DoStartInstance( - const TDesC& aFullExePath, - const TDesC& aCommand, - const TArray< TProcessStartupParam >* aParams ); - - static TInt ApplyParameters( - const TArray< TProcessStartupParam >* aParams, - RProcess& aProcess ); - - }; - - - - -/** - * Generic process startup parameters. - */ -class TProcessStartupParam - { - public: - - TProcessStartupParam(); - void Set( TInt aSlot, const RHandleBase& aHandle ); - void Set( TInt aSlot, const RSubSessionBase& aSubSession ); - void Set( TInt aSlot, const TDesC16& aDes ); - void Set( TInt aSlot, const TDesC8& aDes ); - void Set( TInt aSlot, TInt aInt ); - TInt ApplyParam( RProcess& aProcess ) const; - - - - private: //data - - enum TParamType{ EUnknown, EHandle, ESubSession, - EDes16, EDes8, EInt }; - - TParamType iType; - TInt iSlot; - const RHandleBase* iHandle; - const RSubSessionBase* iSubSession; - TPtrC16 iDes16; - TPtrC8 iDes8; - TInt iInt; - }; - - -#endif // __PROCESSSTARTER_H__ - - -//END OF FILE - - diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsclient/cbsaccess.cpp --- a/brandingserver/bsclient/cbsaccess.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,291 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CBSAccess.cpp -* -*/ - - -// INCLUDE FILES - -#include -#include // skins -#include -#include - -#include "cbsaccess.h" -#include "cbsbitmap.h" -#include "debugtrace.h" -#include "mbsaccess.h" -#include "mbsupdater.h" -#include "cbsiconfileprovider.h" - -void Panic(TInt aPanic) - { - _LIT( KPanic, "CBS" ); - User::Panic( KPanic, aPanic ); - } - -// Two-phased constructor. -CBSAccess* CBSAccess::NewL( const TDesC8& aBrandId, - const TDesC8& aAppId, - const TDesC8& aDefaultBrandId, - TLanguage aLanguageId, - TBool aCacheData, - TInt aReserved ) - { - CBSAccess* self = new ( ELeave ) CBSAccess( aLanguageId, aCacheData, aReserved) ; - CleanupStack::PushL( self ); - self->ConstructL( aBrandId, aAppId, aDefaultBrandId ); - CleanupStack::Pop( self ); //self - return self; - } - -// Symbian OS default constructor can leave. -void CBSAccess::ConstructL( const TDesC8& aBrandId, const TDesC8& aAppId, - const TDesC8& aDefaultBrandId ) - { - iBrand = aBrandId.AllocL(); - iDefaultBrand = aDefaultBrandId.AllocL(); - iAppId = aAppId.AllocL(); - User::LeaveIfError( iClient.Connect() ); - - iClient.StartTransactionL( *iAppId, *iBrand, aDefaultBrandId, - iLanguageId, EBSTxAccess, iReserved ); - } - -// Destructor -CBSAccess::~CBSAccess() - { - delete iBrand; - delete iDefaultBrand; - delete iAppId; - iClient.Close(); - } - -// C++ default constructor can NOT contain any code, that -// might leave. -// -CBSAccess::CBSAccess( TLanguage aLanguageId, TBool aCacheData, TInt aReserved ) -: iLanguageId( aLanguageId ), iUseCache( aCacheData ), iReserved( aReserved ) - { - } - -// ----------------------------------------------------------------------------- -// CBSAccess::Close() -// ----------------------------------------------------------------------------- -// -void CBSAccess::Close() - { - delete this; - } - -// ----------------------------------------------------------------------------- -// CBSAccess::GetTextL() -// ----------------------------------------------------------------------------- -// -HBufC* CBSAccess::GetTextL( const TDesC8& aId ) - { - HBufC* buffer = NULL; - - iClient.GetTextL( aId, buffer ); - - TRACE( T_LIT("iClient.GetText( iBrandId, aId, buffer )") ); - return buffer; - } - -// ----------------------------------------------------------------------------- -// CBSAccess::GetTextLC() -// ----------------------------------------------------------------------------- -// -HBufC* CBSAccess::GetTextLC( const TDesC8& aId ) - { - HBufC* buffer = NULL; - iClient.GetTextL( aId, buffer ); - TRACE( T_LIT("iClient.GetText( aBrandId, aId, buffer )") ); - - CleanupStack::PushL( buffer ); - return buffer; - } - - -// ----------------------------------------------------------------------------- -// CBSAccess::GetIntL() -// ----------------------------------------------------------------------------- -// -TInt CBSAccess::GetIntL( const TDesC8& aId ) - { - TInt value = 0; - - iClient.GetIntL( aId, value ); - return value; - } - -TInt CBSAccess :: isBrandUpdateRequiredL () -{ - TInt updateRequired = -1; - iClient.isBrandUpdateRequiredL (updateRequired); - return updateRequired; - -} - -// ----------------------------------------------------------------------------- -// CBSAccess::GetSeveralIntL() -// ----------------------------------------------------------------------------- -// -MBSElement* CBSAccess::GetSeveralL( MDesC8Array& aIds ) - { - MBSElement* returnValue = iClient.GetSeveralL( aIds ); - return returnValue; - } - -// ----------------------------------------------------------------------------- -// CBSAccess::GetFileL() -// ----------------------------------------------------------------------------- -// -void CBSAccess::GetFileL( const TDesC8& aId, - RFile& aFile ) - { - iClient.GetFileL( aId, aFile ); - } - -// ----------------------------------------------------------------------------- -// CBSAccess::GetStructureL() -// ----------------------------------------------------------------------------- -// -MBSElement* CBSAccess::GetStructureL( const TDesC8& aId ) - { - MBSElement* returnValue = NULL; - - returnValue = iClient.GetStructureL( aId ); - - return returnValue; - - } - -// ----------------------------------------------------------------------------- -// CBSAccess::GetBufferL() -// ----------------------------------------------------------------------------- -// -HBufC8* CBSAccess::GetBufferL( const TDesC8& aId ) - { - HBufC8* buffer = NULL; - iClient.GetBufferL( aId, buffer ); - return buffer; - } - -// ----------------------------------------------------------------------------- -// CBSAccess::GetBufferLC() -// ----------------------------------------------------------------------------- -// -HBufC8* CBSAccess::GetBufferLC( const TDesC8& aId ) - { - HBufC8* buffer = GetBufferL( aId ); - CleanupStack::PushL( buffer ); - return buffer; - } - -// ----------------------------------------------------------------------------- -// CBSAccess::RegisterObserverL() -// ----------------------------------------------------------------------------- -// -void CBSAccess::RegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver* aBackupObserver) - { - iClient.RegisterObserverL( aObserver, aBackupObserver ); - } - -// ----------------------------------------------------------------------------- -// CBSAccess::UnRegisterObserverL() -// ----------------------------------------------------------------------------- -// -void CBSAccess::UnRegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver* aBackupObserver ) - { - iClient.UnRegisterObserverL( aObserver, aBackupObserver ); - } - -// ----------------------------------------------------------------------------- -// CBSAccess::GetBitmapL() -// ----------------------------------------------------------------------------- -// -void CBSAccess::GetBitmapL( const TDesC8& aBitmapId, - CFbsBitmap*& aBitmap, - CFbsBitmap*& aMask ) - { - TBool useSkins = ETrue; - CCoeEnv* coeEnv = CCoeEnv::Static(); - if( !coeEnv ) - { - TRACE( T_LIT("GETBITMAPL NO COE ENV ") ); - // no CONE -> don't try to use skins - useSkins = EFalse; - } - - MBSElement* bitmapItem = NULL; - - // get the structure containing the info for the bitmap - bitmapItem = GetStructureL( aBitmapId ); - CleanupClosePushL( *bitmapItem ); - - // get the list from the bitmap element - const CBSBitmap* bitmap = &bitmapItem->BitmapDataL(); - - RFile bitmapFile; - - // we need to get the bitmap file from where we can load the bitmap - GetFileL( bitmap->BitmapFileId(), bitmapFile ); - - TInt err = KErrNotFound; - CFbsBitmap* skinBitmap = NULL; - if( useSkins ) - { - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - - TAknsItemID itemId; - itemId.Set( bitmap->SkinIdMajor(), bitmap->SkinIdMinor() ); - - // Codescanner warning: neglected to put variable on cleanup stack (id:35) - // This method cannot leave after this line if the bitmap is created - TRAP( err, skinBitmap = AknsUtils::CreateBitmapL( skin, itemId ) ); // CSI: 35 # See above - } - // if useSkins is TRUE that means there is a COE Env, and icons can be created - // otherwise, without CoeEnv, we cannot create icons, hence leave - if( err == KErrNotFound && useSkins) - { - // no skin bitmap found - - // icon server take ownership of of icon file provider - CBSIconFileProvider* ifp = CBSIconFileProvider::NewL( bitmapFile ); - CleanupStack::PushL( ifp ); - - AknIconUtils::CreateIconLC( aBitmap, aMask, - *ifp, - bitmap->BitmapId(), bitmap->BitmapMaskId() ); - - CleanupStack::Pop( 2 ); // aBitmap, aMask - CleanupStack::Pop(ifp) ; - } - else if( err ) - { - User::Leave( err ); - } - else - { - aBitmap = skinBitmap; - aMask = NULL; - } - bitmapFile.Close() ; - CleanupStack::PopAndDestroy(); // structure - } - -// END OF FILE - diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsclient/cbsaccess.h --- a/brandingserver/bsclient/cbsaccess.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,168 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: cbsaccess.h -* -* Description: cbsaccess.h -* -*/ - - -#ifndef __CBSACCESS_H__ -#define __CBSACCESS_H__ -#include -#include "mbsaccess.h" -#include "cbsclient.h" - - -// Forward declarations -class CFbsBitmap; - -/** - * - */ -NONSHARABLE_CLASS( CBSAccess ): public CBase, - public MBSAccess - { - public: - /** - * Two-phased constructor. - */ - static CBSAccess* NewL( const TDesC8& aBrandId, - const TDesC8& aAppId, - const TDesC8& aDefaultBrandId, - TLanguage aLanguageId, - TBool aCacheData, - TInt aReserved = 0 ); - - // destructor - virtual ~CBSAccess(); - - /* - * Close - */ - void Close(); - - private: - - void ConstructL( const TDesC8& aBrandId, - const TDesC8& aAppId, - const TDesC8& aDefaultBrandId ); - CBSAccess( TLanguage aLanguageId, TBool aCacheData, TInt aReserved = 0); - - - private: // from MBranding - - /* - * Get text type item - * @param aId ID of the item - * @return the text item - */ - HBufC* GetTextL( const TDesC8& aId ); - - /* - * Get text type item - * @param aId ID of the item - * @return the text item - */ - HBufC* GetTextLC( const TDesC8& aId ); - - /* - * Get 8-bit data type item - * @param aId ID of the item - * @return the data buffer item - */ - HBufC8* GetBufferL( const TDesC8& aId ); - - /* - * Get 8-bit data type item - * @param aId ID of the item - * @return the data buffer item - */ - HBufC8* GetBufferLC( const TDesC8& aId ); - - /* - * Get integer type item - * @param aId ID of the item - * @return the integer item - */ - TInt GetIntL( const TDesC8& aId ); - - - /* - * Get an array of items - * @param aIds ID's of the items - * @return the items - */ - MBSElement* GetSeveralL( MDesC8Array& aIds ); - - /* - * Get a file item - * @param aId ID of the item - * @param aFile on return will contain an open file handle - * to the file - */ - void GetFileL( const TDesC8& aId, RFile& aFile ); - - /* - * Get a structure type item - * @param aIds ID of the item - * @param aFile on return will contain the strucure type item - * @return structure branding element - */ - MBSElement* GetStructureL( const TDesC8& aId ); - - /* - * Register to observer brand data updates - * @param aObserver the observer interface - */ - void RegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver *aBackupObserver ); - - /* - * Unregister a brand data update observer - * @param aObserver the observer interface - */ - void UnRegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver *aBackupObserver); - - /* - * Get a bitmap type item - * @param aBitmapId the ID of the bitmap item itself - * @param aBitmap on return will contain the bitmap - * @param aMask on return will contain the mask - */ - void GetBitmapL( const TDesC8& aBitmapId, - CFbsBitmap*& aBitmap, - CFbsBitmap*& aMask ); - - - - TInt isBrandUpdateRequiredL (); - - - public: // New methods - - - - private: // data - HBufC8* iBrand; - HBufC8* iDefaultBrand; - HBufC8* iAppId; - TLanguage iLanguageId; - TBool iUseCache; - RBSClient iClient; - TInt iReserved; - }; - -#endif // __CBSACCESS_H__ - - -// END OF FILE - diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsclient/cbsbitmap.cpp --- a/brandingserver/bsclient/cbsbitmap.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,135 +0,0 @@ -/* -* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: cbsbitmap.cpp -* -*/ - - -// INCLUDE FILES - -#include "e32base.h" -#include "cbsbitmap.h" - -// ----------------------------------------------------------------------------- -// CBSBitmap::NewLC -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -EXPORT_C CBSBitmap* CBSBitmap::NewLC( TInt aBitmapId, - TInt aBitmapMaskId, - TInt aSkinId, - TInt aSkinMaskId, - const TDesC8& aBitmapFileId ) - { - CBSBitmap* self = new ( ELeave ) CBSBitmap( aBitmapId, aBitmapMaskId, - aSkinId, aSkinMaskId ); - CleanupStack::PushL( self ); - self->ConstructL( aBitmapFileId ); - return self; - } - -// ----------------------------------------------------------------------------- -// CBSBitmap::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -EXPORT_C CBSBitmap* CBSBitmap::NewL( TInt aBitmapId, - TInt aBitmapMaskId, - TInt aSkinIdMajor, - TInt aSkinIdMinor, - const TDesC8& aBitmapFileId ) - { - CBSBitmap* self = NewLC( aBitmapId, - aBitmapMaskId, - aSkinIdMajor, - aSkinIdMinor, - aBitmapFileId ); - CleanupStack::Pop(); - return self; - } - - -// Symbian OS default constructor can leave. -void CBSBitmap::ConstructL( const TDesC8& aBitmapFileId ) - { - iBitmapFileId = aBitmapFileId.AllocL(); - } - -// destructor -CBSBitmap::~CBSBitmap() - { - delete iBitmapFileId; - } - -// C++ default constructor can NOT contain any code, that -// might leave. -// -CBSBitmap::CBSBitmap( TInt aBitmapId, - TInt aBitmapMaskId, - TInt aSkinIdMajor, - TInt aSkinIdMinor ) -: iBitmapId( aBitmapId), iBitmapMaskId( aBitmapMaskId ), - iSkinIdMajor( aSkinIdMajor ), iSkinIdMinor( aSkinIdMinor ) - { - } - - -// ----------------------------------------------------------------------------- -// CBSBitmap::BitmapId() -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CBSBitmap::BitmapId() const - { - return iBitmapId; - } - -// ----------------------------------------------------------------------------- -// CBSBitmap::BitmapMaskId() -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CBSBitmap::BitmapMaskId() const - { - return iBitmapMaskId; - } - -// ----------------------------------------------------------------------------- -// CBSBitmap::SkinId() -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CBSBitmap::SkinIdMajor() const - { - return iSkinIdMajor; - } - -// ----------------------------------------------------------------------------- -// CBSBitmap::SkinMaskId() -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CBSBitmap::SkinIdMinor() const - { - return iSkinIdMinor; - } - -// ----------------------------------------------------------------------------- -// CBSBitmap::BitmapFileId() -// ----------------------------------------------------------------------------- -// -EXPORT_C const TDesC8& CBSBitmap::BitmapFileId() const - { - return *iBitmapFileId; - } - - - -// END OF FILE diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsclient/cbsbrandobserver.cpp --- a/brandingserver/bsclient/cbsbrandobserver.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: cbsbrandobserver.cpp -* -*/ -// INCLUDE FILES - -#include "cbsbrandobserver.h" -#include -#include -#include "mbsbrandobserverregistrar.h" - -CBSBrandObserver* CBSBrandObserver::NewL( MBSBrandChangeObserver* aObserver, - MBSBackupRestoreStateObserver* aBackupObserver, - MBSBrandObserverRegistrar* aRegistrar ) - { - CBSBrandObserver* self = new ( ELeave ) CBSBrandObserver( aObserver, aBackupObserver, aRegistrar ) ; - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); //self - return self; - } - - -void CBSBrandObserver::ConstructL() - { - iContinueBackupStateObserving = ETrue ; - iContinueDataUpdateObserving = ETrue ; - - CActiveScheduler::Add( this ); - iRegistrar->RegisterObserverToServerL( iStatus ); - SetActive(); - } - - -CBSBrandObserver::~CBSBrandObserver() - { - Cancel(); - } - - -CBSBrandObserver::CBSBrandObserver( MBSBrandChangeObserver* aObserver, - MBSBackupRestoreStateObserver* aBackupObserver, - MBSBrandObserverRegistrar* aRegistrar ) -: CActive( CActive::EPriorityIdle ), iObserver( aObserver ), iBackupObserver( aBackupObserver ), - iRegistrar( aRegistrar ) - { - } - -void CBSBrandObserver::RunL() - { - - // Pankaj - chk for what has changed.. - TInt isBackupRestore = iRegistrar->GetBackupRestoreL() ; - if(isBackupRestore) - { - // if client donot want to listen backup state event any more donot call its observer.. - if(iBackupObserver && iContinueBackupStateObserving) - { - TInt activeState = iRegistrar->GetBackupStateL() ; - iContinueBackupStateObserving = iBackupObserver->BackupRestoreActivated(activeState) ; - } - } - else - { - // if client donot want to listen update data event any more donot call its observer.. - if(iObserver && iContinueDataUpdateObserving) - { - TInt newVersion = iRegistrar->GetNewVersionL(); - iContinueDataUpdateObserving = iObserver->BrandUpdateAvailable( newVersion ) ; - } - } - - if(iContinueBackupStateObserving || iContinueDataUpdateObserving) - { - iRegistrar->RegisterObserverToServerL( iStatus ); - SetActive(); - } - } - -void CBSBrandObserver::DoCancel() - { - - } - - -// END OF FILE diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsclient/cbsbrandobserver.h --- a/brandingserver/bsclient/cbsbrandobserver.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CBSBrandObserver.h -* -*/ - - -#ifndef __CBSBRANDOBSERVER_H__ -#define __CBSBRANDOBSERVER_H__ -#include -#include - -class MBSBrandChangeObserver; -class MBSBackupRestoreStateObserver; -class MBSBrandObserverRegistrar; - -/** - * - */ -NONSHARABLE_CLASS( CBSBrandObserver ): public CActive - { - public: - /** - * Two-phased constructor. - */ - static CBSBrandObserver* NewL( MBSBrandChangeObserver* aObserver, - MBSBackupRestoreStateObserver* aBackupObserver, - MBSBrandObserverRegistrar* aRegistrar ); - - virtual ~CBSBrandObserver(); - - public: // From CActive - - void RunL(); - void DoCancel(); - - private: - CBSBrandObserver( MBSBrandChangeObserver* aObserver, - MBSBackupRestoreStateObserver* aBackupObserver, - MBSBrandObserverRegistrar* aRegistrar ); - - - void ConstructL(); - - private: - - - private: // data - - // doesn't own: observer - MBSBrandChangeObserver* iObserver ; - - // doesn't own: observer - MBSBackupRestoreStateObserver* iBackupObserver ; - - // doesn't own: registrar - MBSBrandObserverRegistrar* iRegistrar; - - TBool iContinueBackupStateObserving ; - TBool iContinueDataUpdateObserving ; - }; - -#endif // __CBSBRANDOBSERVER_H__ - - -// END OF FILE - diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsclient/cbsclient.cpp --- a/brandingserver/bsclient/cbsclient.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,753 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CBSClient.cpp -* -*/ - - -// INCLUDE FILES -#include "cbsclient.h" -#include "bsclientdefs.h" -#include "bsprocessstarter.h" -#include "bsserverdefs.h" -#include "mbselement.h" -#include "bselementfactory.h" -#include "cbsbitmap.h" -#include "cbsbrandobserver.h" -#include -#include -#include "debugtrace.h" - -// ============================================================== -// ======================== CLIENT ============================== -// ============================================================== - -// Destructor -RBSClient::~RBSClient() - { -#if _BullseyeCoverage - cov_write(); -#endif - } - -// C++ default constructor can NOT contain any code, that -// might leave. -// -RBSClient::RBSClient() - { - } - - -// ----------------------------------------------------------------------------- -// RBSClient::Connect() -// ----------------------------------------------------------------------------- -// -TInt RBSClient::Connect() - { - TRACE( T_LIT("RBSClient::Connect() begin") ); - TFileName fullExePath; - BSProcessStarter::FullExePathForClienLocation( KBSServerExe, - fullExePath ); - - return BSProcessStarter::ConnectToServer( fullExePath, - KNullDesC, - NULL, - *this, - KBSServerName, - TVersion( KBSVersionMajor, - KBSVersionMinor, - KBSVersionBuild ), - KBSMsgSlotCount ); - } - - -// ----------------------------------------------------------------------------- -// RBSClient::Close() -// ----------------------------------------------------------------------------- -// -void RBSClient::Close() - { - TRACE( T_LIT("RBSClient::Close() begin") ); - RSessionBase::Close(); - } - - -// ----------------------------------------------------------------------------- -// RBSClient::Close() -// ----------------------------------------------------------------------------- -// -void RBSClient::StartTransactionL( const TDesC8& aApplicationId, - const TDesC8& aBrandId, - const TDesC8& aDefaultBrandId, - TLanguage aLanguage, - TTransactionType aType, - TInt aReserved ) - { - TRACE( T_LIT("RBSClient::StartTransactionL() begin") ); - InitClientL( aApplicationId, aBrandId, aDefaultBrandId, - aLanguage, aType, aReserved ); - } - -// ----------------------------------------------------------------------------- -// RBSClient::Close() -// ----------------------------------------------------------------------------- -// -TInt RBSClient::StopTransactionL( const TDesC8& /*aApplicationId*/, - const TDesC8& /*aBrandId*/, - TLanguage /*aLanguage*/, - TInt /*aReserved*/ ) - { - TRACE( T_LIT("RBSClient::StopTransactionL() begin") ); - TInt returnValue = 0; - TPckg pack( returnValue ); - TIpcArgs args( &pack ); - TInt err = SendReceive( EBSStopTransaction, args ); - User::LeaveIfError( err ); - return returnValue; - } - -// ----------------------------------------------------------------------------- -// RBSClient::Close() -// ----------------------------------------------------------------------------- -// -void RBSClient::CancelTransactionL( const TDesC8& aApplicationId, - const TDesC8& aBrandId, - TLanguage aLanguage, - TInt aReserved ) - { - TIpcArgs args = CreateArgumentsL( aApplicationId, aBrandId, - aLanguage, aReserved ); - - TInt err = SendReceive( EBSCancelTransaction, args ); - User::LeaveIfError( err ); - } - -// ----------------------------------------------------------------------------- -// RBSClient::InitClientL() -// ----------------------------------------------------------------------------- -// -void RBSClient::InitClientL( const TDesC8& aApplicationId, - const TDesC8& aBrandId, - const TDesC8& aDefaultBrandId, - TLanguage aLanguage, - TTransactionType aType, - TInt aReserved ) - { - TRACE( T_LIT("RBSClient::InitClientL() begin aAppId[%S],aBrandId[%S],TAType[%d]"),&aApplicationId,&aBrandId,aType ); - CBufFlat* flatBuf = CBufFlat::NewL( aDefaultBrandId.Length() + aBrandId.Length() + 2 ); - CleanupStack::PushL( flatBuf ); - - RBufWriteStream stream; - CleanupClosePushL( stream ); - stream.Open( *flatBuf ); - stream.WriteInt16L( aBrandId.Length() ); - stream.WriteL( aBrandId ); - stream.WriteInt16L( aDefaultBrandId.Length() ); - stream.WriteL( aDefaultBrandId ); - - TPtr8 ptrElement( flatBuf->Ptr(0) ); - - // set the arguments for the message - TIpcArgs args( &aApplicationId ); - args.Set( 1, &ptrElement ); - args.Set( 2, aLanguage ); - args.Set( 3, aReserved ); - - TInt operation = 0; - switch( aType ) - { - case EBSTxInstall: - { - operation = EBSInitInstall; - break; - } - case EBSTxUninstall: - { - operation = EBSInitUninstall; - break; - } - case EBSTxAppend: - { - operation = EBSInitAppend; - break; - } - case EBSTxReplace: - { - operation = EBSInitReplace; - break; - } - case EBSTxAccess: - { - operation = EBSInitAccess; - break; - } - default: - { - User::Leave( KErrArgument ); - break; - } - } - TInt err = SendReceive( operation, args ); - TRACE( T_LIT("RBSClient::InitClientL() 1st SendReceive err=%d"),err ); - CleanupStack::PopAndDestroy( 2, flatBuf ); // stream, flatBuf - - User::LeaveIfError( err ); - - User::LeaveIfError( SendReceive( EBSStartTransaction ) ); - TRACE( T_LIT("RBSClient::InitClientL() end") ); - } - -// ----------------------------------------------------------------------------- -// RBSClient::CreateArgumentsL() -// ----------------------------------------------------------------------------- -// -TIpcArgs RBSClient::CreateArgumentsL( const TDesC8& aApplicationId, - const TDesC8& aBrandId, - TLanguage aLanguage, - TInt aReserved ) - { - // set the arguments for the message - TIpcArgs args( &aApplicationId ); - args.Set( 1, &aBrandId ); - args.Set( 2, aLanguage ); - args.Set( 3, aReserved ); - - return args; - } - - -// ----------------------------------------------------------------------------- -// RBSClient::InsertL() -// ----------------------------------------------------------------------------- -// -void RBSClient::InsertL( MBSElement* aElement ) - { - SendUpdateL( aElement, EBSInstall ); - } - - -// ----------------------------------------------------------------------------- -// RBSClient::ReplaceL() -// ----------------------------------------------------------------------------- -// -void RBSClient::ReplaceL( MBSElement* aElement ) - { - SendUpdateL( aElement, EBSReplace ); - } - -// ----------------------------------------------------------------------------- -// RBSClient::AppendL() -// ----------------------------------------------------------------------------- -// -void RBSClient::AppendL( MBSElement* aElement ) - { - SendUpdateL( aElement, EBSAppend ); - } - -// ----------------------------------------------------------------------------- -// RBSClient::SendUpdateL() -// ----------------------------------------------------------------------------- -// -void RBSClient::SendUpdateL( MBSElement* aElement, TBSMessages aMessage ) - { - // FIXME magic number - CBufFlat* flatBuf = CBufFlat::NewL( 128 ); - CleanupStack::PushL( flatBuf ); - - RBufWriteStream elementStream; - CleanupClosePushL( elementStream ); - elementStream.Open( *flatBuf ); - - aElement->ExternalizeL( elementStream ); - - TPtr8 ptrElement( flatBuf->Ptr(0) ); - TIpcArgs args( &ptrElement ); - - TInt err = SendReceive( aMessage, args ); - - CleanupStack::PopAndDestroy(); // elementStream - CleanupStack::PopAndDestroy( flatBuf ); - User::LeaveIfError( err ); - } - -// ----------------------------------------------------------------------------- -// RBSClient::GetTextL() -// ----------------------------------------------------------------------------- -// -void RBSClient::GetTextL( const TDesC8& aId, HBufC*& aValue ) - { - TInt size = 0; - TPckg pack( size ); - - TIpcArgs args( &aId ); - args.Set( 1, &pack ); - TInt err = SendReceive( EBSPrepareText, args ); - User::LeaveIfError( err ); - - aValue = HBufC::NewL( size ); - TPtr ptrBuf( aValue->Des() ); - - args.Set( 2, &ptrBuf ); - err = SendReceive( EBSGetText, args ); - - if( err ) - { - delete aValue; - aValue = NULL; - User::Leave( err ); - } - } - -// ----------------------------------------------------------------------------- -// RBSClient::GetIntL() -// ----------------------------------------------------------------------------- -// -void RBSClient::GetIntL( const TDesC8& aId, TInt& aValue ) - { - TPckg pack( aValue ); - TIpcArgs args( &aId); - args.Set( 1, &pack ); - TInt err = SendReceive( EBSGetInt, args ); - User::LeaveIfError( err ); - } - -void RBSClient :: isBrandUpdateRequiredL (TInt & aUpdateRequired) -{ - //TIpcArgs args; - - TPckg pack (aUpdateRequired); - //args.Set (0, &pack); - TInt err = SendReceive (EBSIsBrandUpdateRequired, TIpcArgs (&pack)); - - User :: LeaveIfError (err); -} -// ----------------------------------------------------------------------------- -// RBSClient::GetTextL() -// ----------------------------------------------------------------------------- -// -void RBSClient::GetBufferL( const TDesC8& aId, HBufC8*& aValue ) - { - TInt size = 0; - TPckg pack( size ); - - TIpcArgs args( &aId ); - args.Set( 1, &pack ); - TInt err = SendReceive( EBSPrepareBuffer, args ); - User::LeaveIfError( err ); - - aValue = HBufC8::NewL( size ); - TPtr8 ptrBuf( aValue->Des() ); - - args.Set( 2, &ptrBuf ); - err = SendReceive( EBSGetBuffer, args ); - - if( err ) - { - delete aValue; - aValue = NULL; - User::Leave( err ); - } - } - -// ----------------------------------------------------------------------------- -// RBSClient::GetSeveralL() -// ----------------------------------------------------------------------------- -// -MBSElement* RBSClient::GetSeveralL( MDesC8Array& aIds ) - { - TInt size = 0; - - TPckg pack( size ); - TIpcArgs args; - args.Set( 0, &pack ); - - - // FIXME magic number - CBufFlat* flatBuf = CBufFlat::NewL( 128 ); - CleanupStack::PushL( flatBuf ); - - RBufWriteStream idStream; - CleanupClosePushL( idStream ); - idStream.Open( *flatBuf ); - - ExternalizeIdArrayL( idStream, aIds ); - - TPtr8 flatPtr = flatBuf->Ptr(0); - args.Set( 1, &flatPtr ); - // get the size of the data - TInt err = SendReceive( EBSPrepareSeveral, args ); - - CleanupStack::PopAndDestroy(); // idStream - CleanupStack::PopAndDestroy( flatBuf ); - User::LeaveIfError( err ); - - HBufC8* buf = HBufC8::NewLC( size ); - TPtr8 ptrBuf( buf->Des() ); - - TIpcArgs msgArgs; - msgArgs.Set( 0, &ptrBuf ); - - err = SendReceive( EBSGetSeveral, msgArgs ); - - TInt length = buf->Size(); - - RDesReadStream readStream; - CleanupClosePushL( readStream ); - readStream.Open( *buf ); - - MBSElement* returnValue = InternalizeElementL( readStream ); - - CleanupStack::PopAndDestroy(); // readStream - CleanupStack::PopAndDestroy( buf ); // buf - - User::LeaveIfError( err ); - return returnValue; - } - - -// ----------------------------------------------------------------------------- -// RBSClient::GetFileL() -// ----------------------------------------------------------------------------- -// -void RBSClient::GetFileL( const TDesC8& aId, RFile& aFile ) - { - TInt fsh; - - TPckgBuf fh; - - TIpcArgs args( &fh ); - args.Set( 2, &aId ); - - fsh = SendReceive( EBSGetFile, args ); - TInt err = aFile.AdoptFromServer( fsh, fh() ); - - User::LeaveIfError( err ); - } - -// ----------------------------------------------------------------------------- -// RBSClient::GetStructureL() -// ----------------------------------------------------------------------------- -// -MBSElement* RBSClient::GetStructureL( const TDesC8& aId ) - { - TInt size = 0; - - TPckg pack( size ); - TIpcArgs args; - args.Set( 0, &pack ); - - args.Set( 1, &aId ); - // get the size of the data - TInt err = SendReceive( EBSPrepareStructure, args ); - - User::LeaveIfError( err ); - - - HBufC8* buf = HBufC8::NewLC( size ); - TPtr8 ptrBuf( buf->Des() ); - - TIpcArgs msgArgs; - msgArgs.Set( 0, &ptrBuf ); - - err = SendReceive( EBSGetStructure, msgArgs ); - - TInt length = buf->Size(); - - RDesReadStream readStream; - CleanupClosePushL( readStream ); - readStream.Open( *buf ); - - MBSElement* returnValue = InternalizeElementL( readStream ); - CleanupStack::PopAndDestroy(); // readStream - CleanupStack::PopAndDestroy( buf ); // buf - - User::LeaveIfError( err ); - - return returnValue; - } - -// ----------------------------------------------------------------------------- -// RBSClient::InternalizeElementL() -// ----------------------------------------------------------------------------- -// -MBSElement* RBSClient::InternalizeElementL( RReadStream& aStream ) - { - MBSElement* returnValue= NULL; - // Write common header for all elements - TBSElementType type = (TBSElementType)aStream.ReadInt16L(); - - TInt idSize = aStream.ReadInt16L(); - - HBufC8* elementId = HBufC8::NewLC( idSize ); - TPtr8 elementIdPtr = elementId->Des(); - - if( idSize > 0 ) - { - // read ID only if it's defined - aStream.ReadL( elementIdPtr, idSize ); - elementIdPtr.SetLength( idSize );// Set length - } - -// Ptr() returns a pointer to the start address of decriptor data, -// TPtrC constructor then parses the data until null terminator met. -// This results in wrong descriptor length & bad data! -// Solution is either -// 1) to use PtrZ() which appends a zero terminator, -// or 2) pass to constructor an object that has length data. -// Option 2) is less prone to errors, so use it. -// In general, assignment operator with descriptors should be avoided! -// So use TPtrC16(const TDesC16 &aDes) instead -// of TPtrC16(const TUint16 *aString)! - TPtrC8 idPtrC( *elementId );//idPtrC creation moved here so it will be updated correctly. - - if( elementId->Length() == 0 ) - { - CleanupStack::PopAndDestroy( elementId ); - elementId = NULL; - idPtrC.Set( KNullDesC8 ); - } - - // Write element type specific data - switch( type ) - { - case EBSInt: - { - TInt intData = aStream.ReadInt16L(); - returnValue = BSElementFactory::CreateBSElementL( idPtrC, - EBSInt, - intData ); - - break; - } - case EBSText: // flowthrough - case EBSFile: - { - TInt textSize = aStream.ReadInt16L(); - HBufC* textData = HBufC::NewLC( textSize ); - - TPtr textPtr = textData->Des(); - aStream.ReadL( textPtr, textSize ); - - returnValue = BSElementFactory::CreateBSElementL( idPtrC, - type, - *textData ); - CleanupStack::PopAndDestroy( textData ); - break; - } - case EBSList: - { - RBSObjOwningPtrArray listData; - CleanupClosePushL( listData ); - TInt count = aStream.ReadInt16L(); - - for( TInt i = 0; i < count; i++ ) - { - MBSElement* subElement = InternalizeElementL( aStream ); - CleanupClosePushL( *subElement ); - listData.AppendL( subElement ); - CleanupStack::Pop(); // subElement - } - - returnValue = BSElementFactory::CreateBSElementL( idPtrC, - EBSList, - listData ); - - CleanupStack::Pop(); // listData - - break; - } - - case EBSBuffer: - { - TInt bufferSize = aStream.ReadInt16L(); - HBufC8* buffeData = HBufC8::NewLC( bufferSize ); - - TPtr8 bufferPtr = buffeData->Des(); - aStream.ReadL( bufferPtr, bufferSize ); - - returnValue = BSElementFactory::CreateBSElementL( idPtrC, - EBSBuffer, - *buffeData ); - - CleanupStack::PopAndDestroy( buffeData ); - break; - } - - case EBSBitmap: - { - TInt length = aStream.ReadInt16L(); - HBufC8* fileId = HBufC8::NewLC( length ); - - TPtr8 fileIdPtr = fileId->Des(); - aStream.ReadL( fileIdPtr, length ); - - TInt bitmapId = aStream.ReadInt16L(); - TInt maskId = aStream.ReadInt16L(); - TInt skinId = aStream.ReadInt16L(); - TInt skinMaskId = aStream.ReadInt16L(); - - CBSBitmap* bitmap = CBSBitmap::NewLC( bitmapId, - maskId, - skinId, - skinMaskId, - fileIdPtr ); - - returnValue = BSElementFactory::CreateBSElementL( idPtrC, - EBSBitmap, - bitmap ); - CleanupStack::Pop( bitmap ); // bitmap - CleanupStack::PopAndDestroy( fileId ); // bitmap - - break; - } - - default: - { - // unknown type! - User::Leave( KErrCorrupt ); - break; - } - } - - if( elementId ) - { - CleanupStack::PopAndDestroy( elementId ); - } - - return returnValue; - } - - -// ----------------------------------------------------------------------------- -// RBSClient::InternalizeElementL() -// ----------------------------------------------------------------------------- -// -void RBSClient::ExternalizeIdArrayL( RWriteStream& aStream, MDesC8Array& aArray ) - { - TInt count = aArray.MdcaCount(); - aStream.WriteInt16L( count ); - - for( TInt i = 0; i < count; i++ ) - { - TPtrC8 ptr = aArray.MdcaPoint(i); - aStream.WriteInt16L( aArray.MdcaPoint( i ).Length() ); - aStream.WriteL( aArray.MdcaPoint( i ) ); - } - - } - -// ----------------------------------------------------------------------------- -// RBSClient::RemoveBrandL() -// ----------------------------------------------------------------------------- -// -void RBSClient::RemoveBrandL( const TDesC8& aApplicationId, - const TDesC8& aBrandId ) - { - // set the arguments for the message - TIpcArgs args( &aApplicationId ); - args.Set( 1, &aBrandId ); - TInt err = SendReceive( EBSRemoveBrand, args ); - User::LeaveIfError( err ); - } - -// ----------------------------------------------------------------------------- -// RBSClient::RemoveBrandsL() -// ----------------------------------------------------------------------------- -// -void RBSClient::RemoveBrandsL( const TDesC8& aApplicationId ) - { - // set the arguments for the message - TIpcArgs args( &aApplicationId ); - - TInt err = SendReceive( EBSRemoveApplication, args ); - User::LeaveIfError( err ); - } - -// ----------------------------------------------------------------------------- -// RBSClient::RegisterObserverL() -// ----------------------------------------------------------------------------- -// -void RBSClient::RegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver* aBackupStateObserver ) - { - CBSBrandObserver* tempObserver = CBSBrandObserver::NewL( aObserver, aBackupStateObserver, this ); - if( iObserver ) - { - delete iObserver; - } - iObserver = tempObserver; - } - -// ----------------------------------------------------------------------------- -// RBSClient::UnRegisterObserverL() -// ----------------------------------------------------------------------------- -// -void RBSClient::UnRegisterObserverL( MBSBrandChangeObserver* /*aObserver*/, MBSBackupRestoreStateObserver* /*aBackupStateObserver*/ ) - { - delete iObserver; - iObserver = NULL; - } - -// ----------------------------------------------------------------------------- -// RBSClient::UnRegisterObserverL() -// ----------------------------------------------------------------------------- -// -void RBSClient::RegisterObserverToServerL( TRequestStatus& aStatus ) - { - TIpcArgs args; - SendReceive( EBSObserveBrand, args, aStatus ); - } - -// ----------------------------------------------------------------------------- -// RBSClient::GetNewVersionL() -// ----------------------------------------------------------------------------- -// -TInt RBSClient::GetNewVersionL() - { - return GetValueL( EBSObserveGetNewVersion); - } - -// ----------------------------------------------------------------------------- -// RBSClient::GetValueL() -// ----------------------------------------------------------------------------- -// -TInt RBSClient::GetValueL(TInt msg) - { - TInt returnValue = 0; - TPckg pack( returnValue ); - TIpcArgs args( &pack ); - TInt err = SendReceive( msg, args ); - User::LeaveIfError( err ); - return returnValue; - } - -// ----------------------------------------------------------------------------- -// RBSClient::GetBackupStateL() -// ----------------------------------------------------------------------------- -// -TInt RBSClient::GetBackupStateL() - { - return GetValueL( EBSObserveGetBackupState); - } - -// ----------------------------------------------------------------------------- -// RBSClient::GetBackupRestoreL() -// ----------------------------------------------------------------------------- -// -TInt RBSClient::GetBackupRestoreL() - { - return GetValueL( EBSObserveGetChange); - } - -// END OF FILE - diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsclient/cbsclient.h --- a/brandingserver/bsclient/cbsclient.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,143 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CBSClient.h -* -*/ - - -#ifndef __CBSCLIENT_H__ -#define __CBSCLIENT_H__ -#include -#include -#include -#include -#include "mbsupdater.h" -#include "bsserverdefs.h" -#include "mbsbrandobserverregistrar.h" - -class MBSElement; -class MBSBrandChangeObserver; -class MBSBackupRestoreStateObserver; -class CBSBrandObserver; - -/** - * Simple ClientServer for - * testing and example purposes. - */ -class RBSClient : public RSessionBase, - public MBSBrandObserverRegistrar - { - - public: // Constructor and destructor - RBSClient(); - ~RBSClient(); - - - public: // New methods - - TInt Connect(); - void Close(); - - void StartTransactionL( const TDesC8& aApplicationId, - const TDesC8& aBrandId, - const TDesC8& aDefaultBrandId, - TLanguage aLanguage, - TTransactionType aType, - TInt aReserved = 0 ); - - TInt StopTransactionL( const TDesC8& aApplicationId, - const TDesC8& aBrandId, - TLanguage aLanguage, - TInt aReserved = 0 ); - - void CancelTransactionL( const TDesC8& aApplicationId, - const TDesC8& aBrandId, - TLanguage aLanguage, - TInt aReserved = 0); - - void InsertL( MBSElement* aElement ); - void ReplaceL( MBSElement* aElement ); - void AppendL( MBSElement* aElement ); - - void GetTextL( const TDesC8& aId, HBufC*& aValue ); - void GetBufferL( const TDesC8& aId, HBufC8*& aValue ); - void GetIntL( const TDesC8& aId, TInt& aValue ); - - MBSElement* GetSeveralL( MDesC8Array& aIds ); - MBSElement* GetStructureL( const TDesC8& aId ); - void GetFileL( const TDesC8& aId, RFile& aFile ); - - void RemoveBrandL( const TDesC8& aApplicationId, - const TDesC8& aBrandId ); - - void RemoveBrandsL( const TDesC8& aApplicationId ); - - void isBrandUpdateRequiredL (TInt& aUpdateRequired); - - /* - * Register to observer brand data updates - * @param aObserver the observer interface - */ - void RegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver* aBackupStateObserver); - - /* - * Unregister a brand data update observer - * @param aObserver the observer interface - */ - void UnRegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver* aBackupStateObserver ); - - - private: - - void InitClientL( const TDesC8& aApplicationId, - const TDesC8& aBrandId, - const TDesC8& aDefaultBrandId, - TLanguage aLanguage, - TTransactionType aType, - TInt aReserved ); - - TIpcArgs CreateArgumentsL( const TDesC8& aApplicationId, - const TDesC8& aBrandId, - TLanguage aLanguage, - TInt aReserved ); - - MBSElement* InternalizeElementL( RReadStream& aStream ); - - void ExternalizeIdArrayL( RWriteStream& aStream, MDesC8Array& aArray ); - - void SendUpdateL( MBSElement* aElement, TBSMessages aMessage ); - - private: // from MBSBrandObserverRegistrar - /* - * Registeres the brand observer to server - */ - void RegisterObserverToServerL( TRequestStatus& aStatus ); - - TInt GetNewVersionL(); - TInt GetValueL(TInt msg) ; - TInt GetBackupStateL() ; - TInt GetBackupRestoreL() ; - - - private: - TTransactionType iType; - CBSBrandObserver* iObserver; - TInt isUpdateRequired; - }; - -#endif // __CBSCLIENT_H__ - - -// END OF FILE - diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsclient/cbselement.cpp --- a/brandingserver/bsclient/cbselement.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,343 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: cbselement.cpp -* -*/ -// INCLUDE FILES - -#include -#include "e32base.h" -#include "s32strm.h" -#include "cbselement.h" -#include "cbsbitmap.h" - - -CBSElement* CBSElement::NewL( - const TDesC8& aElementId, - TInt aData ) - { - - CBSElement* self = new ( ELeave ) CBSElement() ; - CleanupStack::PushL( self ); - self->ConstructL( EBSInt, - aElementId, - aData, - ETrue, - NULL, - KNullDesC, - KNullDesC8, - NULL ); - CleanupStack::Pop( self ); //self - return self; - } - - -CBSElement* CBSElement::NewL( - const TDesC8& aElementId, - const TDesC& aData, - TBSElementType aType /*= EText*/ ) - { - if( aType != EBSFile && aType != EBSText ) - { - User::Leave( KErrArgument ); - } - - CBSElement* self = new ( ELeave ) CBSElement() ; - CleanupStack::PushL( self ); - self->ConstructL( aType, - aElementId, - 0, - EFalse, - NULL, - aData, - KNullDesC8, - NULL); - CleanupStack::Pop( self ); //self - return self; - } - - -CBSElement* CBSElement::NewL( - const TDesC8& aElementId, - const TDesC8& aData ) - { - CBSElement* self = new ( ELeave ) CBSElement() ; - CleanupStack::PushL( self ); - self->ConstructL( EBSBuffer, - aElementId, - 0, - EFalse, - NULL, - KNullDesC, - aData, - NULL); - CleanupStack::Pop( self ); //self - return self; - } - -CBSElement* CBSElement::NewL( - const TDesC8& aElementId, - RBSObjOwningPtrArray& aStructure ) - { - CBSElement* self = new ( ELeave ) CBSElement(); - CleanupStack::PushL( self ); - self->ConstructL( EBSList, - aElementId, - 0, - EFalse, - NULL, - KNullDesC, - KNullDesC8, - &aStructure ); - CleanupStack::Pop( self ); //self - return self; - } - -CBSElement* CBSElement::NewL( - const TDesC8& aElementId, - CBSBitmap* aBitmap ) - { - CBSElement* self = new ( ELeave ) CBSElement() ; - CleanupStack::PushL( self ); - self->ConstructL( EBSBitmap, - aElementId, - 0, - EFalse, - aBitmap, - KNullDesC, - KNullDesC8, - NULL ); - - if( !aBitmap ) - { - User::Leave( KErrArgument ); - } - - CleanupStack::Pop( self ); //self - return self; - } - -void CBSElement::ConstructL( - TBSElementType aElementType, - const TDesC8& aElementId, - TInt aIntData, - TBool aIntDataInitialized, - CBSBitmap* aBitmap, - const TDesC& aTextData, - const TDesC8& aBufferData, - RBSObjOwningPtrArray* aStructure ) - { - iElementType = aElementType; - - iElementId = aElementId.AllocL(); - - iIntData = aIntData; - iIntDataInitialized = aIntDataInitialized; - - iBitmapData = aBitmap; - - if( 0 != aTextData.Compare( KNullDesC() ) ) - { - iTextData = aTextData.AllocL(); - } - if( 0 != aBufferData.Compare( KNullDesC8() ) ) - { - iBufferData = aBufferData.AllocL(); - } - if( aStructure ) - { - iArrayInitialized = ETrue; - iArray = *aStructure; - } - } - - -CBSElement::~CBSElement() - { - delete iTextData; - delete iBufferData; - delete iElementId; - - iArray.Close(); - delete iBitmapData; - } - - -CBSElement::CBSElement() - { - } - -void CBSElement::Close() - { - delete this; - } - - -TBSElementType CBSElement::ElementType() - { - return iElementType; - } - -const TDesC8& CBSElement::ElementId() - { - return *iElementId; - } - -TInt CBSElement::IntDataL() - { - if( !iIntDataInitialized ) - { - User::Leave( KErrArgument ); - } - return iIntData; - } - -const TDesC& CBSElement::TextDataL() - { - if( !iTextData ) - { - User::Leave( KErrArgument ); - } - return *iTextData; - } - -const TDesC8& CBSElement::BufferDataL() - { - if( !iBufferData ) - { - User::Leave( KErrArgument ); - } - return *iBufferData; - } - -const CBSBitmap& CBSElement::BitmapDataL() - { - if( !iBitmapData ) - { - User::Leave( KErrArgument ); - } - return *iBitmapData; - } - -TArray CBSElement::GetStructureL() - { - if( !iArrayInitialized ) - { - User::Leave( KErrArgument ); - } - - return iArray.Array(); - } - -const MBSElement& CBSElement::FindSubEntryL( const TDesC& aElementId ) - { - if ( !iArray.Count() ) - { - User::Leave( KErrNotFound ); - } - - MBSElement* element = NULL; - HBufC8* id = CnvUtfConverter::ConvertFromUnicodeToUtf8L( aElementId ); - User::LeaveIfNull( id ); - CleanupStack::PushL( id ); - for ( TInt i( 0 ) ; i < iArray.Count() ; i++ ) - { - if ( iArray[ i ] ) - { - if ( !iArray[ i ]->ElementId().CompareC( *id ) ) - { - // Match found - element = iArray[ i ]; - i = iArray.Count();// Exit loop. - } - } - } - CleanupStack::PopAndDestroy( id ); - - if ( !element ) - { - User::Leave( KErrNotFound ); - } - - return *element; - } - -void CBSElement::ExternalizeL( RWriteStream& aWriteStream ) - { - // Write common header for all elements - aWriteStream.WriteInt16L( iElementType ); - aWriteStream.WriteInt16L( iElementId->Length() ); - if( iElementId->Length() > 0 ) - { - // Write ID only if it's defined - aWriteStream.WriteL( *iElementId ); - } - - // Write element type specific data - switch( iElementType ) - { - case EBSInt: - { - aWriteStream.WriteInt16L( iIntData ); - break; - } - case EBSText: // flowthrough - case EBSFile: - { - aWriteStream.WriteInt16L( iTextData->Length() ); - aWriteStream.WriteL( *iTextData ); - break; - } - case EBSList: - { - TInt count = iArray.Count(); - aWriteStream.WriteInt16L( count ); - // Write all subitems to stream - for( TInt i = 0; i < count; i++ ) - { - MBSElement* element = iArray[i]; - element->ExternalizeL( aWriteStream ); - } - break; - } - case EBSBitmap: - { - TPtrC8 ptr = iBitmapData->BitmapFileId(); - aWriteStream.WriteInt16L( ptr.Length() ); - aWriteStream.WriteL( ptr ); - - aWriteStream.WriteInt16L( iBitmapData->BitmapId() ); - aWriteStream.WriteInt16L( iBitmapData->BitmapMaskId() ); - aWriteStream.WriteInt16L( iBitmapData->SkinIdMajor() ); - aWriteStream.WriteInt16L( iBitmapData->SkinIdMinor() ); - - break; - } - case EBSBuffer: - { - aWriteStream.WriteInt16L( iBufferData->Length() ); - aWriteStream.WriteL( *iBufferData ); - break; - } - default: - { - // unknown type! - User::Leave( KErrCorrupt ); - break; - } - } - } - - -// END OF FILE diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsclient/cbselement.h --- a/brandingserver/bsclient/cbselement.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: cbselement.h -* -*/ - - -#ifndef __CBSELEMENT_H__ -#define __CBSELEMENT_H__ -#include - -#include "mbselement.h" -#include "rbsobjowningptrarray.h" - -class RWriteStream; - -/** - * - */ -NONSHARABLE_CLASS( CBSElement ): public CBase, - public MBSElement - { - public: - /** - * Two-phased constructor. - */ - static CBSElement* NewL( - const TDesC8& aElementId, - TInt aData ); - - static CBSElement* NewL( - const TDesC8& aElementId, - const TDesC& aData, - TBSElementType aType = EBSText ); - - static CBSElement* NewL( - const TDesC8& aElementId, - const TDesC8& aData ); - - // Transfers ownership - static CBSElement* NewL( - const TDesC8& aElementId, - CBSBitmap* aBitmap ); - - static CBSElement* NewL( - const TDesC8& aElementId, - RBSObjOwningPtrArray& aStructure ); - - void Close(); - - virtual ~CBSElement(); - - private: - CBSElement(); - - - void ConstructL( TBSElementType aElementType, - const TDesC8& aElementId, - TInt aIntData, - TBool aIntDataInitialized, - CBSBitmap* aBitmap, - const TDesC& aTextData, - const TDesC8& aBufferData, - RBSObjOwningPtrArray* aStructure ); - - private: - TBSElementType ElementType(); - const TDesC8& ElementId(); - - // Leaves with KErrArgument if trying to - // get wrong type - TInt IntDataL(); - const TDesC& TextDataL(); - const TDesC8& BufferDataL(); - const CBSBitmap& BitmapDataL(); - TArray GetStructureL(); - - const MBSElement& FindSubEntryL( const TDesC& aElementId ); - - void ExternalizeL( RWriteStream& aWriteStream ); - - - - private: // data - TBSElementType iElementType; - HBufC8* iElementId; - TInt iIntData; - TBool iIntDataInitialized; - HBufC* iTextData; - HBufC8* iBufferData; - TBool iArrayInitialized; - RBSObjOwningPtrArray iArray; - CBSBitmap* iBitmapData; - - }; - -#endif // __CBSELEMENT_H__ - - -// END OF FILE - diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsclient/cbsfactory.cpp --- a/brandingserver/bsclient/cbsfactory.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,130 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Factory for creating branding -* -*/ - -// INCLUDE FILES -#include "cbsfactory.h" -#include "cbsaccess.h" -#include "cbsupdater.h" -#include "mbsaccess.h" -#include "mbsupdater.h" -#include "cbsclient.h" -#include "debugtrace.h" - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// BrandingFactory::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -EXPORT_C CBSFactory* CBSFactory::NewL( const TDesC8& aDefaultBrandId, - const TDesC8& aApplicationId ) - { - TRACE( T_LIT("CBSFactory::NewL begin") ); - CBSFactory* self = new ( ELeave ) CBSFactory() ; - CleanupStack::PushL( self ); - self->ConstructL( aDefaultBrandId, aApplicationId ); - CleanupStack::Pop( self ); //self - TRACE( T_LIT("CBSFactory::NewL end") ); - return self; - } - - -// C++ default constructor can NOT contain any code, that -// might leave. -// -CBSFactory::CBSFactory() - { - } - -// destructor -CBSFactory::~CBSFactory() - { - delete iDefaultBrand; - delete iApplicationId; - if( iServerKeepAlive ) - { - iServerKeepAlive->Close(); - } - delete iServerKeepAlive; - } - -// Symbian OS default constructor can leave. -void CBSFactory::ConstructL( const TDesC8& aDefaultBrandId, - const TDesC8& aApplicationId ) - { - iDefaultBrand = aDefaultBrandId.AllocL(); - iApplicationId = aApplicationId.AllocL(); - iServerKeepAlive = new(ELeave) RBSClient(); // CSI: 74 # this needs to be like this - User::LeaveIfError( iServerKeepAlive->Connect() ); - } - - -// ----------------------------------------------------------------------------- -// CBSFactory::CreateAccessL() -// ----------------------------------------------------------------------------- -// -EXPORT_C MBSAccess* CBSFactory::CreateAccessL( const TDesC8& aBrandId, - TLanguage aLanguageId, - TBool aCacheData, /* = EFalse */ - TInt aReserved /*= 0*/ ) - { - TRACE( T_LIT("CBSFactory::CreateAccessL begin") ); - CBSAccess* access = CBSAccess::NewL( aBrandId, *iApplicationId, *iDefaultBrand, - aLanguageId, aCacheData, aReserved ); - TRACE( T_LIT("CBSFactory::CreateAccessL end") ); - return access; - } - -// ----------------------------------------------------------------------------- -// CBSFactory::CreateAccessL() -// ----------------------------------------------------------------------------- -// -EXPORT_C MBSAccess* CBSFactory::CreateAccessLC( const TDesC8& aBrandId, - TLanguage aLanguageId, - TBool aCacheData, /* = EFalse */ - TInt aReserved /*= 0 */) - { - CBSAccess* access = CBSAccess::NewL( aBrandId, *iApplicationId, *iDefaultBrand, - aLanguageId, aCacheData, aReserved ); - CleanupClosePushL( *access ); - return access; - } - -// ----------------------------------------------------------------------------- -// CBSFactory::CreateUpdaterL() -// ----------------------------------------------------------------------------- -// -EXPORT_C MBSUpdater* CBSFactory::CreateUpdaterL() - { - CBSUpdater* updater = CBSUpdater::NewL( *iApplicationId ); - return updater; - } - -// ----------------------------------------------------------------------------- -// CBSFactory::CreateUpdaterLC() -// ----------------------------------------------------------------------------- -// -EXPORT_C MBSUpdater* CBSFactory::CreateUpdaterLC() - { - CBSUpdater* updater = CBSUpdater::NewL( *iApplicationId ); - CleanupClosePushL( *updater ); - return updater; - } - -// End of File - diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsclient/cbsiconfileprovider.cpp --- a/brandingserver/bsclient/cbsiconfileprovider.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Icon file provider. - * -*/ - - -// INCLUDE FILES -#include "cbsiconfileprovider.h" -#include -#include - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CBSIconFileProvider::CBSIconFileProvider -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CBSIconFileProvider::CBSIconFileProvider() - { - } -// ----------------------------------------------------------------------------- -// CBSIconFileProvider::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CBSIconFileProvider::ConstructL(RFile& aFile) - { - User::LeaveIfError( iFile.Duplicate( aFile ) ); - } - -// ----------------------------------------------------------------------------- -// CBSIconFileProvider::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CBSIconFileProvider* CBSIconFileProvider::NewL( - RFile& aFile ) - { - CBSIconFileProvider* self = new( ELeave ) CBSIconFileProvider(); - - CleanupStack::PushL( self ); - self->ConstructL(aFile); - CleanupStack::Pop( self ); - return self; - } - - -// Destructor -CBSIconFileProvider::~CBSIconFileProvider() - { - delete iFilename; - iFile.Close(); - } - -// ----------------------------------------------------------------------------- -// CBSIconFileProvider::RetrieveIconFileHandleL -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void CBSIconFileProvider::RetrieveIconFileHandleL( - RFile& aFile, const TIconFileType /*aType*/ ) - { - aFile.Duplicate( iFile ); - } - -// ----------------------------------------------------------------------------- -// CBSIconFileProvider::Finished -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void CBSIconFileProvider::Finished() - { - // commit suicide because Avkon Icon Server said so - delete this; - } - -// End of File diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsclient/cbsiconfileprovider.h --- a/brandingserver/bsclient/cbsiconfileprovider.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Icon file provider. - * -*/ - - - -#ifndef CBSICONFILEPROVIDER_H -#define CBSICONFILEPROVIDER_H - -// INCLUDES -#include -#include -#include - - -// FORWARD DECLARATIONS - -// CLASS DECLARATION - -/** - * Icon file provider. - * See MAknIconFileProvider.h for comments. - * - * @lib chat.app - * @since 3.0 - */ -class CBSIconFileProvider : public CBase, public MAknIconFileProvider - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CBSIconFileProvider* NewL( RFile& aFile ); - /** - * Destructor. - */ - virtual ~CBSIconFileProvider(); - - public: // Functions from base classes - - /** - * @see MAknIconFileProvider - */ - void RetrieveIconFileHandleL( - RFile& aFile, const TIconFileType aType ); - - /** - * @see MAknIconFileProvider - */ - void Finished(); - - private: - - /** - * C++ default constructor. - */ - CBSIconFileProvider(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(RFile& aFile); - - private: // Data - - // owned. filename of this icon. must be a copy, - // a reference could end up pointing into another file. - HBufC* iFilename; - - RFile iFile; - }; - -#endif // CBSICONFILEPROVIDER_H - -// End of File diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsclient/cbsupdater.cpp --- a/brandingserver/bsclient/cbsupdater.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,538 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CBSUpdater.cpp -* -*/ - - -// INCLUDE FILES - -#include "e32base.h" - -#include "cbsupdater.h" -#include "debugtrace.h" -#include "mbsaccess.h" -#include "bselementfactory.h" -#include "mbselement.h" -#include "bsserverdefs.h" - -// Two-phased constructor. -CBSUpdater* CBSUpdater::NewL( const TDesC8& aApplicationId ) - { - CBSUpdater* self = new ( ELeave ) CBSUpdater() ; - CleanupStack::PushL( self ); - self->ConstructL( aApplicationId ); - CleanupStack::Pop( self ); //self - return self; - } - -// Symbian OS default constructor can leave. -void CBSUpdater::ConstructL( const TDesC8& aApplicationId ) - { - iApplicationId = aApplicationId.AllocL(); - User::LeaveIfError( iClient.Connect() ); - } - -// Destructor -CBSUpdater::~CBSUpdater() - { - delete iApplicationId; - delete iBrandId; - iClient.Close(); - } - -// C++ default constructor can NOT contain any code, that -// might leave. -// -CBSUpdater::CBSUpdater() - { - } - - -// ----------------------------------------------------------------------------- -// CBSUpdater::Close() -// ----------------------------------------------------------------------------- -// -void CBSUpdater::Close() - { - delete this; - } - -// ----------------------------------------------------------------------------- -// CBSUpdater::StartTransactionL() -// ----------------------------------------------------------------------------- -// -void CBSUpdater::StartTransactionL( const TDesC8& aBrandId, - TLanguage aLanguageId, - TUpdateTransactionType aType, /*EUpdateInstall*/ - TInt aReserved) - { - if( iActive ) - { - User::Leave( KErrAlreadyExists ); - } - - iActive = ETrue; - HBufC8* tmp = aBrandId.AllocL(); - delete iBrandId; - iBrandId = tmp; - iLanguageId = aLanguageId; - iReserved = aReserved; - iTxType = aType; - - TTransactionType operation = EBSTxAccess; - switch( aType ) - { - case EUpdateInstall: - { - operation = EBSTxInstall; - break; - } - case EUpdateAppend: - { - operation = EBSTxAppend; - break; - } - case EUpdateReplace: - { - operation = EBSTxReplace; - break; - } - case EUpdateUninstall: - { - operation = EBSTxUninstall; - break; - } - default: - break; - } - - TRAPD( err, iClient.StartTransactionL( *iApplicationId, aBrandId, KNullDesC8, - aLanguageId, operation, aReserved ) ); - if( err ) - { - iActive = EFalse; - User::Leave( err ); - } - - } -// ----------------------------------------------------------------------------- -// CBSUpdater::StopTransactionL() -// ----------------------------------------------------------------------------- -// -TInt CBSUpdater::StopTransactionL() - { - if( !iActive ) - { - User::Leave( KErrNotFound ); - } - - TInt returnValue = iClient.StopTransactionL( *iApplicationId, - *iBrandId, - iLanguageId, - iReserved ); - iActive = EFalse; - return returnValue; - } - - -// ----------------------------------------------------------------------------- -// CBSUpdater::CancelTransactionL() -// ----------------------------------------------------------------------------- -// -void CBSUpdater::CancelTransactionL() - { - if( !iActive ) - { - User::Leave( KErrNotFound ); - } - - iClient.CancelTransactionL( *iApplicationId, *iBrandId, iLanguageId, iReserved ); - iActive = EFalse; - } - - - -//*** BRAND INSTALLING ***// -// ----------------------------------------------------------------------------- -// CBSUpdater::InsertTextL() -// ----------------------------------------------------------------------------- -// -void CBSUpdater::InsertTextL( const TDesC8& aId, - const TDesC& aText ) - { - if( !iActive ) - { - User::Leave( KErrNotReady ); - } - if( iTxType != EUpdateInstall ) - { - User::Leave( KErrArgument ); - } - MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSText, aText ); - CleanupClosePushL( *element ); - InsertElementL( element ); - CleanupStack::PopAndDestroy(); // element - } - - -// ----------------------------------------------------------------------------- -// CBSUpdater::InsertBufferL() -// ----------------------------------------------------------------------------- -// -void CBSUpdater::InsertBufferL( const TDesC8& aId, - const TDesC8& aBuffer ) - { - if( !iActive ) - { - User::Leave( KErrNotReady ); - } - if( iTxType != EUpdateInstall ) - { - User::Leave( KErrArgument ); - } - MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSBuffer, aBuffer ); - CleanupClosePushL( *element ); - InsertElementL( element ); - CleanupStack::PopAndDestroy(); // element - } - - -// ----------------------------------------------------------------------------- -// CBSUpdater::InsertIntL() -// ----------------------------------------------------------------------------- -// -void CBSUpdater::InsertIntL( const TDesC8& aId, - TInt aInt ) - { - if( !iActive ) - { - User::Leave( KErrNotReady ); - } - if( iTxType != EUpdateInstall ) - { - User::Leave( KErrArgument ); - } - MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSInt, aInt ); - CleanupClosePushL( *element ); - InsertElementL( element ); - CleanupStack::PopAndDestroy(); // element - } - - -// ----------------------------------------------------------------------------- -// CBSUpdater::InsertFileL() -// ----------------------------------------------------------------------------- -// -void CBSUpdater::InsertFileL( const TDesC8& aId, - const TDesC& aFileName ) - { - if( !iActive ) - { - User::Leave( KErrNotReady ); - } - if( iTxType != EUpdateInstall ) - { - User::Leave( KErrArgument ); - } - MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSFile, aFileName ); - CleanupClosePushL( *element ); - InsertElementL( element ); - CleanupStack::PopAndDestroy(); // element - } - - -// ----------------------------------------------------------------------------- -// CBSUpdater::InsertElementL() -// ----------------------------------------------------------------------------- -// -void CBSUpdater::InsertElementL( MBSElement* aElement ) - { - if( !iActive ) - { - User::Leave( KErrNotReady ); - } - if( iTxType != EUpdateInstall ) - { - User::Leave( KErrArgument ); - } - iClient.InsertL( aElement ); - } - - - - -//*** BRAND UPDATING - replacing ***// -// ----------------------------------------------------------------------------- -// CBSUpdater::ReplaceTextL() -// ----------------------------------------------------------------------------- -// -void CBSUpdater::ReplaceTextL( const TDesC8& aId, - const TDesC& aText ) - { - if( !iActive ) - { - User::Leave( KErrNotReady ); - } - if( iTxType != EUpdateReplace ) - { - User::Leave( KErrArgument ); - } - MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSText, aText ); - CleanupClosePushL( *element ); - ReplaceElementL( element ); - CleanupStack::PopAndDestroy(); // element - } - - -// ----------------------------------------------------------------------------- -// CBSUpdater::ReplaceBufferL() -// ----------------------------------------------------------------------------- -// -void CBSUpdater::ReplaceBufferL( const TDesC8& aId, - const TDesC8& aBuffer ) - { - if( !iActive ) - { - User::Leave( KErrNotReady ); - } - if( iTxType != EUpdateReplace ) - { - User::Leave( KErrArgument ); - } - MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSBuffer, aBuffer ); - CleanupClosePushL( *element ); - ReplaceElementL( element ); - CleanupStack::PopAndDestroy(); // element - } - - -// ----------------------------------------------------------------------------- -// CBSUpdater::ReplaceIntL() -// ----------------------------------------------------------------------------- -// -void CBSUpdater::ReplaceIntL( const TDesC8& aId, - TInt aInt ) - { - if( !iActive ) - { - User::Leave( KErrNotReady ); - } - if( iTxType != EUpdateReplace ) - { - User::Leave( KErrArgument ); - } - MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSInt, aInt ); - CleanupClosePushL( *element ); - ReplaceElementL( element ); - CleanupStack::PopAndDestroy(); // element - } - - -// ----------------------------------------------------------------------------- -// CBSUpdater::ReplaceFileL() -// ----------------------------------------------------------------------------- -// -void CBSUpdater::ReplaceFileL( const TDesC8& aId, - const TDesC& aFileName ) - { - if( !iActive ) - { - User::Leave( KErrNotReady ); - } - if( iTxType != EUpdateReplace ) - { - User::Leave( KErrArgument ); - } - MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSFile, aFileName ); - CleanupClosePushL( *element ); - ReplaceElementL( element ); - CleanupStack::PopAndDestroy(); // element - } - - -// ----------------------------------------------------------------------------- -// CBSUpdater::ReplaceElementL() -// ----------------------------------------------------------------------------- -// -void CBSUpdater::ReplaceElementL( MBSElement* aElement ) - { - if( !iActive ) - { - User::Leave( KErrNotReady ); - } - if( iTxType != EUpdateReplace ) - { - User::Leave( KErrArgument ); - } - iClient.ReplaceL( aElement ); - } - - - - -//*** BRAND UPDATING - appending ***// -// ----------------------------------------------------------------------------- -// CBSUpdater::AppendTextL() -// ----------------------------------------------------------------------------- -// -void CBSUpdater::AppendTextL( const TDesC8& aId, - const TDesC& aText ) - { - if( !iActive ) - { - User::Leave( KErrNotReady ); - } - if( iTxType != EUpdateAppend ) - { - User::Leave( KErrArgument ); - } - MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSText, aText ); - CleanupClosePushL( *element ); - AppendElementL( element ); - CleanupStack::PopAndDestroy(); // element - } - - -// ----------------------------------------------------------------------------- -// CBSUpdater::AppendBufferL() -// ----------------------------------------------------------------------------- -// -void CBSUpdater::AppendBufferL( const TDesC8& aId, - const TDesC8& aBuffer ) - { - if( !iActive ) - { - User::Leave( KErrNotReady ); - } - if( iTxType != EUpdateAppend ) - { - User::Leave( KErrArgument ); - } - MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSBuffer, aBuffer ); - CleanupClosePushL( *element ); - AppendElementL( element ); - CleanupStack::PopAndDestroy(); // element - } - - -// ----------------------------------------------------------------------------- -// CBSUpdater::AppendIntL() -// ----------------------------------------------------------------------------- -// -void CBSUpdater::AppendIntL( const TDesC8& aId, - TInt aInt ) - { - if( !iActive ) - { - User::Leave( KErrNotReady ); - } - if( iTxType != EUpdateAppend ) - { - User::Leave( KErrArgument ); - } - MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSInt, aInt ); - CleanupClosePushL( *element ); - AppendElementL( element ); - CleanupStack::PopAndDestroy(); // element - } - - -// ----------------------------------------------------------------------------- -// CBSUpdater::AppendFileL() -// ----------------------------------------------------------------------------- -// -void CBSUpdater::AppendFileL( const TDesC8& aId, - const TDesC& aFileName ) - { - if( !iActive ) - { - User::Leave( KErrNotReady ); - } - if( iTxType != EUpdateAppend ) - { - User::Leave( KErrArgument ); - } - MBSElement* element = BSElementFactory::CreateBSElementL( aId, EBSFile, aFileName ); - CleanupClosePushL( *element ); - AppendElementL( element ); - CleanupStack::PopAndDestroy(); // element - } - - -// ----------------------------------------------------------------------------- -// CBSUpdater::AppendElementL() -// ----------------------------------------------------------------------------- -// -void CBSUpdater::AppendElementL( MBSElement* aElement ) - { - if( !iActive ) - { - User::Leave( KErrNotReady ); - } - if( iTxType != EUpdateAppend ) - { - User::Leave( KErrArgument ); - } - iClient.AppendL( aElement ); - } - - -// ----------------------------------------------------------------------------- -// CBSUpdater::AppendElementL() -// ----------------------------------------------------------------------------- -// -void CBSUpdater::RemoveBrandL( const TDesC8& aApplicationId, - const TDesC8& aBrandId ) - { - if( !iActive ) - { - User::Leave( KErrNotReady ); - } - iClient.RemoveBrandL( aApplicationId, aBrandId ); - } - -// ----------------------------------------------------------------------------- -// CBSUpdater::AppendElementL() -// ----------------------------------------------------------------------------- -// -void CBSUpdater:: RemoveBrandsL( const TDesC8& aApplicationId ) - { - if( !iActive ) - { - User::Leave( KErrNotReady ); - } - iClient.RemoveBrandsL( aApplicationId ); - } - -// ----------------------------------------------------------------------------- -// CBSUpdater::RegisterObserverL() -// ----------------------------------------------------------------------------- -// -void CBSUpdater:: RegisterObserverL( MBSBackupRestoreStateObserver* aBackupObserver ) -{ - iClient.RegisterObserverL(NULL, aBackupObserver) ; -} - -// ----------------------------------------------------------------------------- -// CBSUpdater::UnRegisterObserverL() -// ----------------------------------------------------------------------------- -// -void CBSUpdater:: UnRegisterObserverL( MBSBackupRestoreStateObserver* aObserver ) -{ - iClient.UnRegisterObserverL(NULL, aObserver) ; -} - -// END OF FILE - diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsclient/cbsupdater.h --- a/brandingserver/bsclient/cbsupdater.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,205 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CBSUpdater.h -* -*/ - - -#ifndef __CBSUPDATER_H__ -#define __CBSUPDATER_H__ -#include -#include "mbsupdater.h" -#include "cbsclient.h" - -/** - * Simple ClientServer for - * testing and example purposes. - */ -NONSHARABLE_CLASS( CBSUpdater ): public CBase, - public MBSUpdater - { - public: - /** - * Two-phased constructor. - */ - static CBSUpdater* NewL( const TDesC8& aApplicationId ); - - virtual ~CBSUpdater(); - - /* - * @see MBSUpdater - */ - void Close(); - - private: - void ConstructL( const TDesC8& aApplicationId ); - CBSUpdater(); - - - private: // from MBSUpdater - - /* - * @see MBSUpdater - */ - void StartTransactionL( const TDesC8& aBrandId, - TLanguage aLanguageId, - TUpdateTransactionType aType = EUpdateInstall, - TInt aReserved = 0 ); - /* - * @see MBSUpdater - */ - TInt StopTransactionL(); - - /* - * @see MBSUpdater - */ - void CancelTransactionL(); - - - /* - * @see MBSUpdater - */ - void RemoveBrandL( const TDesC8& aApplicationId, - const TDesC8& aBrandId ); - - /* - * @see MBSUpdater - */ - void RemoveBrandsL( const TDesC8& aApplicationId ); - - - //*** BRAND INSTALLING ***// - /* - * @see MBSUpdater - */ - void InsertTextL( const TDesC8& aId, - const TDesC& aText ); - - /* - * @see MBSUpdater - */ - void InsertBufferL( const TDesC8& aId, - const TDesC8& aBuffer ); - - /* - * @see MBSUpdater - */ - void InsertIntL( const TDesC8& aId, - TInt aInt ); - - /* - * @see MBSUpdater - */ - void InsertFileL( const TDesC8& aId, - const TDesC& aFileName ); - - /* - * @see MBSUpdater - */ - void InsertElementL( MBSElement* aElement ); - - - - //*** BRAND UPDATING - replacing ***// - /* - * @see MBSUpdater - */ - void ReplaceTextL( const TDesC8& aId, - const TDesC& aText ); - - /* - * @see MBSUpdater - */ - void ReplaceBufferL( const TDesC8& aId, - const TDesC8& aBuffer ); - - /* - * @see MBSUpdater - */ - void ReplaceIntL( const TDesC8& aId, - TInt aInt ); - - /* - * @see MBSUpdater - */ - void ReplaceFileL( const TDesC8& aId, - const TDesC& aFileName ); - - /* - * @see MBSUpdater - */ - void ReplaceElementL( MBSElement* aElement ); - - - - //*** BRAND UPDATING - appending ***// - /* - * @see MBSUpdater - */ - void AppendTextL( const TDesC8& aId, - const TDesC& aText ); - - /* - * @see MBSUpdater - */ - void AppendBufferL( const TDesC8& aId, - const TDesC8& aBuffer ); - - /* - * @see MBSUpdater - */ - void AppendIntL( const TDesC8& aId, - TInt aInt ); - - /* - * @see MBSUpdater - */ - void AppendFileL( const TDesC8& aId, - const TDesC& aFileName ); - - /* - * @see MBSUpdater - */ - void AppendElementL( MBSElement* aElement ); - - /* - * @see MBSUpdater - */ - void RegisterObserverL( MBSBackupRestoreStateObserver* aBackupObserver ) ; - - /* - * @see MBSUpdater - */ - void UnRegisterObserverL( MBSBackupRestoreStateObserver* aObserver ) ; - - - private: // data - - // tells if a transaction is ongoing or not - TBool iActive; - - HBufC8* iApplicationId; - HBufC8* iBrandId; - TLanguage iLanguageId; - TBool iUseCache; - RBSClient iClient; - TUpdateTransactionType iTxType; - TInt iReserved; - }; - -#endif // __CBSUPDATER_H__ - - -// END OF FILE - diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsclient/mbsbrandobserverregistrar.h --- a/brandingserver/bsclient/mbsbrandobserverregistrar.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: MBSBrandObserverRegistrar.h -* -*/ - - - -#ifndef __MBSBRANDOBSERVERREGISTRAR_H -#define __MBSBRANDOBSERVERREGISTRAR_H - -#include - - -/** - * An interface through which client can take into use - * available brand data updates. - * - * @since - */ -class MBSBrandObserverRegistrar - { - public: - - /* - * Registeres the brand observer to server - */ - virtual void RegisterObserverToServerL( TRequestStatus& aStatus) = 0; - - - /* - * Gets the new updated version number - */ - virtual TInt GetNewVersionL() = 0; - - virtual TInt GetBackupRestoreL() = 0; - - virtual TInt GetBackupStateL() = 0; - -protected: - /* - * Destructor - */ - virtual ~MBSBrandObserverRegistrar() {}; - }; - -#endif //__MBSBRANDOBSERVERREGISTRAR_H diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsclient/tbselementiterator.cpp --- a/brandingserver/bsclient/tbselementiterator.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: tbselementiterator.cpp -* -*/ - - - -// INCLUDE FILES -#include "tbselementiterator.h" -#include - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// TBSElementIterator::TBSElementIterator -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -TBSElementIterator::TBSElementIterator( const TDesC& aElementId ) - : iElementId( aElementId ) - { - } - -MBSElement& TBSElementIterator::Next() - { - } - - -// End of File diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsclient/tbsmdescarrayadapter.cpp --- a/brandingserver/bsclient/tbsmdescarrayadapter.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: One value adapter for MDesCArray. -* -*/ - -// INCLUDES -#include "tbsmdescarrayadapter.h" -#include -#include - - -//LOCAL constants -namespace - { - //Panic - _LIT( KBSMDesArrayAdapterPanic, "BSDesArrAdp" ); - - //Panic reasons - enum TBSMDesArrayAdapterReasons - { - EMdcaPointOutOfBounds - }; - - void BSMDesAdapPanic( TBSMDesArrayAdapterReasons aPanicReason ) - { - User::Panic( KBSMDesArrayAdapterPanic, aPanicReason ); - } - } - - - - -// ================= MEMBER FUNCTIONS ======================= -// C++ default constructor can NOT contain any code, that -// might leave. -// -EXPORT_C TBSMDesCArrayAdapter::TBSMDesCArrayAdapter( const TDesC& aDesc ) - : iDesc( aDesc ) - { - } - -// ----------------------------------------------------------------------------- -// TBSMDesCArrayAdapter::MdcaCount() -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt TBSMDesCArrayAdapter::MdcaCount() const - { - //there is just one adapted descriptor - return 1; - } - -// ----------------------------------------------------------------------------- -// TBSMDesCArrayAdapter::MdcaPoint() -// ----------------------------------------------------------------------------- -// -EXPORT_C TPtrC TBSMDesCArrayAdapter::MdcaPoint( TInt aIndex ) const - { - //there is just one adapted descriptor - __ASSERT_ALWAYS( aIndex == 0, BSMDesAdapPanic( EMdcaPointOutOfBounds ) ); - return iDesc; - } - - - -// End of File - diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsserver/bsimportconstants.h --- a/brandingserver/bsserver/bsimportconstants.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: BrandingServer constants. -* -*/ -// CONSTANTS - -// Characters to strip from xml text values -_LIT( KCommonControlCharacters, "\n\t\r" ); -_LIT( KEndl, "\n\r" ); - -// === Directory & file constants ============================================= -_LIT( KDirSeparator, "\\" ); -_LIT( KDot, "." ); -_LIT( KDefFileName, "brandfile.bin.r" ); -_LIT( KDefEventLogDir, "BSImport" ); -_LIT( KDefEventLogFile, "eventlog.txt" ); -_LIT( KFileElementStore, "files" ); -_LIT( KBSDataStore, "data" ); -_LIT( KAllFilesWildCard, "*.*" ); -_LIT( KBSCDrive, "C:" ); -_LIT( KBSZDrive, "Z:" ); -// Codescanner warning : hard-coded drive letters (id:25) -// this folder is always on c-drive -_LIT( KBSIbyDirectory, "c:\\data\\bs\\" ); // CSI: 25 # See above -_LIT( KBSIbyExtension, ".iby" ); -_LIT( KBSFileLangSuffix, "r" ); -const TInt KMaxVersionLenght = 3; - -const TInt KLeadingZero = 0; -const TInt KLangBufLength = 2; - -// folders inside server's private: "\\private\\102828DD\\" -_LIT( KInstallObservePath, "import\\install\\" ); // new files -_LIT( KInstallPath, "install\\" ); // installed files - -// drive where installation files are saved -_LIT( KInstallDrive, "C:" ); - -// brand installation file extension -_LIT( KBrandInstallExt, ".install" ); - -// Separator which separates brand id from application id in -// uninstall buffer -_LIT( KInstallFileDataSeparator, "$" ); - -_LIT( KDiscardBrandFileName, "discardedbrand.txt" ); - - - - - - diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsserver/bsserverdefs.h --- a/brandingserver/bsserver/bsserverdefs.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: server defintions. -* -*/ -#ifndef __BSSERVERDEFS_H__ -#define __BSSERVERDEFS_H__ -#include - -/** - * - * - */ -const TInt KBSVersionMajor = 1; -const TInt KBSVersionMinor = 1; -const TInt KBSVersionBuild = 1; - -/** - * - * - */ -_LIT( KBSServerExe, "bsserver.exe" ); - - -/** - * - * - */ -_LIT( KBSServerName, "bs" ); - - -/** - * - * - */ -const TUint KBSMsgSlotCount = 4; - - -enum TTransactionType - { - EBSTxInstall = 1, - EBSTxUninstall, - EBSTxAppend, - EBSTxReplace, - EBSTxAccess - }; - -/** - * - * - */ -enum TBSMessages - { - // access API - EBSInitInstall = 1, - EBSInitUninstall, - EBSInitAppend, - EBSInitReplace, - EBSInitAccess, - EBSPrepareText, - EBSGetText, - EBSGetInt, - EBSPrepareBuffer, - EBSGetBuffer, - EBSPrepareSeveral, - EBSGetSeveral, - EBSGetFile, - EBSPrepareStructure, - EBSGetStructure, - - EBSStartTransaction, - EBSStopTransaction, - EBSCancelTransaction, - - // installing - EBSInstall, - - // replacing - EBSReplace, - - // appending - EBSAppend, - - // removing - EBSRemoveBrand, - - EBSRemoveApplication, - - // observing - EBSObserveBrand, - EBSObserveGetNewVersion, - EBSObserveGetChange, - EBSObserveGetBackupState, - EBSIsBrandUpdateRequired, - EBSOperationLast - }; - - -#endif //__BSSERVERDEFS_H__ - -// END OF FILE - - - - - diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsserver/cbsbackupobserver.cpp --- a/brandingserver/bsserver/cbsbackupobserver.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,195 +0,0 @@ -/* -* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Stores element data and writes it to stream -* -*/ - - -#include - -#include "cbsbackupobserver.h" - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CBSBackupObserver::NewL -// --------------------------------------------------------------------------- -// -CBSBackupObserver* CBSBackupObserver::NewL() - { - CBSBackupObserver* self = NewLC(); - CleanupStack::Pop(); - return self; - } - -// --------------------------------------------------------------------------- -// CBSBackupObserver::NewLC -// --------------------------------------------------------------------------- -// -CBSBackupObserver* CBSBackupObserver::NewLC() - { - CBSBackupObserver* self = new (ELeave) CBSBackupObserver(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// CBSBackupObserver::ConstructL -// --------------------------------------------------------------------------- -// -void CBSBackupObserver::ConstructL() - { - CActiveScheduler::Add( this ); - iProperty.Attach( KUidSystemCategory, conn::KUidBackupRestoreKey ); - iLatestState = BackupStateL(); - Subscribe(); - } - -// --------------------------------------------------------------------------- -// CBSBackupObserver::CBSBackupObserver -// --------------------------------------------------------------------------- -// -CBSBackupObserver::CBSBackupObserver() : - CActive( EPriorityStandard ) - { - } - -// --------------------------------------------------------------------------- -// CBSBackupObserver::~CBSBackupObserver -// --------------------------------------------------------------------------- -// -CBSBackupObserver::~CBSBackupObserver() - { - Cancel(); - iObservers.Close(); - } - -// --------------------------------------------------------------------------- -// CBSBackupObserver::RunL -// --------------------------------------------------------------------------- -// -void CBSBackupObserver::RunL() - { - MBSBackupObserver::TBackupState newState = BackupStateL(); - if( newState != iLatestState ) - { - // state changed - iLatestState = newState; - NotifyObserversL( iLatestState ); - } - Subscribe(); - } - -// --------------------------------------------------------------------------- -// CBSBackupObserver::DoCancel -// --------------------------------------------------------------------------- -// -void CBSBackupObserver::DoCancel() - { - iProperty.Cancel(); - } - -// --------------------------------------------------------------------------- -// CBSBackupObserver::RunError -// --------------------------------------------------------------------------- -// -TInt CBSBackupObserver::RunError( TInt /*aError*/ ) - { - return KErrNone; - } - -// --------------------------------------------------------------------------- -// CBSBackupObserver::RegisterObserver -// --------------------------------------------------------------------------- -// -TInt CBSBackupObserver::RegisterObserver( MBSBackupObserver* aObserver ) - { - TInt err = iObservers.InsertInAddressOrder( aObserver ); - if( err == KErrAlreadyExists ) - { - // ignore duplicate registration - err = KErrNone; - } - - // if backup is already active -> notify - if( iLatestState == MBSBackupObserver::EBackupActive ) - { - TRAP_IGNORE( aObserver->HandleBackupStateL( iLatestState ) ); - } - - return err; - } - -// --------------------------------------------------------------------------- -// CBSBackupObserver::UnregisterObserver -// --------------------------------------------------------------------------- -// -void CBSBackupObserver::UnregisterObserver( MBSBackupObserver* aObserver ) - { - TInt index = iObservers.FindInAddressOrder( aObserver ); - if( index != KErrNotFound ) - { - iObservers.Remove( index ); - } - } - -// --------------------------------------------------------------------------- -// CBSBackupObserver::Subscribe -// --------------------------------------------------------------------------- -// -void CBSBackupObserver::Subscribe() - { - if( IsActive() ) - { - // already active - return; - } - iStatus = KRequestPending; - iProperty.Subscribe( iStatus ); - SetActive(); - } - -// --------------------------------------------------------------------------- -// CBSBackupObserver::NotifyObservers -// --------------------------------------------------------------------------- -// -void CBSBackupObserver::NotifyObserversL( MBSBackupObserver::TBackupState aState ) - { - TInt count = iObservers.Count(); - for( TInt i = 0; i < count; i++ ) - { - TRAP_IGNORE( iObservers[i]->HandleBackupStateL( aState ) ); - } - } - -// --------------------------------------------------------------------------- -// CBSBackupObserver::BackupState -// --------------------------------------------------------------------------- -// -MBSBackupObserver::TBackupState CBSBackupObserver::BackupStateL() - { - TInt value = 0; - User::LeaveIfError( iProperty.Get( value ) ); - if( value == 0 || - value == ( conn::EBURNormal | conn::ENoBackup ) ) - { - // backup or restore is not active at the moment - return MBSBackupObserver::EBackupNotActive; - } - return MBSBackupObserver::EBackupActive; - } - -// End of file diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsserver/cbsbackupobserver.h --- a/brandingserver/bsserver/cbsbackupobserver.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +0,0 @@ -/* -* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Gets and notifies backup and Restore events from system -* -*/ - - -#ifndef CBSBACKUPOBSERVER_H -#define CBSBACKUPOBSERVER_H - -#include -#include - -#include "mbsbackupobserver.h" - -/** - * Gets and notifies backup and Restore events from system - * - * @lib bsserver.exe - * @since S60 v3.2 - */ -class CBSBackupObserver : public CActive -{ -public: - - static CBSBackupObserver* NewL(); - - static CBSBackupObserver* NewLC(); - - ~CBSBackupObserver(); - - -private: // From CActive - - /** - * @see CActive - */ - void RunL(); - - /** - * @see CActive - */ - void DoCancel(); - - /** - * @see CActive - */ - TInt RunError( TInt aError ); - - -private: // Private constructors - - CBSBackupObserver(); - - void ConstructL(); - - -public: // New Methods - - /** - * Register observer to observe backup state changes - * @param aObserver observer to register - * @return KErrNone or some other system wide errorcode - */ - TInt RegisterObserver( MBSBackupObserver* aObserver ); - - /** - * Unregister observer - * @param aObserver observer to remove - */ - void UnregisterObserver( MBSBackupObserver* aObserver ); - - -private: // New methods - - /** - * Subscribes to backup and restore P&S value. - */ - void Subscribe(); - - /** - * Notify registered observers of new backup state - */ - void NotifyObserversL( MBSBackupObserver::TBackupState aState ); - - /** - * Read current backup state - * @return current backup state - */ - MBSBackupObserver::TBackupState BackupStateL(); - - -private: // Data - - // backup state property - RProperty iProperty; - - // Own (array only). Observers - RPointerArray iObservers; - - // latest state of backup and restore; - MBSBackupObserver::TBackupState iLatestState; -}; - -#endif //CBSBACKUPOBSERVER_H diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsserver/cbsbrandhandler.cpp --- a/brandingserver/bsserver/cbsbrandhandler.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,614 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CBSBrandHandler.cpp -* -*/ - - -// INCLUDE FILES - -#include "cbsbrandhandler.h" -#include "bselementfactory.h" -#include "debugtrace.h" -#include "cbsstoragemanager.h" -#include "cbsbitmap.h" -#include "bsimportconstants.h" - -#include -#include -#include - -void Panic(TInt aPanic) - { - _LIT( KPanic, "CBS" ); - User::Panic( KPanic, aPanic ); - } - -// Two-phased constructor. -CBSBrandHandler* CBSBrandHandler::NewL( const TDesC& aApplicationId, - const TDesC& aBrandId, - const TDesC& aDefaultBrandId, - TLanguage aLanguage, - CBSSession* aSession, - TInt aReserved ) - { - CBSBrandHandler* self = new ( ELeave ) CBSBrandHandler( aLanguage, aReserved ) ; - CleanupStack::PushL( self ); - self->ConstructL( aApplicationId, aBrandId, aDefaultBrandId, aSession ); - CleanupStack::Pop( self ); //self - return self; - } - -// Symbian OS default constructor can leave. -void CBSBrandHandler::ConstructL( const TDesC& aApplicationId, - const TDesC& aBrandId, - const TDesC& aDefaultBrandId, - CBSSession* aSession ) - { - iApplicationId = aApplicationId.AllocL(); - iBrandId = aBrandId.AllocL(); - iDefaultBrandId = aDefaultBrandId.AllocL(); - iSession = aSession; - - User::LeaveIfError( iFs.Connect() ); - - iHandle = new(ELeave) RFile(); // CSI: 74 # this needs to be like this - - isDefaultBrandUsed = ETrue; - iStorageManager = CBSStorageManager::NewL( iSession, KNullDesC ); - TInt err = -1; - TRAP (err, iStorageManager->BrandHandleL( *iApplicationId, - *iBrandId, iLanguage, - *iHandle, - iReserved )); - - - if (err != KErrNone) - { - iStorageManager->BrandHandleL( *iApplicationId, - *iDefaultBrandId, iLanguage, - *iHandle, - iReserved ); - } - VerifyVersionL(); - } - -// Destructor -CBSBrandHandler::~CBSBrandHandler() - { - delete iDefaultBrand; - delete iApplicationId; - delete iBrandId; - delete iDefaultBrandId; - if( iHandle ) - { - iHandle->Close(); - delete iHandle; - iHandle = NULL; - } - - delete iStorageManager; - - iFs.Close(); - } - -// C++ default constructor can NOT contain any code, that -// might leave. -// -CBSBrandHandler::CBSBrandHandler( TLanguage aLanguage, - TInt aReserved ) -: iLanguage( aLanguage ), iReserved( aReserved) - { - } - - - -TInt CBSBrandHandler:: isBrandUpdateRequiredL () -{ - TRACE( T_LIT( "isBrandUpdateRequired entered")); - TInt updateRequired = -1; - if (isDefaultBrandUsed) - { - TRACE( T_LIT( "isBrandUpdateRequired isDefaultBrandused is TRUE.")); - /* default brand is used, so can check if the actual brand is installed by anychance or not */ - updateRequired = iStorageManager->isActualBrandInstalledL (*iApplicationId, *iBrandId, iLanguage ); - if (1 == updateRequired) - { - TRACE( T_LIT( "isBrandUpdateRequired isDefaultBrandused returned 1, so update required, setting defaultbrand FALSE.")); - isDefaultBrandUsed = EFalse; - } - } - TRACE( T_LIT( "isBrandUpdateRequired isDefaultBrandused leaving..")); - return updateRequired; -} - -// ----------------------------------------------------------------------------- -// CBSBrandHandler::SetDefaultBrandIdL() -// ----------------------------------------------------------------------------- -// -void CBSBrandHandler::SetDefaultBrandIdL( const TDesC8& aBrandId ) - { - HBufC* temp = CnvUtfConverter::ConvertToUnicodeFromUtf8L( aBrandId ); - delete iDefaultBrand; - iDefaultBrand = temp; - } - -// ----------------------------------------------------------------------------- -// CBSBrandHandler::GetTextL() -// ----------------------------------------------------------------------------- -// -HBufC* CBSBrandHandler::GetTextL( const TDesC8& aId ) - { - TRACE( T_LIT( "CBranding::GetTextL begin [%S]"), &aId); - - MBSElement* element = ReadElementLC( aId ); - - HBufC* returnValue = element->TextDataL().AllocL(); - - CleanupStack::PopAndDestroy(); // element - TRACE( T_LIT( "CBranding::GetTextL end") ); - return returnValue; - } - -// ----------------------------------------------------------------------------- -// CBSBrandHandler::GetBufferL() -// ----------------------------------------------------------------------------- -// -HBufC8* CBSBrandHandler::GetBufferL( const TDesC8& aId ) - { - TRACE( T_LIT( "CBSBrandHandler::GetBufferL begin") ); - - MBSElement* element = ReadElementLC( aId ); - - HBufC8* returnValue = element->BufferDataL().AllocL(); - - CleanupStack::PopAndDestroy(); // element - TRACE( T_LIT( "CBSBrandHandler::GetBufferL end") ); - return returnValue; - } - -// ----------------------------------------------------------------------------- -// CBSBrandHandler::GetIntL() -// ----------------------------------------------------------------------------- -// -TInt CBSBrandHandler::GetIntL( const TDesC8& aId ) - { - TRACE( T_LIT( "CBSBrandHandler::GetIntL begin") ); - TInt value = 0; - - MBSElement* element = ReadElementLC( aId ); - - value = element->IntDataL(); - - CleanupStack::PopAndDestroy(); // element - - TRACE( T_LIT( "CBSBrandHandler::GetIntL end") ); - return value; - } - -// ----------------------------------------------------------------------------- -// CBSBrandHandler::GetFileL() -// ----------------------------------------------------------------------------- -// -void CBSBrandHandler::GetFileL( const TDesC8& aId, RFile& aFile ) - { - TRACE( T_LIT( "CBSBrandHandler::GetFileL begin aId[%S] "), &aId ); - RFile file; - User::LeaveIfError( iFs.ShareProtected() ); - - if (iLanguage >= 100) - User::LeaveIfError (KErrNotFound); - HBufC* fileName = GetTextL( aId ); - CleanupStack :: PushL (fileName); - - TBuf buffer; -// append leading zero only if language code is <10. - if ( 10 > iLanguage ) - { - buffer.AppendNum( KLeadingZero ); - } - - buffer.AppendNum( iLanguage ); - - TInt err = -1; - TRAP (err, iStorageManager->FileElementHandleL( *iApplicationId, - *iBrandId, - *fileName, - buffer, - file )); - - if (KErrNone != err) - { - /* if the file is not found in the default brand also, then leave */ - iStorageManager->FileElementHandleL( *iApplicationId, - *iDefaultBrandId, - *fileName, - buffer, - file); - - TRACE( T_LIT( "CBSBrandHandler::GetFileL found in default brand") ); - - } - - CleanupStack :: PopAndDestroy (fileName); - - aFile = file; - TRACE( T_LIT( "CBSBrandHandler::GetFileL end") ); - } - - -// ----------------------------------------------------------------------------- -// CBSBrandHandler::GetSeveralL() -// ----------------------------------------------------------------------------- -// -MBSElement* CBSBrandHandler::GetSeveralL( RBSObjOwningPtrArray& aIds ) - { - MBSElement* returnValue = NULL; - TInt count = aIds.Count(); - - RBSObjOwningPtrArray listData; - CleanupClosePushL( listData ); - for(TInt i = 0; i < count; i++ ) - { - MBSElement* subElement = ReadElementLC( *aIds[ i ] ); - listData.AppendL( subElement ); - CleanupStack::Pop( subElement ); - } - returnValue = BSElementFactory::CreateBSElementL( KNullDesC8, - EBSList, - listData ); - CleanupStack::Pop(); // listData - return returnValue; - } - - -// ----------------------------------------------------------------------------- -// CBSBrandHandler::GetStructureL() -// ----------------------------------------------------------------------------- -// -MBSElement* CBSBrandHandler::GetStructureL( TDesC8& aId ) - { - MBSElement* returnValue = NULL; - - TRACE( T_LIT( "CBSBrandHandler::GetStructureL begin") ); - - returnValue = ReadElementLC( aId ); - - CleanupStack::Pop(); // element - - TRACE( T_LIT( "CBSBrandHandler::GetStructureL end") ); - - return returnValue; - } - - -// ----------------------------------------------------------------------------- -// CBSBrandHandler::ReadElementLC() -// ----------------------------------------------------------------------------- -// -MBSElement* CBSBrandHandler::ReadElementLC( const TDesC8& aId, TBool aForceDefault /*= EFalse*/ ) - { - TRACE( T_LIT( "CBSBrandHandler::ReadElementLC begin aId")); - - if( aForceDefault ) - { - TRACE( T_LIT( "CBSBrandHandler::ReadElementLC default brand")); - iStorageManager->BrandHandleL( *iApplicationId, - *iDefaultBrandId, iLanguage, - *iHandle, - iReserved ); - } - else - { - TInt err = -1; - TRAP (err, iStorageManager->BrandHandleL( *iApplicationId, - *iBrandId, iLanguage, - *iHandle, - iReserved )); - if (KErrNone != err) - { - iStorageManager->BrandHandleL( *iApplicationId, - *iDefaultBrandId, iLanguage, - *iHandle, - iReserved ); - } - } - - RFileReadStream stream; - stream.Attach( *iHandle ); - CleanupClosePushL( stream ); - - VerifyVersionL( stream ); - - TInt count = stream.ReadInt16L(); - - MBSElement* returnValue = NULL; - - for( TInt i = 0; i < count; i++ ) - { - TRAPD( err, returnValue = ReadStreamL( aId, stream ) ); - - if( err == KErrEof ) - { - TRACE( T_LIT( "CBSBrandHandler::ReadElementLC EOF!") ); - // the id is not found in this file - User::Leave( KErrNotFound ); - } - if( returnValue ) - { - TRACE( T_LIT( "CBSBrandHandler::ReadElementLC ELEMENT FOUND.. at position %d"), i); - // we found what we are looking for - break; - } - } - - CleanupStack::PopAndDestroy( &stream ); // stream - - TBool popElementFromCleanupStack( EFalse ); - - /* If retur value is not found and if its read the actual brand, then try in default brand as well. aForceDefault will decide that. */ - if( !returnValue && !aForceDefault) - { - TRACE( T_LIT( "CBSBrandHandler::ReadElementLC force default is true") ); - - // the element was not found - // try the default brand if it's not the same as wanted brand - if( 0 != iBrandId->Compare( *iDefaultBrandId ) ) - { - TRACE( T_LIT( "CBSBrandHandler::ReadElementLC calling READELEMENTLC again") ); - - /* Call ReadElementLC wiht aForceDefault set to TRUE */ - returnValue = ReadElementLC( aId, ETrue ); - - if ( returnValue ) - { - TRACE( T_LIT( "CBSBrandHandler::ReadElementLC VALUE IS FOUND!!!") ); - popElementFromCleanupStack = ETrue; - } - else - { - TRACE( T_LIT( "CBSBrandHandler::ReadElementLC VALUE IS NOT FOUND!!!") ); - CleanupStack :: Pop (returnValue); - } - } - if( !returnValue ) - { - TRACE( T_LIT( "CBSBrandHandler::ReadElementLC VALUE not FOUND LEAVING WITH -1 !!!") ); - User::Leave( KErrNotFound ); - } - } - - CleanupClosePushL( *returnValue ); - // since we make one function call to ReadElementLC in case the default - // brand id is used to retrieved the element, we have to pop one returnValue - // pointer from CleanupStack (otherwise we have two identical pointers on - // the stack!!!) - if ( popElementFromCleanupStack ) - { - CleanupStack::Pop( returnValue ); - } - - TRACE( T_LIT( "CBSBrandHandler::ReadElementLC end ") ); - return returnValue; - } - -// ----------------------------------------------------------------------------- -// CBSBrandHandler::VerifyVersionL() -// ----------------------------------------------------------------------------- -// -void CBSBrandHandler::VerifyVersionL( RFileReadStream& aStream ) - { - TInt version = aStream.ReadInt16L(); - if( version != iReserved ) - { - User::Leave( KErrArgument ); - } - } - - -// ----------------------------------------------------------------------------- -// CBSBrandHandler::VerifyVersionL() -// ----------------------------------------------------------------------------- -// -void CBSBrandHandler::VerifyVersionL() - { - if( !iHandle ) - { - User::Leave( KErrNotReady ); - } - RFileReadStream stream; - stream.Attach( *iHandle ); - CleanupClosePushL( stream ); - - VerifyVersionL( stream ); - - CleanupStack::PopAndDestroy(); // stream - } - -// ----------------------------------------------------------------------------- -// CBSBrandHandler::ReadStreamL() -// ----------------------------------------------------------------------------- -// -MBSElement* CBSBrandHandler::ReadStreamL( const TDesC8& aId, RFileReadStream& aStream, - TBool aAllowEmptyId /* = EFalse */ ) - { - TRACE( T_LIT( "CBSBrandHandler::ReadStreamL BEGIN")); - TBSElementType type = (TBSElementType)aStream.ReadInt16L(); - MBSElement* returnValue = NULL; - - TInt idSize = aStream.ReadInt16L(); - - HBufC8* elementId = HBufC8::NewLC( idSize ); - TPtr8 elementIdPtr = elementId->Des(); - - if( idSize == 0 && aAllowEmptyId ) - { - // we don't read empty ID - } - else - { - aStream.ReadL( elementIdPtr, idSize ); - elementIdPtr.SetLength( idSize );// Set length - } - - - TBool match = EFalse; - if( aAllowEmptyId || ( 0 == elementIdPtr.Compare( aId ) ) ) - { - match = ETrue; - } - - TPtrC8 idPtrC( *elementId );// idPtrC creation moved here so it will be updated correctly. - if( elementId->Length() == 0 ) - { - CleanupStack::PopAndDestroy( elementId ); - elementId = NULL; - idPtrC.Set( KNullDesC8 ); - } - - switch( type ) - { - case EBSInt: - { - TInt intData = aStream.ReadInt16L(); - TRACE( T_LIT( "CBSBrandHandler::ReadStreamL type INT")); - if( match ) - { - // Codescanner warning: neglected to put variable on cleanup stack (id:35) - // This method cannot leave after this line - returnValue = BSElementFactory::CreateBSElementL( idPtrC, // CSI: 35 # See above - EBSInt, - intData ); - } - break; - } - case EBSText: - case EBSFile: // flow through - { - TInt textSize = aStream.ReadInt16L(); - HBufC* textData = HBufC::NewLC( textSize ); - - TPtr textPtr = textData->Des(); - aStream.ReadL( textPtr, textSize ); - - TRACE( T_LIT( "CBSBrandHandler::ReadStreamL type TEXT/ FILE")); - if( match ) - { - // Codescanner warning: neglected to put variable on cleanup stack (id:35) - // This method cannot leave after this line - returnValue = BSElementFactory::CreateBSElementL( idPtrC, // CSI: 35 # See above - type, - *textData ); - } - - CleanupStack::PopAndDestroy( textData ); - break; - } - case EBSList: - { - RBSObjOwningPtrArray listData; - CleanupClosePushL( listData ); - TInt count = aStream.ReadInt16L(); - - for( TInt i = 0; i < count; i++ ) - { - MBSElement* subElement = ReadStreamL( KNullDesC8, aStream, ETrue ); - CleanupDeletePushL( subElement ); - listData.AppendL( subElement ); - CleanupStack::Pop(); // subElement - } - - if( match ) - { - // Codescanner warning: neglected to put variable on cleanup stack (id:35) - // This method cannot leave after this line - returnValue = BSElementFactory::CreateBSElementL( idPtrC, // CSI: 35 # See above - EBSList, - listData ); - } - CleanupStack::Pop(); // listData - break; - } - case EBSBuffer: - { - TInt bufferSize = aStream.ReadInt16L(); - HBufC8* buffeData = HBufC8::NewLC( bufferSize ); - - TPtr8 bufferPtr = buffeData->Des(); - aStream.ReadL( bufferPtr, bufferSize ); - - if( match ) - { - // Codescanner warning: neglected to put variable on cleanup stack (id:35) - // This method cannot leave after this line - returnValue = BSElementFactory::CreateBSElementL( idPtrC, // CSI: 35 # See above - EBSBuffer, - *buffeData ); - } - - CleanupStack::PopAndDestroy( buffeData ); - break; - } - case EBSBitmap: - { - TInt length = aStream.ReadInt16L(); - HBufC8* fileId = HBufC8::NewLC( length ); - - TPtr8 fileIdPtr = fileId->Des(); - aStream.ReadL( fileIdPtr, length ); - - TInt bitmapId = aStream.ReadInt16L(); - TInt maskId = aStream.ReadInt16L(); - TInt skinId = aStream.ReadInt16L(); - TInt skinMaskId = aStream.ReadInt16L(); - - TRACE( T_LIT( "CBSBrandHandler::ReadStreamL type BITMAP .. bitmap ID is [%d]"), bitmapId); - if( match ) - { - CBSBitmap* bitmap = CBSBitmap::NewLC( bitmapId, - maskId, - skinId, - skinMaskId, - fileIdPtr ); - - // Codescanner warning: neglected to put variable on cleanup stack (id:35) - // This method cannot leave after this line - returnValue = BSElementFactory::CreateBSElementL( idPtrC, // CSI: 35 # See above - EBSBitmap, - bitmap ); - CleanupStack::Pop( bitmap ); - } - CleanupStack::PopAndDestroy( fileId ); - - break; - } - default: - { - TRACE( T_LIT( "CBSBrandHandler::ReadStreamL type DEFAULT : corrupt")); - User::Leave( KErrCorrupt ); - break; - } - } - - if( elementId ) - { - CleanupStack::PopAndDestroy( elementId ); - } - - TRACE( T_LIT( "CBSBrandHandler::ReadStreamL END")); - return returnValue; - } - -// END OF FILE - diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsserver/cbsbrandhandler.h --- a/brandingserver/bsserver/cbsbrandhandler.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CBSBrandHandler.h -* -*/ - - -#ifndef __CBSBRANDHANDLER_H__ -#define __CBSBRANDHANDLER_H__ - -#include "rbsobjowningptrarray.h" - -#include -#include -#include -#include -#include -#include - -// FORWARD DECLARATIONS -class MBSElement; -class CBSStorageManager; -class CBSSession; - -/** - * - * - */ -NONSHARABLE_CLASS( CBSBrandHandler ): public CBase - { - public: - /** - * Two-phased constructor. - */ - static CBSBrandHandler* NewL( const TDesC& aApplicationId, - const TDesC& aBrandId, - const TDesC& aDefaultBrandId, - TLanguage aLanguage, - CBSSession* aSession, - TInt aReserved = 0); - - - - virtual ~CBSBrandHandler(); - - private: // constructors - - void ConstructL( const TDesC& aApplicationId, - const TDesC& aBrandId, - const TDesC& aDefaultBrandId, - CBSSession* aSession ); - - CBSBrandHandler( TLanguage aLanguage, - TInt aReserved ); - - public: - HBufC* GetTextL( const TDesC8& aId ); - HBufC8* GetBufferL( const TDesC8& aId ); - TInt GetIntL( const TDesC8& aId ); - MBSElement* GetSeveralL( RBSObjOwningPtrArray& aIds ); - void GetFileL( const TDesC8& aId, RFile& aFile ); - MBSElement* GetStructureL( TDesC8& aId ); - void SetDefaultBrandIdL( const TDesC8& aBrandId ); - - - TInt isBrandUpdateRequiredL (); - - private: // New methods - - MBSElement* ReadElementLC( const TDesC8& aId, TBool aForceDefault = EFalse ); - - MBSElement* ReadStreamL( const TDesC8& aId, - RFileReadStream& aStream, - TBool aAllowEmptyId = EFalse ); - - void VerifyVersionL(); - void VerifyVersionL( RFileReadStream& aStream ); - - private: // data - HBufC* iDefaultBrand; - /// -#include -#include - -#include "cbsibywriter.h" -#include "bsimportconstants.h" -//#include "importlogwriter.h" -#include "debugtrace.h" - -// CONSTANTS -_LIT8( KIBYHeader1, "\n#ifndef __BRAND_" ); -_LIT8( KIBYHeader2, "\n#define __BRAND_" ); -_LIT8( KIBYHeaderEnd, "_IBY_" ); -_LIT8( KIBYFileItem, "\nfile=" ); -_LIT8( KIBYEmptyLine, "\n" ); -_LIT8( KIBYSpace, " \t\t " ); -_LIT8( KIBYFooter, "\n#endif //__BRAND_" ); - -// File & dir -_LIT8( KIBYBaseSource, "\\epoc32\\winscw\\c" ); - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CBSIBYWriter::NewL -// --------------------------------------------------------------------------- -// -CBSIBYWriter* CBSIBYWriter::NewL() - { - CBSIBYWriter* self = NewLC(); - CleanupStack::Pop(); - return self; - } - -// --------------------------------------------------------------------------- -// CBSIBYWriter::NewLC -// --------------------------------------------------------------------------- -// -CBSIBYWriter* CBSIBYWriter::NewLC() - { - CBSIBYWriter* self = new (ELeave) CBSIBYWriter(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// CBSIBYWriter::ConstructL -// --------------------------------------------------------------------------- -// -void CBSIBYWriter::ConstructL() - { - } - -// --------------------------------------------------------------------------- -// CBSIBYWriter::CBSIBYWriter -// --------------------------------------------------------------------------- -// -CBSIBYWriter::CBSIBYWriter() - { - } - -// --------------------------------------------------------------------------- -// CBSIBYWriter::~CBSIBYWriter -// --------------------------------------------------------------------------- -// -CBSIBYWriter::~CBSIBYWriter() - { - iSourcePath.ResetAndDestroy(); - iSourceFiles.ResetAndDestroy(); - iDestinations.ResetAndDestroy(); - delete iIbyFile; - } - -// --------------------------------------------------------------------------- -// CBSIBYWriter::SetFileItemL -// --------------------------------------------------------------------------- -// -void CBSIBYWriter::SetFileItemL( const TDesC& aSrc, const TDesC& aDest ) - { - TRACE( T_LIT( "CBSIBYWriter::SetFileItemL begin") ); - // Parse and construct filenames - TParse srcparse; - srcparse.Set( aSrc, NULL, NULL ); - - TParse dstparse; - dstparse.Set( aDest, NULL, NULL ); - - // Path - HBufC8* srcpath = HBufC8::NewLC( srcparse.Path().Length() ); - TPtr8 ptr( srcpath->Des() ); - CnvUtfConverter::ConvertFromUnicodeToUtf8( ptr, srcparse.Path() ); - - HBufC8* src = HBufC8::NewLC( srcparse.NameAndExt().Length() ); - ptr.Set( src->Des() ); - CnvUtfConverter::ConvertFromUnicodeToUtf8( ptr, srcparse.NameAndExt() ); - - HBufC8* dst = HBufC8::NewLC( aDest.Length() ); - ptr.Set( dst->Des() ); - - HBufC* newDst = HBufC::NewLC( aDest.Length() ); - TPtr dstPtr( newDst->Des() ); - TPtrC name = dstparse.NameAndExt(); - TPtrC path = dstparse.Path(); - dstPtr.Append( KBSZDrive ); - dstPtr.Append( path ); - dstPtr.Append( name ); - - CnvUtfConverter::ConvertFromUnicodeToUtf8( ptr, dstPtr ); - - TRACE( T_LIT( "CBSIBYWriter::SetFileItemL - setting source file %S"), &aSrc ); - TRACE( T_LIT( "CBSIBYWriter::SetFileItemL - setting destination file %S"), newDst ); - CleanupStack::PopAndDestroy( newDst ); - CleanupStack::Pop( 3 ); - - // Append filepair - iSourcePath.Append( srcpath ); - iSourceFiles.Append( src ); - iDestinations.Append( dst ); - - TRACE( T_LIT( "CBSIBYWriter::SetFileItemL end") ); - } - -// --------------------------------------------------------------------------- -// CBSIBYWriter::WriteIBYFile() -// --------------------------------------------------------------------------- -// -void CBSIBYWriter::WriteIBYFileL( RFs& aFs, const TDesC& aFileName ) - { - TRACE( T_LIT( "CBSIBYWriter::WriteIBYFileL begin") ); - - TInt count = iSourceFiles.Count(); - if( count == 0 ) - { - TRACE( T_LIT( "CBSIBYWriter::WriteIBYFileL - No file elements, nothing to do.") ); - return; - } - if( count != iDestinations.Count() ) - { - TRACE( T_LIT("Internal error: IBY filename count mismatch ( %d != %d )"), - count, iDestinations.Count() ); - User::Leave( KErrCorrupt ); - } - - RFile outfile; - TInt err = outfile.Open( aFs, aFileName, EFileWrite ); - if( err == KErrNotFound ) - { - TRACE( T_LIT( "CBSIBYWriter::WriteIBYFileL - IBY file not initialized!") ); - // if the file is not initialized -> not ready - err = KErrNotReady; - } - User::LeaveIfError( err ); - - // write data - TInt size = -1; - User::LeaveIfError( outfile.Size( size ) ); - - outfile.Write( size, KIBYEmptyLine ); - - TRACE( T_LIT( "CBSIBYWriter::WriteIBYFileL - start writing files to IBY") ); - - for( TInt i = 0; i < count; i++ ) - { - outfile.Write( KIBYFileItem ); - outfile.Write( KIBYBaseSource ); - outfile.Write( iSourcePath[i]->Des() ); - outfile.Write( iSourceFiles[i]->Des() ); - outfile.Write( KIBYSpace ); - outfile.Write( iDestinations[i]->Des() ); - TRACE( T_LIT( "CBSIBYWriter::WriteIBYFileL - %S"), iDestinations[i] ); - } - - TRACE( T_LIT( "CBSIBYWriter::WriteIBYFileL - writing IBY file footer") ); - outfile.Write( KIBYEmptyLine ); - outfile.Write( KIBYFooter ); - outfile.Write( KIBYHeaderEnd ); - - // cleanup - outfile.Close(); - TRACE( T_LIT( "CBSIBYWriter::WriteIBYFileL end") ); - } - -// --------------------------------------------------------------------------- -// CBSIBYWriter::WriteIBYFile() -// --------------------------------------------------------------------------- -// -void CBSIBYWriter::InitIbyFileL( RFs& aFs, const TDesC& aFileName ) - { - TRACE( T_LIT( "CBSIBYWriter::InitIbyFileL begin") ); - HBufC* temp = aFileName.AllocL(); - delete iIbyFile; - iIbyFile = temp; - - TInt err = aFs.MkDir( KBSIbyDirectory ); - if( err == KErrAlreadyExists ) - { - err = KErrNone; - } - User::LeaveIfError( err ); - - TRACE( T_LIT( "CBSIBYWriter::InitIbyFileL IBY directory (%S) created"), &KBSIbyDirectory() ); - - // Open file for writing - RFile outfile; - User::LeaveIfError( outfile.Replace( aFs, aFileName, EFileWrite ) ); - - TRACE( T_LIT( "CBSIBYWriter::InitIbyFileL IBY file (%S) created"), &aFileName ); - - outfile.Write( KIBYHeader1 ); - outfile.Write( KIBYHeaderEnd ); - outfile.Write( KIBYHeader2 ); - outfile.Write( KIBYHeaderEnd ); - outfile.Close(); - TRACE( T_LIT( "CBSIBYWriter::InitIbyFileL end") ); - } -// End of file diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsserver/cbsibywriter.h --- a/brandingserver/bsserver/cbsibywriter.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -/* -* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Writes IBY files -* -*/ - - -#ifndef CBSIBYWRITER_H -#define CBSIBYWRITER_H - -#include - -class RFs; - -/** - * Writes IBY files - * - * @lib - * @since S60 v3.2 - */ -class CBSIBYWriter : public CBase -{ -public: - - static CBSIBYWriter* NewL(); - - static CBSIBYWriter* NewLC(); - - ~CBSIBYWriter(); - - /** - * Initialize IBY file - * - * @param aFs file system handle - * @param aFileName Full name of the iby file - * @since S60 3.2 - * @return none - */ - void InitIbyFileL( RFs& aFs, const TDesC& aFileName ); - - /** - * File item included in IBY file - * - * @since S60 3.2 - * @param aSrc source file - * @param aDest destination file - * @return none - */ - void SetFileItemL( const TDesC& aSrc, const TDesC& aDest ); - - /** - * Writes Iby file from given file items - * - * @since S60 3.2 - * @param aFs file system handle - * @param aFileName Full name of the iby file - * @return none - */ - void WriteIBYFileL( RFs& aFs, const TDesC& aFileName ); - -private: - - CBSIBYWriter(); - - void ConstructL(); - -private: // Data - - // Own. Source path array - RPointerArray iSourcePath; - - // Own. Source files - RPointerArray iSourceFiles; - - // Own. Destination files - RPointerArray iDestinations; - - // Own. Iby file name - HBufC* iIbyFile; -}; - -#endif //CBSIBYWRITER_H diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsserver/cbsinstallhandler.cpp --- a/brandingserver/bsserver/cbsinstallhandler.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,564 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CBSInstallhandler.cpp -* -*/ - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include - -#include "cbsinstallhandler.h" -#include "debugtrace.h" -#include "bsimportconstants.h" -#include "cbsstoragemanager.h" - - -// CONSTANTS -// branding installer application -_LIT( KInstallerApp, "bsinstall.exe" ); - - -// wildcard for finding installed brand files -_LIT( KBrandWild, "*" ); - -// Line feed separates uninstalled brands from each other -_LIT( KLineFeed, "\n" ); - - -// Pub&Sub Key for uninstalled brands -const TUint KUninstallKey = 0x01; - - -// METHODS - -// Two-phased constructor. -CBSInstallHandler* CBSInstallHandler::NewL( ) - { - TRACE( T_LIT( "CBSInstallHandler::NewL begin") ); - CBSInstallHandler* self = new ( ELeave ) CBSInstallHandler() ; - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - TRACE( T_LIT( "CBSInstallHandler::NewL end") ); - return self; - } - -// Symbian OS default constructor can leave. -void CBSInstallHandler::ConstructL() - { - User::LeaveIfError( iFs.Connect() ); - CActiveScheduler::Add( this ); - } - -// Destructor -CBSInstallHandler::~CBSInstallHandler() - { - Cancel(); - iFs.Close(); - } - -// C++ default constructor can NOT contain any code, that -// might leave. -// -CBSInstallHandler::CBSInstallHandler() : - CActive( EPriorityIdle ) - { - } - -// ----------------------------------------------------------------------------- -// CBSInstallHandler::InstallNewFilesL() -// ----------------------------------------------------------------------------- -// -void CBSInstallHandler::InstallNewFilesL() - { - TRACE( T_LIT( "CBSInstallHandler::InstallNewFilesL begin") ); - TInt needInstaller = 0; - - - TRAP_IGNORE( needInstaller += CheckForDiscardedBrandsL( KBSDataStore ) ); - - // uninstall removed brands - needInstaller += - SyncFilesL( KInstallPath, KInstallObservePath, EInstallDeleteFromSrc ); - - // install new brands - needInstaller += - SyncFilesL( KInstallObservePath, KInstallPath, EInstallCopyNewToDest ); - - if( needInstaller ) - { - // something new was installed - LaunchInstallerAppL(); - } - TRACE( T_LIT( "CBSInstallHandler::InstallNewFilesL end") ); - } - -// ----------------------------------------------------------------------------- -// CBSInstallHandler::StartObservingL() -// ----------------------------------------------------------------------------- -// -void CBSInstallHandler::StartObservingL() - { - TRACE( T_LIT( "CBSInstallHandler::StartObservingL begin") ); - if( IsActive() ) - { - __ASSERT_DEBUG( EFalse, User::Leave( KErrAlreadyExists ) ); - return; - } - - // observe path: (drive:)[private](/import/install) - TPath path( KNullDesC ); - GetPrivateFolder( path, KInstallObservePath ); - - iFs.NotifyChange( ENotifyEntry, iStatus, path ); - SetActive(); - TRACE( T_LIT( "CBSInstallHandler::StartObservingL end") ); - } - -// ----------------------------------------------------------------------------- -// CBSInstallHandler::StopObserving() -// ----------------------------------------------------------------------------- -// -void CBSInstallHandler::StopObserving() - { - TRACE( T_LIT( "CBSInstallHandler::StopObserving begin") ); - Cancel(); - TRACE( T_LIT( "CBSInstallHandler::StopObserving end") ); - } - -// ----------------------------------------------------------------------------- -// CBSInstallHandler::DoCancel() -// ----------------------------------------------------------------------------- -// -void CBSInstallHandler::DoCancel() - { - iFs.NotifyChangeCancel(); - } - -// ----------------------------------------------------------------------------- -// CBSInstallHandler::RunL() -// ----------------------------------------------------------------------------- -// -void CBSInstallHandler::RunL() - { - TRACE( T_LIT( "CBSInstallHandler::RunL start") ); - if( iStatus == KErrNone ) - { - TRACE( T_LIT( "CBSInstallHandler::RunL installing...") ); - TRAP_IGNORE( InstallNewFilesL() ); - StartObservingL(); - } - else - { - TRACE( T_LIT( "CBSInstallHandler::RunL observing stopped") ); - } - TRACE( T_LIT( "CBSInstallHandler::RunL end") ); - } - -// ----------------------------------------------------------------------------- -// CBSInstallHandler::LaunchInstallerAppL() -// ----------------------------------------------------------------------------- -// -void CBSInstallHandler::LaunchInstallerAppL() - { - TRACE( T_LIT( "CBSInstallHandler::LaunchInstallerAppL start") ); - // initialize RApaLsSession - RApaLsSession apas; - User::LeaveIfError( apas.Connect() ); - CleanupClosePushL( apas ); - apas.GetAllApps(); - - // start installer - CApaCommandLine* command = CApaCommandLine::NewLC(); - command->SetExecutableNameL( KInstallerApp ); - User::LeaveIfError( apas.StartApp( *command ) ); - TRACE( T_LIT( "CBSInstallHandler::LaunchInstallerAppL bsinstall.exe launched OK") ); - - CleanupStack::PopAndDestroy( 2 ); // apas, command - TRACE( T_LIT( "CBSInstallHandler::LaunchInstallerAppL end") ); - } - -// ----------------------------------------------------------------------------- -// CBSInstallHandler::SyncFilesL() -// ----------------------------------------------------------------------------- -// -TBool CBSInstallHandler::SyncFilesL( const TDesC& aSrcDir, const TDesC& aDestDir, - TInstallOperation aOperation ) - { - TRACE( T_LIT( "CBSInstallHandler::SyncFilesL start") ); - - // Check new install folder - HBufC* fileBuf = HBufC::NewLC( KMaxFileName ); - TPtr file( fileBuf->Des() ); - GetPrivateFolder( file, aSrcDir ); - - TBool ret = BaflUtils::PathExists( iFs, file ); - if( !ret ) - { - // install folder doesn't exist. - TRACE( T_LIT( - "CBSInstallHandler::SyncFilesL no src folder!") ); - CleanupStack::PopAndDestroy( fileBuf ); - return EFalse; - } - - // Apply extension filter - file.Append( KBrandWild ); // - file.Append( KBrandInstallExt ); // *.install - - // Get list of src dir files - CDir* dir = NULL; - User::LeaveIfError( iFs.GetDir( file, - KEntryAttNormal, ESortNone, dir ) ); - CleanupStack::PushL( dir ); - - // Create destination directory - GetPrivateFolder( file, aDestDir ); - BaflUtils::EnsurePathExistsL( iFs, file ); - - // Compare source dir to destination - TBool OperationExecuted = EFalse; - TInt count = dir->Count(); - - for( TInt i = 0; i < count; i++ ) - { - GetPrivateFolder( file, aDestDir ); - file.Append( (*dir)[i].iName ); - if( !BaflUtils::FileExists( iFs, file ) ) - { - // file does not exist in destionation dir - // => react according to operation - HBufC* fileSrcBuf = HBufC::NewLC( KMaxFileName ); - TPtr fileSrc( fileSrcBuf->Des() ); - GetPrivateFolder( fileSrc, aSrcDir ); - fileSrc.Append( (*dir)[i].iName ); - - switch( aOperation ) - { - case EInstallCopyNewToDest: - { - // copy new files from src to destination - TRACE( T_LIT( "CBSInstallHandler::SyncFilesL copy") ); - OperationNotifyL( aOperation, file ); - User::LeaveIfError( BaflUtils::CopyFile( - iFs, fileSrc, file ) ); - break; - } - case EInstallDeleteFromSrc: - { - // delete files from src if they are not found from dest - TRACE( T_LIT( "CBSInstallHandler::SyncFilesL del") ); - OperationNotifyL( aOperation, fileSrc ); - User::LeaveIfError( BaflUtils::DeleteFile( iFs, fileSrc ) ); - break; - } - default: - { - // Every operation should have a case! - __ASSERT_DEBUG( EFalse, - User::LeaveIfError( KErrArgument ) ); - } - } - - OperationExecuted = ETrue; - CleanupStack::PopAndDestroy( fileSrcBuf ); - } - } - CleanupStack::PopAndDestroy( 2 ); // fileBuf, dir - TRACE( T_LIT( "CBSInstallHandler::SyncFilesL end") ); - return OperationExecuted; - } - -// ----------------------------------------------------------------------------- -// CBSInstallHandler::OperationNotifyL() -// ----------------------------------------------------------------------------- -// -void CBSInstallHandler::OperationNotifyL( TInstallOperation aOperation, - const TDesC& aSrcFile ) - { - TRACE( T_LIT( "CBSInstallHandler::OperationNotifyL start") ); - if( aOperation == EInstallDeleteFromSrc ) - { - // parse brand id and application id from filename - TParse parse; - parse.Set( aSrcFile, NULL, NULL ); - - // find ids from filename - TInt firstSepar = parse.Name().Find( KInstallFileDataSeparator ); - TInt secondSepar = parse.Name(). - Mid( firstSepar + 1 ).Find( KInstallFileDataSeparator ); - TInt cutlen = 0; - secondSepar == KErrNotFound ? cutlen = parse.Name().Length() : - cutlen = firstSepar + secondSepar + 1; - - // brandString: [brandId]$[appId] - TPtrC brandString ( parse.Name().Left( cutlen ) ); - if( IsBrandInstalled( brandString ) ) - { - TRACE( T_LIT( "CBSInstallHandler::OperationNotifyL %S exists in import\\install =>RProperty NOT UPDATED!"),&aSrcFile ); - // brand still exists, so no need to uninstall. - return; - } - - // Create discardedbrand.txt file in the /appid/brandid path - CreateFlagFile( aSrcFile ); - - UpdateRPropertyL( brandString ); - - TRACE( T_LIT( "CBSInstallHandler::OperationNotifyL uninstall string to pub&sub updated OK") ); - } - TRACE( T_LIT( "CBSInstallHandler::OperationNotifyL end") ); - } - -// ----------------------------------------------------------------------------- -// CBSInstallHandler::IsBrandInstalled() -// ----------------------------------------------------------------------------- -// -TBool CBSInstallHandler::IsBrandInstalled( const TDesC& aBrand ) - { - TRACE( T_LIT( "CBSInstallHandler::IsBrandInstalled start") ); - TFileName file; - GetPrivateFolder( file, KInstallObservePath ); - file.Append( aBrand ); - file.Append( KBrandInstallExt ); - - // check file directly: - // aaa$bbb -> aaa$bbb.install - CDir* dir = NULL; - iFs.GetDir( file, KEntryAttNormal, ESortNone, dir ); - if( dir->Count() > 0 ) - { - // brand is installed - delete dir; - TRACE( T_LIT( "CBSInstallHandler::IsBrandInstalled true") ); - return ETrue; - } - delete dir; - dir = NULL; - - GetPrivateFolder( file, KInstallObservePath ); - file.Append( aBrand ); - file.Append( KInstallFileDataSeparator ); - file.Append( KBrandWild ); - file.Append( KBrandInstallExt ); - - // check file with different versions: - // aaa$bbb -> aaa$bbb$*.install - iFs.GetDir( file, KEntryAttNormal, ESortNone, dir ); - if( dir->Count() > 0 ) - { - // brand is installed - delete dir; - TRACE( T_LIT( "CBSInstallHandler::IsBrandInstalled true") ); - return ETrue; - } - delete dir; - - // brand is not installed - TRACE( T_LIT( "CBSInstallHandler::IsBrandInstalled false") ); - return EFalse; - } - -// ----------------------------------------------------------------------------- -// CBSInstallHandler::GetPrivateFolder() -// ----------------------------------------------------------------------------- -// -void CBSInstallHandler::GetPrivateFolder( TDes& aPath, const TDesC& aAppend ) - { - iFs.PrivatePath( aPath ); - aPath.Insert( 0, KInstallDrive ); - aPath.Append( aAppend ); - } - -void CBSInstallHandler::CreateFlagFile(const TDesC& aSrcFile) - { - TRACE( T_LIT( "CBSInstallHandler::CreateFlagFile begin") ); - // parse brand id and application id from aSrcFile - TParse parse; - parse.Set( aSrcFile, NULL, NULL ); - - // find ids from filename - TInt firstSepar = parse.Name().Find( KInstallFileDataSeparator ); - - // Get the brand Id - HBufC* brandId = (parse.Name().Left(firstSepar)).AllocL(); - - // to get application id - TInt secondSepar = parse.Name(). - Mid( firstSepar + 1 ).Find( KInstallFileDataSeparator ); - - TInt cutlen = 0; - secondSepar == KErrNotFound ? cutlen = parse.Name().Length() : - cutlen = firstSepar + secondSepar + 1; - - - TParse parseAgain; - parseAgain.Set(parse.Name().Left( cutlen ), NULL, NULL ); - HBufC* applicationId = (parseAgain.Name().Right( cutlen - firstSepar - 1)).AllocL(); - - - HBufC *fileName = CBSStorageManager::ConstructDiscardBrandFileNameL(*applicationId, *brandId) ; - CleanupStack::PushL(fileName); - HBufC *fullPath = CBSStorageManager::FullDiscardBrandFileNameLC( *fileName ) ; - - // crate a flag file - RFile file; - file.Create(iFs, *fullPath, EFileWrite); - file.Close() ; - - delete brandId ; - delete applicationId ; - - CleanupStack::PopAndDestroy(fullPath) ; - CleanupStack::PopAndDestroy(fileName) ; - TRACE( T_LIT( "CBSInstallHandler::CreateFlagFile end") ); - } - -// ----------------------------------------------------------------------------- -// CBSInstallHandler::CheckForDiscardedBrandsL() -// ----------------------------------------------------------------------------- -// -TBool CBSInstallHandler::CheckForDiscardedBrandsL( const TDesC& aDir ) - { - TRACE( T_LIT( "CBSInstallHandler::CheckForDiscardedBrandsL begin") ); - TBool discardedBrandExists( EFalse ); - - CDir* appDir = NULL; // will contain all application folders - - TPath path; - iFs.PrivatePath( path ); - path.Insert( 0, KInstallDrive ); - path.Append( aDir ); - path.Append( KDirSeparator ); // "C:\\private\\102828dd\\data\\" - - User::LeaveIfError( - iFs.GetDir( path, KEntryAttDir, ESortNone, appDir ) ); - CleanupStack::PushL( appDir ); - - /*TFileName find( path ); - find.Append( KInstallFiles );*/ - - // create array of files (as text) - TInt count = appDir->Count(); - //for each application do... - for( TInt i = 0; i < count; i++ ) - { - TFileName file( path ); - file.Append( (*appDir)[i].iName ); - file.Append( KDirSeparator ); // "C:\\private\\102828dd\\data\\xsp\\" - - TRACE( T_LIT( "CBSInstallHandler::CheckForDiscardedBrandsL AppDir='%S'"),&file ); - CDir* brandDir = NULL; // will contain all brand folder for each application - User::LeaveIfError( - iFs.GetDir( file, KEntryAttDir, ESortNone, brandDir ) ); - CleanupStack::PushL( brandDir ); - - TInt countBrands = brandDir->Count(); - //for each brand of a certain application do... - for( TInt j(0) ; j < countBrands ; j++ ) - { - TFileName discardedFile( file ); - discardedFile.Append( (*brandDir)[j].iName ); - discardedFile.Append( KDirSeparator ); - discardedFile.Append( KDiscardBrandFileName ); // "C:\\private\\102828dd\\data\\xsp\\branda\\discarded.txt" - - TRACE( T_LIT( "CBSInstallHandler::CheckForDiscardedBrandsL BrandDir='%S'"),&file ); - - // check for the existance of the 'discarded.txt' file - if ( BaflUtils::FileExists( iFs, discardedFile ) ) - { - TRACE( T_LIT( "CBSInstallHandler::CheckForDiscardedBrandsL '%S' found!=>brand is discarded."),&discardedFile ); - discardedBrandExists = ETrue; - - //set RProperty for this brand - - //the string written to RProperty: - //"[brandId]$[applicationId]"(e.g."branda$xsp") - HBufC* writeBuf = HBufC::NewLC( RProperty::KMaxPropertySize ); - TPtr writeData( writeBuf->Des() ); - writeData.Append( (*brandDir)[j].iName ); - writeData.Append( KInstallFileDataSeparator ); - writeData.Append( (*appDir)[i].iName ); - TRACE( T_LIT( "CBSInstallHandler::CheckForDiscardedBrandsL uninstallstring='%S'"),writeBuf ); - - //UpdateProperty here!!! - UpdateRPropertyL( writeData ); - - CleanupStack::PopAndDestroy( writeBuf ); - } - } - CleanupStack::PopAndDestroy( brandDir ); - } - - CleanupStack::PopAndDestroy( appDir ); - TRACE( T_LIT( "CBSInstallHandler::CheckForDiscardedBrandsL end") ); - return discardedBrandExists; - } - - -// ----------------------------------------------------------------------------- -// CBSInstallHandler::UpdateRPropertyL -// ----------------------------------------------------------------------------- -// -void CBSInstallHandler::UpdateRPropertyL( const TDesC& aUninstallationString ) - { - HBufC* dataBuf = HBufC::NewLC( RProperty::KMaxPropertySize ); - TPtr data( dataBuf->Des() ); - - // Update uninstall string to pub&sub (only if the RProperty does not - // contain the unistallation string yet) - RProcess me; - TUid uid = me.Identity(); - TInt ret = RProperty::Define( uid, KUninstallKey, RProperty::EText); - if( ret != KErrAlreadyExists ) - { - TRACE( T_LIT( "CBSInstallHandler::UpdateRPropertyL RProperty does not exist") ); - User::LeaveIfError( ret ); - } - TRACE( T_LIT( "CBSInstallHandler::UpdateRPropertyL RProperty created/exists OK") ); - User::LeaveIfError( RProperty::Get( uid, KUninstallKey, data ) ); - - // don't append the uninstall string in case it already exists - // in the RProperty - if( KErrNotFound == data.Find( aUninstallationString ) ) - { - if( data.Length() > 0 ) - { - data.Append( KLineFeed ); - TRACE( T_LIT( "CBSInstallHandler::UpdateRPropertyL lineFeed appended to RProperty uninstallstring") ); - } - data.Append( aUninstallationString ); - TRACE( T_LIT( "CBSInstallHandler::UpdateRPropertyL '%S' appended to RProperty uninstallstring"), &aUninstallationString ); - if( data.Length() <= RProperty::KMaxPropertySize ) - { - User::LeaveIfError( RProperty::Set( uid, KUninstallKey, data ) ); - TRACE( T_LIT( "CBSInstallHandler::UpdateRPropertyL RProperty::Set OK") ); - } - } - else - { - TRACE( T_LIT( "CBSInstallHandler::UpdateRPropertyL '%S' already exists in RProperty"), &aUninstallationString ); - } - - CleanupStack::PopAndDestroy( dataBuf ); - - } - -// END OF FILE diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsserver/cbsinstallhandler.h --- a/brandingserver/bsserver/cbsinstallhandler.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: cbsinstallhandler.h -* -*/ - - -#ifndef __CBSINSTALLHANDLER_H__ -#define __CBSINSTALLHANDLER_H__ - -#include - -// FORWARD DECLARATIONS -class RFs; - -/** - * CBSInstallHandler - * - * Handles installation and uninstallation of brand packages. - * Calls external application "bsinstall.exe" to do the actual work. - * Can Observe the installation directory so that any sis installation - * can be detected while the server is running. - * - */ -NONSHARABLE_CLASS( CBSInstallHandler ): public CActive - { - public: - - // Operations for folder synchronization: - enum TInstallOperation - { - // copy files from source to destination if they don't - // already exists. - EInstallCopyNewToDest, - - // Delete files from source directory if the same - // files doesn't exist in destination directory. - EInstallDeleteFromSrc - }; - - public: // constructors - - static CBSInstallHandler* NewL(); - - virtual ~CBSInstallHandler(); - - private: // constructors - - void ConstructL(); - - CBSInstallHandler(); - - public: - - /** - * Uninstall removed brands and installs new brands. - * This should be called right after construction to sync the - * installation state. - */ - void InstallNewFilesL(); - - /** - * Start observing installation folder. Detects new brands if they - * are installed while the server is active. - */ - void StartObservingL(); - - /** - * Stop observing installation folder. All new brands are installed - * only when calling InstallNewFilesL. - */ - void StopObserving(); - - private: // From CActive - - /** - * @see CActive - */ - void RunL(); - - /** - * @see CActive - */ - void DoCancel(); - - private: // new methods - - /** - * Launches external installer application. It should install all - * available brands into server. - */ - void LaunchInstallerAppL(); - - /** - * Sync files between aSrcDir and aDestDir, according to given - * operation. See TInstallOperation for operations. Calls - * OperationNotifyL before every operation. - * - * @param aSrcDir Source directory - * @param aDestDir Destination directory - * @param aOperation Sync operation to execute - * @return ETrue - Something synchronized - * EFalse - Nothing synchronized - */ - TBool SyncFilesL( const TDesC& aSrcDir, const TDesC& aDestDir, - TInstallOperation aOperation ); - - /** - * Notification that file is about to be synchronized. - * - * @param aOperation operation type which will be executed - * @param aSrcFile file under operation - */ - void OperationNotifyL( TInstallOperation aOperation, - const TDesC& aSrcFile ); - - /** - * check if some version of given brand is installed in - * branding server. - * - * @param aBrand brand installation file to check - * this has to be brand file name without extension and - * version information. - */ - TBool IsBrandInstalled( const TDesC& aBrand ); - - /** - * Helper method to get servers private path - * @param aPath contains the path to servers private folder - * @param aAppend text to add into private path. - */ - void GetPrivateFolder( TDes& aPath, const TDesC& aAppend = KNullDesC ); - - /** - * To create a flag file if brand gets discarded - * @param aSrcFile file under operation - */ - void CreateFlagFile(const TDesC& aSrcFile); - - /** - * Checks if an discarded brand exists. - * (It also writes the RProperty for the bsinstall.exe) - * - * @param aDir the folder of the data storages - * @return ETrue, in case a discarded brand was found, EFalse otherwise - */ - TBool CheckForDiscardedBrandsL( const TDesC& aDir ); - - - /** - * Updates the RProperty. The specified string is added to the - * RProperty only if RProperty does not contain the same string yet. - * - * @param aUninstallationString a string - */ - void UpdateRPropertyL( const TDesC& aUninstallationString ); - - private: // data - - // Own. File server session handle. - RFs iFs; - }; - -#endif // __CBSINSTALLHANDLER_H__ -// END OF FILE diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsserver/cbsserver.cpp --- a/brandingserver/bsserver/cbsserver.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,664 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: cbsserver.cpp -* -*/ - - -// INCLUDE FILES - -#define __INCLUDE_CAPABILITY_NAMES__ -#define __INCLUDE_ALL_SUPPORTED_CAPABILITIES__ - -#include "cbsserver.h" -#include "cbssession.h" -#include "bsserverdefs.h" -#include "debugtrace.h" -#include "cbsstoragemanager.h" -#include "cbsinstallhandler.h" -#include "cbsbackupobserver.h" - -// CBSFileMapping - -CBSServer::CBSFileMapping* CBSServer::CBSFileMapping::NewL( CBSSession* aSession, - const TDesC& aFile, - TBool aVersioned ) - { - CBSFileMapping* self = new( ELeave ) CBSFileMapping( aVersioned ); - CleanupStack::PushL( self ); - self->ConstructL( aSession, aFile ); - CleanupStack::Pop( self ); - return self; - } -void CBSServer::CBSFileMapping::ConstructL( CBSSession* aSession, - const TDesC& aFile ) - { - iSession = aSession; - iFile = aFile.AllocL(); - } -CBSServer::CBSFileMapping::CBSFileMapping( TBool aVersioned ) -: iVersioned( aVersioned ) - { - } -CBSServer::CBSFileMapping::~CBSFileMapping() - { - delete iFile; - } - -CBSSession* CBSServer::CBSFileMapping::Session() - { - return iSession; - } -const TDesC& CBSServer::CBSFileMapping::File() - { - return *iFile; - } -TBool CBSServer::CBSFileMapping::Versioned() - { - return iVersioned; - } - - -// ============================================================== -// =============== PLATSEC POLICY CONFIGURATION ================= -// ============================================================== - -static const TInt KBSPlatSecRangeCount = 2; - -//Ranges for the Request values -static const TInt KBSPlatSecRanges[ KBSPlatSecRangeCount ] = - { - 0, - EBSOperationLast - }; - - -// Element indexes for the defined ranges -static const TUint8 KBSPlatSecElementsIndex[ KBSPlatSecRangeCount ] = - { - 0, - CPolicyServer::ENotSupported - }; - - -// Policy elements -static const CPolicyServer::TPolicyElement KBSPlatSecElements[] = - { - { - _INIT_SECURITY_POLICY_C2( ECapabilityReadUserData, - ECapabilityWriteUserData ), - -5 //CPolicyServer::EFailClient - } - }; - - -// The platsec policy -static const CPolicyServer::TPolicy KBSPlatSecPolicy = - { - // Shortcut to the index into Elements,that is used to check a connection attempt - 0, - - // Number of ranges in the iRanges array - KBSPlatSecRangeCount, - - // A pointer to an array of ordered ranges of request numbers - KBSPlatSecRanges, - - // A pointer to an array of TUint8 values specifying - // the appropriate action to take for each range in iRanges - KBSPlatSecElementsIndex, - - // A pointer to an array of distinct policy elements - KBSPlatSecElements - }; - - - -// ============================================================== -// ======================= SERVER ============================== -// ============================================================== -void CBSServer::ExecuteL() - { - TRACE( T_LIT( "CBrandingServer::ExecuteL() begin") ); - // start scheduler - CActiveScheduler* pA = new( ELeave )CActiveScheduler; - CleanupStack::PushL( pA ); - CActiveScheduler::Install( pA ); - - - // create server - CBSServer* server = new( ELeave ) CBSServer(); - CleanupStack::PushL( server ); - server->InitializeL(); - server->StartL( KBSServerName ); - - - //Signal client that we are started - RProcess().Rendezvous( KErrNone ); - - //Execute the server - // Codescanner warning: using CActiveScheduler::Start (id:3) - // this has to be called for server starting. - CActiveScheduler::Start(); // CSI: 3 # See above - - - //Cleanup - CleanupStack::PopAndDestroy( server );//server - CleanupStack::PopAndDestroy( pA ); - CActiveScheduler::Install( NULL ); - TRACE( T_LIT( "CBrandingServer::ExecuteL() end") ); - } - - - -CBSServer::~CBSServer() - { - TRACE( T_LIT( "CBrandingServer::~CBSServer() begin") ); - delete iBackupObserver; - delete iInstallHandler; - iSessions.Close(); - iFileMapping.Close(); - delete iStorageManager; - -#if _BullseyeCoverage - cov_write(); -#endif - TRACE( T_LIT( "CBrandingServer::~CBSServer() end") ); - } - - - -CBSServer::CBSServer() - : CPolicyServer( CActive::EPriorityStandard, - KBSPlatSecPolicy ) - { - } - - - -CSession2* CBSServer::NewSessionL( const TVersion &aVersion, - const RMessage2& /*aMessage*/ ) const - { - TRACE( T_LIT( "CBrandingServer::NewSessionL() begin") ); - TVersion srvVersion( KBSVersionMajor, - KBSVersionMinor, - KBSVersionBuild ); - - - if( !User::QueryVersionSupported( aVersion, srvVersion ) ) - { - User::Leave( KErrNotSupported ); - } - - CBSSession* session = CBSSession::NewL(); - //enable backup observer - iBackupObserver->RegisterObserver( session ); - - TRACE( T_LIT( "CBrandingServer::NewSessionL() end session[%d] created"), session ); - return session; - } - - -CPolicyServer::TCustomResult - CBSServer::CustomFailureActionL( const RMessage2& aMsg, - TInt /*aAction*/, - const TSecurityInfo& aMissing ) - { - TRACE( T_LIT( "CBrandingServer::CustomFailureActionL() Request %d to session [%d] failed."), - aMsg.Function(), aMsg.Session() ); - - TBuf<512> diagnosticMsg; - _LIT( KDetails, "Failure details: "); - diagnosticMsg.Append( KDetails ); - _LIT( KFormat, "SecureId[%d] VendorId[%d] Missing caps[" ); - diagnosticMsg.AppendFormat( KFormat, - aMissing.iSecureId.iId, aMissing.iVendorId.iId ); - - const SCapabilitySet& missingCaps = (const SCapabilitySet&) aMissing.iCaps; - TBuf<1> separator; - _LIT( KSeparator, "]" ); - for( TInt ix = 0; ix < ECapability_Limit; ix++ ) - { - if( missingCaps[ix>>5] &(1<<(ix&31))) - { - diagnosticMsg.Append( separator ); - - const char* capName = CapabilityNames[ ix ]; - while( *capName ) - { - TUint16 c = *capName; - diagnosticMsg.Append( &c, 1 ); - ++capName; - } - - separator = KSeparator; - } - } - - diagnosticMsg.Append( KSeparator ); - TRACE( T_LIT( "%S"), &diagnosticMsg ); - - return CPolicyServer::EFail; - } - -void CBSServer::HandleBackupStateL( TBackupState aState ) - { - switch( aState ) - { - case EBackupNotActive: // backup has completed - { - // restart install handler and check for brand changes - iInstallHandler->InstallNewFilesL(); - iInstallHandler->StartObservingL(); - - //notify clients that we're back in business - break; - } - case EBackupActive: // backup activated - { - // stop install handler - iInstallHandler->StopObserving(); - - // Notify clients that branding data is not currently - // available - break; - } - default: - { - // unknown state - } - } - } - -void CBSServer::SessionCreatedL( CBSSession* aSession ) - { - TRACE( T_LIT( "CBSServer::SessionCreatedL begin aSession[%d]"),aSession ); - iSessionCount++; - iSessions.AppendL( aSession ); - } - - -void CBSServer::SessionDied( CBSSession* aSession ) - { - TInt count = iSessions.Count(); - for( TInt i = 0; i < count; i++ ) - { - if( iSessions[i] == aSession ) - { - iSessions.Remove( i ); - break; - } - } - TInt ignore = 0; - TRAP( ignore, UnRegisterSessionL( aSession ) ); - - //enable backup observer - iBackupObserver->UnregisterObserver( aSession ); - - iSessionCount--; - if( iSessionCount == 0 ) - { - // Codescanner warning: using CActiveScheduler::Stop ( Id: 4) - // it is required to stop the server - CActiveScheduler::Stop(); // CSI: 4 # See above - } - } - - - -TBool CBSServer::MatchSessionL( const TDesC& aApplicationId, - const TDesC& aBrandId, - TLanguage aLanguageId, - CBSSession* aSession, - TInt aReserved ) - { - TInt sessionCount = iSessions.Count(); - TBool returnValue = EFalse; - for( TInt i = 0; i < sessionCount; i++ ) - { - if( iSessions[i] == aSession ) - { - // we don't want to report the querying session itself - continue; - } - if( iSessions[i]->MatchSessionL( aApplicationId, - aBrandId, - aLanguageId, - aReserved ) ) - { - // even one match is enough for us - returnValue = ETrue; - break; - } - } - return returnValue; - } - -TBool CBSServer::MatchSessionUninstallL( const TDesC& aApplicationId, - const TDesC& aBrandId, CBSSession* aSession) -{ - TInt sessionCount = iSessions.Count(); - TBool returnValue = EFalse; - for( TInt i = 0; i < sessionCount; i++ ) - { - if( iSessions[i] == aSession ) - { - // we don't want to report the querying session itself - continue; - } - if( iSessions[i]->MatchSessionUninstallL( aApplicationId, - aBrandId )) - { - // even one match is enough for us - returnValue = ETrue; - break; - } - } - return returnValue; - -} - -void CBSServer::RegisterFileForSessionL( CBSSession* aSession, - const TDesC& aFile, - TBool aVersioned ) - { - TRACE( T_LIT( "CBSServer::RegisterFileForSessionL begin aSession[%d],aFile[%S]"),aSession,&aFile ); - TBool found = EFalse; - TInt count = iFileMapping.Count(); - for( TInt i = 0; i < count; i ++ ) - { - if( iFileMapping[i]->Session() == aSession && iFileMapping[i]->File() == aFile && - iFileMapping[i]->Versioned() == aVersioned) - { - found = ETrue; - } - } - - if(!found) - { - - CBSFileMapping* fileMapping = CBSFileMapping::NewL( aSession, aFile, aVersioned ); - CleanupStack::PushL( fileMapping ); - iFileMapping.AppendL( fileMapping ); - CleanupStack::Pop( fileMapping ); - } - TRACE( T_LIT( "CBSServer::RegisterFileForSessionL end") ); - } - -void CBSServer::UnRegisterSessionL( CBSSession* aSession ) - { - TRACE( T_LIT( "CBSServer::RegisterFileForSessionL begin aSession[%d]"),aSession ); - TInt count = iFileMapping.Count(); - for( TInt i = 0; i < count; i ++ ) - { - if( iFileMapping[i]->Session() == aSession ) - { - - if( !iStorageManager ) - { - iStorageManager = CBSStorageManager::NewL( aSession, KNullDesC ); - } - if( !FileStillInUse( aSession, iFileMapping[i]->File() ) ) - { - TPtrC baseFile = KNullDesC(); - if( iFileMapping[i]->Versioned() ) - { - baseFile.Set( iStorageManager->FilenameWithoutVersion( iFileMapping[i]->File() ) ); - } - else - { - baseFile.Set( iFileMapping[i]->File() ); - } - // we found the session, now check if any other - // session is using the same file - if( !FileStillInUse( aSession, baseFile ) ) - { - // no other sessions using the file - // cleanup versioned file - CleanupFileL( iFileMapping[i]->File() ); - } - - } - CBSFileMapping* fileMapping = iFileMapping[i]; - iFileMapping.Remove( i ); - delete fileMapping; - break; - } - } - TRACE( T_LIT( "CBSServer::RegisterFileForSessionL end") ); - } - -TBool CBSServer::FileStillInUse( CBSSession* aSession, - const TDesC& aFile ) - { - TBool returnValue = EFalse; - TInt count = iFileMapping.Count(); - for( TInt i = 0; i < count; i ++ ) - { - if( 0 == iFileMapping[i]->File().Compare( aFile ) ) - { - // file found, check that it's not the same sesion - if( iFileMapping[i]->Session() != aSession ) - { - - // it's not the same session - // so the file is still in use, we can - // return ETrue - returnValue = ETrue; - break; - } - } - } - return returnValue; - } - -void CBSServer::CleanupFileL( const TDesC& aFile ) - { - if( !iStorageManager ) - { - iStorageManager = CBSStorageManager::NewL( NULL, KNullDesC); - } - iStorageManager->CleanupFileL( aFile ); - } - -TArray CBSServer::RegisteredFiles() - { - return iFileMapping.Array(); - } - -void CBSServer::InitializeL() - { - TRACE( T_LIT( "CBSServer::InitializeL begin") ); - // Initialize brand install handler - iInstallHandler = CBSInstallHandler::NewL(); - iInstallHandler->InstallNewFilesL(); - iInstallHandler->StartObservingL(); - - //to enable backup observer - // Initialize backup and restore observer - CBSBackupObserver* tmp = CBSBackupObserver::NewL(); - delete iBackupObserver; - iBackupObserver = tmp; - User::LeaveIfError( iBackupObserver->RegisterObserver( this ) ); - TRACE( T_LIT( "CBSServer::InitializeL end") ); - } - -void CBSServer::BrandUpdatedL( const TDesC& aApplicationId, - const TDesC& aBrandId, - TLanguage aLanguageId, - CBSSession* aSession, - TInt aReserved ) - { - TRACE( T_LIT( "CBSServer::BrandUpdatedL begin aAppid[%S],aBrandId[%S]"),&aApplicationId, &aBrandId ); - TInt sessionCount = iSessions.Count(); - for( TInt i = 0; i < sessionCount; i++ ) - { - if( iSessions[i] == aSession ) - { - // we don't want to report the querying session itself - continue; - } - iSessions[i]->BrandUpdatedL( aApplicationId, - aBrandId, - aLanguageId, - aReserved ); - } - TRACE( T_LIT( "CBSServer::BrandUpdatedL end") ); - } - - - -// --------------------------------------------------------------------------- -// CBSServer::DisplaySessionInfoL display the info for each open session, -// except for the one that called this method -// --------------------------------------------------------------------------- -// -void CBSServer::DisplaySessionInfoL( CBSSession* aSession, TInt aErrorCode ) - { - TRACE( T_LIT( "CBSServer::DisplaySessionInfoL() begin aSession[%d], aErrorCode[%d]"),aSession,aErrorCode ); - - User::LeaveIfNull( aSession ); - // some constants - const TInt KStringLength = 512; - const TInt KNumberLength = 16; - _LIT( KMessage0,"Operation failed.Errorcode:"); - _LIT( KMessage1," Info on open sessions [ProcessFileName|ThreadId|ProcessId|Caption]:"); - _LIT( KBracketOpen, " ["); - _LIT( KBracketClose, "]"); - _LIT( KSeparator, "|"); - - - HBufC* outputString = HBufC::NewLC( KStringLength ); - TPtr outputStringPtr( outputString->Des() ); - - TBuf number; - number.Num( aErrorCode ); - - //make sure the string is long enough - TInt newLength = outputString->Length() + - KMessage0().Length() + - number.Length() + - KMessage1().Length(); - - //reallocate if necessary - if ( outputStringPtr.MaxLength() < newLength ) - { - CleanupStack::Pop( outputString ); - outputString = outputString->ReAllocL( newLength ); - outputStringPtr.Set( outputString->Des() ); - CleanupStack::PushL( outputString ); - } - - outputStringPtr.Append( KMessage0 ); - outputStringPtr.Append( number ); - outputStringPtr.Append( KMessage1 ); - - - TInt count = iSessions.Count(); - TRACE( T_LIT( "CBSServer::DisplaySessionInfoL() numberSessions=%d"),count ); - CBSSession* currentSession; - for( TInt i = 0; i < count; i++ ) - { - currentSession = iSessions[i]; - TRACE( T_LIT( "CBSServer::DisplaySessionInfoL() iteration=%d session=%d"),i,currentSession ); - if ( currentSession - && currentSession->InfoAvailable() - && currentSession != aSession ) - { - TBuf threadIdStr; - TThreadId threadId; - if ( KErrNone == currentSession->ThreadId( threadId ) ) - { - threadIdStr.NumUC( threadId.Id(), EDecimal ); - } - TBuf processIdStr; - TProcessId processId; - if ( KErrNone == currentSession->ProcessId( processId ) ) - { - processIdStr.NumUC( processId.Id(), EDecimal ); - } - - //make sure the string is long enough - newLength = outputString->Length() + - KBracketOpen().Length() + - currentSession->FileName().Length() + - threadIdStr.Length() + - processIdStr.Length() + - currentSession->Caption().Length() + - ( 3 * KSeparator().Length() ) + - KBracketClose().Length(); - - //reallocate if necessary - if ( outputStringPtr.MaxLength() < newLength ) - { - CleanupStack::Pop( outputString ); - outputString = outputString->ReAllocL( newLength ); - outputStringPtr.Set( outputString->Des() ); - CleanupStack::PushL( outputString ); - } - - outputStringPtr.Append( KBracketOpen ); - - //processfilename - outputStringPtr.Append( currentSession->FileName() ); - outputStringPtr.Append( KSeparator ); - - //threadid - outputStringPtr.Append( threadIdStr ); - outputStringPtr.Append( KSeparator ); - - //processid - outputStringPtr.Append( processIdStr ); - outputStringPtr.Append( KSeparator ); - - //caption - outputStringPtr.Append( currentSession->Caption() ); - - outputStringPtr.Append( KBracketClose ); - } - } - - TRACE( T_LIT( "CBSServer::DisplaySessionInfoL() string creation OK") ); - TRACE( T_LIT( "%S"), outputString ); - CleanupStack::PopAndDestroy( outputString ); - TRACE( T_LIT( "CBSServer::DisplaySessionInfoL() end") ); - } - -// ============================================================== -// ====================== ENTRY POINT =========================== -// ============================================================== -GLDEF_C TInt E32Main() - { - TRACE( T_LIT("E32Main - enter") ); - - User::RenameThread( KBSServerName ); - - CTrapCleanup* tc = CTrapCleanup::New(); - if( !tc ) - { - return KErrNoMemory; - } - - TRAPD( err, CBSServer::ExecuteL() ); - delete tc; - - TRACE( T_LIT("E32Main - exit: %d"), err ); - return err; - } - - - -// END OF FILE - - diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsserver/cbsserver.h --- a/brandingserver/bsserver/cbsserver.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,147 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CBSSERVER.H -* -*/ - - -#ifndef __CBSSERVER_H__ -#define __CBSSERVER_H__ -#include - -#include "rbsobjowningptrarray.h" -#include "mbsbackupobserver.h" - -// FORWARD DECLARATIONS -class CBSSession; -class CBSStorageManager; -class CBSInstallHandler; -class CBSBackupObserver; - -/** - * Service server. - */ -NONSHARABLE_CLASS( CBSServer ): public CPolicyServer, - public MBSBackupObserver - { - public: - NONSHARABLE_CLASS( CBSFileMapping ): public CBase - { - public: - static CBSFileMapping* NewL( CBSSession* aSession, - const TDesC& aFile, - TBool aVersioned ); - - ~CBSFileMapping(); - private: // constructors - void ConstructL( CBSSession* aSession, - const TDesC& aFile ); - CBSFileMapping( TBool aVersioned ); - - public: // new methods - CBSSession* Session(); - const TDesC& File(); - TBool Versioned(); - - private: // data - // doesn't own: session - CBSSession* iSession; - HBufC* iFile; - TBool iVersioned; - }; - - public: // Execution and destructors - static void ExecuteL(); - virtual ~CBSServer(); - - private: // C++ constructor - CBSServer(); - - protected: // Methods from CPolicyServer - - CSession2* NewSessionL( const TVersion& aVersion, - const RMessage2& aMessage ) const; - - - CPolicyServer::TCustomResult CustomFailureActionL( - const RMessage2& aMsg, - TInt aAction, - const TSecurityInfo& aMissing); - - public: // From MBSBackupObserver - - void HandleBackupStateL( TBackupState aState ); - - public: //New methods - void SessionCreatedL( CBSSession* aSession ); - void SessionDied( CBSSession* aSession ); - - TBool MatchSessionL( const TDesC& aApplicationId, - const TDesC& aBrandId, - TLanguage aLanguageId, - CBSSession* aSession, - TInt aReserved = 0 ); - - TBool MatchSessionUninstallL( const TDesC& aApplicationId, - const TDesC& aBrandId, CBSSession* aSession); - - void RegisterFileForSessionL( CBSSession* aSession, - const TDesC& aFile, - TBool aVersioned ); - - TArray RegisteredFiles(); - - TBool FileStillInUse( CBSSession* aSession, - const TDesC& aFile ); - - void BrandUpdatedL( const TDesC& aApplicationId, - const TDesC& aBrandId, - TLanguage aLanguageId, - CBSSession* aSession, - TInt aReserved ); - /** - * Displays the info for each open session - except for the one that - * called this method. - * - * @param aSession the session that called this method - * @param aErrorCode a system-wide errorcode which is simply displayed - * by this method - */ - void DisplaySessionInfoL( CBSSession* aSession, TInt aErrorCode ); - - private: // New methods - void UnRegisterSessionL( CBSSession* aSession ); - - - void CleanupFileL( const TDesC& aFile ); - - void InitializeL(); - - private: //Data - TInt iSessionCount; - RPointerArray iSessions; - RBSObjOwningPtrArray iFileMapping; - CBSStorageManager* iStorageManager; - CBSInstallHandler* iInstallHandler; - - // Own. Observer for backup and restore events - CBSBackupObserver* iBackupObserver; - }; - -#endif // __CBSSERVER_H__ - - -// END OF FILE - - diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsserver/cbssession.cpp --- a/brandingserver/bsserver/cbssession.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1728 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CBSSession.cpp -* -*/ - - -// INCLUDE FILES -#include -#include - -#include "cbssession.h" -#include "cbsserver.h" -#include "debugtrace.h" -#include "cbsbrandhandler.h" -#include "cbsstoragemanager.h" -#include "cbsstorage.h" -#include "cbsbitmap.h" -//#include "cbselement.h" -#include "rbsobjowningptrarray.h" -#include "bselementfactory.h" -#include "bsimportconstants.h" -#include -#include -#include -#include -#include - -// ============================================================== -// ======================== SESSION ============================= -// ============================================================== - -// Two-phased constructor. -CBSSession* CBSSession::NewL() - { - TRACE( T_LIT("CBSSession::NewL begin") ); - CBSSession* self = new( ELeave ) CBSSession(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - TRACE( T_LIT("CBSSession::NewL end") ); - return self; - } - -// Symbian OS default constructor can leave. -void CBSSession::ConstructL() - { - } - - -// destructor -CBSSession::~CBSSession() - { - TRACE( T_LIT("CBSSession[%d]::~CBSSession()"), this ); - - if( Server() ) - { - Server()->SessionDied( this ); - } - delete iText; - delete iBuffer; - delete iBranding; - delete iSeveralData; - -#ifdef __WINSCW__ - if( iStorageManager ) - { - iStorageManager->WriteIbyFiles(); - } -#endif - delete iStorageManager; - delete iSessionInfo; - - } - - -// C++ default constructor can NOT contain any code, that -// might leave. -// -CBSSession::CBSSession() - { - } - -// --------------------------------------------------------- -// CBSSession::CreateL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -void CBSSession::CreateL() - { - TRACE( T_LIT("CBSSession[%d]::CreateL()"), this ); - Server()->SessionCreatedL( this ); - } - -// --------------------------------------------------------- -// CBSSession::ServiceL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -void CBSSession::ServiceL( const RMessage2 &aMessage ) - { - - /*if( !iSessionInfo ) - { - TRAPD( err, ExtractInfoL( aMessage ) ); - TRACE( T_LIT("CBSSession::ServiceL() ExtractInfoL returned with [%d]"), err ); - } - */ - if( DispatchMessageL( aMessage ) ) - { - if( !iMessageCompleted ) - { - aMessage.Complete( KErrNone ); - } - } - } - -// --------------------------------------------------------- -// CBSSession::ServiceError -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -void CBSSession::ServiceError( const RMessage2& aMessage, - TInt aError ) - { - aMessage.Complete( aError ); - } - -// --------------------------------------------------------- -// CBSSession::HandleBackupStateL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -void CBSSession::HandleBackupStateL( TBackupState aState ) - { - iIsBackup = ETrue ; - switch( aState ) - { - case EBackupNotActive: // backup is complete - { - // release session lock - iBackupActive = EFalse; - if( iStorageManager ) - { - iStorageManager->ReleaseLockL(); - } - - // Sending backup active state change event after unlocking it - if( iObserverActive ) - { - iObserverMessage.Complete( KErrNone ); - iObserverActive = EFalse; - } - - break; - } - case EBackupActive: // backup activated - { - - // Lock session. Branding data is not available until - // backup is completed. - iBackupActive = ETrue; - - // Sending backup active state change event before locking it - if( iObserverActive ) - { - iObserverMessage.Complete( KErrNone ); - iObserverActive = EFalse; - } - - if( iStorageManager ) - { - iStorageManager->LockStorage(); - } - break; - } - default: - { - // unknown state - } - } - - - } - -// --------------------------------------------------------- -// CBSSession::DispatchMessageL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -TBool CBSSession::DispatchMessageL( const RMessage2& aMessage ) - { - TRACE( T_LIT("CBrandingSession[%d]::DispatchMessageL() %d"), - this, aMessage.Function() ); - iMessageCompleted = EFalse; - TBool msgNeedsToBeCompleted = ETrue; - - if( iBackupActive ) - { - // if backup is active, we don't take requests. - // We could take some requests which do not require disk - // operations. This is not a good solution and a better one should be - // investigated. I'm running out of time. - TInt msg = aMessage.Function() ; - if( msg == EBSObserveGetChange || - msg == EBSObserveGetBackupState || - msg == EBSObserveBrand) - { - //allow to do the operation - } - else - { - User::Leave( KErrNotReady ); - } - - } - - switch( aMessage.Function() ) - { - case EBSInitInstall: - { - InitUpdateL( aMessage, EBSTxInstall ); - break; - } - case EBSInitUninstall: - { - InitUpdateL( aMessage, EBSTxUninstall ); - break; - } - case EBSInitAppend: - { - InitUpdateL( aMessage, EBSTxAppend ); - break; - } - case EBSInitReplace: - { - InitUpdateL( aMessage, EBSTxReplace ); - break; - } - case EBSInitAccess: - { - InitAccessL( aMessage ); - break; - } - case EBSPrepareText: - { - GetTextL( aMessage ); - break; - } - case EBSGetText: - { - if( iText ) - { - aMessage.WriteL( 2, *iText ); - } - else - { - aMessage.WriteL( 2, KNullDesC() ); - } - break; - } - - case EBSIsBrandUpdateRequired: - isBrandUpdateRequiredL (aMessage); - break; - - case EBSGetInt: - { - GetIntL( aMessage ); - break; - } - - case EBSPrepareBuffer: - { - GetBufferL( aMessage ); - break; - } - - case EBSGetBuffer: - { - if( iBuffer ) - { - aMessage.WriteL( 2, *iBuffer ); - } - else - { - aMessage.WriteL( 2, KNullDesC8() ); - } - break; - } - - case EBSGetFile: - { - GetFileL( aMessage ); - break; - } - - case EBSPrepareSeveral: - { - PrepareSeveralL( aMessage ); - break; - } - - case EBSGetSeveral: - { - GetSeveralL( aMessage ); - break; - } - - case EBSPrepareStructure: - { - PrepareStructureL( aMessage ); - break; - } - - case EBSGetStructure: - { - GetStructureL( aMessage ); - break; - } - - case EBSStartTransaction: - { - StartTransactionL( aMessage ); - break; - } - - case EBSStopTransaction: - { - StopTransactionL( aMessage ); - break; - } - case EBSCancelTransaction: - { - CancelTransactionL( aMessage ); - break; - } - - case EBSInstall: - { - InstallL( aMessage ); - break; - } - - case EBSReplace: - { - ReplaceL( aMessage ); - break; - } - - case EBSAppend: - { - AppendL( aMessage ); - break; - } - - case EBSRemoveBrand: - { - RemoveBrandL( aMessage ); - break; - } - case EBSRemoveApplication: - { - RemoveApplicationL( aMessage ); - break; - } - - case EBSObserveBrand: - { - if( iObserverActive ) - { - // complete the old observer request with KErrCancel - iObserverMessage.Complete( KErrCancel ); - } - iObserverMessage = aMessage; - iObserverActive = ETrue; - msgNeedsToBeCompleted = EFalse; - break; - } - - case EBSObserveGetNewVersion: - { - TInt newVersion = GetNewVersionL(); - TPckgC pack( newVersion ); - aMessage.WriteL( 0, pack ); - break; - } - - // Get what change happen - case EBSObserveGetChange: - { - TPckgC pack( iIsBackup ); - aMessage.WriteL( 0, pack ); - break ; - } - - // Get the backup state - case EBSObserveGetBackupState: - { - TPckgC pack( iBackupActive ); - aMessage.WriteL( 0, pack ); - break ; - } - - default: - { - User::Leave( KErrNotSupported ); - break; - } - } - - return msgNeedsToBeCompleted; - } - - -// --------------------------------------------------------- -// CBSSession::InitUpdateL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -void CBSSession::InitUpdateL( const RMessage2 &aMessage, TTransactionType aType) - { - TRACE( T_LIT("CBSSession::InitUpdateL: begin TTransactionType[%d] "),aType ); - - // get the application id - TInt bufferSize( aMessage.GetDesLength( 0 ) ); - - HBufC8* appId = HBufC8::NewLC( bufferSize ); - TPtr8 appPtr = appId->Des(); - aMessage.ReadL( 0, appPtr ); - - HBufC* tmpAppId = CnvUtfConverter::ConvertToUnicodeFromUtf8L( *appId ); - CleanupStack::PopAndDestroy( appId ); - - delete iApplicationId; - iApplicationId = tmpAppId; - - // get the brand id - bufferSize = aMessage.GetDesLength( 1 ); - HBufC8* streamBuf = HBufC8::NewLC( bufferSize ); - TPtr8 streamPtr = streamBuf->Des(); - aMessage.ReadL( 1, streamPtr ); - - RDesReadStream stream; - CleanupClosePushL( stream ); - stream.Open( streamPtr ); - - TInt descriptorLength = stream.ReadInt16L(); - HBufC8* brandId = HBufC8::NewLC( descriptorLength ); - TPtr8 brandPtr = brandId->Des(); - stream.ReadL( brandPtr, descriptorLength ); - - HBufC* tmpBrandId = CnvUtfConverter::ConvertToUnicodeFromUtf8L( *brandId ); - CleanupStack::PopAndDestroy( brandId ); - delete iBrandId; - iBrandId = tmpBrandId; - - descriptorLength = stream.ReadInt16L(); - HBufC8* defaultBrandId = HBufC8::NewLC( descriptorLength ); - TPtr8 defaultPtr = defaultBrandId->Des(); - stream.ReadL( defaultPtr, descriptorLength ); - - HBufC* tmpDefaultBrandId = CnvUtfConverter::ConvertToUnicodeFromUtf8L( *defaultBrandId ); - CleanupStack::PopAndDestroy( defaultBrandId ); - delete iDefaultBrandId; - iDefaultBrandId = tmpDefaultBrandId; - - CleanupStack::PopAndDestroy( 2, streamBuf ); // stream, streamBuf - - - // get the language id - iLanguageId = (TLanguage)aMessage.Int2(); - - // get the version - iReserved = aMessage.Int3(); - - // Check if brand is discarded and client is trying to access/append/replace on that - // give error message saying brand not found so that client will not use that brand - if(aType == EBSTxAccess || aType == EBSTxAppend || aType == EBSTxReplace ) - { - if(!iStorageManager) - { - iStorageManager = CBSStorageManager::NewL( this, *iApplicationId ); - } - - TBool brandDiscarded = EFalse ; - brandDiscarded = iStorageManager->CheckBrandDiscarded(*iApplicationId, *iBrandId) ; - - if(brandDiscarded) - { - TRACE( T_LIT("CBSSession::InitUpdateL: Brand discarded!->LeaveWith KErrNotFound") ); - ///Server()->DisplaySessionInfoL( this, KErrNotFound ); - User::Leave( KErrNotFound ); - } - } - - if( aType == EBSTxAppend ) - { - PrepareAppendL(); - } - else if( aType == EBSTxReplace ) - { - PrepareReplaceL(); - } - else if(aType == EBSTxUninstall) - { - if( !iStorageManager ) - { - iStorageManager = CBSStorageManager::NewL( this, *iApplicationId ); - } - // if any client is accessing same brand leave with KErrInUse. - // check if the brand has any active clients - TBool brandActive = EFalse; - CBSServer* server = Server(); - if( server ) - { - brandActive = server->MatchSessionUninstallL( *iApplicationId, *iBrandId, - this); - } - - if(brandActive) - { - TRACE( T_LIT("CBSSession::InitUpdateL: UnInstallation aborted -> LeaveWith KErrInUse") ); - //Server()->DisplaySessionInfoL( this,KErrInUse); - //when changing this errorcode: please read the note in - //UninstallL() ( installer.cpp ) - User::Leave( KErrInUse ); - } - } - else if( aType == EBSTxInstall ) - { - if( !iStorageManager ) - { - iStorageManager = CBSStorageManager::NewL( this, *iApplicationId ); - } - - HBufC* drive = HBufC::NewLC(3); - TRAPD( err, iStorageManager->GetNewestVersionL( *iApplicationId, - *iBrandId, - iLanguageId ) ); - if( ( err == KErrNotFound ) || ( err == KErrPathNotFound ) ) - { - CleanupStack::PopAndDestroy(drive); - // this brand is not yet there, which is the correct situation here - // for starting install. We can just ignore this error - } - - else if( !err ) - { - // there was no error, therefore this brand already exists in the ROM - // (Z drive). - // we leave with KErrAlreadyExists - if( 0 == (drive->Des().Compare(KBSZDrive)) ) - { - CleanupStack::PopAndDestroy(drive); - User::Leave( KErrAlreadyExists ); - } - else - { - //PopAndDestroy drive as it is not needed any longer. - CleanupStack::PopAndDestroy(drive); - - // if any client is accessing same brand leave with KErrInUse. - // check if the brand has any active clients - TBool brandActive = EFalse; - CBSServer* server = Server(); - if( server ) - { - brandActive = server->MatchSessionL( *iApplicationId, *iBrandId, - iLanguageId, this, iReserved ); - } - - if(brandActive == EFalse) - { - TRACE( T_LIT("CBSSession::InitUpdateL: Brand not used -> remove") ); - iStorageManager->RemoveBrandL( *iApplicationId, *iBrandId, - iLanguageId, iReserved ); - } - else - { - TRACE( T_LIT("CBSSession::InitUpdateL: Installation aborted->LeaveWith KErrInUse") ); - //Server()->DisplaySessionInfoL( this,KErrInUse); - //when changing this errorcode: please read the note in - //UninstallL() ( installer.cpp ) - User::Leave( KErrInUse ); - } - } - } - else - { - CleanupStack::PopAndDestroy(drive); - // some other error - TRACE( T_LIT("CBSSession::InitUpdateL: ERROR aType[%d] LeaveWith[%d]"),aType,err ); - User::Leave( err ); - } - } - - - iInitialized = ETrue; - - TRACE( T_LIT("Server initialized") ); - } - - - -// --------------------------------------------------------- -// CBSSession::PrepareAppendL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -void CBSSession::PrepareAppendL() - { - if( !iStorageManager ) - { - iStorageManager = CBSStorageManager::NewL( this, *iApplicationId ); - } - - RFile brandHandle; - iStorageManager->BrandHandleL( *iApplicationId, - *iBrandId, iLanguageId, brandHandle, iReserved ); - CleanupClosePushL( brandHandle ); - RFileReadStream oldStream; - oldStream.Attach( brandHandle ); - CleanupClosePushL( oldStream ); - TInt version = oldStream.ReadInt16L(); - - TInt count = oldStream.ReadInt16L(); - - if( !iStorageManager->Storage() ) - { - iStorageManager->CreateStorageL(); - } - for( TInt i = 0; i < count; i++ ) - { - MBSElement* element = InternalizeElementL( oldStream, ETrue ); - CleanupDeletePushL( element ); - // transfers ownership - iStorageManager->Storage()->AppendElementsL( element ); - CleanupStack::Pop(); // element - } - - iStorageManager->Storage()->SetVersion( iReserved ); - iStorageManager->Storage()->SetStorageIdL( *iBrandId ); - iStorageManager->Storage()->SetApplicationIdL( *iApplicationId ); - iStorageManager->Storage()->SetLanguageL( iLanguageId ); - - CleanupStack::PopAndDestroy( 2 ); // oldStream, brandHandle - iAppending = ETrue; - } -// --------------------------------------------------------- -// CBSSession::PrepareReplaceL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -void CBSSession::PrepareReplaceL() - { - PrepareAppendL(); - } - -// --------------------------------------------------------- -// CBSSession::InitAccessL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -void CBSSession::InitAccessL( const RMessage2 &aMessage ) - { - InitUpdateL( aMessage, EBSTxAccess ); - - iBranding = CBSBrandHandler::NewL( *iApplicationId, *iBrandId, *iDefaultBrandId, - iLanguageId, this, iReserved ); - - - iAccessInit = ETrue; - TRACE( T_LIT("Access initialized") ); - } - - -// --------------------------------------------------------- -// CBSSession::GetTextL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -void CBSSession::GetTextL( const RMessage2 &aMessage ) - { - if( !iAccessInit ) - { - User::Leave( KErrNotReady ); - } - TInt idSize( aMessage.GetDesLength( 0 ) ); - - HBufC8* idBuffer = HBufC8::NewLC( idSize ); - TPtr8 ptrId = idBuffer->Des(); - aMessage.ReadL( 0, ptrId ); - - HBufC* temp = iBranding->GetTextL( ptrId ); - delete iText; - iText = temp; - - CleanupStack::PopAndDestroy( idBuffer ); - TPckgC pack( iText->Size() ); - aMessage.WriteL( 1, pack ); - TRACE( T_LIT("aMessage.WriteL( 1, %d );"), iText->Size() ); - } - -void CBSSession :: isBrandUpdateRequiredL (const RMessage2 &aMessage) -{ - if( !iAccessInit ) - { - User::Leave( KErrNotReady ); - } - TInt updateRequired = iBranding->isBrandUpdateRequiredL (); -// iValue = updateRequired; - TPckgC pack (updateRequired); - aMessage.WriteL( 0, pack ); -} -// --------------------------------------------------------- -// CBSSession::GetIntL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -void CBSSession::GetIntL( const RMessage2 &aMessage ) - { - if( !iInitialized ) - { - User::Leave( KErrNotReady ); - } - TInt idSize( aMessage.GetDesLength( 0 ) ); - - HBufC8* idBuffer = HBufC8::NewLC( idSize ); - TPtr8 ptrId = idBuffer->Des(); - aMessage.ReadL( 0, ptrId ); - - iValue = iBranding->GetIntL( ptrId ); - TPckgC pack( iValue ); - aMessage.WriteL( 1, pack ); - CleanupStack::PopAndDestroy( idBuffer ); - } - -// --------------------------------------------------------- -// CBSSession::GetBufferL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -void CBSSession::GetBufferL( const RMessage2 &aMessage ) - { - if( !iAccessInit ) - { - User::Leave( KErrNotReady ); - } - TInt idSize( aMessage.GetDesLength( 0 ) ); - - HBufC8* idBuffer = HBufC8::NewLC( idSize ); - TPtr8 ptrId = idBuffer->Des(); - aMessage.ReadL( 0, ptrId ); - - HBufC8* temp = iBranding->GetBufferL( ptrId ); - delete iBuffer; - iBuffer = temp; - - CleanupStack::PopAndDestroy( idBuffer ); - TPckgC pack( iBuffer->Size() ); - aMessage.WriteL( 1, pack ); - TRACE( T_LIT("aMessage.WriteL( 1, %d );"), iBuffer->Size() ); - } - - -// --------------------------------------------------------- -// CBSSession::GetFileL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -void CBSSession::GetFileL( const RMessage2 &aMessage ) - { - TRACE( T_LIT("CBSSession::GetFileL begin") ); - if( !iInitialized ) - { - User::Leave( KErrNotReady ); - } - TInt idSize( aMessage.GetDesLength( 2 ) ); - HBufC8* idBuffer = HBufC8::NewLC( idSize ); - TPtr8 ptrId = idBuffer->Des(); - aMessage.ReadL( 2, ptrId ); - - RFile file; - iBranding->GetFileL( ptrId, file ); - - CleanupStack::PopAndDestroy( idBuffer ); - - User::LeaveIfError( file.TransferToClient( aMessage, 0 ) ); - - iMessageCompleted = ETrue; - - file.Close(); - TRACE( T_LIT("CBSSession::GetFileL end") ); - } - - -// --------------------------------------------------------- -// CBSSession::InternalizeElementIdsL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -void CBSSession::InternalizeElementIdsL( RReadStream& aStream, RBSObjOwningPtrArray& aArray ) - { - TInt count = aStream.ReadInt16L(); - - for(TInt i = 0; i < count; i++ ) - { - TInt length = aStream.ReadInt16L(); - HBufC8* id = HBufC8::NewLC( length ); - TPtr8 ptrId = id->Des(); - aStream.ReadL( ptrId, length ); - aArray.AppendL( id ); - CleanupStack::Pop( id ); - } - } - -// --------------------------------------------------------- -// CBSSession::PrepareTextL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -void CBSSession::PrepareSeveralL( const RMessage2 &aMessage ) - { - if( !iInitialized ) - { - User::Leave( KErrNotReady ); - } - - TInt msgSize( aMessage.GetDesLength( 1 ) ); - - HBufC8* idBuffer = HBufC8::NewLC( msgSize ); - TPtr8 ptrId = idBuffer->Des(); - aMessage.ReadL( 1, ptrId ); - - RDesReadStream idStream; - CleanupClosePushL( idStream ); - idStream.Open( ptrId ); - - RBSObjOwningPtrArray idArray; - CleanupClosePushL( idArray ); - - InternalizeElementIdsL( idStream, idArray ); - - - MBSElement* texts = iBranding->GetSeveralL( idArray ); - - CleanupStack::PopAndDestroy(); // idArray - CleanupStack::PopAndDestroy(); // idStream - CleanupStack::PopAndDestroy(); // idBuffer - - CleanupDeletePushL( texts ); - - // FIXME magic number - CBufFlat* data = CBufFlat::NewL( 2000 ); - CleanupStack::PushL( data ); - - RBufWriteStream writeStream; - CleanupClosePushL( writeStream ); - writeStream.Open( *data ); - - texts->ExternalizeL( writeStream ); - - CleanupStack::PopAndDestroy(); // writeStream - - delete iSeveralData; - iSeveralData = data; - CleanupStack::Pop( data ); - - CleanupStack::PopAndDestroy(); // texts - - delete iBuffer; - iBuffer = NULL; - iBuffer = iSeveralData->Ptr(0).AllocL(); - - delete iSeveralData; - iSeveralData = NULL; - TPckgC pack( iBuffer->Size() ); - TRACE( T_LIT("DispatchMessageL - EPlatSecPrepareSeveral writing size %d"), iBuffer->Size() ); - aMessage.WriteL( 0, pack ); - - } - -// --------------------------------------------------------- -// CBSSession::GetSeveralTextL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -void CBSSession::GetSeveralL( const RMessage2 &aMessage ) - { - if( !iInitialized ) - { - User::Leave( KErrNotReady ); - } - aMessage.WriteL( 0, *iBuffer ); - - delete iBuffer; - iBuffer = NULL; - } - - -// --------------------------------------------------------- -// CBSSession::PrepareStructureL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -void CBSSession::PrepareStructureL( const RMessage2 &aMessage ) - { - if( !iInitialized ) - { - User::Leave( KErrNotReady ); - } - TInt idSize( aMessage.GetDesLength( 1 ) ); - - RBSObjOwningPtrArray valueArray; - CleanupClosePushL( valueArray ); - - HBufC8* idBuffer = HBufC8::NewLC( idSize ); - TPtr8 ptrId = idBuffer->Des(); - aMessage.ReadL( 1, ptrId ); - - - MBSElement* extElement = iBranding->GetStructureL( ptrId ); - CleanupDeletePushL( extElement ); - // FIXME magic number - CBufFlat* data = CBufFlat::NewL( 2000 ); - CleanupStack::PushL( data ); - - RBufWriteStream writeStream; - CleanupClosePushL( writeStream ); - writeStream.Open( *data ); - - extElement->ExternalizeL( writeStream ); - - CleanupStack::PopAndDestroy(); // writeStream - - delete iSeveralData; - iSeveralData = data; - CleanupStack::Pop( data ); - - CleanupStack::PopAndDestroy( extElement ); - - delete iBuffer; - iBuffer = NULL; - iBuffer = iSeveralData->Ptr(0).AllocL(); - - delete iSeveralData; - iSeveralData = NULL; - TPckgC pack( iBuffer->Size() ); - TRACE( T_LIT("DispatchMessageL - EPlatSecPrepareSeveral writing size %d"), iBuffer->Size() ); - aMessage.WriteL( 0, pack ); - - - CleanupStack::PopAndDestroy(idBuffer); - - CleanupStack::PopAndDestroy(); // valueArray - - } - -// --------------------------------------------------------- -// CBSSession::GetStructureL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -void CBSSession::GetStructureL( const RMessage2 &aMessage ) - { - if( !iInitialized ) - { - User::Leave( KErrNotReady ); - } - aMessage.WriteL( 0, *iBuffer ); - - delete iBuffer; - iBuffer = NULL; - } - - - -// --------------------------------------------------------- -// CBSSession::InstallL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -void CBSSession::InstallL( const RMessage2 &aMessage ) - { - TRACE( T_LIT( "CBSSession::InstallL begin") ); - if( !iInitialized || !iStorageManager ) - { - User::Leave( KErrNotReady ); - } - - if( !iStorageManager->Storage() ) - { - iStorageManager->CreateStorageL(); - } - - iStorageManager->ConnectTransactionL( *iApplicationId, - *iBrandId, iLanguageId, EFalse, iReserved ); - - TInt msgSize( aMessage.GetDesLength( 0 ) ); - - HBufC8* buffer = HBufC8::NewLC( msgSize ); - TPtr8 ptr = buffer->Des(); - aMessage.ReadL( 0, ptr ); - - RDesReadStream stream; - CleanupClosePushL( stream ); - stream.Open( ptr ); - - MBSElement* element = InternalizeElementL( stream ); - CleanupDeletePushL( element ); - - iStorageManager->Storage()->SetVersion( iReserved ); - iStorageManager->Storage()->SetStorageIdL( *iBrandId ); - iStorageManager->Storage()->SetApplicationIdL( *iApplicationId ); - iStorageManager->Storage()->SetLanguageL( iLanguageId ); - // transfers ownership - iStorageManager->Storage()->AppendElementsL( element ); - - CleanupStack::Pop(); // element - CleanupStack::PopAndDestroy( 2, buffer ); - iWriteNeeded = ETrue; - TRACE( T_LIT( "CBSSession::InstallL end") ); - } - -// --------------------------------------------------------- -// CBSSession::ReplaceL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -void CBSSession::ReplaceL( const RMessage2 &aMessage ) - { - TRACE( T_LIT( "CBSSession::ReplaceL begin") ); - if( !iInitialized || !iStorageManager ) - { - User::Leave( KErrNotReady ); - } - - iStorageManager->ConnectTransactionL( *iApplicationId, - *iBrandId, iLanguageId, EFalse, iReserved ); - - TInt msgSize( aMessage.GetDesLength( 0 ) ); - - HBufC8* buffer = HBufC8::NewLC( msgSize ); - TPtr8 ptr = buffer->Des(); - aMessage.ReadL( 0, ptr ); - - RDesReadStream stream; - CleanupClosePushL( stream ); - stream.Open( ptr ); - - MBSElement* element = InternalizeElementL( stream ); - CleanupDeletePushL( element ); - - // transfers ownership - iStorageManager->Storage()->ReplaceElementL( element ); - - CleanupStack::Pop(); // element - CleanupStack::PopAndDestroy( 2, buffer ); - iWriteNeeded = ETrue; - TRACE( T_LIT( "CBSSession::ReplaceL end") ); - } - - -// --------------------------------------------------------- -// CBSSession::AppendL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -void CBSSession::AppendL( const RMessage2 &aMessage ) - { - TRACE( T_LIT( "CBSSession::AppendL begin") ); - if( !iInitialized || !iStorageManager ) - { - User::Leave( KErrNotReady ); - } - - iStorageManager->ConnectTransactionL( *iApplicationId, - *iBrandId, iLanguageId, EFalse, iReserved ); - - TInt msgSize( aMessage.GetDesLength( 0 ) ); - - HBufC8* buffer = HBufC8::NewLC( msgSize ); - TPtr8 ptr = buffer->Des(); - aMessage.ReadL( 0, ptr ); - - RDesReadStream stream; - CleanupClosePushL( stream ); - stream.Open( ptr ); - - MBSElement* element = InternalizeElementL( stream ); - CleanupDeletePushL( element ); - - iStorageManager->Storage()->SetVersion( iReserved ); - iStorageManager->Storage()->SetStorageIdL( *iBrandId ); - iStorageManager->Storage()->SetApplicationIdL( *iApplicationId ); - iStorageManager->Storage()->SetLanguageL( iLanguageId ); - // transfers ownership - iStorageManager->Storage()->AppendElementsL( element ); - - CleanupStack::Pop(); // element - CleanupStack::PopAndDestroy( 2, buffer ); - iWriteNeeded = ETrue; - TRACE( T_LIT( "CBSSession::AppendL end") ); - } - -// --------------------------------------------------------- -// CBSSession::StartTransactionL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -void CBSSession::StartTransactionL( const RMessage2& /*aMessage*/ ) - { - if( !iStorageManager ) - { - iStorageManager = CBSStorageManager::NewL( this, *iApplicationId ); - } - // if we are appending or replacing, we don't need to - // create storage - if( !iAppending ) - { - iStorageManager->CreateStorageL(); - } - } - - -// --------------------------------------------------------- -// CBSSession::CancelTransactionL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -void CBSSession::CancelTransactionL( const RMessage2 &aMessage ) - { - // get the application id - TInt bufferSize( aMessage.GetDesLength( 0 ) ); - - HBufC8* appId = HBufC8::NewLC( bufferSize ); - TPtr8 appPtr = appId->Des(); - aMessage.ReadL( 0, appPtr ); - - - // get the brand id - bufferSize = aMessage.GetDesLength( 1 ); - HBufC8* brandId = HBufC8::NewLC( bufferSize ); - TPtr8 brandPtr = brandId->Des(); - aMessage.ReadL( 1, brandPtr ); - - // get the language id - TLanguage language = (TLanguage)aMessage.Int2(); - - // get the version - TInt version = aMessage.Int3(); - - - HBufC* tmpBrandId = CnvUtfConverter::ConvertToUnicodeFromUtf8L( *brandId ); - CleanupStack::PopAndDestroy( brandId ); - CleanupStack::PushL( tmpBrandId ); - HBufC* tmpAppId = CnvUtfConverter::ConvertToUnicodeFromUtf8L( *appId ); - CleanupStack::PushL( tmpAppId ); - - // check if the transaction is correct - iStorageManager->ConnectTransactionL( *tmpAppId, - *tmpBrandId, iLanguageId, - EFalse, iReserved ); - - CleanupStack::PopAndDestroy( 2, tmpBrandId ); // tmpBrandId, tmpAppId - CleanupStack::PopAndDestroy( appId ); - // cancel the transaction - iStorageManager->CancelTransactionL(); - iWriteNeeded = EFalse; - } - -// --------------------------------------------------------- -// CBSSession::StopTransactionL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -void CBSSession::StopTransactionL( const RMessage2 &aMessage ) - { - if( !iStorageManager ) - { - // transaction not found - User::Leave( KErrNotFound ); - } - if( iAppending ) - { - // find next available version number - TInt nextVersion = iStorageManager->NextAvailableVersionL(); - iStorageManager->SetVersion( nextVersion ); - iStorageManager->Storage()->SetVersion( nextVersion ); - } - - if( iWriteNeeded ) - { - iReserved = iStorageManager->WriteStorageFilesL(); - iWriteNeeded = EFalse; - } - - delete iStorageManager; - iStorageManager = NULL; - - TPckgC pack( iReserved ); - aMessage.WriteL( 0, pack ); - - } - - -// --------------------------------------------------------- -// CBSSession::InternalizeElementL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -MBSElement* CBSSession::InternalizeElementL( RReadStream& aStream, TBool aAppending /*= EFalse*/ ) - { - MBSElement* returnValue = NULL; - - TBSElementType type = (TBSElementType)aStream.ReadInt16L(); - TInt idSize = aStream.ReadInt16L(); - HBufC8* elementId = HBufC8::NewLC( idSize ); - TPtr8 elementIdPtr = elementId->Des(); - aStream.ReadL( elementIdPtr, idSize ); - - - switch( type ) - { - case EBSInt: - { - TInt intData = aStream.ReadInt16L(); - returnValue = BSElementFactory::CreateBSElementL( *elementId, - EBSInt, - intData ); - break; - } - case EBSText: - { - TInt textSize = aStream.ReadInt16L(); - HBufC* textData = HBufC::NewLC( textSize ); - - TPtr textPtr = textData->Des(); - aStream.ReadL( textPtr, textSize ); - - returnValue = BSElementFactory::CreateBSElementL( *elementId, - type, - *textData ); - - CleanupStack::Pop( textData ); - break; - } - - case EBSFile: - { - TInt nameSize = aStream.ReadInt16L(); - HBufC* fileName = HBufC::NewLC( nameSize ); - - TPtr filePtr = fileName->Des(); - aStream.ReadL( filePtr, nameSize ); - - if( !aAppending ) - { - // we are installing, so the filename is pointing to a file - // that has to be installed - // Install file and get the filename without path - HBufC* strippedName = iStorageManager->InstallFileLC( *fileName ); - returnValue = BSElementFactory::CreateBSElementL( *elementId, - type, - *strippedName ); - CleanupStack::Pop( strippedName ); - CleanupStack::PopAndDestroy( fileName ); - } - else - { - // we are appending, so this is really the filename - returnValue = BSElementFactory::CreateBSElementL( *elementId, - type, - *fileName ); - CleanupStack::Pop( fileName ); - } - break; - } - - case EBSList: - { - RBSObjOwningPtrArray listData; - CleanupClosePushL( listData ); - TInt listCount = aStream.ReadInt16L(); - for( TInt i = 0; i < listCount; i++ ) - { - MBSElement* listElement = InternalizeElementL( aStream ); - CleanupDeletePushL( listElement ); - listData.AppendL( listElement ); - CleanupStack::Pop(); // listElement - } - - returnValue = BSElementFactory::CreateBSElementL( *elementId, - EBSList, - listData ); - CleanupStack::Pop(); // listData - break; - } - case EBSBuffer: - { - TInt bufferSize = aStream.ReadInt16L(); - HBufC8* buffer = HBufC8::NewLC( bufferSize ); - - TPtr8 buffPtr = buffer->Des(); - aStream.ReadL( buffPtr, bufferSize ); - - returnValue = BSElementFactory::CreateBSElementL( *elementId, - EBSBuffer, - *buffer ); - - CleanupStack::Pop( buffer ); - break; - } - case EBSBitmap: - { - TInt length = aStream.ReadInt16L(); - HBufC8* fileId = HBufC8::NewLC( length ); - - TPtr8 fileIdPtr = fileId->Des(); - aStream.ReadL( fileIdPtr, length ); - - TInt bitmapId = aStream.ReadInt16L(); - TInt maskId = aStream.ReadInt16L(); - TInt skinId = aStream.ReadInt16L(); - TInt skinMaskId = aStream.ReadInt16L(); - - - CBSBitmap* bitmap = CBSBitmap::NewLC( bitmapId, - maskId, - skinId, - skinMaskId, - fileIdPtr ); - - returnValue = BSElementFactory::CreateBSElementL( *elementId, - EBSBitmap, - bitmap ); - CleanupStack::Pop( bitmap ); - CleanupStack::PopAndDestroy( fileId ); - break; - } - - default: - { - User::Leave( KErrArgument ); - break; - } - } - - CleanupStack::PopAndDestroy( elementId ); - - return returnValue; - } - - -// --------------------------------------------------------- -// CBSSession::MatchSessionL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -TBool CBSSession::MatchSessionL( const TDesC& aApplicationId, - const TDesC& aBrandId, - TLanguage aLanguageId, - TInt aReserved ) - { - TBool returnValue = EFalse; - if( iApplicationId && iBrandId ) - { - if( ( 0 == iApplicationId->Compare( aApplicationId ) ) && - ( 0 == iBrandId->Compare( aBrandId ) ) && - ( iLanguageId == aLanguageId ) && - ( iReserved == aReserved )) - { - returnValue = ETrue; - } - } - - return returnValue; - } - -// --------------------------------------------------------- -// CBSSession::MatchSessionL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -TBool CBSSession::MatchSessionUninstallL( const TDesC& aApplicationId, - const TDesC& aBrandId) - { - TBool returnValue = EFalse; - if( iApplicationId && iBrandId ) - { - if( ( 0 == iApplicationId->Compare( aApplicationId ) ) && - ( 0 == iBrandId->Compare( aBrandId ) ) ) - { - returnValue = ETrue; - } - } - - return returnValue; - } -// --------------------------------------------------------- -// CBSSession::BrandUpdatedL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -void CBSSession::BrandUpdatedL( const TDesC& aApplicationId, - const TDesC& aBrandId, - TLanguage aLanguageId, - TInt /*aReserved*/ ) - { - TRACE( T_LIT( "CBSSession::BrandUpdatedL begin aAppId[%S] aBrandId[%S]"), &aApplicationId, &aBrandId ); - iIsBackup = EFalse ; - if( iApplicationId && iBrandId ) - { - if( ( 0 == iApplicationId->Compare( aApplicationId ) ) && - ( 0 == iBrandId->Compare( aBrandId ) ) && - ( iLanguageId == aLanguageId ) ) - { - // this event is for us - // complete the observer request from client - if( iObserverActive ) - { - iObserverMessage.Complete( KErrNone ); - iObserverActive = EFalse; - } - } - } - TRACE( T_LIT( "CBSSession::BrandUpdatedL end") ); - } - - -// --------------------------------------------------------- -// CBSSession::RemoveBrandL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -void CBSSession::RemoveBrandL( const RMessage2& /*aMessage*/ ) - { - TRACE( T_LIT( "CBSSession::RemoveBrandL begin") ); - if( !iInitialized || !iStorageManager ) - { - User::Leave( KErrNotReady ); - } - - iStorageManager->RemoveBrandL( *iApplicationId, *iBrandId, - iLanguageId, iReserved ); - - - - TRACE( T_LIT( "CBSSession::RemoveBrandL end") ); - } - -// --------------------------------------------------------- -// CBSSession::RemoveApplicationL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -void CBSSession::RemoveApplicationL( const RMessage2& /*aMessage*/ ) - { - TRACE( T_LIT( "CBSSession::RemoveApplicationL begin") ); - if( !iInitialized || !iStorageManager ) - { - User::Leave( KErrNotReady ); - } - iStorageManager->RemoveApplicationL( *iApplicationId ); - TRACE( T_LIT( "CBSSession::RemoveApplicationL end") ); - } - -// --------------------------------------------------------- -// CBSSession::GetNewVersionL -// -// (other items were commented in a header). -// --------------------------------------------------------- -// -TInt CBSSession::GetNewVersionL() - { - if( !iStorageManager ) - { - iStorageManager = CBSStorageManager::NewL( this, KNullDesC ); - } - - return iStorageManager->GetNewestVersionL( *iApplicationId, *iBrandId, iLanguageId ); - } - - -// CBSSessionInfo -CBSSession::CBSSessionInfo* CBSSession::CBSSessionInfo::NewL( const TDesC& aFileName, - const TDesC& aCaption, - TThreadId aThreadId, - TProcessId aProcessId ) - { - CBSSessionInfo* self = new( ELeave ) CBSSessionInfo( aThreadId, aProcessId ); - CleanupStack::PushL( self ); - self->ConstructL( aFileName, aCaption ); - CleanupStack::Pop( self ); - return self; - } -void CBSSession::CBSSessionInfo::ConstructL( const TDesC& aFileName, const TDesC& aCaption ) - { - iFileName = aFileName.AllocL(); - iCaption = aCaption.AllocL(); - } -CBSSession::CBSSessionInfo::CBSSessionInfo( TThreadId aThreadId, TProcessId aProcessId ) -: iThreadId( aThreadId ), - iProcessId( aProcessId ) - { - } -CBSSession::CBSSessionInfo::~CBSSessionInfo() - { - delete iFileName; - delete iCaption; - } - -const TDesC& CBSSession::CBSSessionInfo::FileName() - { - return *iFileName; - } -const TDesC& CBSSession::CBSSessionInfo::Caption() - { - return *iCaption; - } - -TThreadId CBSSession::CBSSessionInfo::ThreadId() - { - return iThreadId; - } -TProcessId CBSSession::CBSSessionInfo::ProcessId() - { - return iProcessId; - } - - -// --------------------------------------------------------------------------- -// CBSSession::ExtractInfoL -// Extracts some information from the specified RMessage2 and saves it. -// --------------------------------------------------------------------------- -// -void CBSSession::ExtractInfoL( const RMessage2& aMessage ) - { - TRACE( T_LIT( "CBSSession::ExtractInfoL begin") ); - //Collect all necessary data - RThread thread; - TInt getProcessErr,getClientThreadErr; - getClientThreadErr = aMessage.Client( thread ); - CleanupClosePushL( thread ); - - if ( KErrNone == getClientThreadErr ) - { - TRACE( T_LIT( "CBSSession::ExtractInfoL Client retrieved OK") ); - TThreadId threadId = thread.Id(); - RProcess process; - getProcessErr = thread.Process( process ); - CleanupClosePushL( process ); - if ( getProcessErr == KErrNone ) - { - TRACE( T_LIT( "CBSSession::ExtractInfoL Processfilename retrieved OK") ); - TFileName fileName = process.FileName(); - TParsePtrC parser( fileName ); - TPtrC processFileNameAndExt( parser.NameAndExt() ); - - RApaLsSession session; - TInt connectErr = session.Connect(); - User :: LeaveIfError (connectErr); - session.GetAllApps(); - CleanupClosePushL( session ); - - TApaAppInfo info; - TPtrC captionPtr( KNullDesC ); - TPtrC printCaptionPtr( KNullDesC ); - TPtrC fullName( KNullDesC ); - while ( KErrNone == session.GetNextApp( info ) ) - { - fullName.Set( info.iFullName ); - printCaptionPtr.Set( info.iCaption ); - if( KErrNotFound != fullName.Find( processFileNameAndExt ) ) - { - captionPtr.Set( info.iCaption ); - TRACE( T_LIT( "CBSSession::ExtractInfoL caption saved: %S"),&captionPtr ); - break; - } - } - - CBSSessionInfo* temp = - CBSSessionInfo::NewL( processFileNameAndExt, - captionPtr, - threadId, - process.Id() ); - TRACE( T_LIT( "CBSSession::ExtractInfoL SessionInfo object creation OK") ); - delete iSessionInfo; - iSessionInfo = NULL; - iSessionInfo = temp; - CleanupStack::PopAndDestroy( &session ); - } - CleanupStack::PopAndDestroy( &process ); - } - CleanupStack::PopAndDestroy( &thread ); - TRACE( T_LIT( "CBSSession::ExtractInfoL end") ); - } - - -// --------------------------------------------------------------------------- -// CBSSession::FileName -// --------------------------------------------------------------------------- -// -const TDesC& CBSSession::FileName() - { - TRACE( T_LIT( "CBSSession::FileName begin") ); - if ( iSessionInfo ) - { - TRACE( T_LIT( "CBSSession::FileName SessionInfo exists") ); - return iSessionInfo->FileName(); - } - else - { - TRACE( T_LIT( "CBSSession::FileName SessionInfo does not exist") ); - return KNullDesC; - } - } - -// --------------------------------------------------------------------------- -// CBSSession::Caption -// --------------------------------------------------------------------------- -// -const TDesC& CBSSession::Caption() - { - TRACE( T_LIT( "CBSSession::Caption begin") ); - if ( iSessionInfo ) - { - TRACE( T_LIT( "CBSSession::Caption SessionInfo exists") ); - return iSessionInfo->Caption(); - } - else - { - TRACE( T_LIT( "CBSSession::Caption SessionInfo does not exist") ); - return KNullDesC; - } - } - - -// --------------------------------------------------------------------------- -// CBSSession::ThreadId -// --------------------------------------------------------------------------- -// -TInt CBSSession::ThreadId( TThreadId& aThreadId ) - { - TRACE( T_LIT( "CBSSession::ThreadId begin") ); - TInt err( KErrNotFound ); - if ( iSessionInfo ) - { - TRACE( T_LIT( "CBSSession::ThreadId SessionInfo exists") ); - aThreadId = iSessionInfo->ThreadId(); - err = KErrNone; - } - return err; - } - - -// --------------------------------------------------------------------------- -// CBSSession::ProcessId -// --------------------------------------------------------------------------- -// -TInt CBSSession::ProcessId( TProcessId& aProcessId ) - { - TRACE( T_LIT( "CBSSession::ProcessId begin") ); - TInt err( KErrNotFound ); - if ( iSessionInfo ) - { - TRACE( T_LIT( "CBSSession::ProcessId SessionInfo exists") ); - aProcessId = iSessionInfo->ProcessId(); - err = KErrNone; - } - return err; - } - - -// --------------------------------------------------------------------------- -// CBSSession::InfoAvailable -// --------------------------------------------------------------------------- -// -TBool CBSSession::InfoAvailable() - { - return iSessionInfo ? ETrue : EFalse; - } - -// END OF FILE - - diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsserver/cbssession.h --- a/brandingserver/bsserver/cbssession.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,461 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: cbssession.h -* -*/ - - -#ifndef __CBSSESSION_H__ -#define __CBSSESSION_H__ - -#include -#include -#include "rbsobjowningptrarray.h" -#include "bsserverdefs.h" -#include "mbsbackupobserver.h" - -class CBSServer; -class CBSBrandHandler; -class MBSElement; -class CBSStorageManager; - -/** - * Service side session. - * - * @lib - * @since - */ - class CBSSession : public CSession2, - public MBSBackupObserver - { - - - public: - - /** - * Class for encapsulating the session information. - */ - NONSHARABLE_CLASS( CBSSessionInfo ): public CBase - { - public: - - /** - * Creates a new CBSSessionInfo - * - * @param aFileName the filename of the process, that created - * this session - * @param aCaption a caption of the process, that created this - * session - * @param aThreadId thread id where this session was created - * @param aProcessId processId of the process, that created - * this session - * @return a new CBSSessionInfo instance - */ - static CBSSessionInfo* NewL( const TDesC& aFileName, - const TDesC& aCaption, - TThreadId aThreadId, - TProcessId aProcessId ); - /** - * Destructor. - */ - ~CBSSessionInfo(); - - private: - - /** - * Symbian second-phase constructor - * - * @param aFileName the filename of the process, that created - * this session - * @param aCaption a caption of the process, that created this - * session - */ - void ConstructL( const TDesC& aFileName, - const TDesC& aCaption ); - - /** - * Constructor. - * - * @param aThreadId thread id where this session was created - * @param aProcessId processId of the process, that created - * this session - */ - CBSSessionInfo( TThreadId aThreadId, TProcessId aProcessId ); - - public: - - /** - * Returns the filename of the process, that created this - * session. - * - * @return a filename - */ - const TDesC& FileName(); - - /** - * Returns the caption of the process, that created this - * session. - * - * @return a caption - */ - const TDesC& Caption(); - - /** - * Returns the thread id where this session was created. - * - * @return a thread id - */ - TThreadId ThreadId(); - - /** - * Returns the processId of the process, that created - * this session. - * - * @return a process id - */ - TProcessId ProcessId(); - - private: // data - - /** - * Filename - * Own. - */ - HBufC* iFileName; - - /** - * Caption - * Own. - */ - HBufC* iCaption; - - /** - * Thread Id. - */ - TThreadId iThreadId; - - /** - * Process Id. - */ - TProcessId iProcessId; - }; - - - public: // Constructors and destructors - static CBSSession* NewL(); - virtual ~CBSSession(); - - - protected: // C++ constructors - /** - * C++ default constructor. - */ - CBSSession(); - - /** - * Symbian OS constructor - */ - void ConstructL(); - - public: // Methods derived from CSession2 - /** - * From CSession2 - */ - void CreateL(); - /** - * From CSession2 - */ - void ServiceL( const RMessage2 &aMessage ); - /** - * From CSession2 - */ - void ServiceError( const RMessage2& aMessage, - TInt aError ); - - public: // From MBSBackupObserver - - /* - * @see MBSBackupObserver - */ - void HandleBackupStateL( TBackupState aState ); - - public: // New methods - - /** - * - */ - CBSServer* Server() { return (CBSServer*) CSession2::Server(); } - - - TBool MatchSessionL( const TDesC& aApplicationId, - const TDesC& aBrandId, - TLanguage aLanguageId, - TInt aReserved ); - - TBool MatchSessionUninstallL( const TDesC& aApplicationId, - const TDesC& aBrandId); - - void BrandUpdatedL( const TDesC& aApplicationId, - const TDesC& aBrandId, - TLanguage aLanguageId, - TInt aReserved ); - - - - /** - * Returns the filename of the process, that created this - * session. - * - * @return a filename - */ - const TDesC& FileName(); - - /** - * Returns the caption of the process, that created this - * session. - * - * @return a caption - */ - const TDesC& Caption(); - - /** - * Returns the thread id where this session was created. - * - * @return a thread id - */ - TInt ThreadId( TThreadId& aThreadId ); - - /** - * Returns the processId of the process, that created - * this session. - * - * @return a process id - */ - TInt ProcessId( TProcessId& aProcessId ); - - /** - * Returns, if the session info for this object is available. - * - * @return ETrue, if information about this object is available; - * EFalse otherwise - */ - TBool InfoAvailable(); - - - private: // New methods - - /** - * Dispatch clients message - * - * @since - * @param aMessage client's message - */ - TBool DispatchMessageL( const RMessage2 &aMessage ); - - - /** - * Initializes the server - * @param aMessage client's message - */ - void InitUpdateL( const RMessage2 &aMessage, TTransactionType aType ); - - /** - * Initializes the server - * @param aMessage client's message - */ - void InitAccessL( const RMessage2 &aMessage ); - - - /** - * Get text type branding item - * @param aMessage client's message - */ - void GetTextL( const RMessage2 &aMessage ); - - /** - * Get text type branding item - * @param aMessage client's message - */ - void GetBufferL( const RMessage2 &aMessage ); - - /** - * Get integer type branding item - * @param aMessage client's message - */ - void GetIntL( const RMessage2 &aMessage ); - - /** - * Get file type branding item - * @param aMessage client's message - */ - void GetFileL( const RMessage2 &aMessage ); - - /** - * Prepares several textual type branding items. - * These have to be fetched with GetSeveralText. - * @param aMessage client's message - */ - void PrepareSeveralL( const RMessage2 &aMessage ); - - /** - * Gets the several textual branding items - * previously prepared. - * @param aMessage client's message - */ - void GetSeveralL( const RMessage2 &aMessage ); - - - /** - * Prepares several structure type branding items. - * These have to be fetched with GetStructure. - * @param aMessage client's message - */ - void PrepareStructureL( const RMessage2 &aMessage ); - - /** - * Gets the several structure type branding items - * previously prepared. - * @param aMessage client's message - */ - void GetStructureL( const RMessage2 &aMessage ); - - void isBrandUpdateRequiredL (const RMessage2 &aMessage); - - - - /** - * - * - * @param aMessage client's message - */ - void InstallL( const RMessage2 &aMessage ); - - /** - * - * - * @param aMessage client's message - */ - void ReplaceL( const RMessage2 &aMessage ); - - - /** - * - * - * @param aMessage client's message - */ - void AppendL( const RMessage2 &aMessage ); - - /** - * - * - * @param aMessage client's message - */ - MBSElement* InternalizeElementL( RReadStream& aStream, TBool aAppending = EFalse ); - - - /** - * Cancels the transaction - */ - void StartTransactionL( const RMessage2 &aMessage ); - - - /** - * Cancels the transaction - */ - void CancelTransactionL( const RMessage2 &aMessage ); - - /** - * Finishes the transaction - */ - void StopTransactionL( const RMessage2 &aMessage ); - - - /** - * Internalize element ids - */ - void InternalizeElementIdsL( RReadStream& aStream, RBSObjOwningPtrArray& aArray ); - - /** - * - * - * @param aMessage client's message - */ - void RemoveBrandL( const RMessage2 &aMessage ); - - - /** - * - * - * @param aMessage client's message - */ - void RemoveApplicationL( const RMessage2 &aMessage ); - - void PrepareAppendL(); - - void PrepareReplaceL(); - - TInt GetNewVersionL(); - - - /** - * Extracts some information from the specified RMessage2 - * and saves it. - * - * @param aMessage a message from a client - */ - void ExtractInfoL( const RMessage2& aMessage ); - - private: // Data - TBool iInitialized; - TBool iAppending; - TBool iAccessInit; - TBool iWriteNeeded; - - // is backup process currently active - TBool iBackupActive; - - HBufC* iBrandId; - HBufC* iDefaultBrandId; - HBufC* iApplicationId; - TLanguage iLanguageId; - - TInt iValue; - HBufC* iText; - CBSBrandHandler* iBranding; - CBufFlat* iSeveralData; - HBufC8* iBuffer; - TBool iMessageCompleted; - - CBSStorageManager* iStorageManager; - - TBool iObserverActive; - RMessage2 iObserverMessage; - - // To send backup event to client - TBool iIsBackup ; - TInt iReserved; - - /** - * Contains information about this object. - * Own. - */ - CBSSessionInfo* iSessionInfo; - - }; - -#endif // __CBSSESSION_H__ - - -// END OF FILE - diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsserver/cbsstorage.cpp --- a/brandingserver/bsserver/cbsstorage.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,371 +0,0 @@ -/* -* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Stores element data and writes it to stream -* -*/ - - -#include "cbsstorage.h" -#include "bsimportconstants.h" -#include "debugtrace.h" - - -#include -#include -#include - -//#include "mbsimportlogger.h" -//#include "importlogwriter.h" - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CBSStorage::NewL -// --------------------------------------------------------------------------- -// -CBSStorage* CBSStorage::NewL() - { - CBSStorage* self = NewLC(); - CleanupStack::Pop(); - return self; - } - -// --------------------------------------------------------------------------- -// CBSStorage::NewLC -// --------------------------------------------------------------------------- -// -CBSStorage* CBSStorage::NewLC() - { - CBSStorage* self = new (ELeave) CBSStorage(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// CBSStorage::ConstructL -// --------------------------------------------------------------------------- -// -void CBSStorage::ConstructL() - { - } - -// --------------------------------------------------------------------------- -// CBSStorage::CBSStorage -// --------------------------------------------------------------------------- -// -CBSStorage::CBSStorage() - { - } - -// --------------------------------------------------------------------------- -// CBSStorage::~CBSStorage -// --------------------------------------------------------------------------- -// -CBSStorage::~CBSStorage() - { - iElements.Close(); - delete iAppId; - delete iStorageId; - delete iLanguage; - delete iFilename; - } - -// --------------------------------------------------------------------------- -// CBSStorage::AppendElement -// --------------------------------------------------------------------------- -// -void CBSStorage::AppendElementsL( MBSElement* aElement ) - { - if( !aElement ) - { - // Ignore empty - return; - } - - TPtrC8 id = aElement->ElementId(); - - // check if the id is unique - TInt count = iElements.Count(); - - for( TInt i = 0; i < count; i++ ) - { - if( 0 == iElements[i]->ElementId().Compare( id ) ) - { - // duplicate found - User::Leave( KErrAlreadyExists ); - } - } - - iElements.AppendL( aElement ); - } - - -// --------------------------------------------------------------------------- -// CBSStorage::ReplacesElementL -// --------------------------------------------------------------------------- -// -void CBSStorage::ReplaceElementL( MBSElement* aElement ) - { - if( !aElement ) - { - // Ignore empty - return; - } - - TPtrC8 id = aElement->ElementId(); - - // check if the id is unique - TInt count = iElements.Count(); - - for( TInt i = 0; i < count; i++ ) - { - if( 0 == iElements[i]->ElementId().Compare( id ) ) - { - // item found - MBSElement* element = iElements[i]; - iElements.Remove( i ); - delete element; - // put the new element - iElements.AppendL( aElement ); - return; - } - } - // the element was not found from this storage - User::Leave( KErrNotFound ); - } - - -// --------------------------------------------------------------------------- -// CBSStorage::ElementCount -// --------------------------------------------------------------------------- -// -TInt CBSStorage::ElementCount() - { - return iElements.Count(); - } - -// --------------------------------------------------------------------------- -// CBSStorage::ExternalizeL -// --------------------------------------------------------------------------- -// -void CBSStorage::ExternalizeL( RWriteStream& aWriteStream ) - { - if( !VerifyHeader() || !VerifyDataL( iElements ) ) - { - // Header not complete. Will not write to stream - User::Leave( KErrCorrupt ); - } - // Write header - aWriteStream.WriteInt16L( iVersion ); - - // Write elements - TInt count = iElements.Count(); - aWriteStream.WriteInt16L( count ); - for( TInt i = 0; i < count; i++ ) - { - iElements[i]->ExternalizeL( aWriteStream ); - } - } - -// --------------------------------------------------------------------------- -// CBSStorage::SetVersion -// --------------------------------------------------------------------------- -// -void CBSStorage::SetVersion( TInt aVersion ) - { - iVersion = aVersion; - } - -// --------------------------------------------------------------------------- -// CBSStorage::SetApplicationIdL -// --------------------------------------------------------------------------- -// -void CBSStorage::SetApplicationIdL( const TDesC& aAppId ) - { - HBufC* tmp = aAppId.AllocL(); - - delete iAppId; - iAppId = tmp; - } - -// --------------------------------------------------------------------------- -// CBSStorage::SetStorageIdL -// --------------------------------------------------------------------------- -// -void CBSStorage::SetStorageIdL( const TDesC& aStorageId ) - { - HBufC* tmp = aStorageId.AllocL(); - delete iStorageId; - iStorageId = tmp; - } - -// --------------------------------------------------------------------------- -// CBSStorage::SetLanguageL -// --------------------------------------------------------------------------- -// -void CBSStorage::SetLanguageL( TLanguage aLanguage ) - { - TBuf buffer; - buffer.AppendNum( aLanguage ); - - HBufC* tmp = buffer.AllocL(); - delete iLanguage; - iLanguage = tmp; - } - -// --------------------------------------------------------------------------- -// CBSStorage::VerifyHeader -// --------------------------------------------------------------------------- -// -TBool CBSStorage::VerifyHeader() - { - // not checking version as it is been consider not to use. - Pankaj - 31 may 07 - //return ( iAppId && iStorageId && iVersion > 0 && iLanguage ); - return ( iAppId && iStorageId && iLanguage ); - } - - -// --------------------------------------------------------------------------- -// CBSStorage::VerifyDataL -// --------------------------------------------------------------------------- -// -TBool CBSStorage::VerifyDataL( TArray aArray, - TBool aIgnoreEmptyID /* = EFalse */ ) - { - // Check that elements have unique ID's in their own namespace - TInt count = aArray.Count(); - for( TInt i = 0; i < count; i++ ) - { - // Verify inside list elements - if( aArray[i]->ElementType() == EBSList ) - { - TArray listArray = aArray[i]->GetStructureL(); - if( !VerifyDataL( listArray, ETrue ) ) - { - return EFalse; - } - } - - if( aIgnoreEmptyID && - aArray[i]->ElementId().CompareC( KNullDesC8() ) == 0 ) - { - // ignore empty id - continue; - } - - // Check that sibling elements have unique ID - for( TInt j = i + 1; j < count; j++ ) - { - if( aArray[i]->ElementId().CompareC( aArray[j]->ElementId() ) == 0 ) - { - // convert elementID to 16-bit for event logger - TPtrC8 id( aArray[i]->ElementId() ); - HBufC* conv = HBufC::NewLC( id.Length() ); - TPtr uniptr( conv->Des() ); - CnvUtfConverter::ConvertToUnicodeFromUtf8( uniptr, id ); - TRACE( T_LIT("ERROR: Found duplicate element ID (%S)!"), &uniptr ); - CleanupStack::PopAndDestroy(); - return EFalse; - } - } - } - - // All elements ok - return ETrue; - } - - -// --------------------------------------------------------------------------- -// CBSStorage::VerifyDataL -// --------------------------------------------------------------------------- -// -TBool CBSStorage::VerifyDataL( RBSObjOwningPtrArray& aArray, - TBool aIgnoreEmptyID /* = EFalse */ ) - { - return VerifyDataL( aArray.Array(), aIgnoreEmptyID ); - } - - -// --------------------------------------------------------------------------- -// CBSStorage::ProposeFileNameL -// --------------------------------------------------------------------------- -// -TPtrC CBSStorage::ProposeFileNameL() - { - if( !iFilename ) - { - User::Leave( KErrNotReady ); - } - return iFilename->Des(); - } - -// --------------------------------------------------------------------------- -// CBSStorage::ProposeFileNameL -// --------------------------------------------------------------------------- -// -TPtrC CBSStorage::ProposedDirL() - { - if( !iFilename ) - { - User::Leave( KErrNotReady ); - } - return iDir; - } - - -// --------------------------------------------------------------------------- -// CBSStorage::GetListOfFiles() -// --------------------------------------------------------------------------- -// -void CBSStorage::GetListOfFilesL( RArray& aFileList ) - { - TInt count = iElements.Count(); - for( TInt i = 0; i < count; i++ ) - { - AppendFilesL( iElements[i], aFileList ); - } - } - -// --------------------------------------------------------------------------- -// CBSStorage::AppendFiles() -// --------------------------------------------------------------------------- -// -void CBSStorage::AppendFilesL( MBSElement* aElement, RArray& aFileList ) - { - if( !aElement ) - { - // invalid element - return; - } - - TBSElementType type = aElement->ElementType(); - if( EBSList == type ) - { - TArray list = aElement->GetStructureL(); - - TInt count = list.Count(); - for( TInt i = 0; i < count; i++ ) - { - AppendFilesL( list[i], aFileList ); - } - } - else if( EBSFile == type ) - { - TPtrC ptr( aElement->TextDataL() ); - aFileList.Append( aElement->TextDataL() ); - } - } - -// End of file diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsserver/cbsstorage.h --- a/brandingserver/bsserver/cbsstorage.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,171 +0,0 @@ -/* -* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Stores element data and writes it to stream -* -*/ - - -#ifndef CBSSTORAGE_H -#define CBSSTORAGE_H - -#include - -#include "rbsobjowningptrarray.h" - -class MBSElement; -class RWriteStream; -class MBSImportLogger; - - -/** - * Stores element data and writes it to stream - * - * @lib brandimporter.exe - * @since S60 v3.2 - */ -class CBSStorage : public CBase -{ -public: - - static CBSStorage* NewL(); - - static CBSStorage* NewLC(); - - ~CBSStorage(); - - /** - * Set version of brand storage - * - * @since S60 3.2 - * @param aVersion version - */ - void SetVersion( TInt aVersion ); - - /** - * Set application ID of brand storage - * - * @since S60 3.2 - * @param aAppId application ID - * @return none - */ - void SetApplicationIdL( const TDesC& aAppId ); - - /** - * Set storage ID of brand storage - * - * @since S60 3.2 - * @param aStorageId storage ID - * @return none - */ - void SetStorageIdL( const TDesC& aStorageId ); - - /** - * Set language of brand storage - * - * @since S60 3.2 - * @param aLanguage language - * @return none - */ - void SetLanguageL( TLanguage aLanguage ); - - /** - * Store element to storage. Storage takes the ownership of element. - * - * @since S60 3.2 - * @param aElement element to store. - * @return General Symbian errorcode. - */ - void AppendElementsL( MBSElement* aElement ); - - /** - * Return the count of elements in storage - * - * @since S60 3.2 - * @return count of elements - */ - TInt ElementCount(); - - /** - * Externalize storage into stream - * - * @since S60 3.2 - * @param aWriteStream output stream - * @return none - */ - void ExternalizeL( RWriteStream& aWriteStream ); - - /** - * Replaces an element in the storage - * - * @since S60 3.2 - * @param aElement the element to be replaced - */ - void ReplaceElementL( MBSElement* aElement ); - - - TPtrC ProposeFileNameL(); - TPtrC ProposedDirL(); - void GetListOfFilesL( RArray& aFileList ); - -private: - - CBSStorage(); - - void ConstructL(); - - /** - * Check that header information is complete - * - * @since S60 3.2 - * @return ETrue - header information ok - * EFalse - header information missing or incomplete - */ - TBool VerifyHeader(); - - TBool VerifyDataL( TArray aArray, - TBool aIgnoreEmptyID = EFalse ); - TBool VerifyDataL( RBSObjOwningPtrArray& aArray, - TBool aIgnoreEmptyID = EFalse ); - - void HandleIfErrorL( TInt aError, const TDesC& aText ); - - void AppendFilesL( MBSElement* aElement, RArray& aFileList ); - -private: // Data - - // Own. Array of stored elements. - RBSObjOwningPtrArray iElements; - - // Own. Proposed file name - HBufC* iFilename; - - // Proposed directory (points to iFilename) - TPtrC iDir; - - // HEADER DATA - - // Version number of storage - TInt iVersion; - - // Own. Language ID of storage - HBufC* iLanguage; - - // Own. Application ID of storage - HBufC* iAppId; - - // Own. Storage ID.of storage - HBufC* iStorageId; -}; - -#endif //CBSSTORAGE_H diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsserver/cbsstoragemanager.cpp --- a/brandingserver/bsserver/cbsstoragemanager.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1424 +0,0 @@ -/* -* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Stores element data and writes it to stream -* -*/ - - -#include -#include -#include - -#include -#include - - -#include "bsimportconstants.h" -#include "cbsstoragemanager.h" -#include "cbsstorage.h" -#ifdef __WINSCW__ -#include "cbsibywriter.h" -#endif -#include "cbsserver.h" -#include "cbssession.h" -#include "mbsupdater.h" -//#include "importlogwriter.h" -#include "debugtrace.h" - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CBSStorageManager::NewL -// --------------------------------------------------------------------------- -// -CBSStorageManager* CBSStorageManager::NewL( CBSSession* aSession, const TDesC& aAppId ) - { - CBSStorageManager* self = NewLC( aSession, aAppId ); - CleanupStack::Pop(); - return self; - } - -// --------------------------------------------------------------------------- -// CBSStorageManager::NewLC -// --------------------------------------------------------------------------- -// -CBSStorageManager* CBSStorageManager::NewLC( CBSSession* aSession, const TDesC& aAppId ) - { - CBSStorageManager* self = - new (ELeave) CBSStorageManager(); - CleanupStack::PushL( self ); - self->ConstructL( aSession, aAppId ); - return self; - } - -// --------------------------------------------------------------------------- -// CBSStorageManager::ConstructL -// --------------------------------------------------------------------------- -// -void CBSStorageManager::ConstructL( CBSSession* aSession, const TDesC& aAppId ) - { - TRACE( T_LIT( "CBSStorageManager::ConstructL begin aAppId[%S]"), &aAppId ); - User::LeaveIfError( iFs.Connect() ); - -// RFs::ShareProtected() needs to be called for the session -// used to open the handle that is going to be shared. -// ShareProtected() was called to a wrong Fs-session in -// CBSBrandHandler::GetFileL(). - User::LeaveIfError( iFs.ShareProtected() ); - - iFs.CreatePrivatePath( EDriveC ); - - iSession = aSession; - - -#ifdef __WINSCW__ - if( !iWriter ) - { - iWriter = CBSIBYWriter::NewL(); - } - if( aAppId.Compare( KNullDesC ) ) - { - HBufC* temp = HBufC::NewL( KBSIbyDirectory().Length() + - aAppId.Length() + - KBSIbyExtension().Length() ); - TPtr ptr( temp->Des() ); - ptr.Append( KBSIbyDirectory ); - ptr.Append( aAppId ); - ptr.Append( KBSIbyExtension ); - delete iIbyFile; - iIbyFile = temp; - iWriter->InitIbyFileL( iFs, *iIbyFile ); - } -#endif - TRACE( T_LIT( "CBSStorageManager::ConstructL end") ); - } - -// --------------------------------------------------------------------------- -// CBSStorageManager::CBSStorageManager -// --------------------------------------------------------------------------- -// -CBSStorageManager::CBSStorageManager() : - iCurrent( KErrNotFound ) - { - } - -// --------------------------------------------------------------------------- -// CBSStorageManager::~CBSStorageManager -// --------------------------------------------------------------------------- -// -CBSStorageManager::~CBSStorageManager() - { - TRACE( T_LIT( "CBSStorageManager::~CBSStorageManager begin") ); - iStorages.ResetAndDestroy(); - iFs.Close(); - - delete iAppId; - delete iBrandId; - delete iLanguageId; - delete iFilename; - - #ifdef __WINSCW__ - delete iWriter; - #endif - - delete iIbyFile; - TRACE( T_LIT( "CBSStorageManager::~CBSStorageManager end") ); - } - -// --------------------------------------------------------------------------- -// CBSStorageManager::InitTransactionL -// --------------------------------------------------------------------------- -// -void CBSStorageManager::ConnectTransactionL(const TDesC& aAppId, - const TDesC& aBrandId, - TLanguage aLanguageId, - TBool aAppending, /*= EFalse*/ - TInt aReserved /*=0*/) - { - TRACE( T_LIT( "CBSStorageManager::ConnectTransactionL begin AppId[%S],BrandId[%S]"),&aAppId, &aBrandId ); - if( iActive ) - { - TBool transactionOk = ETrue; - - transactionOk = iReserved == aReserved; - - if( transactionOk ) - { - transactionOk = iLanguageIdNum == aLanguageId; - } - - if( transactionOk ) - { - transactionOk != iAppId->Compare( aAppId ); - } - - if( transactionOk ) - { - transactionOk != iBrandId->Compare( aBrandId ); - } - - if( !transactionOk ) - { - User::Leave( KErrArgument ); - } - // the same transaction as is ongoing - return; - } - iActive = ETrue; - - HBufC* tmpAppId = aAppId.AllocL(); - delete iAppId; - iAppId = tmpAppId; - - HBufC* tmpBrandId = aBrandId.AllocL(); - delete iBrandId; - iBrandId = tmpBrandId; - - iLanguageIdNum = aLanguageId; - - TBuf buffer; - if( aLanguageId < 10 ) - { - // we want two digit languageid - buffer.AppendNum( KLeadingZero ); - } - buffer.AppendNum( aLanguageId ); - HBufC* tmp = buffer.AllocL(); - delete iLanguageId; - iLanguageId = tmp; - - iReserved = aReserved; - - HBufC* tempFile = ConstructFileNameL(); - delete iFilename; - iFilename = tempFile; - - iAppending = aAppending; - TRACE( T_LIT( "CBSStorageManager::ConnectTransactionL end") ); - } - - -// --------------------------------------------------------------------------- -// CBSStorageManager::CancelTransactionL -// --------------------------------------------------------------------------- -// -void CBSStorageManager::CancelTransactionL() - { - TRACE( T_LIT( "CBSStorageManager::CancelTransactionL begin") ); - if( !iActive ) - { - User::Leave( KErrNotFound ); - } - // this closes the transaction - CleanupTransaction(); - TRACE( T_LIT( "CBSStorageManager::CancelTransactionL end") ); - } - -// --------------------------------------------------------------------------- -// CBSStorageManager::ConstructFileNameL() -// --------------------------------------------------------------------------- -// -HBufC* CBSStorageManager::ConstructFileNameL( TInt aReserved /* = 0 */ ) - { - HBufC* fileName = NULL; - if( iAppId && iBrandId && iLanguageId ) - { - fileName = ConstructFileNameL( *iAppId, *iBrandId, iLanguageIdNum, aReserved ); - } - return fileName; - } - -// --------------------------------------------------------------------------- -// CBSStorageManager::ConstructFileNameL() -// --------------------------------------------------------------------------- -// -HBufC* CBSStorageManager::ConstructFileNameL( const TDesC& aAppId, - const TDesC& aBrandId, - TLanguage aLanguage, - TInt aReserved /* = 0 */ ) - { - HBufC* fileName = NULL; - - TBuf langBuf; - if (aLanguage >= 100) - User::LeaveIfError (KErrNotFound); - if( aLanguage < 10 ) - { - // we want two digit languageid - langBuf.AppendNum( KLeadingZero ); - } - langBuf.AppendNum( aLanguage ); - - TInt length = aAppId.Length() + aBrandId.Length() + - KDefFileName().Length() + KDirSeparator().Length() * 2 + - langBuf.Length() + KDot().Length() * 3 + KMaxVersionLenght; - fileName = HBufC::NewLC( length ); - - TPtr file( fileName->Des() ); - - // [application_id]\[brand_id]\[def_filename][language_id] - // - - file.Append( aAppId ); - file.Append( KDirSeparator ); - file.Append( aBrandId ); - file.Append( KDirSeparator ); - iDir.Set( file.Left( file.Length() ) ); - file.Append( KDefFileName ); - file.Append( langBuf ); - if( aReserved > 0 ) - { - TBuf versionBuffer; - versionBuffer.AppendNum( aReserved ); - file.Append( KDot() ); - file.Append( versionBuffer ); - } - - if( fileName ) - { - CleanupStack::Pop( fileName ); - } - return fileName; - } - -// --------------------------------------------------------------------------- -// CBSStorageManager::CreateStorageL -// --------------------------------------------------------------------------- -// -void CBSStorageManager::CreateStorageL() - { - CBSStorage* tmp = CBSStorage::NewL(); - iStorages.Append( tmp ); - iCurrent = iStorages.Find( tmp ); - } - -// --------------------------------------------------------------------------- -// CBSStorageManager::StorageCount -// --------------------------------------------------------------------------- -// -TInt CBSStorageManager::StorageCount() - { - return iStorages.Count(); - } - -// --------------------------------------------------------------------------- -// CBSStorageManager::Storage -// --------------------------------------------------------------------------- -// -CBSStorage* CBSStorageManager::Storage( TInt aIndex ) - { - return iStorages[ aIndex ]; - } - -// --------------------------------------------------------------------------- -// CBSStorageManager::Storage -// --------------------------------------------------------------------------- -// -CBSStorage* CBSStorageManager::Storage() - { - if( iStorages.Count() > 0 ) - { - return iStorages[ iCurrent ]; - } - return NULL; - } - -// --------------------------------------------------------------------------- -// CBSStorageManager::WriteStorageFilesL -// --------------------------------------------------------------------------- -// -TInt CBSStorageManager::WriteStorageFilesL() - { - TRACE( T_LIT( "CBSStorageManager::WriteStorageFilesL begin") ); - if( !iActive ) - { - User::Leave( KErrNotFound ); - } - TInt count = iStorages.Count(); - for( TInt i = 0; i < count; i++ ) - { - // get the private path - TBuf path; - User::LeaveIfError( iFs.PrivatePath( path ) ); - - // construct absolute filename - HBufC* fullname = FullFileNameLC( *iFilename, ETrue ); - - TParse filestorename; - iFs.Parse( *fullname, filestorename ); - - RFileWriteStream outstream; - - TInt currentVersion = iReserved; - TInt newVersion = iReserved; - // check if the brand has any active clients - TBool brandActive = ETrue; - if( iSession ) - { - CBSServer* server = iSession->Server(); - if( server ) - { - brandActive = server->MatchSessionL( *iAppId, *iBrandId, - iLanguageIdNum, iSession, currentVersion ); - } - } - - if( BaflUtils::FileExists( iFs, filestorename.FullName() ) ) - { - currentVersion = ReadVersionL( filestorename.FullName() ); - - if( iReserved == KBSAutomaticVersionUpdate && brandActive ) - { - - // the brand has active clients - // check if there is already a versioned file for this version - HBufC* fileName = FindAvailableVersionL( currentVersion + 1, newVersion ); - CleanupStack::PushL( fileName); - - HBufC* newName = FullFileNameLC( *fileName, ETrue ); - - iFs.Parse( *newName, filestorename ); - - if( BaflUtils::FileExists( iFs, filestorename.FullName() ) ) - { - // the file already exists - User::Leave( KErrAlreadyExists ); - } - CleanupStack::PopAndDestroy( 2, fileName ); // newName, fileName - } - - else if( ( iReserved == currentVersion ) ) - { - // this version is already installed - User::Leave( KErrAlreadyExists ); - } - - else - { - // check if the current version brand is active - brandActive = iSession->Server()->MatchSessionL( *iAppId, *iBrandId, - iLanguageIdNum, iSession, currentVersion ); - // new version - if( brandActive ) - { - // brand is active - // check if there is already a versioned file for this version - HBufC* fileName = ConstructFileNameL( iReserved ); - CleanupStack::PushL( fileName ); - - HBufC* newName = FullFileNameLC( *fileName, ETrue ); - - iFs.Parse( *newName, filestorename ); - - if( BaflUtils::FileExists( iFs, filestorename.FullName() ) ) - { - // the file already exists - User::Leave( KErrAlreadyExists ); - } - CleanupStack::PopAndDestroy( 2, fileName ); // newName, fileName - } - } - } - - - // write a new brand file - - // Construct the output file & stream. - iFs.MkDirAll( filestorename.DriveAndPath() ); - - TInt err = outstream.Replace( iFs, filestorename.FullName(), EFileWrite ); - - - if( err ) - { - TRACE( T_LIT("ERROR: Cannot create branding file: '%S'"), fullname ); - - User::Leave( err ); - } - - CleanupClosePushL( outstream ); - - if( iReserved == KBSAutomaticVersionUpdate ) - { - // set the next version - iStorages[i]->SetVersion( newVersion ); - iReserved = newVersion; - } - - // Write data to file - TRAPD( extError, iStorages[i]->ExternalizeL( outstream ) ); - if( extError && !iAppending ) - { - // there was an error externalizing the data and we are installing - // delete the file, since it's not complete - iFs.Delete( filestorename.DriveAndPath() ); - } - User::LeaveIfError( extError ); - - -#ifdef __WINSCW__ - // Add to IBY file - iWriter->SetFileItemL( *fullname, *fullname ); -#endif - - CleanupStack::PopAndDestroy( 2 ); // fullname, outstream - - - // existing brand modified --> inform server - if( iSession ) - { - CBSServer* server = iSession->Server(); - if( server ) - { - server->BrandUpdatedL( *iAppId, *iBrandId, - iLanguageIdNum, iSession, iReserved ); - } - } - } - - // this closes the transaction - CleanupTransaction(); - TRACE( T_LIT( "CBSStorageManager::WriteStorageFilesL end") ); - return iReserved; - } - - -// --------------------------------------------------------------------------- -// CBSStorageManager::ReadVersionL -// --------------------------------------------------------------------------- -// -TInt CBSStorageManager::ReadVersionL( const TDesC& aFilename ) - { - RFile handle; - User::LeaveIfError( handle.Open( iFs, aFilename, EFileRead ) ); - CleanupClosePushL( handle ); - RFileReadStream stream; - stream.Attach( handle ); - CleanupClosePushL( stream ); - TInt version = stream.ReadInt16L(); - CleanupStack::PopAndDestroy( 2 ); // stream, handle - return version; - } - -// --------------------------------------------------------------------------- -// CBSStorageManager::FindAvailableVersionL -// --------------------------------------------------------------------------- -// -HBufC* CBSStorageManager::FindAvailableVersionL( TInt /*aCurrentVersion*/, TInt& aNewVersion ) - { - HBufC* fileName = NULL; - TInt newVersion = GetNewestVersionL( *iAppId, *iBrandId, iLanguageIdNum ); - aNewVersion = newVersion++; - fileName = ConstructFileNameL( aNewVersion ); - - return fileName; - } - - -// --------------------------------------------------------------------------- -// CBSStorageManager::CleanupTransaction -// --------------------------------------------------------------------------- -// -void CBSStorageManager::CleanupTransaction() - { - iActive = EFalse; - delete iAppId; - iAppId = NULL; - delete iBrandId; - iBrandId = NULL; - delete iLanguageId; - iLanguageId = NULL; - delete iFilename; - iFilename = NULL; - - iStorages.ResetAndDestroy(); - } - - -TInt CBSStorageManager :: isActualBrandInstalledL ( const TDesC& aAppId, const TDesC& aBrandId, TLanguage aLanguage) -{ - TInt actualBrandInstalled = -1; - HBufC *actualBrandFileName = ConstructFileNameL(aAppId, aBrandId, aLanguage); - CleanupStack::PushL( actualBrandFileName ); - HBufC* newName = FullFileNameLC( *actualBrandFileName , ETrue ); - if (newName) - { - RFile handle; - TInt err = handle.Open( iFs, *newName, EFileShareAny ); - if (KErrNone == err) - { - actualBrandInstalled = 1; - handle.Close (); - } - } - - CleanupStack::PopAndDestroy (2); - return actualBrandInstalled; -} -// --------------------------------------------------------------------------- -// CBSStorageManager::BrandHandleL -// --------------------------------------------------------------------------- -// -void CBSStorageManager::BrandHandleL( const TDesC& aAppId, - const TDesC& aBrandId, - TLanguage aLanguageId, - RFile& aFile, - TInt aReserved ) - { - TRACE( T_LIT( "CBSStorageManager::BrandHandleL begin AppId[%S],BrandId[%S]"),&aAppId, &aBrandId ); - TBuf langBuf; - if (aLanguageId >= 100) - User::LeaveIfError( KErrNotFound ); - if( aLanguageId < 10 ) - { - // we want two digit languageid - langBuf.AppendNum( KLeadingZero ); - } - langBuf.AppendNum( aLanguageId ); - - TInt length = aAppId.Length() + aBrandId.Length() + - KDefFileName().Length() + KDirSeparator().Length() * 2 + - langBuf.Length(); - - HBufC* fileName = HBufC::NewLC( length ); - - TPtr filePtr( fileName->Des() ); - - // [application_id]\[brand_id]\[def_filename][language_id] - // - filePtr.Append( aAppId ); - filePtr.Append( KDirSeparator ); - filePtr.Append( aBrandId ); - filePtr.Append( KDirSeparator ); - - TPtrC directory; - directory.Set( filePtr.Left( filePtr.Length() ) ); - - filePtr.Append( KDefFileName ); - filePtr.Append( langBuf ); - - HBufC* fullname = FullFileNameLC( filePtr ); - - RFile handle; - - TBool versioned = EFalse; - - TParse findname; - iFs.Parse( *fullname, findname ); - - TFileName fullPtr = fullname->Des(); - - - // seems like nearestlanguagefile is only - // searching from z-drive by default, unless - // some other drive is explicitely defined - // for that reason we first try from - // default drive and then force c-drive if - // not found. - BaflUtils::NearestLanguageFile( iFs, fullPtr ); - - TInt currentVersion = 0; - TRAPD( err, currentVersion = ReadVersionL( fullPtr ) ); - if( ( err == KErrNotFound ) || ( err == KErrPathNotFound ) ) - { - // not found, we try forcing c-drive - HBufC* driveForced = FullFileNameLC( filePtr, ETrue ); - TFileName forcedPtr = driveForced->Des(); - BaflUtils::NearestLanguageFile( iFs, forcedPtr ); - TRAP( err, currentVersion = ReadVersionL( forcedPtr ) ); - - if( err == KErrPathNotFound ) - { - // switching the error code to be more clear - err = KErrNotFound; - } - User::LeaveIfError( err ); - - // this file was found, we can use this - CleanupStack::Pop( driveForced ); - CleanupStack::PopAndDestroy( fullname ); - fullname = driveForced; - CleanupStack::PushL( fullname ); - } - else - { - User::LeaveIfError( err ); - } - err = KErrNone; - if( currentVersion != aReserved ) - { - // not the base version, check if we have a versioned file for this - HBufC* versionedName = ConstructFileNameL( aAppId, aBrandId, - aLanguageId, aReserved ); - CleanupStack::PushL( versionedName ); - HBufC* fullVersionedName = FullFileNameLC( *versionedName, ETrue ); - - err = handle.Open( iFs, *fullVersionedName, EFileShareAny ); - CleanupStack::Pop( fullVersionedName ); - CleanupStack::PopAndDestroy( versionedName ); - CleanupStack::PopAndDestroy( fullname ); - fullname = fullVersionedName; - CleanupStack::PushL( fullname ); - versioned = ETrue; - } - else - { - err = handle.Open( iFs, *fullname, EFileShareAny ); - } - - if( err == KErrBadName ) - { - // change bad name to not found - err = KErrNotFound; - } - User::LeaveIfError( err ); - - aFile = handle; - - if( iSession ) - { - CBSServer* server = iSession->Server(); - if( server ) - { - server->RegisterFileForSessionL( iSession, *fullname, versioned ); - } - } - - CleanupStack::PopAndDestroy( 2, fileName ); // fullname, fileName - TRACE( T_LIT( "CBSStorageManager::BrandHandleL end") ); - } - -// --------------------------------------------------------------------------- -// CBSStorageManager::FileElementHandleL -// --------------------------------------------------------------------------- -// -void CBSStorageManager::FileElementHandleL( const TDesC& aAppId, - const TDesC& aBrandId, - const TDesC& aFileName, - const TDesC& aLanguageBuf, - RFile& aFile ) - { - TRACE( T_LIT( "CBSStorageManager::FileElementHandleL begin AppId[%S],BrandId[%S],Filename[%S]"),&aAppId, &aBrandId, &aFileName ); -// Modified file name format: "r[n].filename.ext", -// where "n" is the language code. -// Format used to be "filename.ext.r[n]". - HBufC* internalFn = HBufC::NewLC( aFileName.Length() - + KBSFileLangSuffix().Length() - + aLanguageBuf.Length() - + KDot().Length() ); - TPtr pInternalFn( internalFn->Des() ); - pInternalFn.Append( KBSFileLangSuffix() ); - pInternalFn.Append( aLanguageBuf ); - pInternalFn.Append( KDot() ); - pInternalFn.Append( aFileName ); - - TInt length = aAppId.Length() - + aBrandId.Length() - + pInternalFn.Length() - + ( KDirSeparator().Length() * 3 ) - + KFileElementStore().Length(); - - HBufC* fileName = HBufC::NewL( length ); // replaced NewLC with NewL - - TPtr filePtr( fileName->Des() ); - - // [application_id]\[brand_id]\files\[aFilename] - // - filePtr.Append( aAppId ); - filePtr.Append( KDirSeparator ); - filePtr.Append( aBrandId ); - filePtr.Append( KDirSeparator ); - filePtr.Append( KFileElementStore ); - filePtr.Append( KDirSeparator ); - filePtr.Append( pInternalFn ); - - CleanupStack::PopAndDestroy( internalFn ); - internalFn = NULL; - pInternalFn.Set( 0, 0, 0 ); - - CleanupStack::PushL( fileName ); - HBufC* fullname = FullFileNameLC( filePtr ); - -// Make a TPtr instead of TFileName because after mod, "fullPtr" -// does not need to be passed to BaflUtils::NearestLanguageFile() -// old implementation: TFileName fullPtr = fullname->Des(); - TPtr fullPtr( fullname->Des() ); - - -// A few thoughts about language suffix of files: -// NOTE: NOT about brand file (e.g. "brandfile.bin.r99" ), -// but about other files which belong to the branding package, -// since language suffix added by branding server to a -// mif-file is not acceptable later when calling -// AknIconUtils::CreateIconLC() on the mif-file. -// Skipped call to BaflUtils::NearestLanguageFile() because "XSP MOD" -// moves language code from suffix to prefix. -// NearestLanguageFile()-call could be replaced by an op where -// manager seeks a file only from c and z, or from all drives, -// but does so only for file matching to current or requested -// language. Meaning will not try to get the nearest language -// file but the matching one. -// If nearest language file is actually needed, then -// manager could for example implement a seek-function similar to -// BaflUtils::NearestLanguageFile(), but with the difference that -// it will inspect file prefix instead of suffix. - - - RFile handle; -// RFs::ShareProtected() needs to be called for the Fs-session -// used to open the handle that is about to be shared. -// ShareProtected() was called to a wrong Fs session in -// CBSBrandHandler::GetFileL()! - TInt err = handle.Open( iFs, fullPtr, EFileShareReadersOnly ); - if( err == KErrPathNotFound ) - { - // not found, we try forcing c-drive - HBufC* driveForced = FullFileNameLC( filePtr, ETrue ); - - TFileName forcedPtr = driveForced->Des(); - - - err = handle.Open( iFs, forcedPtr, EFileShareReadersOnly ); - User::LeaveIfError( err ); - // this file was found, we can use this - CleanupStack::Pop( driveForced ); - CleanupStack::PopAndDestroy( fullname ); - fullname = driveForced; - CleanupStack::PushL( fullname ); - } - else - { - User::LeaveIfError( err ); - } - - CleanupStack::PopAndDestroy( 2, fileName ); // fullname, fileName - aFile = handle; - TRACE( T_LIT( "CBSStorageManager::FileElementHandleL end") ); - } - - -// --------------------------------------------------------------------------- -// CBSStorageManager::FullFileNameLC -// --------------------------------------------------------------------------- -// -HBufC* CBSStorageManager::FullFileNameLC( const TDesC& aFilename, TBool aForceCDrive /*= EFalse*/ ) - { - // get the private path - TBuf path; - User::LeaveIfError( iFs.PrivatePath( path ) ); - - // construct absolute filename - HBufC* fullname = HBufC::NewLC( KBSCDrive().Length() + aFilename.Length() + path.Length() + - KBSDataStore().Length() + KDirSeparator().Length() ); - TPtr fullPtr( fullname->Des() ); - fullPtr.Append( KBSCDrive ); - fullPtr.Append( path ); - fullPtr.Append( KBSDataStore ); - fullPtr.Append( KDirSeparator ); - fullPtr.Append( aFilename ); - - TParse filename; - iFs.Parse( fullPtr, filename ); - - if( !aForceCDrive ) - { - // C-drive not explicitely requested - if( !BaflUtils::FileExists( iFs, fullPtr ) ) - { - // the file does not exist in C-drive, so - // we have to return a path to Z-drive - fullPtr.Zero(); - fullPtr.Append( KBSZDrive ); - fullPtr.Append( path ); - fullPtr.Append( KBSDataStore ); - fullPtr.Append( KDirSeparator ); - fullPtr.Append( aFilename ); - } - } - - return fullname; - } - -// --------------------------------------------------------------------------- -// CBSStorageManager::CleanupFileL -// --------------------------------------------------------------------------- -// -void CBSStorageManager::CleanupFileL( const TDesC& aFileName ) - { - TRACE( T_LIT( "CBSStorageManager::CleanupFileL begin") ); - // we have a versioned file we need to clean up - // get the file name without the version information - if( !IsBaseFileL( aFileName) ) - { - // this is not a basefile - // we need to check if basefile should be replaced - // with this one - TPtrC baseFile = FilenameWithoutVersion( aFileName ); - TInt version = ReadVersionL( aFileName ); - TInt baseVersion = ReadVersionL( baseFile ); - if( version > baseVersion ) - { - // newer version --> replace basefile - TInt err = iFs.Replace( aFileName, baseFile); - User::LeaveIfError( err ); - } - else - { - // same or older version --> delete - TInt err = iFs.Delete( aFileName ); - User::LeaveIfError( err ); - } - } - else - { - // this is a basefile - // we need to check if there are any newer versioned files - // that are not in use - - TParse filename; - iFs.Parse( aFileName, filename ); - TPtrC driveAndPath = filename.DriveAndPath(); - - HBufC* nameWithDrive = HBufC::NewLC( aFileName.Length() + KBSCDrive().Length() ); - TPtr nameWithDrivePtr = nameWithDrive->Des(); - - nameWithDrivePtr.Append( aFileName ); - - CDir* files = NULL; - CDir* directories = NULL; - - User::LeaveIfError( iFs.GetDir( driveAndPath, KEntryAttNormal, ESortByName, files, directories ) ); - - CleanupStack :: PushL (files); - CleanupStack :: PushL (directories); - - TInt count = files->Count(); - for( TInt i = 0; i < count; i++ ) - { - const TEntry file = (*files)[ i ]; - TBufC name = file.iName; - - HBufC* fullName = HBufC::NewLC( driveAndPath.Length() + name.Length() ); - TPtr fullPtr = fullName->Des(); - - fullPtr.Append( driveAndPath ); - fullPtr.Append( name ); - - TPtrC strippedName = FilenameWithoutVersion( *fullName ); - - if( 0 == strippedName.Compare( nameWithDrivePtr ) ) - { - // there is a versioned file, that might be newer - // than the basefile - TInt baseVersion = ReadVersionL( nameWithDrivePtr ); - - TInt versionedVersion = ReadVersionL( fullPtr ); - if( versionedVersion > baseVersion ) - { - // versioned file newer than base file - // check if the versioned file is still in use - if( !iSession->Server()->FileStillInUse( iSession, fullPtr ) ) - { - // the file is not in use, we can replace the basefile - // with the versioned file - TInt err = iFs.Replace( fullPtr, nameWithDrivePtr ); - User::LeaveIfError( err ); - } - } - } - CleanupStack::PopAndDestroy( fullName ); - } - - CleanupStack :: PopAndDestroy (directories); - CleanupStack :: PopAndDestroy (files); - CleanupStack :: PopAndDestroy (nameWithDrive); - } - TRACE( T_LIT( "CBSStorageManager::CleanupFileL end") ); - } - -// --------------------------------------------------------------------------- -// CBSStorageManager::FilenameWithoutVersionL -// --------------------------------------------------------------------------- -// -TPtrC CBSStorageManager::FilenameWithoutVersion( const TDesC& aFileName ) - { - TParse filename; - iFs.Parse( aFileName, filename ); - TPtrC extension = filename.Ext(); - TPtrC strippedName = aFileName.Left( aFileName.Length() - ( extension.Length() ) ); - return strippedName; - } - - -// --------------------------------------------------------------------------- -// CBSStorageManager::IsBaseFileL -// --------------------------------------------------------------------------- -// -TBool CBSStorageManager::IsBaseFileL( const TDesC& aFileName ) - { - TBool returnValue = ETrue; - TPtrC fileName = FilenameWithoutVersion( aFileName ); - if( BaflUtils::FileExists( iFs, fileName ) ) - { - // file with one extension stripped out exists - // --> the file was not a base file - returnValue = EFalse; - } - return returnValue; - } - -// --------------------------------------------------------------------------- -// CBSStorageManager::InstallFile -// --------------------------------------------------------------------------- -// -HBufC* CBSStorageManager::InstallFileLC( const TDesC& aFileName ) - { - TRACE( T_LIT( "CBSStorageManager::InstallFileLC begin") ); - if( !iAppId || !iBrandId ) - { - User::Leave( KErrNotReady ); - } - TParse filename; - iFs.Parse( aFileName, filename ); - - TInt length = iAppId->Length() + iBrandId->Length() + - aFileName.Length() + KDirSeparator().Length() * 3 - + KFileElementStore().Length() + iLanguageId->Length() - + KDot().Length() + KBSFileLangSuffix().Length(); - - HBufC* fileName = HBufC::NewLC( length ); - - TPtr filePtr( fileName->Des() ); - - filePtr.Append( *iAppId ); - filePtr.Append( KDirSeparator ); - filePtr.Append( *iBrandId ); - filePtr.Append( KDirSeparator ); - filePtr.Append( KFileElementStore ); - filePtr.Append( KDirSeparator ); - filePtr.Append( KBSFileLangSuffix() ); - filePtr.Append( *iLanguageId ); - filePtr.Append( KDot() ); - filePtr.Append( filename.NameAndExt() ); - - HBufC* fullname = FullFileNameLC( filePtr, ETrue ); - - TParse directory; - iFs.Parse( *fullname, directory ); - TPtrC ptr = directory.DriveAndPath(); - TInt dirError = iFs.MkDirAll( directory.DriveAndPath() ); - if( dirError == KErrAlreadyExists ) - { - // ignore already exists - dirError = KErrNone; - } - User::LeaveIfError( dirError ); - - CFileMan* fileMan = CFileMan::NewL( iFs ); - CleanupStack::PushL( fileMan ); - - // copy the file, no overwriting - TInt err = fileMan->Copy( aFileName, *fullname, 1 ); - User::LeaveIfError( err ); - -#ifdef __WINSCW__ - // Add to IBY file - iWriter->SetFileItemL( *fullname, *fullname ); -#endif - - CleanupStack::PopAndDestroy( 3, fileName ); // fileMan, fullname, fileName - - - HBufC* returnValue = filename.NameAndExt().AllocLC(); - TRACE( T_LIT( "CBSStorageManager::InstallFileLC end") ); - return returnValue; - } - - -// --------------------------------------------------------------------------- -// CBSStorageManager::RemoveBrandL -// --------------------------------------------------------------------------- -// -void CBSStorageManager::RemoveBrandL( const TDesC& aAppId, - const TDesC& aBrandId, - TLanguage aLanguageId, - TInt aReserved ) - { - TRACE( T_LIT( "CBSStorageManager::RemoveBrandL begin") ); - HBufC* fileName = ConstructFileNameL( aAppId, - aBrandId, - aLanguageId, - aReserved ); - CleanupStack::PushL( fileName ); - - HBufC* fullname = FullFileNameLC( *fileName, ETrue ); - - TParse parseName; - iFs.Parse( *fullname, parseName ); - - TPtrC directory = parseName.DriveAndPath(); - - CFileMan* fileMan = CFileMan::NewL( iFs ); - CleanupStack::PushL( fileMan ); - - // delete all files under this brand and language - TInt err = fileMan->RmDir( directory ); - TRACE( T_LIT( "CBSStorageManager::RemoveBrandL dir='%S' err=%d "), &directory, err ); - - //in case the removal of the entire brand failed because the brand was - //in use, we set this brand as discarded (since parts of the package - //might have been removed) - if ( KErrInUse == err ) - { - MarkBrandAsDiscardedL( aAppId, aBrandId ); - } - - User::LeaveIfError( err ); - - CleanupStack::PopAndDestroy( 3, fileName ); - TRACE( T_LIT( "CBSStorageManager::RemoveBrandL end ") ); - } - -// --------------------------------------------------------------------------- -// CBSStorageManager::RemoveApplicationL -// --------------------------------------------------------------------------- -// -void CBSStorageManager::RemoveApplicationL( const TDesC& aAppId ) - { - TRACE( T_LIT( "CBSStorageManager::RemoveApplicationL begin") ); - TInt length = aAppId.Length() + - KDefFileName().Length() + KDirSeparator().Length(); - - - HBufC* fileName = HBufC::NewLC( length ); - - TPtr file( fileName->Des() ); - - file.Append( aAppId ); - file.Append( KDirSeparator ); - - HBufC* fullName = FullFileNameLC( *fileName, ETrue ); - - CFileMan* fileMan = CFileMan::NewL( iFs ); - CleanupStack::PushL( fileMan ); - - // delete all files under this brand and language - TInt err = fileMan->RmDir( *fullName ); - User::LeaveIfError( err ); - - CleanupStack::PopAndDestroy( 3, fileName ); - TRACE( T_LIT( "CBSStorageManager::RemoveApplicationL end") ); - } - - -// --------------------------------------------------------------------------- -// CBSStorageManager::NextAvailableVersionL -// --------------------------------------------------------------------------- -// -TInt CBSStorageManager::NextAvailableVersionL() - { - TRACE( T_LIT( "CBSStorageManager::NextAvailableVersionL begin") ); - TInt returnValue = 0; - - if( iAppId && iBrandId ) - { - TInt newVersion = 0; - TRAPD( err, newVersion = GetNewestVersionL( *iAppId, *iBrandId, iLanguageIdNum ) ); - if( err == KErrNotFound ) - { - // ignore not found -> we default to 1 - err = KErrNone; - returnValue = iReserved; - } - else - { - returnValue = newVersion + 1; - } - User::LeaveIfError( err ); - } - TRACE( T_LIT( "CBSStorageManager::NextAvailableVersionL end") ); - return returnValue; - } - - -// --------------------------------------------------------------------------- -// CBSStorageManager::NextAvailableVersionL -// --------------------------------------------------------------------------- -// -void CBSStorageManager::SetVersion( TInt aReserved ) - { - iReserved = aReserved; - } - - -// --------------------------------------------------------------------------- -// CBSStorageManager::GetCurrentVersionL -// --------------------------------------------------------------------------- -// -TInt CBSStorageManager::GetNewestVersionL( const TDesC& aAppId, - const TDesC& aBrandId, - TLanguage aLanguageId, - TPtr* aDrive /*= KNullDesC()*/ ) - { - TRACE( T_LIT( "CBSStorageManager::GetNewestVersionL begin") ); - HBufC* fileName = ConstructFileNameL( aAppId, aBrandId, aLanguageId ); - CleanupStack::PushL( fileName ); - - - // FullFileNameLC returns the file from C-drive if it exists there - // and if not, then from ROM - HBufC* fullFileName = FullFileNameLC( *fileName ); - - TParse parse; - iFs.Parse( *fullFileName, parse ); - TPtrC driveAndPath = parse.DriveAndPath(); - - CDir* files = NULL; - CDir* directories = NULL; - - TInt err = iFs.GetDir( driveAndPath, KEntryAttNormal, ESortByName, files, directories ); - if(KErrNone == err ) - { - if(aDrive) - { - (*aDrive).Copy(KBSZDrive); - } - - } - if( err == KErrPathNotFound ) - { - // not found from Z-drive, try from C-drive - CleanupStack::PopAndDestroy( fullFileName ); - fullFileName = FullFileNameLC( *fileName, ETrue ); - driveAndPath.Set( parse.DriveAndPath() ); - err = iFs.GetDir( driveAndPath, KEntryAttNormal, ESortByName, files, directories ); - if(KErrNone == err ) - { - if(aDrive) - { - (*aDrive).Copy(KBSCDrive); - } - } - if( err == KErrPathNotFound ) - { - // switching error code to make it more clear - err = KErrNotFound; - } - // as we are leaving here cleanup the stack - CleanupStack::PopAndDestroy( 2, fileName ); // fullFileName, fileName - User::LeaveIfError( err ); - } - - // get the base file version - TInt returnValue = ReadVersionL( *fullFileName ); - - TInt count = files->Count(); - for( TInt i = 0; i < count; i++ ) - { - const TEntry file = (*files)[ i ]; - TBufC name = file.iName; - - HBufC* fullName = HBufC::NewLC( driveAndPath.Length() + name.Length() ); - TPtr fullPtr = fullName->Des(); - - fullPtr.Append( driveAndPath ); - fullPtr.Append( name ); - - TPtrC strippedName = FilenameWithoutVersion( *fullName ); - - if( 0 == strippedName.Compare( *fullFileName ) ) - { - // there is a versioned file, that might be newer - // than the basefile - TInt versionedVersion = ReadVersionL( fullPtr ); - if( versionedVersion > returnValue ) - { - // versioned file newer than base file - returnValue = versionedVersion; - } - } - CleanupStack::PopAndDestroy( fullName ); - } - - CleanupStack::PopAndDestroy( 2, fileName ); // fullFileName, fileName - - TRACE( T_LIT( "CBSStorageManager::GetNewestVersionL end") ); - return returnValue; - } - - -// --------------------------------------------------------------------------- -// CBSStorageManager::WriteIbyFiles -// --------------------------------------------------------------------------- -// -TInt CBSStorageManager::WriteIbyFiles() - { - TInt err = KErrNone; -#ifdef __WINSCW__ - if( !iWriter ) - { - return KErrNone; - } - - TRAP( err, iWriter->WriteIBYFileL( iFs, *iIbyFile ) ); - delete iIbyFile; - iIbyFile = NULL; - delete iWriter; - iWriter = NULL; - -#endif - return err; - } - -// --------------------------------------------------------------------------- -// CBSStorageManager::LockStorage -// --------------------------------------------------------------------------- -// -void CBSStorageManager::LockStorage() - { - TRACE( T_LIT( "CBSStorageManager::LockStorage begin") ); - // This will disable all filehandles, so that clients can't use them - iFs.Close(); - TRACE( T_LIT( "CBSStorageManager::LockStorage end") ); - } - -// --------------------------------------------------------------------------- -// CBSStorageManager::ReleaseLockL -// --------------------------------------------------------------------------- -// -void CBSStorageManager::ReleaseLockL() - { - TRACE( T_LIT( "CBSStorageManager::ReleaseLockL begin") ); - User::LeaveIfError( iFs.Connect() ); - TRACE( T_LIT( "CBSStorageManager::ReleaseLockL end") ); - } - -// --------------------------------------------------------------------------- -// CBSStorageManager::CheckBrandDiscarded -// --------------------------------------------------------------------------- -// -TBool CBSStorageManager::CheckBrandDiscarded(const TDesC& aAppId, - const TDesC& aBrandId) -{ - TBool flag = EFalse ; - - HBufC *fileName = ConstructDiscardBrandFileNameL(aAppId, aBrandId) ; - CleanupStack::PushL(fileName); - HBufC *fullPath = FullDiscardBrandFileNameLC( *fileName ) ; - - // crate a flag file - RFile file; - TInt err = file.Open(iFs, *fullPath, EFileWrite); - if(err == KErrNone) - { - // file exists. - file.Close() ; - flag = ETrue ; - } - - CleanupStack::PopAndDestroy(fullPath) ; - CleanupStack::PopAndDestroy(fileName) ; - return flag ; -} - -// --------------------------------------------------------------------------- -// CBSStorageManager::ConstructDiscardBrandFileNameL -// --------------------------------------------------------------------------- -// -HBufC* CBSStorageManager::ConstructDiscardBrandFileNameL( const TDesC& aAppId, - const TDesC& aBrandId ) - { - HBufC* fileName = NULL; - - TInt length = aAppId.Length() + aBrandId.Length() + - KDiscardBrandFileName().Length() + KDirSeparator().Length() * 2 ; - fileName = HBufC::NewLC( length ); - - TPtr file( fileName->Des() ); - - // [application_id]\[brand_id]\discardedbrand.txt - file.Append( aAppId ); - file.Append( KDirSeparator ); - file.Append( aBrandId ); - file.Append( KDirSeparator ); - file.Append( KDiscardBrandFileName ); - - if( fileName ) - { - CleanupStack::Pop( fileName ); - } - - return fileName; - } - -// --------------------------------------------------------------------------- -// CBSStorageManager::FullDiscardBrandFileNameLC -// --------------------------------------------------------------------------- -// -HBufC* CBSStorageManager::FullDiscardBrandFileNameLC( TDesC& aFilename ) - { - // get the private path - TBuf path; - RFs fs ; - User::LeaveIfError( fs.Connect() ); - CleanupClosePushL(fs); - User::LeaveIfError( fs.PrivatePath( path ) ); - - // construct absolute filename - HBufC* fullname = HBufC::NewLC( KBSCDrive().Length() + aFilename.Length() + path.Length() + - KBSDataStore().Length() + KDirSeparator().Length() ); - TPtr fullPtr( fullname->Des() ); - fullPtr.Append( KBSCDrive ); - fullPtr.Append( path ); - fullPtr.Append( KBSDataStore ); - fullPtr.Append( KDirSeparator ); - fullPtr.Append( aFilename ); - - CleanupStack::Pop(); // fullname - CleanupStack::PopAndDestroy() ; //fs - CleanupStack::PushL(fullname) ; - - return fullname; - } - -// --------------------------------------------------------------------------- -// CBSStorageManager::MarkBrandAsDiscardedL -// --------------------------------------------------------------------------- -// -void CBSStorageManager::MarkBrandAsDiscardedL( const TDesC& aAppId, - const TDesC& aBrandId ) - { - TRACE( T_LIT( "CBSStorageManager::MarkBrandAsDiscardedL begin app='%S' brand='%S'"), &aAppId, &aBrandId ); - - HBufC *fileName = ConstructDiscardBrandFileNameL( aAppId, aBrandId ) ; - CleanupStack::PushL( fileName ); - HBufC *fullPath = FullDiscardBrandFileNameLC( *fileName ) ; - TRACE( T_LIT( "CBSStorageManager::MarkBrandAsDiscardedL discardedfile='%S'"), &fullPath ); - - // create flag file - RFile file; - TInt err = file.Replace( iFs, *fullPath, EFileWrite ); - TRACE( T_LIT( "CBSStorageManager::MarkBrandAsDiscardedL discarded file creation result='%d'"), err ); - file.Close(); - - CleanupStack::PopAndDestroy( fullPath ); - fullPath = NULL; - CleanupStack::PopAndDestroy( fileName ); - fileName = NULL; - - TRACE( T_LIT( "CBSStorageManager::MarkBrandAsDiscardedL begin") ); - } - -// End of file diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bsserver/cbsstoragemanager.h --- a/brandingserver/bsserver/cbsstoragemanager.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,225 +0,0 @@ -/* -* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Storage handler -* -*/ - - -#ifndef CBSSTORAGEMANAGER_H -#define CBSSTORAGEMANAGER_H - -#include -#include - -class CBSSession; -class CBSIBYWriter; -class MBSElement; -class CBSStorage; -class RWriteStream; - - -/** - * Storage handler - * - * @lib .exe - * @since S60 v3.2 - */ -class CBSStorageManager : public CBase -{ -public: - - static CBSStorageManager* NewL( CBSSession* aSession, const TDesC& aAppId ); - - static CBSStorageManager* NewLC( CBSSession* aSession, const TDesC& aAppId ); - - ~CBSStorageManager(); - - - /** - * Initializes the transaction to the - * storagemanager - * - * @since S60 3.2 - * @return none - */ - void ConnectTransactionL(const TDesC& aAppId, - const TDesC& aBrandId, - TLanguage aLanguageId, - TBool aAppending = EFalse, - TInt aReserved = 0 ); - - - /** - * Create a new storage and set it to current. - * - * @since S60 3.2 - * @return none - */ - void CreateStorageL(); - - /** - * Return the count of storages - * - * @since S60 3.2 - * @return count of elements - */ - TInt StorageCount(); - - /** - * Get stored storage at index or current storage. - * - * @since S60 3.2 - * @param aIndex index of storage to fetch. - * @return Stored storage - */ - CBSStorage* Storage( TInt aIndex ); - CBSStorage* Storage(); - - /** - * Externalize storage files into file system - * - * @since S60 3.2 - * @param aFs filesystem handle - * @param aBaseDir Base directory for writing - * @return the new brand version - */ - TInt WriteStorageFilesL(); - - void CancelTransactionL(); - - void BrandHandleL( const TDesC& aAppId, - const TDesC& aBrandId, - TLanguage aLanguageId, - RFile& aFile, - TInt aReserved ); - - void FileElementHandleL( const TDesC& aAppId, - const TDesC& aBrandId, - const TDesC& aFileName, - const TDesC& aLanguageBuf, - RFile& aFile ); - - void CleanupFileL( const TDesC& aFileName ); - - TPtrC FilenameWithoutVersion( const TDesC& aFileName ); - - /** - * Externalize storage files into file system - * - * @since S60 3.2 - * @param aFileName the name of the installed file - * including path - * @return the filename without path component - */ - HBufC* InstallFileLC( const TDesC& aFileName ); - - void RemoveBrandL( const TDesC& aAppId, - const TDesC& aBrandId, - TLanguage aLanguageId, - TInt aReserved = 0); - - void RemoveApplicationL( const TDesC& aAppId ); - - TInt NextAvailableVersionL(); - void SetVersion( TInt aVersionId ); - - TInt GetNewestVersionL( const TDesC& aAppId, - const TDesC& aBrandId, - TLanguage aLanguageId, - TPtr* aDrive = NULL); - TInt WriteIbyFiles(); - - void LockStorage(); - - void ReleaseLockL(); - - TBool CheckBrandDiscarded(const TDesC& aAppId, - const TDesC& aBrandId) ; - static HBufC* ConstructDiscardBrandFileNameL( const TDesC& aAppId, - const TDesC& aBrandId ); - - static HBufC* FullDiscardBrandFileNameLC( TDesC& aFilename ) ; - - TInt isActualBrandInstalledL ( const TDesC& aAppId, const TDesC& aBrandId, TLanguage aLanguage); -private: - - CBSStorageManager(); - - void ConstructL( CBSSession* aSession, const TDesC& aAppId ); - - HBufC* ConstructFileNameL( TInt aVersion = 0 ); - - HBufC* ConstructFileNameL( const TDesC& aAppId, - const TDesC& aBrandId, - TLanguage aLanguage, - TInt aReserved = 0 ); - - void CleanupTransaction(); - - HBufC* FullFileNameLC( const TDesC& aFilename, TBool aForceCDrive = EFalse ); - - TInt ReadVersionL( const TDesC& aFilename ); - - HBufC* FindAvailableVersionL( TInt aCurrentVersion, TInt& aNewVersion ); - - TBool IsBaseFileL( const TDesC& aFileName ); - - - /** - * Mark a brand package as discarded. Future attempts to create an - * access to this brand package will fail. - * - * @since S60 3.2 - * @param aAppId a application id - * @param aBrandId a brand id - */ - void MarkBrandAsDiscardedL( const TDesC& aAppId, - const TDesC& aBrandId ); - -private: // Data - - // Own. Array of stored storages. - RPointerArray iStorages; - - // Index of currently active storage - TInt iCurrent; - - // IBY writer - CBSIBYWriter* iWriter; - - RFs iFs; - TBool iActive; - - HBufC* iAppId; - HBufC* iBrandId; - HBufC* iLanguageId; - TLanguage iLanguageIdNum; - - // Own. Proposed file name - HBufC* iFilename; - - // Proposed directory (points to iFilename) - TPtrC iDir; - - // doesn't own: the server - CBSSession* iSession; - - TBool iAppending; - - HBufC* iIbyFile; - TInt iReserved; - -}; - -#endif //CBSSTORAGEMANAGER_H diff -r 085f765766a0 -r 860cd8a5168c brandingserver/bwins/bsclientu.def --- a/brandingserver/bwins/bsclientu.def Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -EXPORTS - ??1CBSBitmap@@UAE@XZ @ 1 NONAME ; CBSBitmap::~CBSBitmap(void) - ??1CBSFactory@@UAE@XZ @ 2 NONAME ; CBSFactory::~CBSFactory(void) - ?BitmapFileId@CBSBitmap@@QBEABVTDesC8@@XZ @ 3 NONAME ; class TDesC8 const & CBSBitmap::BitmapFileId(void) const - ?BitmapId@CBSBitmap@@QBEHXZ @ 4 NONAME ; int CBSBitmap::BitmapId(void) const - ?BitmapMaskId@CBSBitmap@@QBEHXZ @ 5 NONAME ; int CBSBitmap::BitmapMaskId(void) const - ?CreateAccessL@CBSFactory@@QAEPAVMBSAccess@@ABVTDesC8@@W4TLanguage@@HH@Z @ 6 NONAME ; class MBSAccess * CBSFactory::CreateAccessL(class TDesC8 const &, enum TLanguage, int, int) - ?CreateAccessLC@CBSFactory@@QAEPAVMBSAccess@@ABVTDesC8@@W4TLanguage@@HH@Z @ 7 NONAME ; class MBSAccess * CBSFactory::CreateAccessLC(class TDesC8 const &, enum TLanguage, int, int) - ?CreateBSElementL@BSElementFactory@@SAPAVMBSElement@@ABVTDesC8@@W4TBSElementType@@0@Z @ 8 NONAME ; class MBSElement * BSElementFactory::CreateBSElementL(class TDesC8 const &, enum TBSElementType, class TDesC8 const &) - ?CreateBSElementL@BSElementFactory@@SAPAVMBSElement@@ABVTDesC8@@W4TBSElementType@@AAV?$RBSObjOwningPtrArray@VMBSElement@@@@@Z @ 9 NONAME ; class MBSElement * BSElementFactory::CreateBSElementL(class TDesC8 const &, enum TBSElementType, class RBSObjOwningPtrArray &) - ?CreateBSElementL@BSElementFactory@@SAPAVMBSElement@@ABVTDesC8@@W4TBSElementType@@ABVTDesC16@@@Z @ 10 NONAME ; class MBSElement * BSElementFactory::CreateBSElementL(class TDesC8 const &, enum TBSElementType, class TDesC16 const &) - ?CreateBSElementL@BSElementFactory@@SAPAVMBSElement@@ABVTDesC8@@W4TBSElementType@@H@Z @ 11 NONAME ; class MBSElement * BSElementFactory::CreateBSElementL(class TDesC8 const &, enum TBSElementType, int) - ?CreateBSElementL@BSElementFactory@@SAPAVMBSElement@@ABVTDesC8@@W4TBSElementType@@PAVCBSBitmap@@@Z @ 12 NONAME ; class MBSElement * BSElementFactory::CreateBSElementL(class TDesC8 const &, enum TBSElementType, class CBSBitmap *) - ?CreateUpdaterL@CBSFactory@@QAEPAVMBSUpdater@@XZ @ 13 NONAME ; class MBSUpdater * CBSFactory::CreateUpdaterL(void) - ?CreateUpdaterLC@CBSFactory@@QAEPAVMBSUpdater@@XZ @ 14 NONAME ; class MBSUpdater * CBSFactory::CreateUpdaterLC(void) - ?NewL@CBSBitmap@@SAPAV1@HHHHABVTDesC8@@@Z @ 15 NONAME ; class CBSBitmap * CBSBitmap::NewL(int, int, int, int, class TDesC8 const &) - ?NewL@CBSFactory@@SAPAV1@ABVTDesC8@@0@Z @ 16 NONAME ; class CBSFactory * CBSFactory::NewL(class TDesC8 const &, class TDesC8 const &) - ?NewLC@CBSBitmap@@SAPAV1@HHHHABVTDesC8@@@Z @ 17 NONAME ; class CBSBitmap * CBSBitmap::NewLC(int, int, int, int, class TDesC8 const &) - ?SkinIdMajor@CBSBitmap@@QBEHXZ @ 18 NONAME ; int CBSBitmap::SkinIdMajor(void) const - ?SkinIdMinor@CBSBitmap@@QBEHXZ @ 19 NONAME ; int CBSBitmap::SkinIdMinor(void) const - diff -r 085f765766a0 -r 860cd8a5168c brandingserver/eabi/bsclientu.def --- a/brandingserver/eabi/bsclientu.def Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -EXPORTS - _ZN10CBSFactory13CreateAccessLERK6TDesC89TLanguageii @ 1 NONAME - _ZN10CBSFactory14CreateAccessLCERK6TDesC89TLanguageii @ 2 NONAME - _ZN10CBSFactory14CreateUpdaterLEv @ 3 NONAME - _ZN10CBSFactory15CreateUpdaterLCEv @ 4 NONAME - _ZN10CBSFactory4NewLERK6TDesC8S2_ @ 5 NONAME - _ZN16BSElementFactory16CreateBSElementLERK6TDesC814TBSElementTypeP9CBSBitmap @ 6 NONAME - _ZN16BSElementFactory16CreateBSElementLERK6TDesC814TBSElementTypeR20RBSObjOwningPtrArrayI10MBSElementE @ 7 NONAME - _ZN16BSElementFactory16CreateBSElementLERK6TDesC814TBSElementTypeRK7TDesC16 @ 8 NONAME - _ZN16BSElementFactory16CreateBSElementLERK6TDesC814TBSElementTypeS2_ @ 9 NONAME - _ZN16BSElementFactory16CreateBSElementLERK6TDesC814TBSElementTypei @ 10 NONAME - _ZN9CBSBitmap4NewLEiiiiRK6TDesC8 @ 11 NONAME - _ZN9CBSBitmap5NewLCEiiiiRK6TDesC8 @ 12 NONAME - _ZNK9CBSBitmap11SkinIdMajorEv @ 13 NONAME - _ZNK9CBSBitmap11SkinIdMinorEv @ 14 NONAME - _ZNK9CBSBitmap12BitmapFileIdEv @ 15 NONAME - _ZNK9CBSBitmap12BitmapMaskIdEv @ 16 NONAME - _ZNK9CBSBitmap8BitmapIdEv @ 17 NONAME - _ZTI10CBSFactory @ 18 NONAME ; ## - _ZTI19CBSIconFileProvider @ 19 NONAME ; ## - _ZTI9RBSClient @ 20 NONAME ; ## - _ZTV10CBSFactory @ 21 NONAME ; ## - _ZTV19CBSIconFileProvider @ 22 NONAME ; ## - _ZTV9RBSClient @ 23 NONAME ; ## - diff -r 085f765766a0 -r 860cd8a5168c brandingserver/group/backup_registration.xml --- a/brandingserver/group/backup_registration.xml Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff -r 085f765766a0 -r 860cd8a5168c brandingserver/group/bld.inf --- a/brandingserver/group/bld.inf Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: branding server BLD.INF which builds, tools and also server and client. -* -*/ -#include - -PRJ_PLATFORMS -DEFAULT - -PRJ_MMPFILES -bsclient.mmp -bsserver.mmp -../tools/bsimport/group/importer.mmp -../tools/bsimport/group/installer.mmp - -PRJ_EXPORTS -// Headers exported to source tree -../inc/cbsfactory.h MW_LAYER_PLATFORM_EXPORT_PATH(cbsfactory.h) -../inc/mbsaccess.h MW_LAYER_PLATFORM_EXPORT_PATH(mbsaccess.h) -../inc/mbsupdater.h MW_LAYER_PLATFORM_EXPORT_PATH(mbsupdater.h) -../inc/mbselement.h MW_LAYER_PLATFORM_EXPORT_PATH(mbselement.h) -../inc/cbsbitmap.h MW_LAYER_PLATFORM_EXPORT_PATH(cbsbitmap.h) -../inc/bselementfactory.h MW_LAYER_PLATFORM_EXPORT_PATH(bselementfactory.h) -../inc/tbselementiterator.h MW_LAYER_PLATFORM_EXPORT_PATH(tbselementiterator.h) -../inc/rbsobjowningptrarray.h MW_LAYER_PLATFORM_EXPORT_PATH(rbsobjowningptrarray.h) -../inc/rbsobjowningptrarray.inl MW_LAYER_PLATFORM_EXPORT_PATH(rbsobjowningptrarray.inl) -../inc/mbsbrandchangeobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(mbsbrandchangeobserver.h) -../inc/mbsbackuprestorestateobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(mbsbackuprestorestateobserver.h) - -../group/backup_registration.xml z:/private/102828dd/backup_registration.xml - -// Exporting iby file - -../rom/brandingserver.iby CORE_MW_LAYER_IBY_EXPORT_PATH(brandingserver.iby) - -// Exporting stubsis file -../sis/bsstub.sis /epoc32/data/Z/System/Install/bsstub.sis diff -r 085f765766a0 -r 860cd8a5168c brandingserver/group/bsclient.mmp --- a/brandingserver/group/bsclient.mmp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Branding server client component project descripton file. -* -*/ -#include "bsuids.h" -#include -#include - -TARGET bsclient.dll -TARGETTYPE dll -UID KStaticInterfaceDllUid2 KBrandingClientUid3 -CAPABILITY CAP_CLIENT_DLL -VENDORID VID_DEFAULT - - -SOURCEPATH ../bsclient -SOURCE cbsclient.cpp -SOURCE bsprocessstarter.cpp -SOURCE cbsfactory.cpp -SOURCE cbsaccess.cpp -SOURCE cbsupdater.cpp -SOURCE cbselement.cpp -SOURCE bselementfactory.cpp -SOURCE cbsbitmap.cpp -SOURCE cbsbrandobserver.cpp -SOURCE cbsiconfileprovider.cpp - - -USERINCLUDE ../group -USERINCLUDE ../bsserver -USERINCLUDE ../bsclient - -APP_LAYER_SYSTEMINCLUDE - - -LIBRARY euser.lib -LIBRARY efsrv.lib -LIBRARY flogger.lib -LIBRARY estor.lib -LIBRARY aknskins.lib -LIBRARY aknicon.lib //avkon icons -LIBRARY cone.lib -LIBRARY charconv.lib diff -r 085f765766a0 -r 860cd8a5168c brandingserver/group/bsserver.mmp --- a/brandingserver/group/bsserver.mmp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Branding server, server comopnent project description file. -* -*/ -#include "bsuids.h" -#include -#include - -TARGET bsserver.exe -TARGETTYPE exe - - -UID 0x0 KBrandingSrvUid3 -VENDORID VID_DEFAULT -CAPABILITY CAP_SERVER -TARGETPATH /system/libs - - -SOURCEPATH ../bsserver -SOURCE cbsserver.cpp -SOURCE cbssession.cpp -SOURCE cbsbrandhandler.cpp -SOURCE cbsibywriter.cpp -SOURCE cbsstoragemanager.cpp -SOURCE cbsstorage.cpp -SOURCE cbsinstallhandler.cpp -SOURCE cbsbackupobserver.cpp - -SOURCEPATH ../bsclient -SOURCE cbselement.cpp -SOURCE cbsbitmap.cpp -SOURCE bselementfactory.cpp - - - -USERINCLUDE ../group -USERINCLUDE ../bsserver -USERINCLUDE ../bsclient -USERINCLUDE ../inc - -APP_LAYER_SYSTEMINCLUDE - - - -LIBRARY euser.lib -LIBRARY flogger.lib -LIBRARY efsrv.lib - -LIBRARY bafl.lib -LIBRARY estor.lib -LIBRARY charconv.lib - -// for install handler -LIBRARY apgrfx.lib -LIBRARY apparc.lib diff -r 085f765766a0 -r 860cd8a5168c brandingserver/group/bsuids.h --- a/brandingserver/group/bsuids.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: BRANDINGSERVER UIDs -* -*/ -#ifndef __BRANDINGUIDS_H -#define __BRANDINGUIDS_H - -//Uid2:s -#define KStaticInterfaceDllUid2 0x1000008d // CSI: 8 # - - -//Uid3:s -#define KBrandingClientUid3 0x102828DE // CSI: 8 # -#define KBrandingSrvUid3 0x102828DD // CSI: 8 # - - -#endif // __BRANDINGUIDS_H - - -// END OF FILE - - diff -r 085f765766a0 -r 860cd8a5168c brandingserver/group/debugtrace.h --- a/brandingserver/group/debugtrace.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,162 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Debug Traces. -* -*/ -#ifndef __DEBUGTRACE_H__ -#define __DEBUGTRACE_H__ - -// INCLUDES -#include "e32std.h" - -// DEFINES -//Undefine: tracing disabled -//Define 1: Traces goes to file log -//Define 2: Traces goes to RDebug output -//Define 3: Trace goes both file and RDebug output -#undef TRACE_MODE -//#define TRACE_MODE 3 - - - -// ----------------------------------------------------------------------------- -// Trace definitions -// ----------------------------------------------------------------------------- -#ifdef TRACE_MODE - - // INCLUDES - #include - #include - - // CONSTANTS - _LIT( KTraceLogDir, "BS" ); - _LIT( KTraceLogFile, "BS.log" ); - - //TRACE INDIRECTION - #define T_LIT(s) _L(s) // CSI: 78 # See above - #define TRACE Trace::Emit - #define IF_TRACE_ON( aStatement ) aStatement -#endif // TRACE_MODE - - -//----------------------------------------------------------------------------- -// Empty trace definitions -//----------------------------------------------------------------------------- -#ifndef TRACE_MODE - struct TEmptyTraceString { }; - #define T_LIT(s) TEmptyTraceString() - #define IF_TRACE_ON( aStatement ) - - inline void TRACE(TEmptyTraceString){} - - template - inline void TRACE(TEmptyTraceString,T1){} - - template - inline void TRACE(TEmptyTraceString,T1,T2){} - - template - inline void TRACE(TEmptyTraceString,T1,T2,T3){} - - template - inline void TRACE(TEmptyTraceString,T1,T2,T3,T4){} - - template - inline void TRACE(TEmptyTraceString,T1,T2,T3,T4,T5){} - - template - inline void TRACE(TEmptyTraceString,T1,T2,T3,T4,T5,T6){} - - template - inline void TRACE(TEmptyTraceString,T1,T2,T3,T4,T5,T6,T7){} - - template - inline void TRACE(TEmptyTraceString,T1,T2,T3,T4,T5,T6,T7,T8){} - -#endif // TRACE_MODE - - - - -// ----------------------------------------------------------------------------- -// Trace implementation -// ----------------------------------------------------------------------------- -#ifdef TRACE_MODE - #include - #include - - // TARGET WARNING - #if !defined(_DEBUG) - - #if defined(__CW32__) - #pragma message("Trace logging on.") // CSI: 68 # See above - #else - //ARMCC warning - #endif - #endif - - namespace Trace - { - class TOverflowHandler : public TDes16Overflow - { - inline void Overflow( TDes16& /*aDes*/ ) {} - }; - - inline void Emit( TRefByValue aFmt, ... ) - { - //Format the log line - TBuf< 250 > buffer; - buffer.Append( _L("[") ); // CSI: 78 # See above - buffer.Append( RThread().Name() ); - buffer.Append( _L("] ") ); // CSI: 78 # See above - - TOverflowHandler overflowHandler; - - VA_LIST list; - VA_START( list, aFmt ); - buffer.AppendFormatList( aFmt, list, &overflowHandler ); - - TInt theTraceMode = TRACE_MODE; - - //Send trace to file - if( ( theTraceMode == 1 ) || - ( theTraceMode == 3 ) ) - { - RFileLogger logger; - if( logger.Connect() == KErrNone ) - { - logger.SetDateAndTime( EFalse, ETrue ); - logger.CreateLog( KTraceLogDir, - KTraceLogFile, - EFileLoggingModeAppend ); - - logger.Write( buffer ); - logger.CloseLog(); - logger.Close(); - } - } - - //Send trace to default debug output - if( ( theTraceMode == 2 ) || - ( theTraceMode == 3 ) ) - { - RDebug::Print( _L("%S"), &buffer ); - } - } - } -#endif //TRACE_MODE - -#endif //__DEBUGTRACE_H__ - -// END OF FILE diff -r 085f765766a0 -r 860cd8a5168c brandingserver/inc/bselementfactory.h --- a/brandingserver/inc/bselementfactory.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: bselementfactory.h -* -*/ - - -#ifndef __BSELEMENTFACTORY_H -#define __BSELEMENTFACTORY_H - -#include -#include - - -class CBSElement; - - -/** - * Factory for creating branding elements - * - * @since - */ -class BSElementFactory - { - public: - - /* - * Create integer type element. - * @param aElementId id of the element - * @param aElementType type of the element - * @param aElementData the element data - */ - IMPORT_C static MBSElement* CreateBSElementL( const TDesC8& aElementId, - TBSElementType aElementType, - TInt aElementData ); - - /* - * Create text or file type element. - * @param aElementId id of the element - * @param aElementType type of the element - * @param aElementData the element data, if the element is file type - * then this should contain the file name - */ - IMPORT_C static MBSElement* CreateBSElementL( const TDesC8& aElementId, - TBSElementType aElementType, - const TDesC& aElementData ); - - /* - * Create buffer type element. - * @param aElementId id of the element - * @param aElementType type of the element - * @param aElementData the element data - */ - IMPORT_C static MBSElement* CreateBSElementL( const TDesC8& aElementId, - TBSElementType aElementType, - const TDesC8& aElementData ); - - /* - * Create bitmap type element. - * @param aElementId id of the element - * @param aElementType type of the element - * @param aElementData the element data - */ - IMPORT_C static MBSElement* CreateBSElementL( const TDesC8& aElementId, - TBSElementType aElementType, - CBSBitmap* aElementData ); - - /* - * Create an element containing a list of other elements. - * @param aElementId id of the element - * @param aElementType type of the element - * @param aElementData the element data - */ - IMPORT_C static MBSElement* CreateBSElementL( const TDesC8& aElementId, - TBSElementType aElementType, - RBSObjOwningPtrArray& aElementData ); - - }; - -#endif //__BSELEMENTFACTORY_H diff -r 085f765766a0 -r 860cd8a5168c brandingserver/inc/cbsbitmap.h --- a/brandingserver/inc/cbsbitmap.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: cbsbitmap.h -* -*/ - - - -#ifndef __CBSBITMAP_H__ -#define __CBSBITMAP_H__ - -#include - -/** - * - */ -NONSHARABLE_CLASS( CBSBitmap ): public CBase - { - public: - /** - * Two-phased constructor. - * @param aBitmapId the bitmap id - * @param aBitmapMaskId the bitmap mask id - * @param aSkinId the skin id - * @param aSkinMaskId the skin mask id - * @param aBitmapFileId the bitmap file id - */ - IMPORT_C static CBSBitmap* NewL( TInt aBitmapId, - TInt aBitmapMaskId, - TInt aSkinIdMajor, - TInt aSkinIdMinor, - const TDesC8& aBitmapFileId ); - - /** - * Two-phased constructor. - * @see NewL - */ - IMPORT_C static CBSBitmap* NewLC( TInt aBitmapId, - TInt aBitmapMaskId, - TInt aSkinIdMajor, - TInt aSkinIdMinor, - const TDesC8& aBitmapFileId ); - - // destructor - IMPORT_C virtual ~CBSBitmap(); - - private: - /** - * @see NewL - */ - CBSBitmap( TInt aBitmapId, - TInt aBitmapMaskId, - TInt aSkinIdMajor, - TInt aSkinIdMinor ); - - /** - * @see NewL - */ - void ConstructL( const TDesC8& aBitmapFileId ); - - public: - /** - * Getter for bitmap id - * @return the bitmap id - */ - IMPORT_C TInt BitmapId() const; - - /** - * Getter for bitmap mask id - * @return the bitmap mask id - */ - IMPORT_C TInt BitmapMaskId() const; - - /** - * Getter for skin id - * @return the skin id - */ - IMPORT_C TInt SkinIdMajor() const; - - /** - * Getter for skin mask id - * @return the skin mask id - */ - IMPORT_C TInt SkinIdMinor() const; - - /** - * Getter for bitmap file id - * @return bitmap file id - */ - IMPORT_C const TDesC8& BitmapFileId() const; - - - private: // data - TInt iBitmapId; - TInt iBitmapMaskId; - TInt iSkinIdMajor; - TInt iSkinIdMinor; - HBufC8* iBitmapFileId; - }; - -#endif // __CBSBITMAP_H__ - - -// END OF FILE - diff -r 085f765766a0 -r 860cd8a5168c brandingserver/inc/cbsfactory.h --- a/brandingserver/inc/cbsfactory.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: cbsfactory.h -* -*/ - -#ifndef __CBSFACTORY_H -#define __CBSFACTORY_H - -// INCLUDES -#include - -// FORWARD DECLARATIONS -class MBSAccess; -class MBSUpdater; -class RBSClient; - - -// CLASS DECLARATION - -class CBSFactory : public CBase - { - - public: - - /** - * Two-phased constructor. - * @param aDefaultBrandId the default brand id for branding interfaces - * that are created through this factory. If this parameter - * is given the branding items will be taken from the given - * default brand if they are not found from the wanted brand. - * brand. - * @param aApplicationId application id - */ - IMPORT_C static CBSFactory* NewL( const TDesC8& aDefaultBrandId, - const TDesC8& aApplicationId ); - - // destructor - IMPORT_C virtual ~CBSFactory(); - - private: - - // constructor - CBSFactory(); - - void ConstructL( const TDesC8& aDefaultBrandId, const TDesC8& aApplicationId ); - - - public: - - /** - * Creates a brand access interface - * @param aBrandId the brand to be used with this interface instance - * @param aLanguageId the language id to be used with this interface instance - * @param aCacheData should the interface cache the branding data - * @param aReserved for further use - * @return the access interface - */ - IMPORT_C MBSAccess* CreateAccessL( const TDesC8& aBrandId, - TLanguage aLanguageId, - TBool aCacheData = EFalse, - TInt aReserved = 0 ); - - /** - * Creates a brand access interface - * @param aBrandId the brand to be used with this interface instance - * @param aLanguageId the language id to be used with this interface instance - * @param aCacheData should the interface cache the branding data - * @param aReserved for further use - * @return the access interface - */ - IMPORT_C MBSAccess* CreateAccessLC( const TDesC8& aBrandId, - TLanguage aLanguageId, - TBool aCacheData = EFalse, - TInt aReserved = 0 ); - - /** - * Creates a brand update interface - * @return the interface - */ - IMPORT_C MBSUpdater* CreateUpdaterL(); - - /** - * Creates a brand update interface - * @return the interface - */ - IMPORT_C MBSUpdater* CreateUpdaterLC(); - - - private: // data - HBufC8* iDefaultBrand; - bool iUseDefaultBrand; - HBufC8* iApplicationId; - RBSClient* iServerKeepAlive; - - }; - -#endif // __CBSFACTORY_H - -// End of File diff -r 085f765766a0 -r 860cd8a5168c brandingserver/inc/mbsaccess.h --- a/brandingserver/inc/mbsaccess.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,143 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: MBSAccess -* -*/ - - - -#ifndef __MBSACCESS_H -#define __MBSACCESS_H - -#include -#include -#include -#include - - -// forward declarations -class MBSBrandChangeObserver; -class MBSBackupRestoreStateObserver; -class CFbsBitmap; - -/** - * An interface for getting branding information - * - * @since - */ -class MBSAccess - { - public: - - /* - * Get text type item - * @param aId ID of the item - * @return the text item - */ - virtual HBufC* GetTextL( const TDesC8& aId ) = 0; - - /* - * Get text type item - * @param aId ID of the item - * @return the text item - */ - virtual HBufC* GetTextLC( const TDesC8& aId ) = 0; - - /* - * Get 8-bit data type item - * @param aId ID of the item - * @return the data buffer item - */ - virtual HBufC8* GetBufferL( const TDesC8& aId ) = 0; - - /* - * Get 8-bit data type item - * @param aId ID of the item - * @return the data buffer item - */ - virtual HBufC8* GetBufferLC( const TDesC8& aId ) = 0; - - /* - * Get integer type item - * @param aId ID of the item - * @return the integer item - */ - virtual TInt GetIntL( const TDesC8& aId ) = 0; - - - /* - * Get an array of items - * @param aIds ID's of the items - * @return the items - */ - virtual MBSElement* GetSeveralL( MDesC8Array& aIds ) = 0; - - - /* - * Get a file item - * @param aId ID of the item - * @param aFile on return will contain an open file handle - * to the file - */ - virtual void GetFileL( const TDesC8& aId, - RFile& aFile ) = 0; - - /* - * Get a structure type item - * @param aIds ID of the item - * @return structure branding element - */ - virtual MBSElement* GetStructureL( const TDesC8& aId ) = 0; - - /* - * Register to observer brand data updates - * @param aObserver the observer interface - */ - virtual void RegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver* aBackupObserver ) = 0; - - /* - * Unregister a brand data update observer - * @param aObserver the observer interface - */ - virtual void UnRegisterObserverL( MBSBrandChangeObserver* aObserver, MBSBackupRestoreStateObserver *aBackupObserver ) = 0; - - /* - * Get a bitmap type item. - * Note that this method supports skins, but as skin support - * requires CONE, it will only try to load skin bitmaps if - * CONE is available. Else it will only load normal bitmaps. - * @param aBitmapId the ID of the bitmap item itself - * @param aBitmap on return will contain the bitmap - * @param aMask on return will contain the mask - */ - virtual void GetBitmapL( const TDesC8& aBitmapId, - CFbsBitmap*& aBitmap, - CFbsBitmap*& aMask ) = 0; - - - virtual TInt isBrandUpdateRequiredL () = 0; - /* - * Closes the handle to server and deletes the object. - */ - virtual void Close() = 0; - - protected: - - /* - * Destructor - */ - virtual ~MBSAccess() {}; - }; - -#endif //__MBSACCESS_H diff -r 085f765766a0 -r 860cd8a5168c brandingserver/inc/mbsbackupobserver.h --- a/brandingserver/inc/mbsbackupobserver.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* -* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Backup and Restore observer interface -* -*/ - - -#ifndef __MBSBACKUPOBSERVER_H -#define __MBSBACKUPOBSERVER_H - -#include - -/** - * Observer interface for backup and restore events - * @since S60 v3.2 - */ -NONSHARABLE_CLASS( MBSBackupObserver ) - { - public: - - // Backup and restore states - enum TBackupState - { - EBackupNotActive, - EBackupActive - }; - - /* - * Hanlder method to receive observer events - * @param aEvent new state of backup and restore - */ - virtual void HandleBackupStateL( TBackupState aState ) = 0; - - /* - * Destructor - */ - virtual ~MBSBackupObserver() {}; - }; - -#endif //__MBSBACKUPOBSERVER_H diff -r 085f765766a0 -r 860cd8a5168c brandingserver/inc/mbsbackuprestorestateobserver.h --- a/brandingserver/inc/mbsbackuprestorestateobserver.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: MBS Backup restore observer definition. -* -*/ - - - -#ifndef __MBSBACKUPRESTORESTATEOBSERVER_H -#define __MBSBACKUPRESTORESTATEOBSERVER_H - -#include - - -/** - * An interface through which client gets information - * about available brand data updates. - * - * @since - */ -class MBSBackupRestoreStateObserver - { - public: - - /* - * Gets called when backup restore operation begins or ends - * Client can then decide wether to store accessing date or not - * @return ETrue if observer should continue observing - */ - virtual TBool BackupRestoreActivated(TInt activeState) = 0 ; - -protected: - /* - * Destructor - */ - virtual ~MBSBackupRestoreStateObserver() {}; - }; - -#endif //__MBSBACKUPRESTORESTATEOBSERVER_H diff -r 085f765766a0 -r 860cd8a5168c brandingserver/inc/mbsbrandchangeobserver.h --- a/brandingserver/inc/mbsbrandchangeobserver.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: MBSBrandChangeObserver -* -*/ - - - -#ifndef __MBSBRANDCHANGEOBSERVER_H -#define __MBSBRANDCHANGEOBSERVER_H - -#include - - -/** - * An interface through which client gets information - * about available brand data updates. - * - * @since - */ -class MBSBrandChangeObserver - { - public: - - /* - * Gets called when brand data update is available. - * Client can then decide wether to use the old one - * or the updated one. - * @return ETrue if observer should continue observing - */ - virtual TBool BrandUpdateAvailable( TInt aNewVersion ) = 0; - - -protected: - /* - * Destructor - */ - virtual ~MBSBrandChangeObserver() {}; - }; - -#endif //__MBSBRANDCHANGEOBSERVER_H diff -r 085f765766a0 -r 860cd8a5168c brandingserver/inc/mbselement.h --- a/brandingserver/inc/mbselement.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: MBSElement.h -* -*/ - - -#ifndef __MBSELEMENT_H -#define __MBSELEMENT_H - -#include -#include - -enum TBSElementType - { - EBSInt, - EBSText, - EBSList, - EBSBuffer, - EBSBitmap, - EBSFile - }; - -/** - * Class encapsulating the structure type branding items - * - * @since - */ - -class RWriteStream; -class CBSBitmap; - -NONSHARABLE_CLASS( MBSElement ) - { - - public: - - /* - * Element type - * @return the element type - */ - virtual TBSElementType ElementType() = 0; - - /* - * Element id - * @return the element id - */ - virtual const TDesC8& ElementId() = 0; - - /* - * Integer data - * Panics if trying to get wrong type data. - * @return the integer data of the item - */ - virtual TInt IntDataL() = 0; - - /* - * Text data - * Panics if trying to get wrong type data. - * @return the text data of the item - */ - virtual const TDesC& TextDataL() = 0; - - /* - * 8-bit buffer data - * Panics if trying to get wrong type data. - * @return the text data of the item - */ - virtual const TDesC8& BufferDataL() = 0; - - /* - * Bitmap data - * Panics if trying to get wrong type data. - * @return the text data of the item - */ - virtual const CBSBitmap& BitmapDataL() = 0; - - /* - * Structure data - * Panics if trying to get wrong type data. - * @return the list data - */ - virtual TArray GetStructureL() = 0; - - /* - * Finds the first entry from the list of a list type element with - * the given element id. Note that if there are several subelements - * with the same elementId then TBrandingElementIterator should be - * used to iterate through them. - * @param aElementId elementId of the subelement to be found. - * @return the subelement - */ - virtual const MBSElement& FindSubEntryL( const TDesC& aElementId ) = 0; - - /* - * Writes the internal state to stream. - * @param aWriteStream output stream; - */ - virtual void ExternalizeL( RWriteStream& aWriteStream ) = 0; - - /* - * Deletes the element. - */ - virtual void Close() = 0; - - /* - * Destructor - */ - virtual ~MBSElement() {}; - - }; - - - - -#endif //__MBSELEMENT_H diff -r 085f765766a0 -r 860cd8a5168c brandingserver/inc/mbsupdater.h --- a/brandingserver/inc/mbsupdater.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,244 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: MBSUpdater - * -*/ - - - - #ifndef __MBSUPDATER_H - #define __MBSUPDATER_H - - #include - #include - -class MBSBackupRestoreStateObserver ; - -const TInt KBSAutomaticVersionUpdate = -1; - - /** - * An interface for updating branding information - * - * @since - */ - class MBSUpdater - { - public: - - enum TUpdateTransactionType - { - EUpdateInstall = 1, - EUpdateAppend, - EUpdateReplace, - EUpdateUninstall - }; - - //*** TRANSACTION HANDLING ***// - - /* - * Start transaction for installing a brand. - * @param aApplicationId id of the application - * @param aBrandId id of the brand - * @param aLanguageId languageid of the brand - * @param aReserved for further use - */ - virtual void StartTransactionL( const TDesC8& aBrandId, - TLanguage aLanguageId, - TUpdateTransactionType aType = EUpdateInstall, - TInt aReserved = 0 ) = 0; - - /* - * Stop brand installation transaction. - * Calling this will indicate that the brand has - * been updated completely and it will be taken - * into use. - * @return new version of the installed/updated brand - */ - virtual TInt StopTransactionL() = 0; - - /* - * Cancels brand installation transaction. - * All the elements updated in this transaction - * will be discarded. - */ - virtual void CancelTransactionL() = 0; - - - //*** BRAND REMOVING ***// - - /* - * Removes all brand data from the specified brand. - */ - virtual void RemoveBrandL( const TDesC8& aApplicationId, - const TDesC8& aBrandId ) = 0; - - /* - * Removes all brand data from the specified application. - */ - virtual void RemoveBrandsL( const TDesC8& aApplicationId ) = 0; - - - //*** BRAND INSTALLING ***// - - - /* - * Insert text type item into the new brand - * @param aId ID of the item - * @param aText the text item - */ - virtual void InsertTextL( const TDesC8& aId, const TDesC& aText ) = 0; - - /* - * Insert 8-bit data type item into the new brand - * @param aId ID of the item - * @param aBuffer the data item - */ - virtual void InsertBufferL( const TDesC8& aId, const TDesC8& aBuffer ) = 0; - - /* - * Insert integer type item into the new brand - * @param aId ID of the item - * @param aInt the integer item - */ - virtual void InsertIntL( const TDesC8& aId, TInt aInt ) = 0; - - /* - * Insert a file type item into the new brand. - * Note that the this is only the id and file name pair, - * the file itself has to be imported separately. - * @param aId ID of the item - * @param aFile the integer item - */ - virtual void InsertFileL( const TDesC8& aId, - const TDesC& aFileName ) = 0; - - /* - * Inserts an element into the brand that is being installed. - * @param aElement the element - */ - virtual void InsertElementL( MBSElement* aElement ) = 0; - - - - - - //*** BRAND UPDATING - replacing ***// - - - /* - * Insert text type item into the new brand - * @param aId ID of the item - * @param aText the text item - */ - virtual void ReplaceTextL( const TDesC8& aId, const TDesC& aText ) = 0; - - /* - * Insert 8-bit data type item into the new brand - * @param aId ID of the item - * @param aBuffer the data item - */ - virtual void ReplaceBufferL( const TDesC8& aId, const TDesC8& aBuffer ) = 0; - - /* - * Insert integer type item into the new brand - * @param aId ID of the item - * @param aInt the integer item - */ - virtual void ReplaceIntL( const TDesC8& aId, TInt aInt ) = 0; - - /* - * Insert a file type item into the new brand. - * Note that the this is only the id and file name pair, - * the file itself has to be imported separately. - * @param aId ID of the item - * @param aFile the integer item - */ - virtual void ReplaceFileL( const TDesC8& aId, - const TDesC& aFileName ) = 0; - - /* - * Inserts an element into the brand that is being installed. - * @param aElement the element - */ - virtual void ReplaceElementL( MBSElement* aElement ) = 0; - - - - //*** BRAND UPDATING - appending ***// - - - /* - * Insert text type item into the new brand - * @param aId ID of the item - * @param aText the text item - */ - virtual void AppendTextL( const TDesC8& aId, const TDesC& aText ) = 0; - - /* - * Insert 8-bit data type item into the new brand - * @param aId ID of the item - * @param aBuffer the data item - */ - virtual void AppendBufferL( const TDesC8& aId, const TDesC8& aBuffer ) = 0; - - /* - * Insert integer type item into the new brand - * @param aId ID of the item - * @param aInt the integer item - */ - virtual void AppendIntL( const TDesC8& aId, TInt aInt ) = 0; - - /* - * Insert a file type item into the new brand. - * Note that the this is only the id and file name pair, - * the file itself has to be imported separately. - * @param aId ID of the item - * @param aFile the integer item - */ - virtual void AppendFileL( const TDesC8& aId, - const TDesC& aFileName ) = 0; - - /* - * Inserts an element into the brand that is being installed. - * @param aElement the element - */ - virtual void AppendElementL( MBSElement* aElement ) = 0; - - - /* - * Closes the handle to server and deletes the object. - */ - virtual void Close() = 0; - - /* - * Register to observer backup restore state change - * @param aObserver the observer interface - */ - virtual void RegisterObserverL( MBSBackupRestoreStateObserver* aBackupObserver ) = 0; - - /* - * Unregister a backup restore state change observer - * @param aObserver the observer interface - */ - virtual void UnRegisterObserverL( MBSBackupRestoreStateObserver* aObserver ) = 0; - - - protected: - /* - * Destructor - */ - virtual ~MBSUpdater() {}; - }; - - #endif //__MBSUPDATER_H diff -r 085f765766a0 -r 860cd8a5168c brandingserver/inc/rbsobjowningptrarray.h --- a/brandingserver/inc/rbsobjowningptrarray.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: RBSOBJOWNINGPTRaRRAY.H -* -*/ - -#ifndef _RBSOBJOWNINGPTRARRAY_H -#define _RBSOBJOWNINGPTRARRAY_H - -#include - - - -/** - * Templated array of pointers. Array owns the pointed objects - * and overwrites the normal RPointerArray::Close() - * behaviour to destroy objects, before reseting the - * array contents. - * - * Array is used with Presence Framework interface objects. - * - * @since S60 v3.2 - */ -template< class T > -class RBSObjOwningPtrArray : public RPointerArray - { - public: - - /** - * Default C++ constructor. - */ - inline RBSObjOwningPtrArray(); - - - /** - * Overwritten Close(). - * - * Calls ResetAndDestroy() to delete holded objects - * before reseting array contents. Thus array can be - * pushed on the cleanup stack with CleanupClosePushL(). - */ - inline void Close(); - }; - - - - -#include "rbsobjowningptrarray.inl" - -#endif // _RBSOBJOWNINGPTRARRAY_H - - - diff -r 085f765766a0 -r 860cd8a5168c brandingserver/inc/rbsobjowningptrarray.inl --- a/brandingserver/inc/rbsobjowningptrarray.inl Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: rbsobjowningptrarray.inl -* -*/ - - -#include - -// ----------------------------------------------------------------------------- -// RBSObjOwningPtrArray::RBSObjOwningPtrArray() implementation. -// -// ----------------------------------------------------------------------------- -// -template -inline RBSObjOwningPtrArray::RBSObjOwningPtrArray() - { - } - - -// ----------------------------------------------------------------------------- -// RBSObjOwningPtrArray::Close() implementation. -// Calls ResetAndDestroy() to destroy holded objects. -// ----------------------------------------------------------------------------- -// -template -inline void RBSObjOwningPtrArray::Close() - { - RPointerArray::ResetAndDestroy(); - } diff -r 085f765766a0 -r 860cd8a5168c brandingserver/inc/tbselementiterator.h --- a/brandingserver/inc/tbselementiterator.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: tbselementiterator.h -* -*/ - - - -#ifndef TBSELEMENTITERATOR_H -#define TBSELEMENTITERATOR_H - -#include - -// CLASS DECLARATION - -/** -* -* -* @lib -* @since -*/ - -class MBSElement; - - -class TBSElementIterator - { - public: // New functions - - IMPORT_C MBSElement& Next(); - - /** - * C++ default constructor. - */ - IMPORT_C TBSElementIterator( const TDesC& aElementId ); - - private: - TInt iIndex; - const TDesC& iElementId; - }; - -#endif // TBSELEMENTITERATOR_H - -// End of File diff -r 085f765766a0 -r 860cd8a5168c brandingserver/inc/tbsmdescarrayadapter.h --- a/brandingserver/inc/tbsmdescarrayadapter.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: One value adapter for MDesCArray. -* -*/ - -#ifndef TBSMDESCARRAYADAPTER_H__ -#define TBSMDESCARRAYADAPTER_H__ - -// INCLUDES -#include -#include - - -// CLASS DECLARATION -/** - * One value adapter for MDesCArray. - * - * @since 3.0 - */ -class TBSMDesCArrayAdapter : public MDesCArray - { - public: //Constructor & destructor - - /** - * C++ constructor. - * Takes the descriptor to adapt. - */ - IMPORT_C TBSMDesCArrayAdapter( const TDesC& aDesc ); - - - public: //From MDesCArray - - IMPORT_C TInt MdcaCount() const; - IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const; - - - private: //Data - - //OWN: Adapted descriptor - TPtrC iDesc; - }; - - -#endif //TBSMDESCARRAYADAPTER_H__ - -// End of File - - - - diff -r 085f765766a0 -r 860cd8a5168c brandingserver/rom/brandingserver.iby --- a/brandingserver/rom/brandingserver.iby Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Branding Server IBY -* -*/ -#ifndef __BS_IBY__ -#define __BS_IBY__ - -#include - - -// branding client -file=ABI_DIR\BUILD_DIR\bsclient.dll SHARED_LIB_DIR\bsclient.dll -// branding server -file=ABI_DIR\BUILD_DIR\bsserver.exe PROGRAMS_DIR\bsserver.exe - -// Add bsinstall.exe to rom to get xml importing working. -file=ABI_DIR\BUILD_DIR\bsinstall.exe PROGRAMS_DIR\bsinstall.exe - -// backup registration file -data=ZPRIVATE\102828dd\backup_registration.xml private\102828dd\backup_registration.xml - -// stubsis file -data=DATAZ_/system/install/bsstub.sis system/install/bsstub.sis - -#endif // __BS_IBY__ \ No newline at end of file diff -r 085f765766a0 -r 860cd8a5168c group/bld.inf --- a/group/bld.inf Fri May 28 18:27:27 2010 +0530 +++ b/group/bld.inf Fri Sep 17 19:56:13 2010 +0530 @@ -24,9 +24,9 @@ // MMP files for project components PRJ_MMPFILES -#include "../imsrv_plat/group/bld.inf" -#include "../ximpfw/group/bld.inf" -#include "../imservices/group/bld.inf" +//#include "../imsrv_plat/group/bld.inf" +//#include "../ximpfw/group/bld.inf" +//#include "../imservices/group/bld.inf" #include "../brandingserver/Group/bld.inf" PRJ_TESTMMPFILES diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/dataconvlib/bwins/opencstringutilitieslibexu.def --- a/imservices/ossprotocoladaptation/dataconvlib/bwins/opencstringutilitieslibexu.def Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -EXPORTS - ?chartohbufc16@@YAHPBDAAVHBufC16@@@Z @ 1 NONAME ; int chartohbufc16(char const *, class HBufC16 &) - ?chartohbufc8@@YAXPBDAAVHBufC8@@@Z @ 2 NONAME ; void chartohbufc8(char const *, class HBufC8 &) - ?chartotbuf16@@YAHPBDAAVTDes16@@@Z @ 3 NONAME ; int chartotbuf16(char const *, class TDes16 &) - ?chartotbuf8@@YAXPBDAAVTDes8@@@Z @ 4 NONAME ; void chartotbuf8(char const *, class TDes8 &) - ?createMsgBuffer@@YAXPAD000H@Z @ 5 NONAME ; void createMsgBuffer(char *, char *, char *, char *, int) - ?tbuf16tochar@@YAHAAVTDes16@@PAD@Z @ 6 NONAME ; int tbuf16tochar(class TDes16 &, char *) - ?tbuf16towchar@@YAPAGAAVTDes16@@@Z @ 7 NONAME ; unsigned short * tbuf16towchar(class TDes16 &) - ?tbuf8tochar@@YAPADAAVTDes8@@@Z @ 8 NONAME ; char * tbuf8tochar(class TDes8 &) - ?tbuf8towchar@@YAHAAVTDes8@@PAG@Z @ 9 NONAME ; int tbuf8towchar(class TDes8 &, unsigned short *) - ?tbufC16tochar@@YAHAAVTDesC16@@PAD@Z @ 10 NONAME ; int tbufC16tochar(class TDesC16 &, char *) - ?tbufC16towchar@@YAXAAVTDesC16@@PAG@Z @ 11 NONAME ; void tbufC16towchar(class TDesC16 &, unsigned short *) - ?tbufC8tochar@@YAXAAVTDesC8@@PAD@Z @ 12 NONAME ; void tbufC8tochar(class TDesC8 &, char *) - ?tbufC8towchar@@YAHAAVTDesC8@@PAG@Z @ 13 NONAME ; int tbufC8towchar(class TDesC8 &, unsigned short *) - ?wchartohbufc16@@YAXPBGAAVHBufC16@@@Z @ 14 NONAME ; void wchartohbufc16(unsigned short const *, class HBufC16 &) - ?wchartohbufc8@@YAHPBGAAVHBufC8@@@Z @ 15 NONAME ; int wchartohbufc8(unsigned short const *, class HBufC8 &) - ?wchartotbuf16@@YAXPBGAAVTDes16@@@Z @ 16 NONAME ; void wchartotbuf16(unsigned short const *, class TDes16 &) - ?wchartotbuf8@@YAHPBGAAVTDes8@@@Z @ 17 NONAME ; int wchartotbuf8(unsigned short const *, class TDes8 &) - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/dataconvlib/bwins/opencstringutilslibu.def --- a/imservices/ossprotocoladaptation/dataconvlib/bwins/opencstringutilslibu.def Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -EXPORTS - ?chartohbufc16@@YAHPBDAAVHBufC16@@@Z @ 1 NONAME ; int chartohbufc16(char const *, class HBufC16 &) - ?chartohbufc8@@YAXPBDAAVHBufC8@@@Z @ 2 NONAME ; void chartohbufc8(char const *, class HBufC8 &) - ?chartotbuf16@@YAHPBDAAVTDes16@@@Z @ 3 NONAME ; int chartotbuf16(char const *, class TDes16 &) - ?chartotbuf8@@YAXPBDAAVTDes8@@@Z @ 4 NONAME ; void chartotbuf8(char const *, class TDes8 &) - ?tbuf16tochar@@YAHAAVTDes16@@PAD@Z @ 5 NONAME ; int tbuf16tochar(class TDes16 &, char *) - ?tbuf16towchar@@YAPAGAAVTDes16@@@Z @ 6 NONAME ; unsigned short * tbuf16towchar(class TDes16 &) - ?tbuf8tochar@@YAPADAAVTDes8@@@Z @ 7 NONAME ; char * tbuf8tochar(class TDes8 &) - ?tbuf8towchar@@YAHAAVTDes8@@PAG@Z @ 8 NONAME ; int tbuf8towchar(class TDes8 &, unsigned short *) - ?tbufC16tochar@@YAHAAVTDesC16@@PAD@Z @ 9 NONAME ; int tbufC16tochar(class TDesC16 &, char *) - ?tbufC16towchar@@YAXAAVTDesC16@@PAG@Z @ 10 NONAME ; void tbufC16towchar(class TDesC16 &, unsigned short *) - ?tbufC8tochar@@YAXAAVTDesC8@@PAD@Z @ 11 NONAME ; void tbufC8tochar(class TDesC8 &, char *) - ?tbufC8towchar@@YAHAAVTDesC8@@PAG@Z @ 12 NONAME ; int tbufC8towchar(class TDesC8 &, unsigned short *) - ?wchartohbufc16@@YAXPBGAAVHBufC16@@@Z @ 13 NONAME ; void wchartohbufc16(unsigned short const *, class HBufC16 &) - ?wchartohbufc8@@YAHPBGAAVHBufC8@@@Z @ 14 NONAME ; int wchartohbufc8(unsigned short const *, class HBufC8 &) - ?wchartotbuf16@@YAXPBGAAVTDes16@@@Z @ 15 NONAME ; void wchartotbuf16(unsigned short const *, class TDes16 &) - ?wchartotbuf8@@YAHPBGAAVTDes8@@@Z @ 16 NONAME ; int wchartotbuf8(unsigned short const *, class TDes8 &) - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/dataconvlib/eabi/OpenCStringUtilsLibu.def --- a/imservices/ossprotocoladaptation/dataconvlib/eabi/OpenCStringUtilsLibu.def Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -EXPORTS - _Z11chartotbuf8PKcR5TDes8 @ 1 NONAME - _Z11tbuf8tocharR5TDes8 @ 2 NONAME - _Z12chartohbufc8PKcR6HBufC8 @ 3 NONAME - _Z12chartotbuf16PKcR6TDes16 @ 4 NONAME - _Z12tbuf16tocharR6TDes16Pc @ 5 NONAME - _Z12tbuf8towcharR5TDes8Pw @ 6 NONAME - _Z12tbufC8tocharR6TDesC8Pc @ 7 NONAME - _Z12wchartotbuf8PKwR5TDes8 @ 8 NONAME - _Z13chartohbufc16PKcR7HBufC16 @ 9 NONAME - _Z13tbuf16towcharR6TDes16 @ 10 NONAME - _Z13tbufC16tocharR7TDesC16Pc @ 11 NONAME - _Z13tbufC8towcharR6TDesC8Pw @ 12 NONAME - _Z13wchartohbufc8PKwR6HBufC8 @ 13 NONAME - _Z13wchartotbuf16PKwR6TDes16 @ 14 NONAME - _Z14tbufC16towcharR7TDesC16Pw @ 15 NONAME - _Z14wchartohbufc16PKwR7HBufC16 @ 16 NONAME - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/dataconvlib/eabi/opencstringutilitieslibexu.def --- a/imservices/ossprotocoladaptation/dataconvlib/eabi/opencstringutilitieslibexu.def Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -EXPORTS - _Z11chartotbuf8PKcR5TDes8 @ 1 NONAME - _Z11tbuf8tocharR5TDes8 @ 2 NONAME - _Z12chartohbufc8PKcR6HBufC8 @ 3 NONAME - _Z12chartotbuf16PKcR6TDes16 @ 4 NONAME - _Z12tbuf16tocharR6TDes16Pc @ 5 NONAME - _Z12tbuf8towcharR5TDes8Pw @ 6 NONAME - _Z12tbufC8tocharR6TDesC8Pc @ 7 NONAME - _Z12wchartotbuf8PKwR5TDes8 @ 8 NONAME - _Z13chartohbufc16PKcR7HBufC16 @ 9 NONAME - _Z13tbuf16towcharR6TDes16 @ 10 NONAME - _Z13tbufC16tocharR7TDesC16Pc @ 11 NONAME - _Z13tbufC8towcharR6TDesC8Pw @ 12 NONAME - _Z13wchartohbufc8PKwR6HBufC8 @ 13 NONAME - _Z13wchartotbuf16PKwR6TDes16 @ 14 NONAME - _Z14tbufC16towcharR7TDesC16Pw @ 15 NONAME - _Z14wchartohbufc16PKwR7HBufC16 @ 16 NONAME - _Z15createMsgBufferPcS_S_S_i @ 17 NONAME - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/dataconvlib/group/bld.inf --- a/imservices/ossprotocoladaptation/dataconvlib/group/bld.inf Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Generic string utility Apis to convert SYMBIAN descriptors -* to standard C character/Wide-character strings and Viceversa -* -*/ - - -PRJ_PLATFORMS -WINSCW -ARMV5 - - - -PRJ_MMPFILES -stringutils.mmp \ No newline at end of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/dataconvlib/group/stringutils.mmp --- a/imservices/ossprotocoladaptation/dataconvlib/group/stringutils.mmp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Generic string utility Apis to convert SYMBIAN descriptors -* to standard C character/Wide-character strings and Viceversa -* -*/ - - -#include -TARGET opencstringutilslib.dll -TARGETTYPE dll -UID 0x1000008D 0x2001241C - -CAPABILITY ALL -TCB -VENDORID VID_DEFAULT - -VERSION 10.0 - -SOURCEPATH ../src -//Sourcefile -SOURCE stringutils.cpp - -USERINCLUDE ../inc - - - -MW_LAYER_SYSTEMINCLUDE -OS_LAYER_LIBC_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY libc.lib - -LANG SC - - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/dataconvlib/inc/stringutils.h --- a/imservices/ossprotocoladaptation/dataconvlib/inc/stringutils.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,249 +0,0 @@ -/* -* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Header file for stringutils -* -*/ - -#ifndef __STRINGUTILS_H__ -#define __STRINGUTILS_H__ - -/** @file stringutils.h - * stringutils is a DLL that exports some set of genaralized APIs using which - * user can convert the SYMBIAN descriptors to standard C character/wide-character - * strings and vice-versa - */ - -//Symbian Headers -#include -#include - -/** - * Aliases : Cconverting HBufC variants to char/wchar_t strings involves - * similiar procedure to that of converting TBufC variants to char/wchar_t strings. - * Hence HBufC to char/wchar_t conversion Apis are aliased to their corresponding TBufC - * counterparts - */ - - -/** - * Alias to the function tbufC16towchar - */ -#define hbufC16towchar tbufC16towchar -/** - * Alias to the function tbufC16tochar - */ -#define hbufC16tochar tbufC16tochar -/** - * Alias to the function tbufC8towchar - */ -#define hbufC8towchar tbufC8towchar -/** - * Alias to the function tbufC8tochar - */ -#define hbufC8tochar tbufC8tochar - - -//Function prototypes - -/** Functions to convert SYMBIAN descriptors to C character and - * Wide-Character strings - */ - -/** - * This Api converts the tbuf16 to a wide-character string - * @param aArg TDes object - * @return a pointer to a wide-character string - */ -IMPORT_C wchar_t* tbuf16towchar(TDes& aArg); - -/** - * This Api converts the tbuf8 to a character string - * @param aArg TDes8 object - * @return a pointer to a character string - */ -IMPORT_C char* tbuf8tochar(TDes8& aArg); - -/** - * This Api converts the tbuf16 to a character string. It is user - * responsibality to allocate a required size of char object. Api may - * resulting in crash, if the destination object size is smaller than - * that of the source. - * @param aSrc TDes16 object - * @param aDes character pointer, to which the resultant string will be copied. - * @return returns an integer value. - * @return Api returns -1 in case of any error. - */ -IMPORT_C int tbuf16tochar(TDes& aSrc, char* aDes); - -/** - * This Api converts the tbuf8 to a wide-character string. It is user - * responsibality to allocate a required size of wide-char object. Api may - * resulting in crash, if the destination object size is smaller than that - * of the source. - * @param aSrc TDes8 object - * @param aDes wide-character pointer, to which the resultant string will be copied. - * @return returns an integer value. - * @return Api returns -1 in case of any error. - */ -IMPORT_C int tbuf8towchar(TDes8& aSrc, wchar_t* aDes); - -/** - * This Api converts the tbuf16 to a wide-character string. It is user - * responsibality to allocate a required size of wide-char object. Api may - * resulting in crash, if the destination object size is smaller than - * that of the source. - * @param aSrc TDes16 object - * @param aDes wide-character pointer, to which the resultant string will be copied. - * @return none - */ -IMPORT_C void tbufC16towchar(TDesC& aSrc ,wchar_t* aDes); - - - /** - * This Api converts the tbufC8 to a character string. It is user - * responsibality to allocate a required size of wide-char object. Api may - * resulting in crash, if the destination object size is smaller than - * that of the source. - * @param aSrc TDesC8 object - * @param aDes character pointer, to which the resultant string will be copied. - * @return none - */ - -IMPORT_C void tbufC8tochar(TDesC8& aSrc, char* aDes); - -/** - * This Api converts the TBufC16 to a character string. It is user - * responsibality to allocate a required size of wide-char object. Api may - * resulting in crash, if the destination object size is smaller than - * that of the source. - * @param aSrc TDesC object - * @param aDes character pointer, to which the resultant string will be copied. - * @return returns an integer value. - * @return Api returns -1 in case of any error. - */ -IMPORT_C int tbufC16tochar(TDesC& aSrc, char* aDes); - - -/** - * This Api converts the TBufC8 to a wide-character string. It is user - * responsibality to allocate a required size of wide-char object. Api may - * resulting in crash, if the destination object size is smaller than - * that of the source. - * @param aSrc TDesC8 object - * @param aDes wide-character pointer, to which the resultant string will be copied. - * @return returns an integer value. - * @return Api returns -1 in case of any error. - */ -IMPORT_C int tbufC8towchar(TDesC8& aSrc, wchar_t* aDes); - - -/** - * Functions to convert C character and - * Wide-Character strings to SYMBIAN descriptors - */ - -/** - * This Api converts the wide-char to a TBuf16. It is user responsibality - * to allocate a required size of TBuf16 object. Api may resulting in crash, - * if the destination object size is smaller than that of the source. - * @param aSrc wide-character pointer. - * @param aDes TBuf16 object, to which the resultant string will be copied. - * @return none - */ -IMPORT_C void wchartotbuf16(const wchar_t *aSrc, TDes16& aDes); - - - /** - * This Api converts the char to a TBuf16. It is user responsibality - * to allocate a required size of TBuf16 object. Api may resulting in crash, - * if the destination object size is smaller than that of the source. - * @param aSrc character pointer. - * @param aDes TBuf16 object, to which the resultant string will be copied. - * @return returns an integer value. - * @return Api returns -1 in case of any error. - */ -IMPORT_C int chartotbuf16(const char* aSrc, TDes16& aDes); - -/** - * This Api converts the wide-char string to a TBuf8. It is user - * responsibality to allocate a required size of TBuf8 object. Api may - * resulting in crash, if the destination object size is smaller than - * that of the source. - * @param aSrc wide-character pointer. - * @param aDes TBuf8 object, to which the resultant string will be copied. - * @return returns an integer value. - * @return Api returns -1 in case of any error. - */ -IMPORT_C int wchartotbuf8(const wchar_t* aSrc, TDes8& aDes); - - - /* - * This Api converts the character string to a TBuf8. It is user - * responsibality to allocate a required size of TBuf8 object. Api may - * resulting in crash, if the destination object size is smaller than - * that of the source. - * @param aSrc character pointer. - * @param aDes TBuf8 object, to which the resultant string will be copied. - * @return none - */ -IMPORT_C void chartotbuf8(const char* aSrc, TDes8& aDes); - - - /** - * This Api converts the wide-char to a HBufC16. It is user responsibality - * to allocate a required size of HBufC16 object. Api may resulting in crash, - * if the destination object size is smaller than that of the source. - * @param aSrc wide-character pointer. - * @param aDes HBufC16 object, to which the resultant string will be copied. - * @return none - */ -IMPORT_C void wchartohbufc16(const wchar_t* aSrc, HBufC16& aDes); - - - /** - * This Api converts the char to a HBufC16. It is user responsibality - * to allocate a required size of HBufC16 object. Api may resulting in crash, - * if the destination object size is smaller than that of the source. - * @param aSrc character pointer. - * @param aDes HBufC16 object, to which the resultant string will be copied. - * @return returns an integer value. - * @return Api returns -1 in case of any error. - */ -IMPORT_C int chartohbufc16(const char* aSrc, HBufC16& aDes); - -/** - * This Api converts the wide-char to a HBufC8. It is user responsibality - * to allocate a required size of HBufC8 object. Api may resulting in crash, - * if the destination object size is smaller than that of the source. - * @param aSrc wide-character pointer. - * @param aDes HBufC8 object, to which the resultant string will be copied. - * @return returns an integer value. - * @return Api returns -1 in case of any error. - */ -IMPORT_C int wchartohbufc8(const wchar_t* aSrc, HBufC8& aDes); - - - /* - * This Api converts the char to a HBufC8. It is user responsibality - * to allocate a required size of HBufC8 object. Api may resulting in crash, - * if the destination object size is smaller than that of the source. - * @param aSrc character pointer. - * @param aDes HBufC8 object, to which the resultant string will be copied. - * @return none - */ -IMPORT_C void chartohbufc8(const char* aSrc, HBufC8& aDes); - - - -#endif //__STRINGUTILS_H__ \ No newline at end of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/dataconvlib/sis/stringutils_lib.pkg --- a/imservices/ossprotocoladaptation/dataconvlib/sis/stringutils_lib.pkg Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -; -; Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: Installation file for OpenCStringUtilitiesLibEx Library -; -&EN - -;packet-header (name, uid, major, minor, build, type) -#{"StringUtils Library"},(0xA0001321),1,0,6371, TYPE=SA - -;Localised Vendor name -%{"Nokia"} - -;Unique Vendor name -:"Nokia" - -;Supports Series 60 v3.0 -;This line indicates that this installation is for the Series 60 platform v3.0 -;This line must appear _exactly_ as shown below in the sis file -;If this line is missing or incorrect, the sis file will not be able -;to be installed on Series 60 v2.0 platforms -[0x101F7961], 0, 0, 0, {"Series60ProductID"} - -;copy any data files if you have - -;Files to install -"\epoc32\release\armv5\urel\OpenCStringUtilitiesLibEx.dll" - "!:\sys\bin\OpenCStringUtilitiesLibEx.dll" - - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/dataconvlib/src/stringutils.cpp --- a/imservices/ossprotocoladaptation/dataconvlib/src/stringutils.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,177 +0,0 @@ -/* -* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Source file for stringutils -* -*/ - - -// GCCE header -//#ifdef __GCCE__ -//#include -//#endif //__GCCE__ - -//System headers -#include -#include - -//User-definied headers -#include "stringutils.h" - - -EXPORT_C wchar_t* tbuf16towchar(TDes& aArg) -{ - return (wchar_t*)aArg.PtrZ(); -} - -EXPORT_C char* tbuf8tochar(TDes8& aArg) -{ - return (char*)aArg.PtrZ(); -} - -EXPORT_C int tbuf16tochar(TDes& aSrc, char* aDes) -{ - const TUint16 *wideString = aSrc.PtrZ(); - - TInt ret = wcstombs(aDes, (const wchar_t*)wideString, KMaxFileName ); - - return ret; -} - -EXPORT_C int tbuf8towchar(TDes8& aSrc ,wchar_t* aDes) -{ - const char *charString = (const char*)aSrc.PtrZ(); - - TInt ret = mbstowcs(aDes, charString, KMaxFileName ); - - return ret; -} - - -EXPORT_C void tbufC16towchar(TDesC& aSrc ,wchar_t *aDes) -{ - wchar_t *temp = (wchar_t*)aSrc.Ptr(); - const TInt size = aSrc.Size(); - *(temp + size/2 ) = L'\0'; - wcscpy(aDes, temp); -} - -EXPORT_C void tbufC8tochar(TDesC8& aSrc, char* aDes) -{ - char *temp = (char*)aSrc.Ptr(); - const TInt size = aSrc.Length(); - *(temp + size) = '\0'; - strcpy(aDes, temp); -} - -EXPORT_C int tbufC16tochar(TDesC& aSrc, char* aDes) -{ - TUint16* wideString = (TUint16*)aSrc.Ptr(); - const TInt size = aSrc.Length(); - *(wideString + size) = L'\0'; - - - TInt ret = wcstombs(aDes, (const wchar_t*)wideString, size*2 ); - return ret; -} - - -EXPORT_C int tbufC8towchar(TDesC8& aSrc, wchar_t* aDes) -{ - TUint8* charString = (TUint8*)aSrc.Ptr(); - const TInt size = aSrc.Length(); - *(charString + size) = '\0'; - - TInt ret = mbstowcs(aDes, (const char*)charString, KMaxFileName ); - return ret; -} - -EXPORT_C void wchartotbuf16(const wchar_t *aSrc, TDes16 &aDes) -{ - aDes = (const TUint16*)aSrc; -} - -EXPORT_C int chartotbuf16(const char *aSrc, TDes16 &aDes) -{ - int len = strlen(aSrc); - wchar_t *buf = new wchar_t[len]; - - TInt ret = mbstowcs(buf, (const char*)aSrc, len + 1 ); - - if( ret != -1) - aDes = (const TUint16*)buf; - - delete buf; - return ret; -} - -EXPORT_C int wchartotbuf8(const wchar_t *aSrc, TDes8 &aDes) -{ - int len = wcslen(aSrc); - char *buf = new char[len]; - - TInt ret = wcstombs(buf, (const wchar_t*)aSrc, len + 1); - - if( ret != -1) - aDes = (const TUint8*)buf; - - delete buf; - return ret; -} - -EXPORT_C void chartotbuf8 (const char *aSrc, TDes8 &aDes) -{ - aDes = (const TUint8*)aSrc; -} - -EXPORT_C void wchartohbufc16 (const wchar_t* aSrc ,HBufC16& aDes ) -{ - aDes = (const TUint16*)aSrc; -} - -EXPORT_C int chartohbufc16(const char* aSrc, HBufC16& aDes) -{ - int len = strlen(aSrc); - wchar_t *buf = new wchar_t[len]; - - TInt ret = mbstowcs(buf, (const char*)aSrc, len + 1); - - if( ret != -1) - aDes = (const TUint16*)buf; - - delete buf; - return ret; -} - -EXPORT_C void chartohbufc8(const char* aSrc, HBufC8& aDes) -{ - aDes = (const TUint8*)aSrc; -} - -EXPORT_C int wchartohbufc8(const wchar_t* aSrc, HBufC8& aDes) -{ - int len = wcslen(aSrc); - char *buf = new char[len]; - - TInt ret = wcstombs(buf, aSrc, len + 1 ); - - if( ret != -1) - aDes = (const TUint8*)buf; - - delete buf; - return ret; -} - - - -// End of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/group/bld.inf --- a/imservices/ossprotocoladaptation/group/bld.inf Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Build information file for project ossprotocoladaptation -* -*/ - - -#include - -PRJ_PLATFORMS -WINSCW -ARMV5 - -PRJ_EXPORTS -../rom/ossprotocoladaptation.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ossprotocoladaptation.iby) -../../data/200195A9.txt /epoc32/data/Z/private/10202be9/200195A9.txt //temporary -../../data/200195A9.txt /epoc32/release/winscw/udeb/Z/private/10202be9/200195A9.txt //temporary - - -PRJ_MMPFILES - -../dataconvlib/group/stringutils.mmp -ossprotocoladaptation.mmp - - - -PRJ_TESTMMPFILES - -PRJ_TESTEXPORTS diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/group/ossprotocoladaptation.mmp --- a/imservices/ossprotocoladaptation/group/ossprotocoladaptation.mmp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,142 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Project definition file for OSSProtocolAdaptation -* -*/ - -// To get the MW_LAYER_SYSTEMINCLUDE-definition -#include -#include "../inc/ossprotocoladaptationuids.h" - -TARGET ossprotocoladaptation.dll -TARGETTYPE Plugin -UID KEComRecognitionDllUid2 KEComRecognitionDllUid3 -VENDORID VID_DEFAULT -CAPABILITY CAP_ECOM_PLUGIN - -VERSION 10.0 - -EPOCALLOWDLLDATA - -EPOCHEAPSIZE 0x100000 0x200000 -START RESOURCE ../rss/ossprotocoladaptation.rss -TARGET ossprotocoladaptation.rsc -END - - -SOURCEPATH ../src -SOURCE cossprotocolsearchfeatures.cpp -SOURCE cossprotocolplugin.cpp -SOURCE cossprotocolconnection.cpp -SOURCE cossprotocolpresencefeatures.cpp -SOURCE cossprotocolconnectionmanager.cpp -SOURCE cossprotocolloginrequest.cpp -SOURCE cossprotocollogoutrequest.cpp -SOURCE cossprotocolimfeatures.cpp -SOURCE waittimer.cpp -SOURCE cosssenddataoperation.cpp -SOURCE cossprotocolservererrorhandler.cpp -SOURCE cosscontactmanager.cpp - -//utils -SOURCE ossprotocoladaptutils.cpp -// for logs -SOURCE ossprotocolpluginlogger.cpp -// presentity groups source -SOURCEPATH ../src/presentitygroups -SOURCE cossprotocolpresentitygroups.cpp -SOURCE csubscribepresentitygroupcontentrequest.cpp -SOURCE caddpresentitygroupmemberrequest.cpp -SOURCE cremovepresentitygroupmemberrequest.cpp -SOURCE caddcontactnotificationhandler.cpp -SOURCE ccontactsynchandler.cpp -// --------------------------------------------------------------------------- -SOURCEPATH ../src/presencepublishing -// --------------------------------------------------------------------------- -SOURCE cossprotocolpresencepublishing.cpp -SOURCE cpresencenotificationhandler.cpp -SOURCE cpublishownpresencerequest.cpp - -// --------------------------------------------------------------------------- -SOURCEPATH ../src/presenceauthorization -// --------------------------------------------------------------------------- -SOURCE cossprotocolpresenceauthorization.cpp -SOURCE csubscribepresencegrantrequestlistrequest.cpp -SOURCE cpresenceauthuserrequest.cpp -SOURCE cwithdrawpresencegrantfrompresentityrequest.cpp -// Im operations source -SOURCEPATH ../src/im -SOURCE cossprotocolimconversation.cpp -SOURCE cosssendmessagerequest.cpp -SOURCE creceivemessagehandler.cpp - -SOURCEPATH ../src/processlauncher -SOURCE processlaunher.cpp - -// --------------------------------------------------------------------------- -SOURCEPATH ../src/search -// --------------------------------------------------------------------------- -SOURCE cossprotocolsearch.cpp -SOURCE csearchrequest.cpp -SOURCE csearchkeystore.cpp -SOURCE csearchgetsearchkeys.cpp - -// user includes -USERINCLUDE ../inc/search -USERINCLUDE . -USERINCLUDE ../inc -USERINCLUDE ../inc/presentitygroups -USERINCLUDE ../inc/im -USERINCLUDE ../inc/processlauncher -USERINCLUDE ../inc/presencepublishing -USERINCLUDE ../inc/presenceauthorization -USERINCLUDE ../dataconvlib/inc - -USERINCLUDE ../../xmppsettingsfetcher/inc - -// Default system include paths for middleware layer modules. -APP_LAYER_SYSTEMINCLUDE -OS_LAYER_LIBC_SYSTEMINCLUDE -OS_LAYER_GLIB_SYSTEMINCLUDE -OS_LAYER_SSL_SYSTEMINCLUDE -OS_LAYER_STDCPP_SYSTEMINCLUDE -OS_LAYER_DBUS_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/ecom - - - - - -LIBRARY euser.lib -LIBRARY ecom.lib -LIBRARY flogger.lib -LIBRARY bafl.lib -LIBRARY jabbersettings.lib -LIBRARY xmppsettingsfetcher.lib - -LIBRARY libc.lib -LIBRARY estor.lib -LIBRARY efsrv.lib -LIBRARY apparc.lib -LIBRARY opencmessagequeuelibrary.lib -LIBRARY opencstringutilslib.lib -LIBRARY inetprotutil.lib - -LIBRARY serviceprovidersettings.lib -LIBRARY centralrepository.lib -LIBRARY estlib.lib -LIBRARY presencecacheclient2.lib -LIBRARY presencecacheutils.lib - -// End of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/cosscontactmanager.h --- a/imservices/ossprotocoladaptation/inc/cosscontactmanager.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,135 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: contact manager -* -*/ - -#ifndef __COSSCONTACTMANAGER_H__ -#define __COSSCONTACTMANAGER_H__ - -#include - - -class MOSSProtocolConnectionManager; -/** - * COSSContactManager - * - */ -NONSHARABLE_CLASS ( COSSContactManager ) : public CBase - { - - public: - - static COSSContactManager* NewL(MOSSProtocolConnectionManager& aConnMan); - ~COSSContactManager(); - - - private: - - COSSContactManager(MOSSProtocolConnectionManager& aConnMan); - void ConstructL(); - - public: - /** - * get iFetchContactsFirstTime - */ - TBool IsFetchContactsFirstTime(); - /** - * iFetchInvitationsFirstTime - */ - TBool IsFetchInvitationsForFirstTime(); - /** - * Set iFetchContactsFirstTime - * @param value to be set - */ - void SetFetchContactsFirstTime(TBool aValue); - /** - * Set iFetchInvitationsFirstTime - * @param value to be set - */ - void SetFetchInvitationsForFirstTime(TBool aValue); - /** - * Get reference to iContacts - * @param iContacts - */ - RPointerArray& GetContactsListL(); - - /** - * Get reference to iInvitationList - * @param return iInvitationList - */ - RPointerArray& GetInvitationListL(); - /** - * give list of invitations to ximp fw and client side ui - * - */ - void ReturnInvitationListL(); - /** - * give list of current member and remote pending contacts to ximp fw and client side ui - * - */ - void ReturnContactsListL(); - /** - * remove a contact from the local copy of iContacts - * @param aContactName to be removed - */ - void RemoveContactFromLocalL(const TDesC& aContactName); - /** - * add a contact to the local copy of iContacts - * @param aContactName to be added - */ - void AddContactToLocalL(const TDesC& aContactName); - /** - * remove a invitation from the local copy of iInvitationList - * @param aContactName to be removed from the invitation list - */ - void RemoveInvitationFromLocalL(const TDesC& aContactName); - - private: - - /** - * Oss Protocol Plugin Contact Manager - * Not own. *** Write "Not own" if some other class owns this object. - */ - MOSSProtocolConnectionManager& iConnMan; - - /** - * stores if fetching contacts for the first time value - * Own - */ - TBool iFetchContactsFirstTime ; - /** - * stores if fetching invitations for the first time value - * Own - */ - TBool iFetchInvitationsFirstTime ; - /** - * current contacts. to maintain local copy of current contacts - * own - */ - RPointerArray iContacts; - - /** - * local copy of pending contacts or invitations - * own - */ - RPointerArray iInvitationList; - - }; - -#endif // __COSSCONTACTMANAGER_H__ - -// End of File - - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/cossprotocolconnection.h --- a/imservices/ossprotocoladaptation/inc/cossprotocolconnection.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,197 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: oss plugin implementation for XIMP Framework -* -*/ - - -#ifndef __COSSPROTOCOLCONNECTION_H__ -#define __COSSPROTOCOLCONNECTION_H__ - -//#include "OSSProtocloLiterals.h" - -#include -#include -#include -#include -#include - - -// FORWARD DECLARATIONS - -class MXIMPServiceInfo; - -class MXIMPContextClientInfo; - -class MXIMPProtocolConnection; - -class COSSProtocolConnectionManager; - -class COSSProtocolLogoutRequest; - -class COSSProtocolLoginRequest; - -class COSSProtocolPresenceFeatures; - -class COSSProtocolImFeatures; -class COSSProtocolSearchFeature; -/** - * COSSProtocolConnection - * - * OSS Protocol Connection Object. Protocol Connection Object has connection Manager. - * - * - * - */ - -class COSSProtocolConnection : - public CBase, - public MXIMPProtocolConnection - { - - public: - - static COSSProtocolConnection* NewL ( const MXIMPServiceInfo& aServiceInfo, - const MXIMPContextClientInfo& aClientCtxInfo ); - - - ~COSSProtocolConnection(); - - - - void ReleaseConnectionL(); - - - private: - - COSSProtocolConnection(); - - - void ConstructL ( const MXIMPServiceInfo& aServiceInfo, - const MXIMPContextClientInfo& aClientCtxInfo ); - - - public: // from MXIMPBase - - /** - * @see MXIMPProtocolConnection - */ - TAny* GetInterface ( TInt32 aInterfaceId, - TIfGetOps aOptions ); - /** - * @see MXIMPProtocolConnection - */ - const TAny* GetInterface ( TInt32 aInterfaceId, - TIfGetOps aOptions ) const; - /** - * @see MXIMPProtocolConnection - */ - TInt32 GetInterfaceId() const; - - - public: // from MXIMPProtocolConnection - - /** - * @see MXIMPProtocolConnection - */ - void PrimeHost ( MXIMPProtocolConnectionHost& aHost ); - - /** - * @see MXIMPProtocolConnection - */ void OpenSessionL ( const MXIMPContextClientInfo& aClientCtxInfo, - TXIMPRequestId aOpId ); - - /** - * @see MXIMPProtocolConnection - */ - void OpenSessionL ( const TInt& aSettingsId, - TXIMPRequestId aReqId ); - - /** - * @see MXIMPProtocolConnection - */ - void OpenSessionL ( - const MXIMPContextClientInfo& aContextClient, - const TInt& aSettingsId, - TXIMPRequestId aReqId ); - - /** - * @see MXIMPProtocolConnection - */ - void CloseSession ( const MXIMPContextClientInfo& aClientCtxInfo, - TXIMPRequestId aOpId ); - - /** - * @see MXIMPProtocolConnection - */ - void LogoutRequestL(TXIMPRequestId aOpId); - - /** - * @see MXIMPProtocolConnection - */ - void ReOpenSessionsL ( TXIMPRequestId aReqId ); - - /** - * @see MXIMPProtocolConnection - */ - void GetSupportedFeaturesL ( CDesC8Array& aFeatures ) const; - - /** - * @see MXIMPProtocolConnection - */ - MProtocolPresenceFeatures& ProtocolPresenceFeatures(); - - /** - * @see MXIMPProtocolConnection - */ - TAny* GetProtocolInterface(TInt aInterfaceId); - - - private: // data members - /** - * Connection manager - * OWN: - */ - COSSProtocolConnectionManager* iConnMan; - /** - * Presence features - * OWN: - */ - COSSProtocolPresenceFeatures* iPresFeatures; - /** - * Im features - * OWN: - */ - COSSProtocolImFeatures* iImFeatures; - /** - * Search features - * OWN: - */ - COSSProtocolSearchFeature* iSearchFeatures; - /** - * Request id - * OWN: - */ - TXIMPRequestId iRequestId; - /** - * Stores connection count - * OWN: - */ - TInt iConntectionCreated; - - - }; - - -#endif // __COSSPROTOCOLCONNECTION_H__ diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/cossprotocolconnectionmanager.h --- a/imservices/ossprotocoladaptation/inc/cossprotocolconnectionmanager.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,344 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: connection manager -* -*/ - -#ifndef __COSSPROTOCOLCONNECTIONMANAGER_H__ -#define __COSSPROTOCOLCONNECTIONMANAGER_H__ - -// INCLUDES -#include -#include -#include -#include "mossprotocolconnectionmanager.h" -#include "waittimer.h" -#include "cpresencenotificationhandler.h" -#include "creceivemessagehandler.h" -#include "cossprotocolservererrorhandler.h" -#include "caddcontactenotificationhandler.h" -#include "cosscontactmanager.h" -#include "msg_enums.h" -#include -#include "csearchkeystore.h" - -// FORWARD DECLARATIONS - -class MXIMPServiceInfo; - -class MXIMPProtocolConnectionHost; - -class MOSSProtocolConnectionManager; - -class CXmppParameters; - -class CWaitTimer; -class MProtocolImDataHost ; -class MProtocolSearchDataHost; -class CContactSyncHandler; - -_LIT(KColon,":"); - -/** - * COSSProtocolConnectionManager - * - * Every XIMPFW-OSS Connection has Connection Manager Object. - * - * - */ -NONSHARABLE_CLASS ( COSSProtocolConnectionManager ) : public CBase, - public MOSSProtocolConnectionManager - // implement session status observer callback - { - -public: - - static COSSProtocolConnectionManager* NewL(); - virtual ~COSSProtocolConnectionManager(); - - -private: - - COSSProtocolConnectionManager(); - void ConstructL(); - - -public: // From MOSSProtocolConnectionManager - - /** - * @see MOSSProtocolConnectionManager - */ - CXmppParameters& XmppParams(); - - /** - * @see MOSSProtocolConnectionManager - */ - CWaitTimer& DataHandler(); - - /** - * @see MOSSProtocolConnectionManager - */ - MXIMPProtocolConnectionHost& HandleToHost(); - - /** - * @see MOSSProtocolConnectionManager - */ - void ManufactureDataHandlerL() ; - - /** - * @see MOSSProtocolConnectionManager - */ - RArray< HBufC >* PresenceAuthGrantReqList(); - -public: // new methods - - /** - * set protocol connection host - * @param aHost protocol connection host - */ - void SetHost ( MXIMPProtocolConnectionHost& aHost ); - - /** - * set connection parameters - * @param aUserName user account - * @param aPassword password - * @param aServiceId ,service id - */ - void SetConnectionParamsL ( const TDesC& aUserName, - const TDesC& aPassword, - const TInt32 aServiceId ); - - /** - * set connection parameters - * @param aServiceId, service id - * @param aReadNedded, EFalse if need not to red from xmpp settings - * @return error if any - */ - TInt SetConnectionParamsL ( const TUint32 aServiceId, TBool aReadNeeded = ETrue ); - - - /** - * set protocol im data host - * @param aHost protocol im data host - */ - void SetImHost(MProtocolImDataHost& aHost); - - /** - * Get protocol im data host - * @param aHost protocol im data host - */ - MProtocolImDataHost& GetImHost() ; - - /** - * Get add notification handler - * @param iAddnotificationhandler - */ - CAddContactNotificationHandler& GetAddNotificationHandler(); - /** - * set protocol search data host - * @param aHost protocol search data host - */ - void SetSearchHost(MProtocolSearchDataHost& aHost); - - /** - * Get protocol search data host - * @param aHost protocol search data host - */ - MProtocolSearchDataHost& GetSearchHost() ; - - /** - * Release Connection - * send killing request to isoserver - */ - void ReleaseConnectionL(); - - - /** - * return ETrue if server disconnect has happen - */ - TBool IsServerDisconnect(); - - /*! /brief Gets a handle to search key store - * /return A handle to search key store - */ - CSearchKeyStore& GetSearchKeyStore(); - -public: - - /** - * Get id - * @return id - */ - TInt32 IapId(); - - /** - * Get username - * @return username - */ - TDesC& UserName(); - - /** - * Get password - * @return password - */ - TDesC& Password(); - - /** - * Get groupid - * @return groupid - */ - TDesC& GroupId(); - /** - * Get service name - * @return servicename - */ - const TDesC& ServiceName(); - /** - * Set group id - * @param group id - */ - void SetGroupIDL(TDesC& aGroupId); - - /** - * gets the contactmanager - * @return iContactManager - */ - COSSContactManager& GetContactManager(); - - -private: // data - - /** - * Stores settings - * Own - */ - CXmppParameters* iXmppParams; - - /** - * REF: protocol connection host - */ - MXIMPProtocolConnectionHost* iHostHandle; - - /** - * Server address: - * Own - */ - HBufC* iServerAddress; - - /** - * UserName: - * Own - */ - HBufC* iUserName; - - /** - * UserName: - * Own - */ - HBufC* iPassword; - - /** - * Group id: - * Own - */ - HBufC* iGroupId; - - /** - * wait scheduler: - * Own - */ - CActiveSchedulerWait* iWaitScheduler; - - /** - * wait timer: - * Own - */ - CWaitTimer* iTimer; - - /** - * Presence notifier: - * Own - */ - CPresenceNotificationHandler* iNotifier; - - /** - * Recieve message handler: - * Own - */ - CReceiveMessageHandler* iRecvHandler; - - /** - * Server intiated error hanlder: - * Own - */ - COssprotocolServerErrorHandler* iServerErrorHandler; - - /** - * Add notifications handler - * Own - */ - CAddContactNotificationHandler* iAddNotificationHanlder; - - /** - * Contact synchronisation handler: - * Own - */ - CContactSyncHandler* iContactSyncHandler; - - /** - * stores data handler readyness value - * Own - */ - TBool iIsDataHandlerReady; - - /** - * Search key store - * Own - */ - CSearchKeyStore* iSearchKeyStore; - - /** - * Protocol im data host - * Doesn't own - */ - MProtocolImDataHost *iHost ; - - /** - * Protocl search data host - * Doesn't own - */ - MProtocolSearchDataHost *iSearchHost ; - - /** - * local contact manager - * own - */ - COSSContactManager* iContactManager; - /** - * service name for presence cache updation - * Own - */ - HBufC* iServiceName; -public: - /** - * Presence authorisation grant list - * Doesn't own - */ - RArray< HBufC > iPresenceAuthGrantReqList; - - - }; - - -#endif // __COSSPROTOCOLCONNECTIONMANAGER_H__ diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/cossprotocolimfeatures.h --- a/imservices/ossprotocoladaptation/inc/cossprotocolimfeatures.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: oss presence features implementation for XIMP Framework -* -*/ - - -#ifndef __COSSPROTOCOLIMFEATURES_H__ -#define __COSSPROTOCOLIMFEATURES_H__ - -// INCLUDES -#include -#include -//#include -#include -#include -//#include -//#include -#include "cossprotocolconnectionmanager.h" - -class COSSProtocolImConversation; -/** - * COSSProtocolImFeatures - * - * OSS Protocol Connection Object. Protocol Connection Object has connection Manager. - * - */ - -class COSSProtocolImFeatures : - public CProtocolImFeatures - { - - public: - - static COSSProtocolImFeatures* NewL ( COSSProtocolConnectionManager& aConnMan ); - - - ~COSSProtocolImFeatures(); - - private: - - COSSProtocolImFeatures(COSSProtocolConnectionManager& aConnMan ); - - - void ConstructL ( COSSProtocolConnectionManager& aConnMan ); - - public: // from MXIMPBase - - TAny* GetInterface ( TInt32 aInterfaceId, - TIfGetOps aOptions ); - - const TAny* GetInterface ( TInt32 aInterfaceId, - TIfGetOps aOptions ) const; - - - TInt32 GetInterfaceId() const; - - public :// From MProtocolImFeatures - - /** - * @see MProtocolImFeatures - */ - MProtocolImGroup& ImGroup(); - /** - * @see MProtocolImFeatures - */ - MProtocolImConversation& ImConversation(); - /** - * @see MProtocolImFeatures - */ - /** - * @see MProtocolImFeatures - */ - MProtocolImInvitation& ImInvitation(); - /** - * @see MProtocolImFeatures - */ - MProtocolImSearch& ImSearch(); - /** - * @see MProtocolImFeatures - */ - void SetHost(MProtocolImDataHost& aHost ); - - TInt SupportedSubInterfaces() const; - - private : //data members - /** - * im conversation - * Own: - */ - COSSProtocolImConversation* iImConversation; - - /** - * Protocol im data hodt - * Not own: - */ - MProtocolImDataHost *iHost ; - - /** - * Connection manager - * Not own: - */ - COSSProtocolConnectionManager &iConnMan ; - }; - -#endif //__COSSPROTOCOLIMFEATURES_H__ - -// end of file \ No newline at end of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/cossprotocolloginrequest.h --- a/imservices/ossprotocoladaptation/inc/cossprotocolloginrequest.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Login Request to the Network Server. -* -*/ - - - -#ifndef _COSSPROTOCOLLOGINREQUEST_H_ -#define _COSSPROTOCOLLOGINREQUEST_H_ - -// INCLUDES -#include -#include -#include -#include "ossprotocolpluginlogger.h" -#include "ossprotocloliterals.h" -// FORWARD DECLARATIONS - -class MOSSProtocolConnectionManager; - -class COSSProtocolConnectionManager; - - -const TInt KImpsMaxResourceIdLen = 64; // maximum Resource ID, this is not sure! - -/** - * COSSProtocolLoginRequest - * - * Issue Login Request to the Network Server - * - */ -NONSHARABLE_CLASS ( COSSProtocolLoginRequest ) : public CActive - - - { - -public: - - static COSSProtocolLoginRequest* NewLC ( MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - static COSSProtocolLoginRequest* NewL ( MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - virtual ~COSSProtocolLoginRequest(); - - -private: - - COSSProtocolLoginRequest ( MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - void ConstructL(); - - -private: // from CActive - - void DoCancel(); - /* - * RunL() function also deletes the request object once the activity is done - * - */ - void RunL(); - TInt RunError ( TInt aError ); - -private: // new methods - - /** - * Resource Id Generator - * Leaves with KErrNotFound if no value - * @return ResourceId - */ - TPtrC GenResourceId( const TDesC& aResourceId ); -public: - - /** - * Issue login request to the isolation server - */ - void IssueLoginRequestL(); - - -private: // data - - /** - * OWN:Request Id from ximpfw - */ - TXIMPRequestId iRequestId; - /** - * Send data request to pure data handler generates the id - */ - TInt iSendId; - /** - * OSS Protocol Plugin Connection Manager - * Not own. - */ - MOSSProtocolConnectionManager& iConnMan; - - /** - * Resource ID Implementation - * Not own. - */ - TBuf iResourceId; - - /** - * Own user id - */ - HBufC* iUserName; - }; - - -#endif // _COSSPROTOCOLLOGINREQUEST_H_ - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/cossprotocollogoutrequest.h --- a/imservices/ossprotocoladaptation/inc/cossprotocollogoutrequest.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Logout Request to the Network Server. -* -*/ - - - -#ifndef __COSSPROTOCOLLOGOUTREQUEST_H_ -#define __COSSPROTOCOLLOGOUTREQUEST_H_ - -// INCLUDES -#include -#include -#include -#include "ossprotocolpluginlogger.h" -#include "ossprotocloliterals.h" -// FORWARD DECLARATIONS - -class MOSSProtocolConnectionManager; - -class COSSProtocolConnectionManager; - - -/** - * COSSProtocolLogoutRequest - * - * Issue Logout Request to the Network Server - * - */ -NONSHARABLE_CLASS ( COSSProtocolLogoutRequest ) : public CActive - - - { - -public: - - static COSSProtocolLogoutRequest* NewLC ( MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - static COSSProtocolLogoutRequest* NewL ( MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - virtual ~COSSProtocolLogoutRequest(); - - -private: - - COSSProtocolLogoutRequest ( MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - void ConstructL(); - - -private: // from CActive - - void DoCancel(); - /* - * RunL() function also deletes the request object once the activity is done - * - */ - void RunL(); - TInt RunError ( TInt aError ); - -public: - /** - * Issue logout request to the isolation server - */ - void IssueLogoutRequestL(); - - -private: // data - - /** - * Request Id - * OWN - */ - TXIMPRequestId iRequestId; - /** - * OSS Protocol Plugin Connection Manager - * Not own. - */ - MOSSProtocolConnectionManager& iConnMan; - - /** - * Send data request to pure data handler generates the id - */ - TInt iSendId; - - }; - - -#endif // __COSSPROTOCOLLOGOUTREQUEST_H_ - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/cossprotocolplugin.h --- a/imservices/ossprotocoladaptation/inc/cossprotocolplugin.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,118 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: adaptation for open source -* -*/ - - -#ifndef __COSSPROTOCOLPLUGIN_H__ -#define __COSSPROTOCOLPLUGIN_H__ - -// INCLUDES -#include -#include - -// FORWARD DECLARATIONS - -class MXIMPServiceInfo; - -class MXIMPContextClientInfo; - -class COSSProtocolConnection; - -class CProcessLauncher; - - - - -/** - * OSS protocol Plugin - * - * OSS plugin is ECOM plugin and shall be loaded by PrFw. - * OSS has one or many connections. - */ - -class COSSProtocolPlugin : public CXIMPProtocolPluginBase - { - - public: - - static COSSProtocolPlugin* NewL(); - static COSSProtocolPlugin* NewLC(); - - ~COSSProtocolPlugin(); - - private: - - COSSProtocolPlugin(); - void ConstructL(); - - public: // From MXIMPProtocolPlugin - - /** - * @see MXIMPProtocolPlugin - */ - void PrimeHost ( MXIMPProtocolPluginHost& aHost ); - /** - * @see MXIMPProtocolPlugin - */ - MXIMPProtocolConnection& AcquireConnectionL ( - const MXIMPServiceInfo& aServiceInfo, - const MXIMPContextClientInfo& aClientCtxInfo ); - /** - * @see MXIMPProtocolPlugin - */ - void ReleaseConnection ( - MXIMPProtocolConnection& aConnection ); - - public: // from MXIMPBase - /** - * @see MXIMPBase - */ - TAny* GetInterface ( - TInt32 aInterfaceId, - TIfGetOps aOptions ); - /** - * @see MXIMPBase - */ - const TAny* GetInterface ( - TInt32 aInterfaceId, - TIfGetOps aOptions ) const; - /** - * @see MXIMPBase - */ - TInt32 GetInterfaceId() const; - - private: // Data - /** - * Prime host - * Not own. - */ - MXIMPProtocolPluginHost* iHost; - /** - * protocol connections - * Own. - */ - RPointerArray< COSSProtocolConnection > iConnections; - - /** - * process launcher.launches isolation server - * Own. - */ - CProcessLauncher *iIsoServerLauncher; - - - }; - -#endif // __COSSPROTOCOLPLUGIN_H__ diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/cossprotocolpresencefeatures.h --- a/imservices/ossprotocoladaptation/inc/cossprotocolpresencefeatures.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: oss presence features implementation for XIMP Framework -* -*/ - - -#ifndef __COSSPROTOCOLPRESENCERFEATURES_H__ -#define __COSSPROTOCOLPRESENCERFEATURES_H__ - -// INCLUDES -#include -#include -#include -#include -#include -#include -#include "cossprotocolconnectionmanager.h" -class COSSProtocolPresentityGroups; -class COSSProtocolpresentitygroups; -class COssProtocolPresencePublishing; -class COssProtocolPresenceAuthorization; -/** - * COSSProtocolPresenceFeatures - * - * COSSProtocolPresenceFeatures provide - * access following feature specific sub-interfaces: - * - MProtocolPresenceWatching - * - MProtocolPresencePublishing - * - MProtocolPresentityGroups - * - MProtocolPresenceAuthorization - * - */ -class COSSProtocolPresenceFeatures : - public CBase, - public MProtocolPresenceFeatures - { - - public: - - static COSSProtocolPresenceFeatures* NewL( COSSProtocolConnectionManager& aConnMan ); - - - ~COSSProtocolPresenceFeatures(); - - private: - - COSSProtocolPresenceFeatures(); - - - void ConstructL( COSSProtocolConnectionManager& aConnMan ); - - public: // from MXIMPBase - /** - * @see MXIMPBase - */ - TAny* GetInterface( TInt32 aInterfaceId, - TIfGetOps aOptions ); - /** - * @see MXIMPBase - */ - const TAny* GetInterface( TInt32 aInterfaceId, - TIfGetOps aOptions ) const; - - /** - * @see MXIMPBase - */ - TInt32 GetInterfaceId() const; - - public : // From MProtocolPresenceFeatures - - /** - * @see MProtocolPresenceFeatures - */ - MProtocolPresenceWatching& PresenceWatching(); - /** - * @see MProtocolPresenceFeatures - */ - MProtocolPresencePublishing& PresencePublishing(); - /** - * @see MProtocolPresenceFeatures - */ - MProtocolPresentityGroups& PresentityGroups(); - /** - * @see MProtocolPresenceFeatures - */ - MProtocolPresenceAuthorization& PresenceAuthorization(); - - private : //data members - /** - * presentity group - * Own - */ - COSSProtocolpresentitygroups* iPresentityGroups; - /** - * presence publishing - * Own - */ - COssProtocolPresencePublishing* iPresencePublishing; - /** - * presence authorisation - * Own - */ - COssProtocolPresenceAuthorization* iAuthrozation; - - }; - -#endif //__COSSPROTOCOLPRESENCERFEATURES_H__ - -// end of file \ No newline at end of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/cossprotocolsearchfeatures.h --- a/imservices/ossprotocoladaptation/inc/cossprotocolsearchfeatures.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: oss search features implementation for XIMP Framework -* -*/ - - -#ifndef __COSSPROTOCOLSEARCHFEATURE_H__ -#define __COSSPROTOCOLSEARCHFEATURE_H__ - -// INCLUDES -#include -#include -#include -#include "cossprotocolconnectionmanager.h" - - -class COSSProtocolSearch; - -/** - * COSSProtocolSearchFeature - * Provides access to subinterface MProtocolSearch - * and sets the search data host - * - */ - -class COSSProtocolSearchFeature : public CBase, - public MProtocolSearchFeature - - { - - public: - - static COSSProtocolSearchFeature* NewL ( COSSProtocolConnectionManager& aConnMan ); - - - ~COSSProtocolSearchFeature(); - - private: - - COSSProtocolSearchFeature(COSSProtocolConnectionManager& aConnMan ); - - - void ConstructL ( COSSProtocolConnectionManager& aConnMan ); - - public: // from MXIMPBase - - TAny* GetInterface ( TInt32 aInterfaceId, - TIfGetOps aOptions ); - - const TAny* GetInterface ( TInt32 aInterfaceId, - TIfGetOps aOptions ) const; - - - TInt32 GetInterfaceId() const; - - public : // From MProtocolSearchFeature.for comments,see MProtocolSearchFeature - - /** - * @see MProtocolSearchFeature - */ - MProtocolSearch& Search(); - /** - * @see MProtocolSearchFeature - */ - void SetHost(MProtocolSearchDataHost& aSearchHost ); - - private : //data members - /** - * search - * owned - */ - COSSProtocolSearch* iSearch; - - /** - * connection manager - * not owned - */ - COSSProtocolConnectionManager &iConnMan ; - }; - -#endif //__COSSPROTOCOLSEARCHFEATURE_H__ - -// end of file \ No newline at end of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/cossprotocolservererrorhandler.h --- a/imservices/ossprotocoladaptation/inc/cossprotocolservererrorhandler.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: implementation of server error notification handler -* -*/ - - -#ifndef __COssprotocolServerErrorHandler_H__ -#define __COssprotocolServerErrorHandler_H__ - - -// INCLUDES -#include -#include - -#include -#include - -// FORWARD DECLARATIONS - -class MOSSProtocolConnectionManager; - -/** - * COssprotocolServerErrorHandler - * - * Handles network server intiated errors - * - */ - -class COssprotocolServerErrorHandler: public CActive - - - { - - public: - - static COssprotocolServerErrorHandler* NewL ( - MOSSProtocolConnectionManager& aConnMan - ); - - static COssprotocolServerErrorHandler* NewLC ( - MOSSProtocolConnectionManager& aConnMan - ); - - virtual ~COssprotocolServerErrorHandler(); - - private: - - COssprotocolServerErrorHandler ( MOSSProtocolConnectionManager& aConnMan ); - void ConstructL(); - - private: // from CActive - - void DoCancel(); - void RunL(); - TInt RunError ( TInt aError ); - - public: - /** - * start listening for server intiated error signals - */ - void StartListeningL(); - /** - * Handles the recieved error signal - */ - void ProcessIncomingDataL(); - - private: // data - - /** - * Send data request to pure data handler generates the id - */ - TInt iSendId; - - /** - * Oss Protocol Plugin Connection Manager - * Not own. *** Write "Not own" if some other class owns this object. - */ - MOSSProtocolConnectionManager& iConnMan; - - }; - - -#endif // __COssprotocolServerErrorHandler_H__ - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/cosssenddataoperation.h --- a/imservices/ossprotocoladaptation/inc/cosssenddataoperation.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Send data operation holder -* -*/ - -#ifndef __COSSSENDDATAOPERATION_H__ -#define __COSSSENDDATAOPERATION_H__ - -// INCLUDES -#include -#include "ossprotocolpluginlogger.h" -#include - - -/** - * COssSendDataOperation: - * Send data operation holder - * - */ -NONSHARABLE_CLASS ( COssSendDataOperation ) : - public CBase - { - -public: - - static COssSendDataOperation* NewLC(); - - /** - * Default constructor - */ - COssSendDataOperation(); - - /** - * Destructor - */ - ~COssSendDataOperation(); - - -public: // new function of the class - - - /** - * Set ids, operation and log id - */ - void SetIds ( TInt aOperationId, TInt aLogId ); - - /** - * Set request status - */ - void SetRequestStatus ( TRequestStatus& aStatus ); - - - /** - * request status of this operation - * @return Trequest status of this operation - */ - TRequestStatus* Status(); - - /** - * Get Ids - * - * @return operation Id - */ - TInt OperationId() const; - - /** - * Complete operation - * - * @param aCode complete code - */ - void CompletedOperation ( TInt aCode ); - - /** - * Set response buffer - * Owner ship is transfered - * @param aBuff response buffer - */ - void SetResponse ( char* aBuff ); - - /** - * Response buffer, - * owner ship is transfered - * @return transfer buffer - */ - char* Response(); - -private: // Public data - - /** - * Status of the operation - */ - TRequestStatus* iStatus; - - /** - * Operation Id - * OWN - */ - TInt iOpId; - - /** - * Response buffer - * OWN - */ - char* iData; - /** - * Id used for logs writting - * OWN - */ - TInt iLogId; - }; - - - -#endif // __COSSSENDDATAOPERATION_H__ - -// End of File diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/cuserafter.h --- a/imservices/ossprotocoladaptation/inc/cuserafter.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,150 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Active object based wait. -* -*/ - -#ifndef CUSERAFTER_H__ -#define CUSERAFTER_H__ - -// INCLUDES -#include - - -// CLASS DESCRIPTION - -/** - * Active object based wait. - * - * Similar like User::After() but doesn't block - * whole thread, but current RunL() with - * CActiveSchedulerWait. - */ - -class CUserAfter : public CTimer - { - - public: //Construction - static inline CUserAfter* NewL(); - static inline CUserAfter* NewLC(); - ~CUserAfter(); - - - public: //Wait support - - /** - * Static "one shot" wait method. - */ - static inline void AfterL ( TInt aWaitTimeMicroSeconds ); - - /** - * Member wait method. - */ - inline void After ( TInt aWaitTimeMicroSeconds ); - - - private: - CUserAfter(); - - void RunL(); - void RunError(); - void DoCancel(); - - - private: //data - - /** - * ActiveSchedulerWait - * Own - */ - CActiveSchedulerWait iWait; - - }; - - - - -// ----------------------------------------------------------------------------- -// CUserAfter public functions -// ----------------------------------------------------------------------------- -// -inline CUserAfter* CUserAfter::NewL() - { - CUserAfter* self = CUserAfter::NewLC(); - CleanupStack::Pop ( self ); - return self; - } - -inline CUserAfter* CUserAfter::NewLC() - { - CUserAfter* self = new ( ELeave ) CUserAfter(); - CleanupStack::PushL ( self ); - self->ConstructL(); - return self; - } - - -inline CUserAfter::~CUserAfter() - { - CTimer::Cancel(); - } - -inline void CUserAfter::After ( TInt aWaitTimeMicroSeconds ) - { - CTimer::After ( aWaitTimeMicroSeconds ); - iWait.Start(); - } - - -inline void CUserAfter::AfterL ( TInt aWaitTimeMicroSeconds ) - { - CUserAfter* after = CUserAfter::NewL(); - after->After ( aWaitTimeMicroSeconds ); - delete after; - } - - - -// ----------------------------------------------------------------------------- -// CUserAfter private functions -// ----------------------------------------------------------------------------- -// -inline CUserAfter::CUserAfter() - : CTimer ( CActive::EPriorityStandard ) - { - CActiveScheduler::Add ( this ); - } - - -inline void CUserAfter::RunL() - { - iWait.AsyncStop(); - Cancel(); - } - -inline void CUserAfter::RunError() - { - } - -inline void CUserAfter::DoCancel() - { - iWait.AsyncStop(); - CTimer::DoCancel(); - } - - -#endif // CUSERAFTER_H__ - -// End of File - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/im/cossprotocolimconversation.h --- a/imservices/ossprotocoladaptation/inc/im/cossprotocolimconversation.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,135 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Oss protocol im conversation -* -*/ - -#ifndef COSSPROTOCOLIMCONVERSATION_H__ -#define COSSPROTOCOLIMCONVERSATION_H__ - - -#include -#include - - -class MOSSProtocolConnectionManager; - - -/** - * COSSProtocolImConversation - * implements MProtocolImConversation methods - * these methods will called by ximp framework - */ -class COSSProtocolImConversation : public CBase, - public MProtocolImConversation - { - -public: - - static COSSProtocolImConversation* NewL( MOSSProtocolConnectionManager& aConnManager ); - ~COSSProtocolImConversation(); - - -private: - - COSSProtocolImConversation( MOSSProtocolConnectionManager& aConnManager ); - void ConstructL(); - -public: //from MXIMPBase - - /** - * @see MXIMPBase - */ - TAny* GetInterface( TInt32 aInterfaceId, - TIfGetOps aOptions ); - /** - * @see MXIMPBase - */ - const TAny* GetInterface( TInt32 aInterfaceId, - TIfGetOps aOptions ) const; - - /** - * @see MXIMPBase - */ - TInt32 GetInterfaceId() const; - -public: // From MProtocolImConversation - /** - * @see MProtocolImConversation - */ - void DoSendMessageL( - const MImConversationInfo& aImMessage, - TXIMPRequestId aReqId ); - /** - * @see MProtocolImConversation - */ - void DoForwardMessageL( - const MImConversationInfo& aImMessage, - TXIMPRequestId aReqId); - /** - * @see MProtocolImConversation - */ - void DoSendMessageToGroupL( - const MImConversationInfo& aImMessage, - const TDesC* aGroupId,TXIMPRequestId aReqId ); - /** - * @see MProtocolImConversation - */ - TXIMPRequestId DoBlockUsersL( - const MDesCArray* aUserIds, - TXIMPRequestId aReqId); - /** - * @see MProtocolImConversation - */ - TXIMPRequestId DoUnBlockUsersL( - const MDesCArray* aUserIds, - TXIMPRequestId aReqId ); - /** - * @see MProtocolImConversation - */ - void DoGetBlockedListRequestL( - const MXIMPIdentity& aImMessageId, - TXIMPRequestId aReqId ); - /** - * @see MProtocolImConversation - */ - void DoGetMessageListL( - const MXIMPIdentity& aImMessageId, - const TDesC* aGroupId, - const TInt aMessageCount, - TBool aDeliveryReportWanted, - TXIMPRequestId aReqId); - /** - * @see MProtocolImConversation - */ - void DoRejectMessageL( - const MXIMPIdentity& aImMessageId, - const TDesC& aMessageID, - TXIMPRequestId aReqId ); -private: - /** - * Creates data handler - */ - void CreateDataHandlerL(); - -private: // data members - /** - * Oss Protocol Plugin Connection Manager - * Not own. *** Write "Not own" if some other class owns this object. - */ - MOSSProtocolConnectionManager& iConnMan; - - }; - -#endif // COSSPROTOCOLIMCONVERSATION_H__ diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/im/cosssendmessagerequest.h --- a/imservices/ossprotocoladaptation/inc/im/cosssendmessagerequest.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Oss Protocol send massage request -* -*/ - - -#ifndef __COSSSENDMESSAGEREQUEST_H__ -#define __COSSSENDMESSAGEREQUEST_H__ - - -// INCLUDES -#include -#include -#include "ossprotocolpluginlogger.h" -#include "ossprotocloliterals.h" - -// FORWARD DECLARATIONS - -class MOSSProtocolConnectionManager; - -class MImConversationInfo; -/** - * COSSSendMessageRequest - * - * Issue Send Message Request to Network Server - * - */ - -class COSSSendMessageRequest: public CActive - - - { - - public: - - static COSSSendMessageRequest* NewL ( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - - static COSSSendMessageRequest* NewLC ( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - - virtual ~COSSSendMessageRequest(); - - private: - - COSSSendMessageRequest ( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - void ConstructL(); - - private: // from CActive - - void DoCancel(); - /* - * RunL() function also deletes the request object once the activity is done - * - */ - void RunL(); - TInt RunError ( TInt aError ); - - public: - /** - * Send message to the recipients - * @param aImMessage stucture stores message,recipients - */ - void SendMessageL ( const MImConversationInfo& aImMessage ); - - private: // data - - /** - * Request Id from ximpfw - */ - TXIMPRequestId iRequestId; - /** - * Send data request to pure data handler generates the id - */ - TInt iSendId; - /** - * list id - * Own - */ - HBufC16* iListId; - /** - * Oss Protocol Plugin Connection Manager - * Not own. *** Write "Not own" if some other class owns this object. - */ - MOSSProtocolConnectionManager& iConnMan; - - }; - - -#endif // __COSSSENDMESSAGEREQUEST_H__ - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/im/creceivemessagehandler.h --- a/imservices/ossprotocoladaptation/inc/im/creceivemessagehandler.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of reicive message handler -* -*/ - - -#ifndef __CRECEIVEMESSAGEHANDLER_H__ -#define __CRECEIVEMESSAGEHANDLER_H__ - - -// INCLUDES -#include -#include - - - -// FORWARD DECLARATIONS - -class MOSSProtocolConnectionManager; - -/** - * CReceiveMessageHandler - * - * Handles the messages recieved. - * updates imfeature plugin data model and - * triggers event - * - */ - -class CReceiveMessageHandler: public CActive - - - { - - public: - - static CReceiveMessageHandler* NewL ( - MOSSProtocolConnectionManager& aConnMan - ); - - - virtual ~CReceiveMessageHandler(); - - private: - - CReceiveMessageHandler ( MOSSProtocolConnectionManager& aConnMan ); - void ConstructL(); - - private: // from CActive - - void DoCancel(); - void RunL(); - TInt RunError ( TInt aError ); - - public: - - /** - * start listening recieved massages - */ - void StartListeningL(); - /** - * parse the data and update the data cache of ximp.send event back to ximp - */ - void ProcessIncomingDataL(); - - private: // data - - /** - * Send data request to pure data handler generates the id - */ - TInt iSendId; - - /** - * Oss Protocol Plugin Connection Manager - * Not own. *** Write "Not own" if some other class owns this object. - */ - MOSSProtocolConnectionManager& iConnMan; - - }; - - -#endif // __CRECEIVEMESSAGEHANDLER_H__ - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/mossprotocolconnectionmanager.h --- a/imservices/ossprotocoladaptation/inc/mossprotocolconnectionmanager.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: oss protocol plugin connection manager interface -* -*/ - -#ifndef __MOSSCONNNECTIONMANAGERCONTROL_H__ -#define __MOSSCONNNECTIONMANAGERCONTROL_H__ - - -// FORWARD DECLARATIONS - -class MXIMPProtocolConnectionHost; -class CXmppParameters; -class CWaitTimer; -class MProtocolImDataHost; -class MProtocolSearchDataHost; -class CSearchKeyStore; -class CAddContactNotificationHandler; -class COSSContactManager; -/** - * MOSSProtocolConnectionManager - * - * Telepathy Plugin Connection Manager's Interface - * - */ -class MOSSProtocolConnectionManager - { - -public: - - /** - * ?description - * - * access to xmpp settings - * @return handle to xmppparameter - */ - virtual CXmppParameters& XmppParams() = 0; - /** - * access to protocol data handler - * @return protocol data handler - */ - virtual CWaitTimer& DataHandler() = 0; - /** - * access to protocol connection host - * @return protocol connection host - */ - virtual MXIMPProtocolConnectionHost& HandleToHost() = 0; - /** - * creates datahanlder - * @return access point - * - */ - virtual void ManufactureDataHandlerL() = 0; - /** - * check the data handler creation - * @return ETrue,if datahandler created,else EFalse - */ - - virtual TDesC& UserName() = 0; - /** - * - * @return Passwor - */ - virtual TDesC& Password() = 0; - /** - * @return GroupId - */ - virtual TDesC& GroupId() =0 ; - /** - * @return ServiceName - */ - virtual const TDesC& ServiceName() = 0; - /** - * sets the groupid - * @param aGroupId : group id to be set - */ - virtual void SetGroupIDL(TDesC& aGroupId) = 0; - /** - * gets the contactmanager - * @return iContactManager - */ - virtual COSSContactManager& GetContactManager() = 0; - /** - * @return authorised list - */ - virtual RArray* PresenceAuthGrantReqList() = 0; - /** - * @return im data host - */ - virtual MProtocolImDataHost& GetImHost() = 0; - /** - * @return add notification handler - */ - virtual CAddContactNotificationHandler& GetAddNotificationHandler() = 0; - /** - * @return search data host - */ - virtual MProtocolSearchDataHost& GetSearchHost() = 0; - /** - * @return search key store - */ - virtual CSearchKeyStore& GetSearchKeyStore() = 0; - -protected: - - /** - * Protected destructor. - * Instancies can't be destroyed via this interface. - */ - virtual ~MOSSProtocolConnectionManager() {} - - }; - -#endif // __MOSSCONNNECTIONMANAGERCONTROL_H__ - - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/mossprotocolstatusobserver.h --- a/imservices/ossprotocoladaptation/inc/mossprotocolstatusobserver.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Access handler of one network session -* -*/ - -#ifndef __MOSSPROTOCOLSTATUSOBSERVER_H -#define __MOSSPROTOCOLSTATUSOBSERVER_H - - -// INCLUDES -#include - -/** - * Access handler of one network session - * - * It is used to open/close network session - * and register its observers - * - */ -class MPEngSessionStatusObserver - { - - public: // - - /** - * Handle Session status change - * - * @param new session slot state - * @param new session slot event - */ - virtual void StatusChangedL(/* TPEngNWSessionSlotState aNewState, - TPEngNWSessionSlotEvent aNewEvent*/ ) = 0; - - - protected: //Destructor - - /** - * Protected destructor to prohibits deletion trough interface. - */ - virtual ~MPEngSessionStatusObserver() {}; - }; - - -#endif // __MOSSPROTOCOLSTATUSOBSERVER_H - -// End of File - - - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/ossadappanics.h --- a/imservices/ossprotocoladaptation/inc/ossadappanics.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: oss adapter plugin panics -* -*/ - -#ifndef __OSSADAPPANICS_H__ -#define __OSSADAPPANICS_H__ - -// INCLUDES -#include - -// CONSTANTS -/** -* Oss Adaptation Library panic category. -*/ -_LIT ( KOssAdapPanic, "OssAdaptation" ); - -/** -* OSS Adaptation Library Auth interface -*/ - -_LIT ( KOssProtocolPresenceAuthorization, "CImpsProtocolPresenceAuthorization" ); - -/** -* OSS Adaptation Library Publishing panic category -*/ - -_LIT ( KOssProtocolPresencePublishing, "CImpsProtocolPresencePublishing" ); - -/** -* Oss adapter Library watching panic category. -*/ - -_LIT ( KOssProtocolPresenceWatching, "CImpsProtocolPresenceWatching" ); - -/** -* Oss adapter Library groups panic category. -*/ - -_LIT ( KOssProtocolPresentityGroups, "CImpsProtocolPresentityGroups" ); - -/** -* OSS adapter plugin library panic reasons. -* -* Following panic reasons are used in -* oss adapter plugin library panics. -* -* @since 3.0 -*/ -enum TOssAdapterPluginPanics - { - ESesionConsistencyLost = 1, - EOpIdConsistencyLost = 2, - ENoActiveOperations = 3, - EUnknownUnumeration = 4, - EReferenceCountUnderflow = 5, - EIlegalSingletonDeletion = 6, - EUnknowPureData = 7, - EListenerAlreadyActive = 8, - ELogInDataNotValid = 9 - - }; - - -#endif //__OSSADAPPANICS_H__ - -// End of File - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/ossprotocloliterals.h --- a/imservices/ossprotocoladaptation/inc/ossprotocloliterals.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: OSS adapter plugin -* -*/ - -#ifndef __OSSPROTOCOLLITERALS_H__ -#define __OSSPROTOCOLLITERALS_H__ - -#include - -#define CONNMGR_BUS "org.freedesktop.Telepathy.ConnectionManager.gabble" -#define CONNMGR_PATH "/org/freedesktop/Telepathy/ConnectionManager/gabble" -#define PROTOCOL "jabber" -#define TP_IFACE_CONN_MGR_INTERFACE \ - "org.freedesktop.Telepathy.ConnectionManager" -#define TestId "mytest" -#define ServerStr "server" -#define ResourceStr "resource" -#define AccountStr "account" -#define PasswdStr "password" -#define PortStr "port" -#define OldsslStr "old-ssl" -#define PORT 443 - -_LIT(KOSSProtocolConnection, "COSSProtocolConnection"); -_LIT8(KConnectionFeature, "telepathy/connection "); -_LIT( KZeroId, "0" ); -_LIT(KSlash,"/"); -_LIT(KEnd,"\0"); - -enum TRegRespState - { - ERequestDelivered = 0, - EResponseRecieved - }; - - -#endif //__OSSPROTOCOLLITERALS_H__ - -// End of File - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/ossprotocoladaptationuids.h --- a/imservices/ossprotocoladaptation/inc/ossprotocoladaptationuids.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: OSSProtocolAdaptationUids -* NOTE!! Don't change / edit any UID values!!! -* -*/ - -#ifndef __OSSPROTOCOLADAPTATIONUIDS_H_ -#define __OSSPROTOCOLADAPTATIONUIDS_H_ -// MACROS - -//Uid2:s -#define KEComRecognitionDllUid2 0x10009D8D // CSI: 8 # - -//Uid3:s -#define KEComRecognitionDllUid3 0x101FB3E7 // 0x10282EE9 - - - -#endif // __OSSPROTOCOLADAPTATIONUIDS_H_ - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/ossprotocoladaptutils.h --- a/imservices/ossprotocoladaptation/inc/ossprotocoladaptutils.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Utils for IOSSProtocolAdaptation -* -*/ - - -#ifndef __OSSPROTOCLADAPUTILS_H__ -#define __OSSPROTOCLADAPUTILS_H__ - -// INCLUDES -#include -#include - -struct charFormatData - { - char* data; - TInt dataSize;//this also includes '/0'. - }; -/** - * Utils for OSSProtocolAdaptation modules. - */ -class OssProtocolAdapUtils - { - public: // new methods - - /** - * utility method to convert from char to unsigned int - * @param1 pmSrc: source - * @return pointer to unsigned int - */ - static HBufC16* ConvertCharToTUint16LC( const char *pcSrc); - /** - * utility method to convert from unsigned int to char - * @param1 pmSrc: source - * @return structure charFormatData, contains data and size - */ - static charFormatData ConvertTUint16ToCharLC( const TDesC &aData ); - /** - * utility method to convert from tdesc8 to char - * @param1 aSrc: source - * @param aDes: destination - */ - static void ConvertTDesC8toChar(const TDesC8& aSrc, char* aDes); - }; - -#endif // __OSSPROTOCLADAPUTILS_H__ - -// End of File diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/ossprotocolpluginerrors.h --- a/imservices/ossprotocoladaptation/inc/ossprotocolpluginerrors.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: OSs adapter plugin errors -* -*/ - -#ifndef __OSSPROTOCOLPLUGINERRORS_H__ -#define __OSSPROTOCOLPLUGINERRORS_H__ - -// INCLUDES -#include -/** -* Mapping xmpp protocl errors with ximpfw -* -*/ -/** - * Xmpp protocol error codes. - * - * Xmpp status codes received from network transactions - * are translated into Xmpp error code range - * with following mapping: - * = KOssAdapBaseErrorXmppServerResponseBase - - * NOTE!! Mapping algorithm above and error symbols defined - * below are in sync with algorithm used by the Xmpp protocol. - */ -enum - { - KOssAdapBaseErrorXmppServerResponseBase = -10000, - KOssAdapBaseErrorXmppServerLoginResponseBase = -11000, - KOssAdapBaseErrorXmppServerContactResponseBase = -12000, - KOssAdapBaseErrorXmppServerContactListResponseBase = -13000, - KOssAdapBaseErrorXmppServerPresenceResponseBase = -14000, - KOssAdapBaseErrorXmppServerSendMessageResponseBase = -15000, - KOssAdapBaseErrorXmppServerReceiveMessageResponseBase = -16000, - KOssAdapBaseErrorXmppServerLogoutResponseBase = -17000, - KOssAdapBaseErrorMessageQueueResponseBase = -18000, - - KOssAdapErrMsgQueueCreate = KOssAdapBaseErrorMessageQueueResponseBase - 100, - KOssAdapErrMsgQueueSend = KOssAdapBaseErrorMessageQueueResponseBase - 101, - - - KOssadapErrInvalidSettingsId = KOssAdapBaseErrorXmppServerLoginResponseBase - 800, - }; - -#endif //__OSSPROTOCOLPLUGINERRORS_H__ diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/ossprotocolpluginlogger.h --- a/imservices/ossprotocoladaptation/inc/ossprotocolpluginlogger.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Logger implementation -* -*/ - - -#ifndef __TLOGGER_H__ -#define __TLOGGER_H__ - -// INCLUDES -#include - -//#ifdef _DEBUG -#define ENABLE_DEBUG_LOGS -//#endif - -/** -* Usage of Log MACRO'S -* _LIT( KExample, "Example" ); -* TXT(s) _L(s) -* LOGGER(TXT("Some text.") ); -* LOGGER(TXT("Some text: %d"), 100 ); -* LOGGER(TXT("Some text: %S"), &KExample ); -*/ - -_LIT( KTAdaptDebugOutputDir, "os" ); -_LIT( KTAdaptDebugOutputFileName, "ossadapt.txt" ); -const TInt KTAdaptMaxLogLineLength = 250 ; -//#ifdef _DEBUG - -#define TXT(s) _L(s) -#define LOGGER TLogger::WriteLog -#define PLUGIN_UNUSED_PARAM(p) (void) p -//#endif - -/** - * OSS Protocol Adaptation logger. - */ -class TLogger - { - public: //Logging functions - static void WriteLog( TRefByValue aFmt,... ); - private: //Prohibited construtor / destructor - TLogger(); - ~TLogger(); - }; -#endif //__TLOGGER_H__ - -// End of File diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/ossprotocolpluginpanics.h --- a/imservices/ossprotocoladaptation/inc/ossprotocolpluginpanics.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: OSs adapter plugin panics -* -*/ - -#ifndef __OSSPROTOCOLPLUGINPANICS_H__ -#define __OSSPROTOCOLPLUGINPANICS_H__ - -// INCLUDES -#include - - -// CONSTANTS -/** -* OSS Adaptation Library panic category. -*/ -_LIT( KOSSProtocolPluginPanic, "OSSProtocolPlugin" ); - -/** -* OSS Adaptation Library Auth interface -*/ - -_LIT(KOSSProtocolPresenceAuthorization, "COSSProtocolPresenceAuthorization"); - -/** -* OSS Adaptation Library Publishing interface -*/ - -_LIT(KOSSProtocolPresencePublishing, "COSSProtocolPresencePublishing"); - -/** -* OSS Adaptation Library watching interface. -*/ - -_LIT(KOSSProtocolPresenceWatching, "COSSProtocolPresenceWatching"); - -/** -* OSS Adaptation Library panic presentity groups interface. -*/ - -_LIT(KOSSProtocolPresentityGroups, "COSSProtocolPresentityGroups"); - -/** -* OSS Adaptation Library panic conversation interface. -*/ - -_LIT(KOSSProtocolConversation, "COSSProtocolImConversation"); - - -/** -* Telepathy adapter plugin library panic reasons. -* -* Following panic reasons are used in -* OSS adapter plugin library panics. -* -* @since 3.0 -*/ -enum TOSSAdapterPluginPanics - { - ESesionConsistencyLost = 1, - EOpIdConsistencyLost = 2, - ENoActiveOperations = 3, - EUnknownUnumeration = 4, - EReferenceCountUnderflow = 5, - EIlegalSingletonDeletion = 6, - EAccessHandlerObserversUnregistered = 7, - EUnknowPureData = 8, - EListenerAlreadyActive = 9, - ELogInDataNotValid = 10 - - }; - - -#endif //__OSSPROTOCOLPLUGINPANICS_H__ - -// End of File - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/presenceauthorization/cossprotocolpresenceauthorization.h --- a/imservices/ossprotocoladaptation/inc/presenceauthorization/cossprotocolpresenceauthorization.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,229 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Oss Protocol implementation for Presence Framework -* -*/ - - -#ifndef __COSSPROTOCLPRESENCEAUTHORISATION_H_ -#define __COSSPROTOCLPRESENCEAUTHORISATION_H_ - - -// INCLUDES -#include -#include -#include -#include - - - -// FORWARD DECLARATIONS - -class MXIMPServiceInfo; -class MOSSProtocolConnectionManager; - - -/** - * COssProtocolPresenceAuthorization - * - * Oss Protocol Authorization Request Handling - * - */ - -class COssProtocolPresenceAuthorization: - public CBase, - public MProtocolPresenceAuthorization - { -public: - - static COssProtocolPresenceAuthorization* NewL(MOSSProtocolConnectionManager& aConnManager); - - - ~COssProtocolPresenceAuthorization(); - - -private: - - COssProtocolPresenceAuthorization(MOSSProtocolConnectionManager& aConnManager); - - - void ConstructL(); - -public: // from MXIMPBase - - /** - * @see MXIMPBase - */ - TAny* GetInterface( TInt32 aInterfaceId, - TIfGetOps aOptions ); - /** - * @see MXIMPBase - */ - const TAny* GetInterface( TInt32 aInterfaceId, - TIfGetOps aOptions ) const; - /** - * @see MXIMPBase - */ - TInt32 GetInterfaceId() const; - -public: //from MProtocolPresenceAuthorization - - /** - * @see MProtocolPresenceAuthorization - */ - void DoSubscribePresenceGrantRequestListL( - TXIMPRequestId aReqId ); - /** - * @see MProtocolPresenceAuthorization - */ - void DoUnsubscribePresenceGrantRequestListL( - TXIMPRequestId aReqId ); - -public: // Granting presence information access to single presentities - - /** - * @see MProtocolPresenceAuthorization - */ - void DoGrantPresenceForPresentityL( - const MXIMPIdentity& aPresentityId, - const MPresenceInfoFilter& aPif, - TXIMPRequestId aReqId ); - /** - * @see MProtocolPresenceAuthorization - */ - void DoUpdatePresenceGrantPifForPresentityL( - const MXIMPIdentity& aPresentityId, - const MPresenceInfoFilter& aPif, - TXIMPRequestId aReqId ); - /** - * @see MProtocolPresenceAuthorization - */ - void DoWithdrawPresenceGrantFromPresentityL( - const MXIMPIdentity& aPresentityId, - TXIMPRequestId aReqId ); - -public: // Granting presence information access to presentity group members - - /** - * @see MProtocolPresenceAuthorization - */ - void DoGrantPresenceForPresentityGroupMembersL( - const MXIMPIdentity& aGroupId, - const MPresenceInfoFilter& aPif, - TXIMPRequestId aReqId ); - /** - * @see MProtocolPresenceAuthorization - */ - void DoUpdatePresenceGrantPifForPresentityGroupMembersL( - const MXIMPIdentity& aGroupId, - const MPresenceInfoFilter& aPif, - TXIMPRequestId aReqId ); - /** - * @see MProtocolPresenceAuthorization - */ - void DoWithdrawPresenceGrantFromPresentityGroupMembersL( - const MXIMPIdentity& aGroupId, - TXIMPRequestId aReqId ); - -public: // Granting presence information access to everyone - - /** - * @see MProtocolPresenceAuthorization - */ - void DoGrantPresenceForEveryoneL( - const MPresenceInfoFilter& aPif, - TXIMPRequestId aReqId ); - - /** - * @see MProtocolPresenceAuthorization - */ - void DoUpdatePresenceGrantPifForEveryoneL( - const MPresenceInfoFilter& aPif, - TXIMPRequestId aReqId ); - - /** - * @see MProtocolPresenceAuthorization - */ - void DoWithdrawPresenceGrantFromEveryoneL( - TXIMPRequestId aReqId ); -public: // Subscribe presence block list - - /** - * @see MProtocolPresenceAuthorization - */ - void DoSubscribePresenceBlockListL( - TXIMPRequestId aReqId ); - - - /** - * @see MProtocolPresenceAuthorization - */ - void DoUnsubscribePresenceBlockListL( - TXIMPRequestId aReqId ); - -public: // Blocking presence information access from single presentities - - /** - * @see MProtocolPresenceAuthorization - */ - void DoBlockPresenceForPresentityL( - const MXIMPIdentity& aPresentityId, - TXIMPRequestId aReqId ); - - /** - * @see MProtocolPresenceAuthorization - */ - void DoCancelPresenceBlockFromPresentityL( - const MXIMPIdentity& aPresentityId, - TXIMPRequestId aReqId ); - - -public: - - /** - * Creates data handler - */ - void CreateDataHandlerL(); - -private: - - /** - * Request Id from ximpfw - */ - TXIMPRequestId iRequestId; - - - /** - * Oss Protocol Plugin Connection Manager - * Not own. *** Write "Not own" if some other class owns this object. - */ - MOSSProtocolConnectionManager& iConnMan; - - - - }; - -#endif // __COSSPROTOCLPRESENCEAUTHORISATION_H_ - - - - - - - - - - - - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/presenceauthorization/cpresenceauthuserrequest.h --- a/imservices/ossprotocoladaptation/inc/presenceauthorization/cpresenceauthuserrequest.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Response to authorization request -* -*/ - - -#ifndef __CPRESENCEAUTHUSERREQUEST_H__ -#define __CPRESENCEAUTHUSERREQUEST_H__ - - -// INCLUDES -#include -#include - - -// FORWARD DECLARATIONS -class MOSSProtocolConnectionManager; -class MXIMPIdentity; -class MPresenceInfoFilter; - -/** - * CPresenceAuthUserRequest - * - * Issue Accept Response of add notification Request to Network Server - * - */ - - class CPresenceAuthUserRequest: public CActive - - - { - -public: - - static CPresenceAuthUserRequest* NewL( MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - - static CPresenceAuthUserRequest* NewLC( MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - - virtual ~CPresenceAuthUserRequest(); - -private: - - CPresenceAuthUserRequest( MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - void ConstructL(); - -private: // from CActive - - void DoCancel(); - void RunL(); - TInt RunError( TInt aError ); - -public: - -/** - * Issue Accept Response of add notification Request to Network Server - * - * @param aIdentity: conatct id - * aPif : presence info filter - */ - void PresenceAuthUserRequestL( - const MXIMPIdentity & aIdentity, - const MPresenceInfoFilter & aPif); - - -private: // data - - /** - * Request Id from ximpfw - */ - TXIMPRequestId iRequestId; - - /** - * Send data request to pure data handler generates the id - */ - TInt iSendId; - - /** - * Oss Protocol Plugin Connection Manager - * Not own. *** Write "Not own" if some other class owns this object. - */ - MOSSProtocolConnectionManager& iConnMan; - - }; - - -#endif // __CPRESENCEAUTHUSERREQUEST_H__ - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/presenceauthorization/csubscribepresencegrantrequestlistrequest.h --- a/imservices/ossprotocoladaptation/inc/presenceauthorization/csubscribepresencegrantrequestlistrequest.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: subscribing to get add notifications -* -*/ - - -#ifndef __CSUBSCRIBEPRESENCEGRANTREQUESTLISTREQUEST_H__ -#define __CSUBSCRIBEPRESENCEGRANTREQUESTLISTREQUEST_H__ - - -// INCLUDES -#include -#include - - -// FORWARD DECLARATIONS -class MOSSProtocolConnectionManager; -class MXIMPIdentity; - -/** - * CSubscribePresenceGrantRequestListRequest - * - * subscribing from ximpfw to grant presence - */ - - class CSubscribePresenceGrantRequestListRequest: public CActive - - - { - -public: - - static CSubscribePresenceGrantRequestListRequest* NewL( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - - static CSubscribePresenceGrantRequestListRequest* NewLC( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - - virtual ~CSubscribePresenceGrantRequestListRequest(); - -private: - - CSubscribePresenceGrantRequestListRequest( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - void ConstructL(); - -private: // from CActive - - void DoCancel(); - void RunL(); - TInt RunError( TInt aError ); - -public: - - void SubscribePresenceGrantRequestListL(); - - -private: // data - - /** - * Request Id from ximpFw - */ - - TXIMPRequestId iRequestId; - - /** - * Oss Protocol Plugin Connection Manager - * Not own. *** Write "Not own" if some other class owns this object. - */ - MOSSProtocolConnectionManager& iConnMan; - - }; - - -#endif // __CSUBSCRIBEPRESENCEGRANTREQUESTLISTREQUEST_H__ - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/presenceauthorization/cwithdrawpresencegrantfrompresentityrequest.h --- a/imservices/ossprotocoladaptation/inc/presenceauthorization/cwithdrawpresencegrantfrompresentityrequest.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Response to authorization request -* -*/ - - -#ifndef __CWITHDRAWPRESENCEGRANTFROMPRESENTITYREQUEST_H__ -#define __CWITHDRAWPRESENCEGRANTFROMPRESENTITYREQUEST_H__ - - -// INCLUDES -#include -#include - - -// FORWARD DECLARATIONS -class MOSSProtocolConnectionManager; -class MXIMPIdentity; -class MPresenceInfoFilter; - -/** - * CWithdrawPresenceGrantFromPresentityRequest - * - * Issue Rejecting Response of add notification Request to Network Server - * - */ - - class CWithdrawPresenceGrantFromPresentityRequest: public CActive - - - { - -public: - - static CWithdrawPresenceGrantFromPresentityRequest* NewL( MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - - static CWithdrawPresenceGrantFromPresentityRequest* NewLC( MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - - virtual ~CWithdrawPresenceGrantFromPresentityRequest(); - -private: - - CWithdrawPresenceGrantFromPresentityRequest( MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - void ConstructL(); - -private: // from CActive - - void DoCancel(); - void RunL(); - TInt RunError( TInt aError ); - -public: - - /** - * Send Rejecting Response of add notification Request to Network Server - * @param aPresentityId: conatct id - */ - void WithdrawPresenceGrantFromPresentityL( - const MXIMPIdentity& aPresentityId); - - -private: // data - - /** - * Request Id from PrFw - */ - - TXIMPRequestId iRequestId; - - /** - * Send data request to wait timer generates the id - */ - TInt iSendId; - - /** - * Oss Protocol Plugin Connection Manager - * Not own. *** Write "Not own" if some other class owns this object. - */ - MOSSProtocolConnectionManager& iConnMan; - - }; - - -#endif // __CWITHDRAWPRESENCEGRANTFROMPRESENTITYREQUEST_H__ - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/presencepublishing/cossprotocolpresencepublishing.h --- a/imservices/ossprotocoladaptation/inc/presencepublishing/cossprotocolpresencepublishing.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: IMPS Protocol implementation for Presence Framework -* -*/ - - -#ifndef __COSSSPROTOCOLPRESENCEPUBLISHING_H__ -#define __COSSSPROTOCOLPRESENCEPUBLISHING_H__ - -// INCLUDES -#include -#include -#include -#include -#include - -// FORWARD DECLARATIONS -class MXIMPServiceInfo; -class MOSSProtocolConnectionManager; -class CPresenceNotificationHandler; -class MProtocolPresencePublishing; - -/** - * COssProtocolPresencePublishing - * - * Oss Protocol presence publishing Request Handling - * - */ -class COssProtocolPresencePublishing: - public CBase, - public MProtocolPresencePublishing - { - -public: - - static COssProtocolPresencePublishing* NewL(MOSSProtocolConnectionManager& aConnManager); - - - ~COssProtocolPresencePublishing(); - - -private: - - COssProtocolPresencePublishing(MOSSProtocolConnectionManager& aConnManager); - - - void ConstructL(); - -public: //from MXIMPBase - /** - * @see MXIMPBase - */ - TAny* GetInterface( TInt32 aInterfaceId, - TIfGetOps aOptions ); - /** - * @see MXIMPBase - */ - const TAny* GetInterface( TInt32 aInterfaceId, - TIfGetOps aOptions ) const; - - /** - * @see MXIMPBase - */ - TInt32 GetInterfaceId() const; - -public: // From MProtocolPresencePublishing - - /** - * @see MProtocolPresencePublishing - */ - void DoPublishOwnPresenceL( const MPresenceInfo& aPresence, - TXIMPRequestId aReqId ); - /** - * @see MProtocolPresencePublishing - */ - void DoSubscribeOwnPresenceL( const MPresenceInfoFilter& aPif, - TXIMPRequestId aReqId ); - /** - * @see MProtocolPresencePublishing - */ - void DoUpdateOwnPresenceSubscriptionPifL( const MPresenceInfoFilter& aPif, - TXIMPRequestId aReqId ); - /** - * @see MProtocolPresencePublishing - */ - void DoUnsubscribeOwnPresenceL( TXIMPRequestId aReqId ); - - /** - * @see MProtocolPresencePublishing - */ - void DoSubscribePresenceWatcherListL( TXIMPRequestId aReqId ); - - /** - * @see MProtocolPresencePublishing - */ - void DoUnsubscribePresenceWatcherListL( TXIMPRequestId aReqId ); - - -private: - - /** - * Request Id from PrFw - */ - TXIMPRequestId iRequestId; - - /** - * Oss Protocol Plugin Connection Manager - * Not own. - *** Write "Not own" if some other class owns this object. - */ - MOSSProtocolConnectionManager& iConnMan; - - CPresenceNotificationHandler* iNotificationHandler; - - }; - -#endif // __COSSSPROTOCOLPRESENCEPUBLISHING_H__ diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/presencepublishing/cpresencenotificationhandler.h --- a/imservices/ossprotocoladaptation/inc/presencepublishing/cpresencenotificationhandler.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: implementation of presence notification handler -* -*/ - - -#ifndef __CPRESENCENOTIFICATIONHANDLER_H__ -#define __CPRESENCENOTIFICATIONHANDLER_H__ - - -// INCLUDES -#include -#include - -#include -#include - -// FORWARD DECLARATIONS - -class MOSSProtocolConnectionManager; - -/** - * CPresenceNotificationHandler - * - * Handles presnce notifications recieved from the server - * and updates presence cache - */ - -class CPresenceNotificationHandler: public CActive - - - { - - public: - - static CPresenceNotificationHandler* NewL ( - MOSSProtocolConnectionManager& aConnMan - ); - - static CPresenceNotificationHandler* NewLC ( - MOSSProtocolConnectionManager& aConnMan - ); - - virtual ~CPresenceNotificationHandler(); - - private: - - CPresenceNotificationHandler ( MOSSProtocolConnectionManager& aConnMan ); - void ConstructL(); - - private: // from CActive - - void DoCancel(); - void RunL(); - TInt RunError ( TInt aError ); - - public: - /** - * Start listening presence from the server - */ - void StartListeningL(); - /** - * Process the recieved presence from the server - */ - void ProcessIncomingDataL(); - - private: // data - - /** - * Send data request to pure data handler generates the id - */ - TInt iSendId; - /** - * Presence cache writer - * Own - */ - MPresenceCacheWriter2* iPresenceCacheWriter; - - /** - * Oss Protocol Plugin Connection Manager - * Not own. *** Write "Not own" if some other class owns this object. - */ - MOSSProtocolConnectionManager& iConnMan; - - }; - - -#endif // __CPRESENCENOTIFICATIONHANDLER_H__ - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/presencepublishing/cpublishownpresencerequest.h --- a/imservices/ossprotocoladaptation/inc/presencepublishing/cpublishownpresencerequest.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: IMPS Protocol implementation for Presence Framework -* -*/ - - -#ifndef __CPUBLISHOWNPRESENCEREQUEST_H__ -#define __CPUBLISHOWNPRESENCEREQUEST_H__ - - -// INCLUDES -#include -#include - - -// FORWARD DECLARATIONS -class MOSSProtocolConnectionManager; -class MPresenceInfo; -class MPresenceBuddyInfo2; - -/** - * CPublishOwnPresencerequest - * - * Publishes own presence - * - */ - - class CPublishOwnPresencerequest: public CActive - - - { - -public: - - static CPublishOwnPresencerequest* NewL( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - - static CPublishOwnPresencerequest* NewLC( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - - virtual ~CPublishOwnPresencerequest(); - -private: - - CPublishOwnPresencerequest( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - void ConstructL(); - -private: // from CActive - - void DoCancel(); - void RunL(); - TInt RunError( TInt aError ); - -public: - /** - * CPublishOwnPresencerequest - * - * Publishes update own presence to network server - * - */ - void PublishOwnPresenceL(const MPresenceInfo& aPresence); - - -private: // data - - /** - * Request Id from ximpfw - */ - - TXIMPRequestId iRequestId; - - /** - * Send data request to pure data handler generates the id - */ - TInt iSendId; - - - /** - * Imps Protocol Plugin Connection Manager - * Not own. *** Write "Not own" if some other class owns this object. - */ - MOSSProtocolConnectionManager& iConnMan; - - //owns : own presence info - MPresenceBuddyInfo2* iOwnPresenceInfo; - - }; - - -#endif // __CPUBLISHOWNPRESENCEREQUEST_H__ - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/presentitygroups/caddcontactenotificationhandler.h --- a/imservices/ossprotocoladaptation/inc/presentitygroups/caddcontactenotificationhandler.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: implementation of add notification handler -* -*/ - - -#ifndef __CADDCONTACTNOTIFICATIONHANDLER_H__ -#define __CADDCONTACTNOTIFICATIONHANDLER_H__ - - -// INCLUDES -#include -#include - -#include -#include - -// FORWARD DECLARATIONS - -class MOSSProtocolConnectionManager; - -/** - * CAddContactNotificationHandler - * - * Handles add notifications recieved from the network server - * - */ - -class CAddContactNotificationHandler: public CActive - - - { - - public: - - static CAddContactNotificationHandler* NewL ( - MOSSProtocolConnectionManager& aConnMan - ); - - static CAddContactNotificationHandler* NewLC ( - MOSSProtocolConnectionManager& aConnMan - ); - - virtual ~CAddContactNotificationHandler(); - - private: - - CAddContactNotificationHandler ( MOSSProtocolConnectionManager& aConnMan ); - void ConstructL(); - - private: // from CActive - - void DoCancel(); - void RunL(); - TInt RunError ( TInt aError ); - - public: - /** - * Start listening for the add notifications - */ - void StartListeningL(); - /** - * Process the recieved add notifications - */ - void ProcessIncomingDataL(); - - private: // data - - /** - * Send data request to pure data handler generates the id - */ - TInt iSendId; - - /** - * Oss Protocol Plugin Connection Manager - * Not own. *** Write "Not own" if some other class owns this object. - */ - MOSSProtocolConnectionManager& iConnMan; - - }; - - -#endif // __CADDCONTACTNOTIFICATIONHANDLER_H__ - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/presentitygroups/caddpresentitygroupmemberrequest.h --- a/imservices/ossprotocoladaptation/inc/presentitygroups/caddpresentitygroupmemberrequest.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Add presentity group member request -* -*/ - - -#ifndef __CADDPRESENTITYGROUPMEMBERREQUEST_H__ -#define __CADDPRESENTITYGROUPMEMBERREQUEST_H__ - - -// INCLUDES -#include -#include - - -// FORWARD DECLARATIONS -class MOSSProtocolConnectionManager; -class MXIMPIdentity; - -/** - * CAddPresentityGroupMemberRequest - * - * Issue Add Presentity Group Member Request to Network Server - * - */ - - class CAddPresentityGroupMemberRequest: public CActive - - - { - -public: - - - static CAddPresentityGroupMemberRequest* NewLC( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - - virtual ~CAddPresentityGroupMemberRequest(); - -private: - - CAddPresentityGroupMemberRequest( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - void ConstructL(); - -private: // from CActive - - void DoCancel(); - /* - * RunL() function also deletes the request object once the activity is done - * - */ - void RunL(); - TInt RunError( TInt aError ); - -public: - /** - * Add contact to the list - * @param aGroupId group identity - * @param aMemberId conatct identity - * @param aMemberDisplayName contact displayname - */ - void AddPresentityGroupMemberL( const MXIMPIdentity& aGroupId, - const MXIMPIdentity& aMemberId, - const TDesC16& aMemberDisplayName ); - - -private: // data - - /** - * Request Id from ximpfw - */ - - TXIMPRequestId iRequestId; - - /** - * Send data request to pure data handler generates the id - */ - TInt iSendId; - - /** - * Oss Protocol Plugin Connection Manager - * Not own. *** Write "Not own" if some other class owns this object. - */ - MOSSProtocolConnectionManager& iConnMan; - - /* - * Stores contactid - * Own - */ - HBufC* iContactId; - }; - - -#endif // __CADDPRESENTITYGROUPMEMBERREQUEST_H__ - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/presentitygroups/ccontactsynchandler.h --- a/imservices/ossprotocoladaptation/inc/presentitygroups/ccontactsynchandler.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: handles synchronisation of contacts -* -*/ - - -#ifndef __CCONTACTSYNCHANDLER_H__ -#define __CCONTACTSYNCHANDLER_H__ - - -// INCLUDES -#include -#include - -#include -#include - -// FORWARD DECLARATIONS - -class MOSSProtocolConnectionManager; - -/** - * CContactSyncHandler - * - * handles synchronisation of contacts from Network Server - * - */ - -class CContactSyncHandler: public CActive - - - { - - public: - - static CContactSyncHandler* NewL ( MOSSProtocolConnectionManager& aConnMan ); - - virtual ~CContactSyncHandler(); - - private: - - CContactSyncHandler ( MOSSProtocolConnectionManager& aConnMan ); - - private: // from CActive - - void DoCancel(); - void RunL(); - TInt RunError ( TInt aError ); - - public: - - /** - * keep on listening for events - */ - void StartListening(); - - /** - * Processes the data from server and sends to ximpfw - */ - void ProcessAndSendL(); - - private: // data - - /** - * Oss Protocol Plugin Connection Manager - * Not own. - */ - MOSSProtocolConnectionManager& iConnMan; - - }; - - -#endif // __CCONTACTSYNCHANDLER_H__ - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/presentitygroups/cossprotocolpresentitygroups.h --- a/imservices/ossprotocoladaptation/inc/presentitygroups/cossprotocolpresentitygroups.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,157 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Oss Protocol presentity groups -* -*/ - -#ifndef COSSPROTOCOLPRESENTITYGROUPS_H__ -#define COSSPROTOCOLPRESENTITYGROUPS_H__ - - -#include -#include - - -class MOSSProtocolConnectionManager; - - -/** - * COSSProtocolpresentitygroups - * - * implementation of MProtocolPresentityGroups methods. - * these methods will called by ximp framework - * - */ -class COSSProtocolpresentitygroups : public CBase, - public MProtocolPresentityGroups - { - -public: - - static COSSProtocolpresentitygroups* NewL( MOSSProtocolConnectionManager& aConnManager ); - ~COSSProtocolpresentitygroups(); - - -private: - - COSSProtocolpresentitygroups( MOSSProtocolConnectionManager& aConnManager ); - void ConstructL(); - -public: // from MXIMPBase - - /** - * @see MXIMPBase - */ - TAny* GetInterface( TInt32 aInterfaceId, - TIfGetOps aOptions ); - /** - * @see MXIMPBase - */ - const TAny* GetInterface( TInt32 aInterfaceId, - TIfGetOps aOptions ) const; - /** - * @see MXIMPBase - */ - TInt32 GetInterfaceId() const; - -public: //From MProtocolPresentityGroups - /** - * @see MProtocolPresentityGroups - */ - void DoSubscribePresentityGroupListL( - TXIMPRequestId aReqId ); - /** - * @see MProtocolPresentityGroups - */ - void DoUnsubscribePresentityGroupListL( - TXIMPRequestId aReqId ); - -public: // Manage presentity groups - /** - * @see MProtocolPresentityGroups - */ - void DoCreatePresentityGroupL( - const MXIMPIdentity& aGroupId, - const TDesC16& aDisplayName, - TXIMPRequestId aReqId ); - /** - * @see MProtocolPresentityGroups - */ - void DoDeletePresentityGroupL( - const MXIMPIdentity& aGroupId, - TXIMPRequestId aReqId ); - /** - * @see MProtocolPresentityGroups - */ - void DoUpdatePresentityGroupDisplayNameL( - const MXIMPIdentity& aGroupId, - const TDesC16& aDisplayName, - TXIMPRequestId aReqId ); - -public: // Subscribe presentity group content - /** - * @see MProtocolPresentityGroups - */ - void DoSubscribePresentityGroupContentL( - const MXIMPIdentity& aGroupId, - TXIMPRequestId aReqId ); - /** - * @see MProtocolPresentityGroups - */ - void DoUnsubscribePresentityGroupContentL( - const MXIMPIdentity& aGroupId, - TXIMPRequestId aReqId ); - -public: // Manage presentity group members - /** - * @see MProtocolPresentityGroups - */ - void DoAddPresentityGroupMemberL( - const MXIMPIdentity& aGroupId, - const MXIMPIdentity& aMemberId, - const TDesC16& aMemberDisplayName, - TXIMPRequestId aReqId ); - /** - * @see MProtocolPresentityGroups - */ - void DoRemovePresentityGroupMemberL( - const MXIMPIdentity& aGroupId, - const MXIMPIdentity& aMemberId, - TXIMPRequestId aReqId ); - /** - * @see MProtocolPresentityGroups - */ - void DoUpdatePresentityGroupMemberDisplayNameL( - const MXIMPIdentity& aGroupId, - const MXIMPIdentity& aMemberId, - const TDesC16& aMemberDisplayName, - TXIMPRequestId aReqId ); - -private: - /** - * Creates data handler - */ - void CreateDataHandlerL(); - -private: // data members - - /** - * Oss Protocol Plugin Connection Manager - * Not own. *** Write "Not own" if some other class owns this object. - */ - MOSSProtocolConnectionManager& iConnMan; - - }; - -#endif // COSSPROTOCOLPRESENTITYGROUPS_H__ diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/presentitygroups/cremovepresentitygroupmemberrequest.h --- a/imservices/ossprotocoladaptation/inc/presentitygroups/cremovepresentitygroupmemberrequest.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Remove presentity group member request -* -*/ - - -#ifndef __CREMOVEPRESENTITYGROUPMEMBERREQUEST_H__ -#define __CREMOVEPRESENTITYGROUPMEMBERREQUEST_H__ - - -// INCLUDES -#include -#include - - -// FORWARD DECLARATIONS -class MOSSProtocolConnectionManager; -class MXIMPIdentity; - - -/** - * CRemovePresentityGroupMemberRequest - * - * Issue Remove Presentity Group Member Request to Network Server - * - */ - - class CRemovePresentityGroupMemberRequest: public CActive - - - { - -public: - - - - static CRemovePresentityGroupMemberRequest* NewLC( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - - virtual ~CRemovePresentityGroupMemberRequest(); - -private: - - CRemovePresentityGroupMemberRequest( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - void ConstructL(); - -private: // from CActive - - void DoCancel(); - /* - * RunL() function also deletes the request object once the activity is done - * - */ - void RunL(); - TInt RunError( TInt aError ); - -public: - /** - * Remove presentity group member from the list - * @param aGroupId group identity - * @param aGroupId group member identity - */ - void RemovePresentityGroupMemberL(const MXIMPIdentity& aGroupId, - const MXIMPIdentity& aMemberId); - -private: // data - - /** - * Request Id from ximpfw - */ - TXIMPRequestId iRequestId; - - /** - * Send data request to pure data handler generates the id - */ - TInt iSendId; - - /** - * Oss Protocol Plugin Connection Manager - * Not own. *** Write "Not own" if some other class owns this object. - */ - MOSSProtocolConnectionManager& iConnMan; - - // owns : userid id to delete - HBufC* iUserId; - - }; - - -#endif // __CREMOVEPRESENTITYGROUPMEMBERREQUEST_H__ - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/presentitygroups/csubscribepresentitygroupcontentrequest.h --- a/imservices/ossprotocoladaptation/inc/presentitygroups/csubscribepresentitygroupcontentrequest.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Subscribe Presentity Group Content Request -* -*/ - - -#ifndef __CSUBSCRIBEPRESENTITYGROUPCONTENTREQUEST_H__ -#define __CSUBSCRIBEPRESENTITYGROUPCONTENTREQUEST_H__ - - -// INCLUDES -#include -#include -#include -#include "ossprotocloliterals.h" -// FORWARD DECLARATIONS - -class MOSSProtocolConnectionManager; - -class MXIMPIdentity; - -/** - * CSubscribePresentityGroupContentRequest - * - * Fetches the contacts and update to ximp fw - * - */ - -class CSubscribePresentityGroupContentRequest: public CActive - - - { - - public: - - static CSubscribePresentityGroupContentRequest* NewL ( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - - static CSubscribePresentityGroupContentRequest* NewLC ( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - - virtual ~CSubscribePresentityGroupContentRequest(); - - private: - - CSubscribePresentityGroupContentRequest ( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - void ConstructL(); - /** - * IssueRequest - */ - void IssueRequest(); - /** - * populate data - */ - void PopulateDataL(); - - private: // from CActive - - void DoCancel(); - /* - * RunL() function also deletes the request object once the activity is done - * - */ - void RunL(); - TInt RunError ( TInt aError ); - - public: - /** - * subscribe to get group members of the list - * @param aGroupId group identity - */ - void SubscribePresentityGroupContentL ( - const MXIMPIdentity& aGroupId ); - - public: - - - /** - * parse the data and update the data cache of ximp.send event back to ximp - */ - - void ProcessIncomingDataL(); - - private: // data - - /** - * Request Id from ximpfw - */ - - TXIMPRequestId iRequestId; - - /** - * Send data request to pure data handler generates the id - */ - TInt iSendId; - - /** - * Array of conatcts - * Own - */ - //RPointerArray iContacts; - /** - * Oss Protocol Plugin Connection Manager - * Not own. *** Write "Not own" if some other class owns this object. - */ - MOSSProtocolConnectionManager& iConnMan; - - /* - * Stores groupname - * Own - */ - HBufC* iGroupName; - /* - * Listcount - */ - TInt iListcount; - }; - - -#endif // __CSUBSCRIBEPRESENTITYGROUPCONTENTREQUEST_H__ - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/processlauncher/processlaunher.h --- a/imservices/ossprotocoladaptation/inc/processlauncher/processlaunher.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Offers launching of given process -* -*/ - - - -#ifndef __CPROCESSLAUNCHER_H__ -#define __CPROCESSLAUNCHER_H__ - - -#include - - -/** -* CProcessLauncher -* The implementation for launching of processes -* -*/ - -class CProcessLauncher : public CActive - { - - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CProcessLauncher* NewL ( const TDesC16& aprocessname ); - - /** - * Destructor. - */ - ~CProcessLauncher(); - - - public: - - /** - * Does the launching of given process - */ - void LaunchProcessL(); - - - private: - - /** - * C++ default constructor. - * @param aReconnHandler Handler for global reconnect continuation query - */ - CProcessLauncher(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL ( const TDesC16& aprocessname ); - - - protected: - /** - * @see CActive. - */ - void DoCancel(); - - /** - * @see CActive. - */ - void RunL(); - - /** - * @see CActive. - */ - TInt RunError ( TInt aError ); - - private: //data - /** - * process launcher - */ - RProcess iLauncher; - /** - * name of the process to be launched - */ - HBufC16* iProcessName; - }; - -#endif // __CPROCESSLAUNCHER_H__ - -// End of File diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/search/cossprotocolsearch.h --- a/imservices/ossprotocoladaptation/inc/search/cossprotocolsearch.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Oss protocol search -* -*/ - -#ifndef COSSPROTOCOLSEARCH_H__ -#define COSSPROTOCOLSEARCH_H__ - - -#include -#include - - -class MOSSProtocolConnectionManager; - - -/** - * COSSProtocolSearch - * implementation of MProtocolSearch methods. - * these methods will called by search feature plugin - */ -class COSSProtocolSearch : public CBase, - public MProtocolSearch - { - - public: - - static COSSProtocolSearch* NewL( MOSSProtocolConnectionManager& aConnManager ); - - ~COSSProtocolSearch(); - - - private: - - COSSProtocolSearch( MOSSProtocolConnectionManager& aConnManager ); - void ConstructL(); - - public: //from MXIMPBase - - /** - * @see MXIMPBase - */ - TAny* GetInterface( TInt32 aInterfaceId, - TIfGetOps aOptions ); - /** - * @see MXIMPBase - */ - const TAny* GetInterface( TInt32 aInterfaceId, - TIfGetOps aOptions ) const; - /** - * @see MXIMPBase - */ - TInt32 GetInterfaceId() const; - - public: // From MProtocolSearch - - /** - * @see MProtocolSearch - */ - void DoSearchL( const MXIMPIdentity& aSearchId, - const RPointerArray< MSearchElement >& aObjs, - TInt aSearchLimit, - TXIMPRequestId aReqId ); - /** - * @see MProtocolSearch - */ - void DoGetSearchKeysL( TXIMPRequestId aReqId ); - - private: // data members - /** - * Oss Protocol Plugin Connection Manager - * Not own. - */ - MOSSProtocolConnectionManager& iConnMan; - - }; - -#endif // COSSPROTOCOLSEARCH_H__ diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/search/csearchgetsearchkeys.h --- a/imservices/ossprotocoladaptation/inc/search/csearchgetsearchkeys.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This class handles dynamic search label-key pair storing. -* -*/ - - -/*! \def To avoid multiple inclusions -*/ -#ifndef C_SEARCHGETSEARCHKEYS_H -#define C_SEARCHGETSEARCHKEYS_H - -#include -#include -#include -#include "mossprotocolconnectionmanager.h" - -/*! \file -* \brief Interfaces for the get search key request -*/ - - -/*! \class CSearchGetSearchKeys csearchgetsearchkeys.h -* \brief This class derived from CActive impliments a request -* for the get search keys -*/ -class CSearchGetSearchKeys : public CActive - { - - public: - - /*! \fn - * \brief static function to create a new object of this class - */ - static CSearchGetSearchKeys* NewL( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - - - /*! \fn - * \brief Default Constructor for this class - */ - CSearchGetSearchKeys( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - - /*! \fn - * \brief destructor - */ - ~CSearchGetSearchKeys(); - - - /*! \brief Function to issue a request, in this case - * it is geting search keys - */ - void GetSearchKeysL(); - - - protected: - - /*! \fn - * \brief Called when a cancel is done on the active object - */ - void DoCancel(); - - /*! \fn - * \brief Called when the request submitted by this object - * is completed - */ - void RunL(); - - /*! \fn - * \brief Called when the RunL leaves - */ - TInt RunError( TInt aError ); - - - - private: - - /*! \fn - * \brief 2nd phase constructor for this class - */ - void ConstructL(); - - /*! \var Data Id generated for the request - */ - TInt iSendId; - - - /*! \var TXIMPRequestId Request Id - * - */ - TXIMPRequestId iRequestId; - - /*! \var iConnMan handle to connection manager - * This variable is not owned by this class - */ - MOSSProtocolConnectionManager& iConnMan; - - }; - - -#endif //C_SEARCHGETSEARCHKEYS_H diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/search/csearchkeystore.h --- a/imservices/ossprotocoladaptation/inc/search/csearchkeystore.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,148 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This class handles dynamic search label-key pair storing. -* -*/ - - -/*! /def To avoid multiple inclusions -*/ -#ifndef C_SEARCHKEYSTORE_H -#define C_SEARCHKEYSTORE_H - -//For CBase -#include -//For RHashMap -#include -//For TDesC -#include -//For CRepository -#include -//For TSearchKey -#include - -/*! /file -* Interfaces for CSearchKeyStore class -*/ - - -/*! /var KLabelKeyStoreHash Uid to access central repository -*/ -const TUid KLabelKeyStoreHash = { 0x200195A9 }; -/*! /def Total no. of keys that the UI supports( for localization ) -*/ -#define NO_OF_KEYS_SUPPORTED 13 - - -/*! /class CSearchKeyStore csearchkeystore.h -* -* /brief This class stores the localizable search labels, and maps -* the labels got from get search keys to enums( Localizable ) and -* strings( non localizable ). -* -* /brief Background : The search key labels from server are not standardized. -* So gizmo can give for 'First Name' a label 'First' and gtalk can give it as -* 'Name'. We will have possible values for 'First Name' in cen rep. And -* whenever a get search keys done and labels got, we wil try to map those -* to enums('Name', 'First' for EFirstName). If for 'first name' the label -* for some xyz server is 'Given' then it is non localizable. And wil be -* sent to UI as a string -*/ -class CSearchKeyStore : public CBase - { - - public : - /*! /fn - * /brief Static function that creates a new object - * of type CSearchKeyStore - */ - static CSearchKeyStore* NewL(); - - /*! /fn - * /brief constructor for the CSearchKeyStore class - */ - CSearchKeyStore(); - - /*! /fn - * /brief destructor for the CSearchKeyStore class - */ - virtual ~CSearchKeyStore(); - - /*! /fn - * /brief Maps the labels from server got by making a get - * search keys request to server. Those are mapped to localizable - * enums and non localizable strings - * - * /param aLabels Labels to be classified - */ - void MapLabelsToEnumL( RPointerArray& aLabels ); - - /*! /fn - * /brief Gets the label (for server) for the given enum(search field) - * - * /param aEnum search field - * /return HBufC* string corresponding to the enum. The ownership of - * returned pointer is transfered to callee. - */ - HBufC* GetLabelFromEnumL( TSearchKey aEnum ); - - /*! /brief This function returns an array of pointers to the - * supported keys( Supported labels are the labels that have - * support in the UI for logical strings) - * - * /return an array of pointers to enums - */ - RPointerArray GetSupportedEnums(); - - - /*! /brief This function returns a handle to the array of not - * supported label strings. Not supported here means that - * there are no logical strings in UI for these labels - * - * /return const handle to not supported strings - */ - - const RPointerArray GetNotSupportedLabels(); - - private: - - /*! /fn - * /brief ConstructL reads labels from the cen rep - * and maps them to enums - */ - void ConstructL(); - - /*! /var iLabelKeyHashRep Handle to cen rep - */ - CRepository* iLabelKeyHashRep;//owned - - /*! /var iEnumLabels maps the labels to enums - */ - RHashMap iEnumLabels;//owned - - /*! /var iNotSupportedLabels Has the labels that can not - * be localized. - */ - RPointerArray iNotSupportedLabels;//owned - - /*! /var iSupportedLabels Hash Map of the search labels and - * to search field enums - */ - RHashMap iSupportedLabels;//owned - - }; - - - -#endif //C_SEARCHKEYSTORE_H diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/search/csearchrequest.h --- a/imservices/ossprotocoladaptation/inc/search/csearchrequest.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Search implementation -* -*/ - - -#ifndef __CSEARCHREQUEST_H__ -#define __CSEARCHREQUEST_H__ - - -// INCLUDES -#include -#include - -#include - -// FORWARD DECLARATIONS -class MOSSProtocolConnectionManager; -class MSearchElement; -class MXIMPIdentity; - -/** - * CSearchrequest - * - * Issue Search Request to Network Server - * - */ - -class CSearchrequest: public CActive - - - { - - public: - - static CSearchrequest* NewLC( MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - - virtual ~CSearchrequest(); - - private: - - CSearchrequest( MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ); - void ConstructL(); - - private: // from CActive - - void DoCancel(); - void RunL(); - TInt RunError( TInt aError ); - - private : - /** - * parse the data - * @param aResponse: response contains searched data - * @param alen: length - * @param aSearchInfo: search info - * @param aKeytype: search key type - */ - void ParseAndSetL(char* aResponse, TInt alen, MSearchInfo& aSearchInfo, TInfoType aKeytype); - - public: - /** - * Issue search request to network server - * @param aSearchId: search id - * @param aObjs: array of search elements - * @param aSearchLimit: search limit - */ - void SearchL(const MXIMPIdentity& aSearchId,const RPointerArray< MSearchElement >& aObjs,TInt aSearchLimit); - - private: // data - - /** - * Request Id - */ - TXIMPRequestId iRequestId; - - /** - * Send data request to pure data handler generates the id - */ - TInt iSendId; - /** - * Search Id - */ - HBufC16* iSearchId; - /** - * Oss Protocol Plugin Connection Manager - * Not own. *** Write "Not own" if some other class owns this object. - */ - MOSSProtocolConnectionManager& iConnMan; - - }; - - -#endif // __CSEARCHREQUEST_H__ - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/inc/waittimer.h --- a/imservices/ossprotocoladaptation/inc/waittimer.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,337 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Header for Waittimer.h. -* -*/ - -#ifndef WAITTIMER_H -#define WAITTIMER_H - -#include // For CActive, link against: euser.lib -#include // For RTimer, link against: euser.lib -#include -// FORWARD DECLARATIONS - -class COssSendDataOperation; -class COSSProtocolConnectionManager; -class MOSSProtocolConnectionManager; -class MXIMPProtocolConnectionHost; - -enum TDataFetchSteps - { - EDataFetchingStep1 = -1, // three - EDataFetchingStep2 , // -1 -// EDataFetchingStep3, // 0 - EDataFetchComplete // 1 done - }; - -/** - * CWaitTimer implementation. - * Responsible for sending filled message queue and - * reading response message queue when it is updated - * keep track of updation of message queue - */ -class CWaitTimer : public CActive - { - - public: - // Cancel and destroy - ~CWaitTimer(); - - // Two-phased constructor. - static CWaitTimer* NewL (MOSSProtocolConnectionManager& aConnMan); - - - public: // New functions - /** - * Function for making the initial request - */ - TInt SendDataL ( TRequestStatus& aStatus, char* msg, TInt nBytes ); - /** - * Get response data based on the transaction id - */ - char* ResponseL ( TInt aTransId ); - /** - * start listening on the queue to keep track of the queue updation - */ - void StartListeningL(); - /** - * Increase operation id - */ - void IncreaseOpId(); - /** - * Get operation id - */ - TInt GetOpId(); - /** - * Listen Incoming data - */ - - void ListenIncomingData ( TRequestStatus& aStatus ); - - /** - * Listen Incoming data count - */ - - TInt IncomingDataCount(); - /** - * Returns searched data count - */ - TInt SearchDataCount(); - - /** - * Returns ContactsChange Response Count - */ - TInt ContactsChangeResponseCount(); - - /** - *Listen Incoming message - */ - TInt ListenIncomingMsg ( TRequestStatus& aStatus ); - /** - * Cancel incoming data listening - */ - void CancelListening(); - - /** - * Listen Incoming message listening - */ - void CancelListeningMsg(); - /** - * returns fetchingcontinue flag - */ - TBool IsFetchingContinue(); - - /** - * Listen Incoming Presence notifications - */ - TInt ListenIncomingPresence ( TRequestStatus& aStatus ); - /** - * Cancel Incoming presence listening - */ - void CancelListeningPres(); - /** - * Listen Incoming Added contact notifications - */ - TInt ListenAddNotification ( TRequestStatus& aStatus ); - /** - * Cancel listening Incoming Added contact notifications - */ - void CancelListeningAddNotication(); - /** - * Listen Incoming network server Error notifications - */ - TInt ListenIncomingServerError ( TRequestStatus& aStatus ); - /** - * Cancel Incoming server error listening - */ - void CancelListeningServerErrors(); - - /** - * issue the releasing reuest and exit - */ - void IssueReleaseRequestL(); - - /** - * return ETrue if server disconnect has happen - */ - TBool IsServerDisconnect(); - /** - * Listen any contacts change events - */ - void ListenContactsChange( TRequestStatus& aStatus ); - - /** - * Cancel any contacts change events listening - */ - void CancelContactsChangeListening(); - /** - * ETrue.if fetching contacts is completed - */ - TBool IsFetchContactsCompleted(); - - private: - /** - * C++ constructor - */ - CWaitTimer ( MOSSProtocolConnectionManager& aConnMan ); - - /** - * Second-phase constructor - */ - void ConstructL(); - - private: // From CActive - - /** - * Handles recieved message queue data. - */ - void RunL(); - - /** - * How to cancel me - */ - void DoCancel(); - /** - * Override to handle leaves from RunL(). Default implementation causes - * the active scheduler to panic. - */ - TInt RunError ( TInt aError ); - - private: // new private functions - - /** - * Find operationl - * - * @return index in array - */ - TInt FindOperation ( TInt aOpId, TInt ( COssSendDataOperation:: *aIdFunc ) () const ) const; - TInt FindOperationL ( TInt aOpId, TInt ( COssSendDataOperation:: *aIdFunc ) () const ) const; - /** - * set presence as pending into the presence cache - * for the remote pending contacts - * @param armsg: message to parse to get remote contacts - */ - void PendingPresenceContactsL(char* aRmessage); - private: - /** - * State of the active object - */ - TInt iState; - /** - * Request status - */ - TRequestStatus* iStatus1; - /** - * Send data operations - * Own - * Elements OWNed - */ - RPointerArray iOperations; - /** - * Logs Id iteration - */ - TInt iOpidIterator; - /** - * Id iteration - */ - TInt iOpId; - - /** - * Max number of active requests - */ - TInt iMaxActive; - - /** - * Incoming data queue - * OWN - */ - RPointerArray iIncomingData; - /** - * Incoming message queue - * OWN - */ - RPointerArray iIncomingMsg; - /** - * Incoming presence information queue - * OWN - */ - RPointerArray iIncomingPres; - /** - * Incoming server error queue - * OWN - */ - RPointerArray iIncomingServerError; - /** - * Incoming add notifications queue - * OWN - */ - RPointerArray iAddNotification; - /** - * Incoming search elements queue - * OWN - */ - RPointerArray iSearchElements; - /** - * Incoming conatct change queue - * OWN - */ - RPointerArray iContactChangeList; - /** - * data Request Status - * OWN - */ - TRequestStatus* iIncReqStatus; - /** - * Message Request Status - * OWN - */ - TRequestStatus* iIncMsgReqStatus; - /** - * Presence Request Status - * OWN - */ - TRequestStatus* iIncPresReqStatus; - /** - * Error Request Status - * OWN - */ - TRequestStatus* iIncErrorReqStatus; - /** - * Add Request Status - * OWN - */ - TRequestStatus* iIncAddReqStatus; - /** - * Contacts Change Request Status - * OWN - */ - TRequestStatus* iContactsChangeStatus; - - /** - * Id which is used to do logs more human readable - * OWN - */ - TInt iConnectionLogsId; - - - /** - * flag for checking fetching is done - */ - TBool iFetchingContinue; - - /** - * connection manager - */ - MOSSProtocolConnectionManager& iConnMan; - /** - * Flag to denote whether Msg Queue was created - * this will help us in reusing the created msgqueue - */ - TBool iResponseMsgQCreated ; - /** - * ETrue if server disconnect has happen - */ - TBool iServerDisconnected; - /** - * timer to trigger message queue uptation checking - */ - RTimer iTimer; - /** - * stores fetching steps - */ - TInt iFetchingStep; - }; - -#endif // WAITTIMER_H diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/rom/ossprotocoladaptation.iby --- a/imservices/ossprotocoladaptation/rom/ossprotocoladaptation.iby Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description:IBY for ossadaptation -* -*/ - - -#ifndef __OSSPROTOCOLADAPTATION_IBY__ -#define __OSSPROTOCOLADAPTATION_IBY__ - -file=ABI_DIR\BUILD_DIR\OpenCStringUtilsLib.dll SHARED_LIB_DIR\OpenCStringUtilsLib.dll - -ECOM_PLUGIN( OSSProtocolAdaptation.dll, ossprotocoladaptation.rsc ) - -#endif - - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/rom/ossprotocoladaptation.pkg --- a/imservices/ossprotocoladaptation/rom/ossprotocoladaptation.pkg Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -; -; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: Pkg file for ossadaptation -; -;Header -#{"XIMP-TELEPATHY Adaptation Plugin"}, (0x10292DE8), 1, 0, 0 - -;Language -&EN - -;Localised VendorID -%{"Nokia"} - -;VendorID -:"Nokia" - -(0x101F7961), 0, 0, 0, {"Series60ProductID"} - -;Test data - -;EUnit test dlls -"\EPOC32\RELEASE\ARMV5\UDEB\TelepathyAdaptation.dll" - "!:\sys\bin\TelepathyAdaptation.dll" - -;resources -"\EPOC32\DATA\Z\Resource\Plugins\TelepathyAdaptation.RSC"-"!:\resource\plugins\TelepathyAdaptation.rsc" diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/rss/ossprotocoladaptation.rss --- a/imservices/ossprotocoladaptation/rss/ossprotocoladaptation.rss Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ECOM registery info for Presence Framework Test Protocol -* -*/ - - -#include - -#include - -// --------------------------------------------------------------------------- -// ECOM registery info for XIMP Framework ECOM hook -// --------------------------------------------------------------------------- -// -RESOURCE REGISTRY_INFO theInfo - { - resource_format_version = RESOURCE_FORMAT_VERSION_2; - dll_uid = 0x101FB3E7; // dll's own uid - - interfaces = - { - INTERFACE_INFO - { // implemented interface - interface_uid = XIMP_ECOM_IF_UID_PROTOCOL_PLUGIN_BASE_INTERFACE; - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = 0x101FB3E7; // implementation's identifier uid - version_no = 1; - display_name = "XMPP"; // Protocol display name - default_data = "XMPP"; // Protocol Id string - - } - }; - } - }; - } - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/cosscontactmanager.cpp --- a/imservices/ossprotocoladaptation/src/cosscontactmanager.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,301 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: contact manager -* -*/ - -#include "cosscontactmanager.h" -#include "mossprotocolconnectionmanager.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "cossprotocolconnectionmanager.h" -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// COSSContactManager::COSSContactManager() -// --------------------------------------------------------------------------- -// -COSSContactManager::COSSContactManager(MOSSProtocolConnectionManager& aConnMan): - iConnMan ( aConnMan ) - { - - } - - -// --------------------------------------------------------------------------- -// COSSContactManager::ConstructL() -// --------------------------------------------------------------------------- -// -void COSSContactManager::ConstructL() - { - iFetchContactsFirstTime = EFalse; - iFetchInvitationsFirstTime = EFalse; - } - - -// --------------------------------------------------------------------------- -// COSSContactManager::NewL() -// --------------------------------------------------------------------------- -// -COSSContactManager* COSSContactManager::NewL(MOSSProtocolConnectionManager& aConnMan) - { - - COSSContactManager* self = new ( ELeave )COSSContactManager(aConnMan); - - CleanupStack::PushL ( self ); - - self->ConstructL(); - CleanupStack::Pop ( self ); - - return self; - } - - -// --------------------------------------------------------------------------- -// COSSContactManager::~COSSProtocolConnectionManager() -// --------------------------------------------------------------------------- -// -COSSContactManager::~COSSContactManager() - { - iContacts.ResetAndDestroy(); - iInvitationList.ResetAndDestroy(); - } - -// --------------------------------------------------------------------------- -// COSSContactManager::IsFetchForFirstTime() -// --------------------------------------------------------------------------- -// -TBool COSSContactManager::IsFetchContactsFirstTime() - { - return iFetchContactsFirstTime; - } - -// --------------------------------------------------------------------------- -// COSSContactManager::IsFetchInvitationsForFirstTime() -// --------------------------------------------------------------------------- -// -TBool COSSContactManager::IsFetchInvitationsForFirstTime() - { - return iFetchInvitationsFirstTime; - } - -// --------------------------------------------------------------------------- -// COSSContactManager::SetFetchForFirstTime() -// --------------------------------------------------------------------------- -// -void COSSContactManager::SetFetchContactsFirstTime(TBool aValue) - { - iFetchContactsFirstTime = aValue; - } - -// --------------------------------------------------------------------------- -// COSSContactManager::SetFetchInvitationsForFirstTime() -// --------------------------------------------------------------------------- -// -void COSSContactManager::SetFetchInvitationsForFirstTime(TBool aValue) - { - iFetchInvitationsFirstTime = aValue; - } - -// --------------------------------------------------------------------------- -// COSSContactManager::GetContactsListL() -// --------------------------------------------------------------------------- -// -RPointerArray& COSSContactManager::GetContactsListL() - { - return iContacts; - } -// --------------------------------------------------------------------------- -// COSSContactManager::GetInvitationListL() -// --------------------------------------------------------------------------- -// -RPointerArray& COSSContactManager::GetInvitationListL() - { - return iInvitationList; - } - -// --------------------------------------------------------------------------- -// COSSContactManager::ReturnContactsListL() -// --------------------------------------------------------------------------- -// -void COSSContactManager::ReturnInvitationListL() - { - MXIMPObjectFactory& prfwObjFact = iConnMan.HandleToHost().ObjectFactory(); - - MPresenceObjectFactory& prObjFact = iConnMan.HandleToHost().ProtocolPresenceDataHost().PresenceObjectFactory(); - - MXIMPIdentity* AuthReqIdentity = NULL ; - MPresenceGrantRequestInfo* presenceGrant = NULL; - - MXIMPObjectCollection* listOfInvitations = prfwObjFact.NewObjectCollectionLC(); - - for ( TInt i = 0; iSetIdentityL(*(iInvitationList[ i ] )); - iInvitationList[i]->Des().Fold(); - presenceGrant->SetRequestorIdL(AuthReqIdentity); - listOfInvitations->AddObjectL( presenceGrant ); - CleanupStack::Pop ( 2 );//presenceGrant, AuthReqIdentity - } - - iConnMan.HandleToHost().ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceGrantRequestListL( listOfInvitations ); - CleanupStack::Pop ( 1 );//listOfInvitations - } - -// --------------------------------------------------------------------------- -// COSSContactManager::ReturnContactsListL() -// --------------------------------------------------------------------------- -// -void COSSContactManager::ReturnContactsListL() - { - MXIMPObjectFactory& prfwObjFact = iConnMan.HandleToHost().ObjectFactory(); - - MPresenceObjectFactory& prObjFact = iConnMan.HandleToHost().ProtocolPresenceDataHost().PresenceObjectFactory(); - - MXIMPIdentity* contactIdentity = NULL; - MPresentityGroupMemberInfo* groupMemberInfo = NULL; - - MXIMPObjectCollection* listOfContacts = prfwObjFact.NewObjectCollectionLC(); - for(TInt i = 0;iSetIdentityL ( *(iContacts[ i ] )); - groupMemberInfo->SetGroupMemberIdL ( contactIdentity ); - groupMemberInfo->SetGroupMemberDisplayNameL ( *(iContacts[ i ] ) ); - listOfContacts->AddObjectL ( groupMemberInfo ); - CleanupStack::Pop ( 2 );//groupMemberInfo, contactIdentity - } - MXIMPIdentity* groupIdentity = prfwObjFact.NewIdentityLC(); - groupIdentity->SetIdentityL ( iConnMan.GroupId() ); - iConnMan.HandleToHost().ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupContentL ( groupIdentity, listOfContacts ); - CleanupStack::Pop ( 2 );//groupIdentity,listOfContacts - } - -// --------------------------------------------------------------------------- -// COSSContactManager::RemoveContactFromLocalL() -// --------------------------------------------------------------------------- -// -void COSSContactManager::RemoveContactFromLocalL(const TDesC& aContactName) - { - HBufC* contactName = aContactName.AllocLC(); - MXIMPObjectFactory& ximpObjFact = iConnMan.HandleToHost().ObjectFactory(); - MXIMPIdentity* contactIdentity = ximpObjFact.NewIdentityLC(); - MXIMPIdentity* groupIdentity = ximpObjFact.NewIdentityLC(); - groupIdentity->SetIdentityL ( iConnMan.GroupId()); - contactIdentity->SetIdentityL(*contactName); - //removing from the local copy of the contacts - for(TInt i = 0; iCompare(*(iContacts[i]))) - { - iContacts.Remove( i ); - //give info after removing. to ximp fw and client - iConnMan.HandleToHost().ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupMemberRemovedL ( groupIdentity, contactIdentity ); - break; - } - } - CleanupStack::Pop( 2 ); // contactIdentity , groupIdentity - CleanupStack::PopAndDestroy( 1 ); //contactName - } - -// --------------------------------------------------------------------------- -// COSSContactManager::AddContactToLocalL() -// --------------------------------------------------------------------------- -// -void COSSContactManager::AddContactToLocalL(const TDesC& aContactName) - { - HBufC* contactName = aContactName.AllocLC(); - MXIMPObjectFactory& ximpObjFact = iConnMan.HandleToHost().ObjectFactory(); - MXIMPIdentity* contactIdentity = ximpObjFact.NewIdentityLC(); - MXIMPIdentity* groupIdentity = ximpObjFact.NewIdentityLC(); - groupIdentity->SetIdentityL ( iConnMan.GroupId()); - contactIdentity->SetIdentityL(*contactName); - iContacts.AppendL(contactName); - groupIdentity->SetIdentityL ( iConnMan.GroupId()); - contactIdentity->SetIdentityL(*contactName); - MPresentityGroupMemberInfo* groupMemberInfo = iConnMan.HandleToHost().ProtocolPresenceDataHost().PresenceObjectFactory().NewPresentityGroupMemberInfoLC(); - groupMemberInfo->SetGroupMemberIdL ( contactIdentity ); - groupMemberInfo->SetGroupMemberDisplayNameL ( *contactName ); - iConnMan.HandleToHost().ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupMemberAddedL ( groupIdentity, groupMemberInfo ); - - //set presence as pending for the added contact - MPresenceBuddyInfo2* buddyPresInfo = MPresenceBuddyInfo2::NewLC(); - - MPresenceCacheWriter2* presenceCacheWriter = MPresenceCacheWriter2::CreateWriterL(); - CleanupDeletePushL(presenceCacheWriter); - HBufC* name = HBufC::NewLC( aContactName.Length() + iConnMan.ServiceName().Length() + KColon().Length() ); - TPtr namePtr( name->Des() ); - namePtr.Zero(); - namePtr.Append(iConnMan.ServiceName() ); // prepend service name - namePtr.Append(KColon); - namePtr.Append(aContactName ); - buddyPresInfo->SetIdentityL(namePtr); - buddyPresInfo->SetAnyFieldL(KExtensionKey,KPendingRequestExtensionValue()); - CleanupStack::PopAndDestroy(1);//name - - // Writing into Presence Cache - TInt cacheerror = presenceCacheWriter->WritePresenceL(buddyPresInfo); - User::LeaveIfError ( cacheerror); - CleanupStack::PopAndDestroy(2);//presenceCacheWriter,buddyPresInfo - CleanupStack::Pop( 4 ); // contactName, contactIdentity , groupIdentity , groupMemberInfo - } - -// --------------------------------------------------------------------------- -// COSSContactManager::RemoveInvitationFromLocalL() -// --------------------------------------------------------------------------- -// -void COSSContactManager::RemoveInvitationFromLocalL(const TDesC& aContactName) - { - MXIMPObjectFactory& ObjFact = iConnMan.HandleToHost().ObjectFactory(); - MPresenceObjectFactory& prfwObjFact = iConnMan.HandleToHost().ProtocolPresenceDataHost().PresenceObjectFactory(); - MXIMPIdentity* authReqIdentity = ObjFact.NewIdentityLC();//1 - if( authReqIdentity ) - { - authReqIdentity->SetIdentityL(aContactName); - for(TInt i = 0; i -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "cossprotocolconnectionmanager.h" -#include "cossprotocolpresencefeatures.h" -#include "cossprotocolimfeatures.h" -#include "ossprotocolpluginlogger.h" -#include "cossprotocolloginrequest.h" -#include "mossprotocolconnectionmanager.h" - -#include -#include "cossprotocolsearchfeatures.h" -#include "cossprotocollogoutrequest.h" -#include - -// ======== COSSProtocolConnection - MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// COSSProtocolConnection::COSSProtocolConnection() -// --------------------------------------------------------------------------- -// -COSSProtocolConnection::COSSProtocolConnection() - { - LOGGER ( TXT ( "COSSProtocolConnection::COSSProtocolConnection() Start-End" ) ); - } - -// --------------------------------------------------------------------------- -// COSSProtocolConnection::ConstructL() -// --------------------------------------------------------------------------- -// -void COSSProtocolConnection::ConstructL ( - const MXIMPServiceInfo& aServiceInfo , - const MXIMPContextClientInfo& aClientCtxInfo ) - { - LOGGER ( TXT ( "COSSProtocolConnection::ConstructL() Start" ) ); - - PLUGIN_UNUSED_PARAM ( aClientCtxInfo ); - iConnMan = COSSProtocolConnectionManager::NewL(); - - iConnMan->SetConnectionParamsL ( aServiceInfo.UserId(), - aServiceInfo.Password(), - aServiceInfo.IapId() ); - iPresFeatures = COSSProtocolPresenceFeatures::NewL ( *iConnMan ); - iImFeatures = COSSProtocolImFeatures::NewL ( *iConnMan ); - iSearchFeatures= COSSProtocolSearchFeature::NewL ( *iConnMan ); - LOGGER ( TXT ( "COSSProtocolConnection::ConstructL() End" ) ); - } - - -// --------------------------------------------------------------------------- -// COSSProtocolConnection::NewL() -// --------------------------------------------------------------------------- -// -COSSProtocolConnection* COSSProtocolConnection::NewL ( - const MXIMPServiceInfo& aServiceInfo, - const MXIMPContextClientInfo& aClientCtxInfo ) - { - LOGGER ( TXT ( "COSSProtocolConnection::NewL() Start" ) ); - - COSSProtocolConnection* self = new ( ELeave ) COSSProtocolConnection; - CleanupStack::PushL ( self ); - self->ConstructL ( aServiceInfo, aClientCtxInfo ); - CleanupStack::Pop ( self ); - - LOGGER ( TXT ( "COSSProtocolConnection::NewL() End" ) ); - return self; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolConnection::~COSSProtocolConnection() -// --------------------------------------------------------------------------- -// -COSSProtocolConnection::~COSSProtocolConnection() - { - LOGGER ( TXT ( "COSSProtocolConnection::~COSSProtocolConnection() Start" ) ); - - delete iSearchFeatures; - delete iConnMan; - delete iPresFeatures; - delete iImFeatures; - LOGGER ( TXT ( "COSSProtocolConnection::~COSSProtocolConnection() End" ) ); - } - - -// --------------------------------------------------------------------------- -// COSSProtocolConnection::GetInterface() -// --------------------------------------------------------------------------- -// -TAny* COSSProtocolConnection::GetInterface ( TInt32 aInterfaceId, - TIfGetOps aOptions ) - { - LOGGER ( TXT ( "COSSProtocolConnection::GetInterface() Start" ) ); - - if ( aInterfaceId == MXIMPProtocolConnection::KInterfaceId ) - { - MXIMPProtocolConnection* self = this; - return self; - } - - if ( aOptions == MXIMPBase::EPanicIfUnknown ) - - { - User::Panic ( KOSSProtocolConnection, KErrExtensionNotSupported ); - } - - LOGGER ( TXT ( "COSSProtocolConnection::GetInterface() End" ) ); - - return NULL; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolConnection::GetInterface() const -// --------------------------------------------------------------------------- -// -const TAny* COSSProtocolConnection::GetInterface ( TInt32 aInterfaceId, - TIfGetOps aOptions ) const - { - LOGGER ( TXT ( "COSSProtocolConnection::GetInterface() const Start" ) ); - - if ( aInterfaceId == MXIMPProtocolConnection::KInterfaceId ) - { - const MXIMPProtocolConnection* self = this; - return self; - } - - if ( aOptions == MXIMPBase::EPanicIfUnknown ) - { - User::Panic ( KOSSProtocolConnection, KErrExtensionNotSupported ); - } - - LOGGER ( TXT ( "COSSProtocolConnection::GetInterface() const End" ) ); - - return NULL; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolConnection::GetInterfaceId() const -// --------------------------------------------------------------------------- -// -TInt32 COSSProtocolConnection::GetInterfaceId() const - { - LOGGER ( TXT ( "COSSProtocolConnection::GetInterfaceId() Start-End" ) ); - return MXIMPProtocolConnection::KInterfaceId; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolConnection::PrimeHost() -// --------------------------------------------------------------------------- -// -void COSSProtocolConnection::PrimeHost ( MXIMPProtocolConnectionHost& aHost ) - { - LOGGER ( TXT ( "COSSProtocolConnection::PrimeHost() Start" ) ); - - iConnMan->SetHost ( aHost ); - - LOGGER ( TXT ( "COSSProtocolConnection::PrimeHost() Start" ) ); - } - - -// --------------------------------------------------------------------------- -// COSSProtocolConnection::OpenSessionL() -// --------------------------------------------------------------------------- -// -void COSSProtocolConnection::OpenSessionL ( - const MXIMPContextClientInfo& /*aClientCtxInfo*/, - TXIMPRequestId aOpId ) - { - if( iConntectionCreated ) - { - iConntectionCreated++; - iConnMan->HandleToHost().HandleRequestCompleted(aOpId,KErrNone); - } - else - { - LOGGER(TXT("COSSProtocolConnection::OpenSessionL \n")); - COSSProtocolLoginRequest* req = - COSSProtocolLoginRequest::NewLC( *iConnMan, aOpId ); - - req->IssueLoginRequestL(); - CleanupStack::Pop( req ); - iConntectionCreated++; - } - - LOGGER ( TXT ( "COSSProtocolConnection::OpenSessionL() End" ) ); - } - -// --------------------------------------------------------------------------- -// COSSProtocolConnection::OpenSessionL() -// --------------------------------------------------------------------------- -// -void COSSProtocolConnection::OpenSessionL ( const TInt& aServiceId, - TXIMPRequestId aReqId ) - { - LOGGER ( TXT ( "COSSProtocolConnection::OpenSessionLsettingsid \n" ) ); - if( iConntectionCreated ) - { - iConntectionCreated++; - iConnMan->HandleToHost().HandleRequestCompleted(aReqId,KErrNone); - } - else - { - TInt error = iConnMan->SetConnectionParamsL ( aServiceId ); - LOGGER ( TXT ( "COSSProtocolConnection::OpenSessionL settings id is %d" ), aServiceId ); - - if( error == KErrNotFound ) - { - iConnMan->HandleToHost().HandleRequestCompleted(aReqId,KXIMPErrServiceGeneralError); - } - else - { - COSSProtocolLoginRequest* req = - COSSProtocolLoginRequest::NewLC ( *iConnMan, aReqId ); - req->IssueLoginRequestL(); - CleanupStack::Pop ( req ); - iConntectionCreated++; - } - } - - LOGGER ( TXT ( "COSSProtocolConnection::OpenSessionLsettingsid() End" ) ); - } - -// --------------------------------------------------------------------------- -// COSSProtocolConnection::OpenSessionL() -// --------------------------------------------------------------------------- -// - -void COSSProtocolConnection::OpenSessionL ( - const MXIMPContextClientInfo& /*aContextClient*/, - const TInt& /*aSettingsId*/, - TXIMPRequestId /*aReqId*/ ) - { - - } - -// --------------------------------------------------------------------------- -// COSSProtocolConnection::CloseSession() -// --------------------------------------------------------------------------- -// -void COSSProtocolConnection::CloseSession ( - const MXIMPContextClientInfo& /*aClientCtxInfo*/, - TXIMPRequestId aOpId ) - { - LOGGER ( TXT ( "COSSProtocolConnection::CloseSession() Start" ) ); - iConntectionCreated--; - - // if server already disconnected no need to issue logout request - TBool serverdisconnect = iConnMan->IsServerDisconnect(); - - if(!iConntectionCreated && !serverdisconnect ) - { - iRequestId = aOpId; - TRAPD(error,LogoutRequestL(aOpId)); - if( KErrNone != error ) - { - iConnMan->HandleToHost().HandleRequestCompleted(aOpId,error); - - } - } - else - { - iConnMan->HandleToHost().HandleRequestCompleted(aOpId,KErrNone); - } - LOGGER ( TXT ( "COSSProtocolConnection::CloseSession() End" ) ); - } - - -// --------------------------------------------------------------------------- -// COSSProtocolConnection::ReOpenSessionsL() -// --------------------------------------------------------------------------- -// -void COSSProtocolConnection::ReOpenSessionsL ( TXIMPRequestId /*aOpId*/ ) - { - LOGGER ( TXT ( "COSSProtocolConnection::ReOpenSessionsL() Start" ) ); - - LOGGER ( TXT ( "COSSProtocolConnection::ReOpenSessionsL() End" ) ); - } - - -// --------------------------------------------------------------------------- -// COSSProtocolConnection::GetSupportedFeaturesL() -// --------------------------------------------------------------------------- -// -void COSSProtocolConnection::GetSupportedFeaturesL ( CDesC8Array& aFeatures ) const - { - LOGGER ( TXT ( "COSSProtocolConnection::GetSupportedFeaturesL() Start End" ) ); - // first empty the whole array - aFeatures.Reset(); - // then add our features there - // currently we are not doing any negotiation from the server for the supported features. - // based on our implimentation we are hardcoding these values. - // actual implimentatiion requires client server negotiation to tackle supported features. - - using namespace NXIMPFeature::Presence; - aFeatures.AppendL( KPublish ); - aFeatures.AppendL( KFetch ); - aFeatures.AppendL( KSubscribe ); - aFeatures.AppendL( KUnsubscribe ); - aFeatures.AppendL( KAddContact ); - aFeatures.AppendL( KDeleteContact ); - aFeatures.AppendL( KAvatar ); - - using namespace NXIMPFeature::InstantMessage; - aFeatures.AppendL( KInstantMessage ); - - using namespace NXIMPFeature::Search; - aFeatures.AppendL( KSearch ); - - LOGGER ( TXT ( "COSSProtocolConnection::GetSupportedFeaturesL" ) ); - } - -// --------------------------------------------------------------------------- -// COSSProtocolConnection::ProtocolPresenceFeatures() -// --------------------------------------------------------------------------- -// -MProtocolPresenceFeatures& COSSProtocolConnection::ProtocolPresenceFeatures() - { - LOGGER ( TXT ( "COSSProtocolConnection::ProtocolPresenceFeatures() Start " ) ); - return *iPresFeatures; - } -// --------------------------------------------------------------------------- -// COSSProtocolConnection::ProtocolImFeatures() -// --------------------------------------------------------------------------- -// -/* -CProtocolImFeatures* COSSProtocolConnection::ProtocolImFeatures() - { - LOGGER ( TXT ( "COSSProtocolConnection::ProtocolImFeatures() Start " ) ); - return iImFeatures; - }*/ - -// --------------------------------------------------------------------------- -// COSSProtocolConnection::ReleaseConnectionL() -// --------------------------------------------------------------------------- -// - -void COSSProtocolConnection::ReleaseConnectionL() - { - LOGGER ( TXT ( "COSSProtocolConnection::ReleaseConnectionL() Start " ) ); - if( iConnMan ) - { - iConnMan->ReleaseConnectionL(); - } - - LOGGER ( TXT ( "COSSProtocolConnection::ReleaseConnectionL() End" ) ); - } -// --------------------------------------------------------------------------- -// COSSProtocolConnection::LogoutRequestL() -// --------------------------------------------------------------------------- -// -void COSSProtocolConnection::LogoutRequestL(TXIMPRequestId aOpId) - { - COSSProtocolLogoutRequest* req = COSSProtocolLogoutRequest::NewLC ( *iConnMan, aOpId ); - - req->IssueLogoutRequestL(); - - CleanupStack::Pop ( req ); - - - } -// --------------------------------------------------------------------------- -// COSSProtocolConnection::GetProtocolInterface -// --------------------------------------------------------------------------- -// - -TAny* COSSProtocolConnection::GetProtocolInterface(TInt aInterfaceId) - { - LOGGER ( TXT ( "COSSProtocolConnection::ProtocolImFeatures() Start " ) ); - - //return iImFeatures->GetInterface(aInterfaceId, MXIMPBase::EPanicIfUnknown ); - - if(aInterfaceId == CProtocolImFeatures::KInterfaceId) - { - return iImFeatures->GetInterface(aInterfaceId, MXIMPBase::EPanicIfUnknown ); - } - - else if(aInterfaceId == MProtocolSearchFeature::KInterfaceId) - { - return iSearchFeatures->GetInterface(aInterfaceId, MXIMPBase::EPanicIfUnknown ) ; - } - - return NULL; - } - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/cossprotocolconnectionmanager.cpp --- a/imservices/ossprotocoladaptation/src/cossprotocolconnectionmanager.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,371 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: connection manager -* -*/ - -#include "cossprotocolconnectionmanager.h" -#include "cossprotocolservererrorhandler.h" -#include "ccontactsynchandler.h" -#include -#include -#include -#include -#include -#include "xmppservicesettingsapi.h" -#include "xmppparams.h" //from xmppsettingsapi - -#include "xmppsettingsfetcher.h" -#include "xmppparameters.h" -#include "waittimer.h" - -#include -#include -#include - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// COSSProtocolConnectionManager::COSSProtocolConnectionManager() -// --------------------------------------------------------------------------- -// -COSSProtocolConnectionManager::COSSProtocolConnectionManager() - { - } - - -// --------------------------------------------------------------------------- -// COSSProtocolConnectionManager::ConstructL() -// --------------------------------------------------------------------------- -// -void COSSProtocolConnectionManager::ConstructL() - { - iXmppParams = CXmppParameters::NewL(); - iTimer = CWaitTimer::NewL (*this); - iTimer->StartListeningL(); //start listening message queue updation - iNotifier = CPresenceNotificationHandler::NewL ( *this ); - iNotifier->StartListeningL(); //start listening presence notifications - iSearchKeyStore = CSearchKeyStore::NewL(); - iContactManager = COSSContactManager::NewL( *this ); - - } - - -// --------------------------------------------------------------------------- -// COSSProtocolConnectionManager::NewL() -// --------------------------------------------------------------------------- -// -COSSProtocolConnectionManager* COSSProtocolConnectionManager::NewL() - { - - COSSProtocolConnectionManager* self = new ( ELeave ) - COSSProtocolConnectionManager(); - - CleanupStack::PushL ( self ); - - self->ConstructL(); - CleanupStack::Pop ( self ); - - return self; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolConnectionManager::~COSSProtocolConnectionManager() -// --------------------------------------------------------------------------- -// -COSSProtocolConnectionManager::~COSSProtocolConnectionManager() - { - delete iXmppParams; - delete iNotifier; - delete iRecvHandler; - delete iServerErrorHandler; - delete iAddNotificationHanlder; - delete iContactSyncHandler; - delete iUserName; - delete iPassword; - delete iTimer; - delete iGroupId; - delete iContactManager; - delete iSearchKeyStore; - if(iServiceName) - { - delete iServiceName; - } - } - - -// --------------------------------------------------------------------------- -// COSSProtocolConnectionManager::Username -// --------------------------------------------------------------------------- -// -TDesC& COSSProtocolConnectionManager::UserName() - { - return *iUserName; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolConnectionManager::Password -// --------------------------------------------------------------------------- -// -TDesC& COSSProtocolConnectionManager::Password() - { - return *iPassword; - } - -// --------------------------------------------------------------------------- -// COSSProtocolConnectionManager::GroupID -// --------------------------------------------------------------------------- -// -TDesC& COSSProtocolConnectionManager::GroupId() - { - return *iGroupId; - } - -// --------------------------------------------------------------------------- -// COSSProtocolConnectionManager::GroupID -// --------------------------------------------------------------------------- -// -void COSSProtocolConnectionManager::SetGroupIDL(TDesC& aGroupId) - { - HBufC* tmpId = aGroupId.AllocL(); - delete iGroupId; - iGroupId=NULL; - iGroupId = tmpId ; - } - -// --------------------------------------------------------------------------- -// COSSProtocolConnectionManager::XmppParams -// --------------------------------------------------------------------------- -// -CXmppParameters& COSSProtocolConnectionManager::XmppParams() - { - return *iXmppParams; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolConnectionManager::DataHandler() -// --------------------------------------------------------------------------- -// -CWaitTimer& COSSProtocolConnectionManager::DataHandler() - { - return *iTimer; - } - -// --------------------------------------------------------------------------- -// COSSProtocolConnectionManager::HandleToHost() -// --------------------------------------------------------------------------- -// -MXIMPProtocolConnectionHost& COSSProtocolConnectionManager::HandleToHost() - { - return *iHostHandle; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolConnectionManager::SetHost() -// --------------------------------------------------------------------------- -// -void COSSProtocolConnectionManager::SetHost ( MXIMPProtocolConnectionHost& aHost ) - { - iHostHandle = &aHost; - } - -// --------------------------------------------------------------------------- -// COSSProtocolConnectionManager::SetConnectionParamsL() -// --------------------------------------------------------------------------- -// -void COSSProtocolConnectionManager::SetConnectionParamsL ( const TDesC& aUserName, - const TDesC& aPassword, - const TInt32 aServiceId ) - { - - // first store the login parameters - - HBufC* tmpBuf = aUserName.AllocL(); - delete iUserName; - iUserName = tmpBuf; - - tmpBuf = aPassword.AllocL(); - delete iPassword; - iPassword = tmpBuf; - - SetConnectionParamsL( aServiceId, EFalse ); - } - - -// --------------------------------------------------------------------------- -// COSSProtocolConnectionManager::ManufactureDataHandlerL() -// --------------------------------------------------------------------------- -// -void COSSProtocolConnectionManager::ManufactureDataHandlerL() - { - if(!iIsDataHandlerReady) - { - iRecvHandler = CReceiveMessageHandler::NewL ( *this ); - iRecvHandler->StartListeningL();//start listening incoming messages - iServerErrorHandler = COssprotocolServerErrorHandler::NewL ( *this ); - iServerErrorHandler->StartListeningL();//start listening incoming messages - iAddNotificationHanlder = CAddContactNotificationHandler::NewL ( *this ); - iContactSyncHandler = CContactSyncHandler::NewL(*this); - iContactSyncHandler->StartListening(); // listening for contacts changes - iIsDataHandlerReady = ETrue; - } - } - -// --------------------------------------------------------------------------- -// COSSProtocolConnectionManager::SetConnectionParamsL -// --------------------------------------------------------------------------- -// -TInt COSSProtocolConnectionManager::SetConnectionParamsL ( const TUint32 aServiceId , TBool aReadNeeded /* = ETrue*/ ) - { - // Get the service setting id and service name - TInt error = KErrNone; - - CSPSettings* settings = CSPSettings::NewLC(); - - if(aReadNeeded) - { - TInt settingsId = 0; - CSPProperty* property = CSPProperty::NewLC(); - settings->FindPropertyL( aServiceId, - ESubPropertyIMSettingsId, - *property ); - if ( property ) - { - property->GetValue( settingsId ); - } - // read settings - - error = CXmppSettingsFetcher::ReadSettingsL ( settingsId, *iXmppParams ); //settings id is used to read settings - - CleanupStack::PopAndDestroy(); // property - - } - // read service name - CSPEntry* entry = CSPEntry::NewLC(); - settings->FindEntryL( aServiceId, *entry ) ; - - // set the service name to presence cache updater - if(iServiceName) - { - delete iServiceName; - iServiceName = NULL; - } - iServiceName = entry->GetServiceName().AllocL(); - CleanupStack::PopAndDestroy(2); // entry, settings - - return error; - } -// --------------------------------------------------------------------------- -// COSSProtocolConnectionManager::PresenceAuthGrantReqList() -// --------------------------------------------------------------------------- -// -RArray< HBufC >* COSSProtocolConnectionManager::PresenceAuthGrantReqList() - { - return &iPresenceAuthGrantReqList; - } - -// --------------------------------------------------------------------------- -// COSSProtocolConnectionManager::ReleaseConnectionL() -// --------------------------------------------------------------------------- -// -void COSSProtocolConnectionManager::ReleaseConnectionL() - { - if( iTimer ) - { - iTimer->IssueReleaseRequestL(); - } - } - -// --------------------------------------------------------------------------- -// COSSProtocolConnectionManager::IsServerDisconnect() -// --------------------------------------------------------------------------- -// -TBool COSSProtocolConnectionManager::IsServerDisconnect() - { - return iTimer->IsServerDisconnect(); - } -// --------------------------------------------------------------------------- -// COSSProtocolConnectionManager::SetImHost -// --------------------------------------------------------------------------- -// - -void COSSProtocolConnectionManager::SetImHost(MProtocolImDataHost& aHost) - { - iHost = &aHost ; - } -// --------------------------------------------------------------------------- -// COSSProtocolConnectionManager::GetImHost() -// --------------------------------------------------------------------------- -// -MProtocolImDataHost& COSSProtocolConnectionManager::GetImHost() - { - return *iHost; - } - -// --------------------------------------------------------------------------- -// COSSProtocolConnectionManager::GetAddNotificationHandler() -// --------------------------------------------------------------------------- -// -CAddContactNotificationHandler& COSSProtocolConnectionManager::GetAddNotificationHandler() - { - return *iAddNotificationHanlder; - } -// --------------------------------------------------------------------------- -// COSSProtocolConnectionManager::SetSearchHost -// --------------------------------------------------------------------------- -// -void COSSProtocolConnectionManager::SetSearchHost(MProtocolSearchDataHost& aSearchHost) - { - iSearchHost = &aSearchHost ; - } -// --------------------------------------------------------------------------- -// COSSProtocolConnectionManager::GetSearchHost() -// --------------------------------------------------------------------------- -// -MProtocolSearchDataHost& COSSProtocolConnectionManager::GetSearchHost() - { - return *iSearchHost; - } -// --------------------------------------------------------------------------- -// COSSProtocolConnectionManager::GetSearchKeyStore() -// --------------------------------------------------------------------------- -// -CSearchKeyStore& COSSProtocolConnectionManager::GetSearchKeyStore() - { - return *iSearchKeyStore; - } - -// --------------------------------------------------------------------------- -// COSSProtocolConnectionManager::GetContactManager() -// --------------------------------------------------------------------------- -// -COSSContactManager& COSSProtocolConnectionManager::GetContactManager() - { - return *iContactManager; - } -// --------------------------------------------------------------------------- -// COSSProtocolConnectionManager::ServiceName() -// --------------------------------------------------------------------------- -// -const TDesC& COSSProtocolConnectionManager::ServiceName() - { - return *iServiceName; - } -// End of File - - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/cossprotocolimfeatures.cpp --- a/imservices/ossprotocoladaptation/src/cossprotocolimfeatures.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,185 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: oss protocol plugin im features -* -*/ - -#include "cossprotocolimfeatures.h" -#include -#include -#include "cossprotocolimconversation.h" -#include "ossprotocolpluginlogger.h" - -_LIT ( KOSSProtocolImFeatures, "COSSProtocolImFeatures" ); - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// COSSProtocolConnection::COSSProtocolImFeatures() -// --------------------------------------------------------------------------- -// -COSSProtocolImFeatures::COSSProtocolImFeatures(COSSProtocolConnectionManager& aConnMan) : iConnMan (aConnMan) - { - } - -// --------------------------------------------------------------------------- -// COSSProtocolImFeatures::ConstructL() -// --------------------------------------------------------------------------- -// -void COSSProtocolImFeatures::ConstructL ( - COSSProtocolConnectionManager& aConnMan ) - { - iImConversation = COSSProtocolImConversation::NewL ( aConnMan ); - } - -// --------------------------------------------------------------------------- -// COSSProtocolImFeatures::NewL() -// --------------------------------------------------------------------------- -// -COSSProtocolImFeatures* COSSProtocolImFeatures::NewL ( - COSSProtocolConnectionManager& aConnMan ) - { - - COSSProtocolImFeatures* self = new ( ELeave ) COSSProtocolImFeatures(aConnMan); - CleanupStack::PushL ( self ); - self->ConstructL ( aConnMan ); - CleanupStack::Pop ( self ); - - return self; - } - -// --------------------------------------------------------------------------- -// COSSProtocolImFeatures::~COSSProtocolImFeatures() -// --------------------------------------------------------------------------- -// -COSSProtocolImFeatures::~COSSProtocolImFeatures() - { - delete iImConversation; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolImFeatures::GetInterface() -// --------------------------------------------------------------------------- -// -TAny* COSSProtocolImFeatures::GetInterface ( TInt32 aInterfaceId, - TIfGetOps aOptions ) - { - if ( aInterfaceId == CProtocolImFeatures::KInterfaceId ) - { - CProtocolImFeatures* self = this; - return self; - } - - if ( aOptions == MXIMPBase::EPanicIfUnknown ) - - { - User::Panic ( KOSSProtocolImFeatures, KErrExtensionNotSupported ); - } - - return NULL; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolImFeatures::GetInterface() -// --------------------------------------------------------------------------- -// -const TAny* COSSProtocolImFeatures::GetInterface ( TInt32 aInterfaceId, - TIfGetOps aOptions ) const - { - - if ( aInterfaceId == CProtocolImFeatures::KInterfaceId ) - { - const CProtocolImFeatures* self = this; - return self; - } - - if ( aOptions == MXIMPBase::EPanicIfUnknown ) - { - User::Panic ( KOSSProtocolImFeatures, KErrExtensionNotSupported ); - } - - return NULL; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolImFeatures::GetInterfaceId() const -// --------------------------------------------------------------------------- -// -TInt32 COSSProtocolImFeatures::GetInterfaceId() const - { - return CProtocolImFeatures::KInterfaceId; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolImFeatures::ImConversation() -// --------------------------------------------------------------------------- -// -MProtocolImConversation& COSSProtocolImFeatures::ImConversation() - { - return *iImConversation; - } - -// --------------------------------------------------------------------------- -// COSSProtocolImFeatures::ImGroup() -// --------------------------------------------------------------------------- -// -MProtocolImGroup& COSSProtocolImFeatures::ImGroup() - { - MProtocolImGroup* dummyGroup = NULL; - return *dummyGroup; - //Not supported - } - -// --------------------------------------------------------------------------- -// COSSProtocolImFeatures::ImInvitation() -// --------------------------------------------------------------------------- -// -MProtocolImInvitation& COSSProtocolImFeatures::ImInvitation() - { - //Not supported - MProtocolImInvitation* dummyInvitation = NULL; - return *dummyInvitation; - - } -// --------------------------------------------------------------------------- -// COSSProtocolImFeatures::SupportedSubInterfaces() -// --------------------------------------------------------------------------- -// -TInt COSSProtocolImFeatures::SupportedSubInterfaces() const - { - return KErrNone; - - } -// --------------------------------------------------------------------------- -// COSSProtocolImFeatures::ImSearch() -// --------------------------------------------------------------------------- -// -MProtocolImSearch& COSSProtocolImFeatures::ImSearch() - { - //ignore compiler worning ,Not supported - MProtocolImSearch* dummySearch = NULL; - return *dummySearch; - - } -void COSSProtocolImFeatures::SetHost(MProtocolImDataHost& aHost ) - { - iHost = &aHost ; - iConnMan.SetImHost(aHost) ; - } - -// End of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/cossprotocolloginrequest.cpp --- a/imservices/ossprotocoladaptation/src/cossprotocolloginrequest.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,420 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Login Request to the Network Server. -* -*/ - - -#include "cossprotocolloginrequest.h" -#include -#include "mossprotocolconnectionmanager.h" -#include "ossprotocolpluginlogger.h" -#include "cossprotocolconnection.h" -#include "cossprotocolconnectionmanager.h" -#include -#include "stringutils.h" -#include -#include "msgliterals.h" -#include "msg_enums.h" -#include "xmppparameters.h" -#include "waittimer.h" -#include - -#include - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// COSSProtocolLoginRequest::COSSProtocolLoginRequest() -// --------------------------------------------------------------------------- -// -COSSProtocolLoginRequest::COSSProtocolLoginRequest ( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) : - CActive ( CActive::EPriorityStandard ), - iRequestId ( aRequestId ), - iConnMan ( aConnMan ) - { - LOGGER ( TXT ( "COSSProtocolLoginRequest::COSSProtocolLoginRequest Start" ) ); - CActiveScheduler::Add ( this ); - LOGGER ( TXT ( "COSSProtocolLoginRequest::COSSProtocolLoginRequest End" ) ); - } - -// COSSProtocolLoginRequest::ConstructL() -// --------------------------------------------------------------------------- -// -void COSSProtocolLoginRequest::ConstructL() - { - LOGGER ( TXT ( "COSSProtocolLoginRequest::COSSProtocolLoginRequest Start-End" ) ); - LOGGER ( TXT ( "COSSProtocolLoginRequest::COSSProtocolLoginRequest End" ) ); - } - - -// --------------------------------------------------------------------------- -// COSSProtocolLoginRequest::NewL() -// --------------------------------------------------------------------------- -// -COSSProtocolLoginRequest* COSSProtocolLoginRequest::NewL ( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) - { - LOGGER ( TXT ( "COSSProtocolLoginRequest::NewL Start" ) ); - - COSSProtocolLoginRequest* self = - new ( ELeave ) COSSProtocolLoginRequest ( aConnMan, aRequestId ); - CleanupStack::PushL ( self ); - self->ConstructL(); - CleanupStack::Pop ( self ); - - LOGGER ( TXT ( "COSSProtocolLoginRequest::NewL End" ) ); - return self; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolLoginRequest::NewLC() -// --------------------------------------------------------------------------- -// -COSSProtocolLoginRequest* COSSProtocolLoginRequest::NewLC ( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) - { - LOGGER ( TXT ( "COSSProtocolLoginRequest::NewLC Start" ) ); - - COSSProtocolLoginRequest* self = - COSSProtocolLoginRequest::NewL ( aConnMan, aRequestId ); - CleanupStack::PushL ( self ); - - LOGGER ( TXT ( "COSSProtocolLoginRequest::NewLC End" ) ); - return self; - } - -// --------------------------------------------------------------------------- -// COSSProtocolLoginRequest::~COSSProtocolLoginRequest() -// --------------------------------------------------------------------------- -// -COSSProtocolLoginRequest::~COSSProtocolLoginRequest() - { - LOGGER ( TXT ( "::~COSSProtocolLoginRequest Start-End" ) ); - Cancel(); - if( iUserName ) - { - delete iUserName; - } - - LOGGER ( TXT ( "::~COSSProtocolLoginRequest End\n" ) ); - } - - -// --------------------------------------------------------------------------- -// COSSProtocolLoginRequest::DoCancel() -// --------------------------------------------------------------------------- -// -void COSSProtocolLoginRequest::DoCancel() - { - } - - -// --------------------------------------------------------------------------- -// COSSProtocolLoginRequest::RunL() -// --------------------------------------------------------------------------- -// -void COSSProtocolLoginRequest::RunL() - { - LOGGER ( TXT ( "COSSProtocolLoginRequest::RunL Start" ) ); - message_hdr_resp* msg_struct = NULL; - User::LeaveIfError ( iStatus.Int() ); - char* pResponse = NULL; - pResponse = iConnMan.DataHandler().ResponseL ( iSendId ); - - msg_struct = ( message_hdr_resp* )pResponse ; - if( !( msg_struct->response ) ) - { - switch( msg_struct->error_type ) - { - case ELOGIN_NETWORK_ERROR: - LOGGER ( TXT ( "COSSProtocolLoginRequest::RunL ELOGIN_NETWORK_ERROR" ) ); - case ELOGIN_NONE_SPECIFIED: - //XImpfw is not giving any error code for canceling accespoint so we are using KErrDisconnected - //once error code is provided by ximpfw we can remove - LOGGER ( TXT ( "COSSProtocolLoginRequest::RunL ELOGIN_NONE_SPECIFIED" ) ); - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KErrDisconnected ); - break; - case ELOGIN_AUTHENTICATION: //The username or password was invalid. - LOGGER ( TXT ( "COSSProtocolLoginRequest::RunL ELOGIN_AUTHENTICATION" ) ); - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KXIMPErrServiceAuthenticationFailed ); - break; - default: //for all other error codes like ssl related are mapped to general error ELOGIN_AUTHORIZATION - LOGGER ( TXT ( "COSSProtocolLoginRequest::RunL defualt" ) ); - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KXIMPErrServiceGeneralError ); - break; - } - } - else - { - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KErrNone ); - MPresenceBuddyInfo2* buddyPresInfo = MPresenceBuddyInfo2::NewLC(); - MPresenceCacheWriter2* presenceCacheWriter = MPresenceCacheWriter2::CreateWriterL(); - HBufC* userName = HBufC::NewLC( iUserName->Length() + iConnMan.ServiceName().Length() + KColon().Length() ); - TPtr namePtr( userName->Des() ); - namePtr.Zero(); - namePtr.Append(iConnMan.ServiceName()); // prepend service name - namePtr.Append(KColon); - namePtr.Append(iUserName->Des() ); - buddyPresInfo->SetIdentityL(namePtr); - LOGGER ( TXT ( "COSSProtocolLoginRequest::owndata:%S " ), userName ); - CleanupStack::PopAndDestroy();//userName - _LIT(KAvailable,"available");//since not getting the own status from downlayer.here - _LIT(KStatusTest,"Online");//is hardcoded once logged in is successfully - HBufC16 *message = KAvailable().AllocLC(); - buddyPresInfo->SetAvailabilityL( MPresenceBuddyInfo2::EAvailable,*message); - HBufC16 *statusmessage = KStatusTest().AllocLC(); - buddyPresInfo->SetStatusMessageL(*statusmessage); - - TInt cacheerror = presenceCacheWriter->WritePresenceL(buddyPresInfo); - User::LeaveIfError ( cacheerror); - CleanupStack::PopAndDestroy ( 3 ); //buddyPresInfo, message ,statusmessage - delete presenceCacheWriter ; - } - - - free( pResponse ); - delete this; - - LOGGER ( TXT ( "COSSProtocolLoginRequest::RunL End" ) ); - - } - - -// --------------------------------------------------------------------------- -// COSSProtocolLoginRequest::RunError() -// --------------------------------------------------------------------------- -// -TInt COSSProtocolLoginRequest::RunError ( TInt aError ) - { - LOGGER ( TXT ( "COSSProtocolLoginRequest::RunError Start" ) ); - - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, aError ); - - delete this; - LOGGER ( TXT ( "COSSProtocolLoginRequest::RunError End" ) ); - return KErrNone; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolLoginRequest::IssueLoginRequestL() -// --------------------------------------------------------------------------- -// -void COSSProtocolLoginRequest::IssueLoginRequestL() - { - LOGGER ( TXT ( "COSSProtocolLoginRequest::IssueLoginRequestL Start" ) ); - - char *smsg = NULL; - char *tmpmsg = NULL; - message_hdr_req msgHdr = {0,}; - int userLen = 0; - int totalLen = 0; - int err = 0; - - smsg = ( char* ) User::AllocLC(MAX_MSG_SIZE); - - tmpmsg = ( char* ) User::AllocLC(MAX_MSG_SIZE); - - HBufC* buffer = HBufC::NewLC ( MAX_MSG_SIZE ); - TPtr bufferPtr ( buffer->Des() ); - bufferPtr.Zero(); - memset ( smsg, '\0', MAX_MSG_SIZE ); - memset ( tmpmsg, '\0', MAX_MSG_SIZE ); - - msgHdr.message_type = ELogin_Request; - iConnMan.DataHandler().IncreaseOpId(); - TInt Opid = iConnMan.DataHandler().GetOpId(); - msgHdr.request_id = Opid; - memcpy ( smsg, &msgHdr, sizeof ( message_hdr_req ) ); - totalLen += sizeof ( message_hdr_req ); - bufferPtr.Zero(); - - if ( iConnMan.UserName().Length() == 0 && iConnMan.Password().Length() == 0 ) //if username and pwd are not passed from client.read default settings - { - bufferPtr.Append ( iConnMan.XmppParams().UserName() ); - iUserName = bufferPtr.AllocL(); - LOGGER ( TXT ( "COSSProtocolLoginRequest::UserName:%S " ), & ( iConnMan.XmppParams().UserName() ) ); - memset ( tmpmsg, '\0', MAX_MSG_SIZE ); - err = tbufC16tochar ( bufferPtr, tmpmsg ); - if( -1 == err) - { - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, err ); - } - userLen = strlen ( tmpmsg ) + 1; //for '\0' - memcpy ( smsg + totalLen, tmpmsg, userLen ); - totalLen += userLen; - - bufferPtr.Zero(); - bufferPtr.Append ( iConnMan.XmppParams().Passwd() ); - memset ( tmpmsg, '\0', MAX_MSG_SIZE ); - err = tbufC16tochar ( bufferPtr, tmpmsg ); - userLen = strlen ( tmpmsg ) + 1; //for '\0' - memcpy ( smsg + totalLen, tmpmsg, userLen ); - totalLen += userLen; - } - else - { - iUserName = iConnMan.UserName().AllocL(); - bufferPtr.Append ( iConnMan.UserName() ); - LOGGER ( TXT ( "COSSProtocolLoginRequest::UserName:%S " ), & ( iConnMan.UserName() ) ); - memset ( tmpmsg, '\0', MAX_MSG_SIZE ); - err = tbufC16tochar ( bufferPtr, tmpmsg ); - userLen = strlen ( tmpmsg ) + 1; //for '\0' - memcpy ( smsg + totalLen, tmpmsg, userLen ); - totalLen += userLen; - - bufferPtr.Zero(); - bufferPtr.Append ( iConnMan.Password() ); - memset ( tmpmsg, '\0', MAX_MSG_SIZE ); - err = tbufC16tochar ( bufferPtr, tmpmsg ); - userLen = strlen ( tmpmsg ) + 1; //for '\0' - memcpy ( smsg + totalLen, tmpmsg, userLen ); - totalLen += userLen; - - } - - bufferPtr.Zero(); - - bufferPtr.Append ( iConnMan.XmppParams().ServerAddress() ); - LOGGER ( TXT ( "COSSProtocolLoginRequest::RunL:ServerAddress:%S " ), & ( iConnMan.XmppParams().ServerAddress() ) ); - memset ( tmpmsg, '\0', MAX_MSG_SIZE ); - err = tbufC16tochar ( bufferPtr, tmpmsg ); - userLen = strlen ( tmpmsg ) + 1; //for '\0' - memcpy ( smsg + totalLen, tmpmsg, userLen ); - totalLen += userLen; - - //resource - bufferPtr.Zero(); - bufferPtr.Append ( GenResourceId(iConnMan.XmppParams().Resource()) ); - memset ( tmpmsg, '\0', MAX_MSG_SIZE ); - err = tbufC16tochar ( bufferPtr, tmpmsg ); - userLen = strlen ( tmpmsg ) + 1; //for '\0' - memcpy ( smsg + totalLen, tmpmsg, userLen ); - totalLen += userLen; - - //ssl - bufferPtr.Zero(); - bufferPtr.AppendNum ( iConnMan.XmppParams().Ssl() ); - memset ( tmpmsg, '\0', MAX_MSG_SIZE ); - err = tbufC16tochar ( bufferPtr, tmpmsg ); - userLen = strlen ( tmpmsg ) + 1; //for '\0' - memcpy ( smsg + totalLen, tmpmsg, userLen ); - totalLen += userLen; - - //ServerPort - bufferPtr.Zero(); - bufferPtr.AppendNum ( iConnMan.XmppParams().ServerPort() ); - memset ( tmpmsg, '\0', MAX_MSG_SIZE ); - err = tbufC16tochar ( bufferPtr, tmpmsg ); - userLen = strlen ( tmpmsg ) + 1; //for '\0' - memcpy ( smsg + totalLen, tmpmsg, userLen ); - totalLen += userLen; - - //IapId - bufferPtr.Zero(); - bufferPtr.AppendNum ( iConnMan.XmppParams().IapId() ); - memset ( tmpmsg, '\0', MAX_MSG_SIZE ); - err = tbufC16tochar ( bufferPtr, tmpmsg ); - userLen = strlen ( tmpmsg ) + 1; //for '\0' - memcpy ( smsg + totalLen, tmpmsg, userLen ); - totalLen += userLen; - - //connmgr_bus - bufferPtr.Zero(); - bufferPtr.Append ( iConnMan.XmppParams().ConnMgrBus() ); - memset ( tmpmsg, '\0', MAX_MSG_SIZE ); - err = tbufC16tochar ( bufferPtr, tmpmsg ); - userLen = strlen ( tmpmsg ) + 1; //for '\0' - memcpy ( smsg + totalLen, tmpmsg, userLen ); - totalLen += userLen; - - //connmgr_path - bufferPtr.Zero(); - bufferPtr.Append ( iConnMan.XmppParams().ConnMgrPath() ); - memset ( tmpmsg, '\0', MAX_MSG_SIZE ); - err = tbufC16tochar ( bufferPtr, tmpmsg ); - userLen = strlen ( tmpmsg ) + 1; //for '\0' - memcpy ( smsg + totalLen, tmpmsg, userLen ); - totalLen += userLen; - - //protocol - bufferPtr.Zero(); - bufferPtr.Append ( iConnMan.XmppParams().Protocol() ); - memset ( tmpmsg, '\0', MAX_MSG_SIZE ); - err = tbufC16tochar ( bufferPtr, tmpmsg ); - userLen = strlen ( tmpmsg ) + 1; //for '\0' - memcpy ( smsg + totalLen, tmpmsg, userLen ); - totalLen += userLen; - -#ifdef __WINSCW__ - //ProxyServer - bufferPtr.Zero(); - bufferPtr.Append ( iConnMan.XmppParams().ProxyServer() ); - memset ( tmpmsg, '\0', MAX_MSG_SIZE ); - err = tbufC16tochar ( bufferPtr, tmpmsg ); - userLen = strlen ( tmpmsg ) + 1; //for '\0' - memcpy ( smsg + totalLen, tmpmsg, userLen ); - totalLen += userLen; - - //ProxyPort - bufferPtr.Zero(); - bufferPtr.AppendNum ( iConnMan.XmppParams().ProxyPort() ); - memset ( tmpmsg, '\0', MAX_MSG_SIZE ); - err = tbufC16tochar ( bufferPtr, tmpmsg ); - userLen = strlen ( tmpmsg ) + 1; //for '\0' - memcpy ( smsg + totalLen, tmpmsg, userLen ); - totalLen += userLen; -#endif - - - iSendId = iConnMan.DataHandler().SendDataL ( iStatus, smsg, totalLen ); - - // signal the scheduler - SetActive(); - CleanupStack::PopAndDestroy (buffer); - CleanupStack::PopAndDestroy (tmpmsg); - CleanupStack::PopAndDestroy (smsg); - LOGGER ( TXT ( "COSSProtocolConnection::OpenSessionL() End" ) ); - } -// --------------------------------------------------------------------------- -// COSSProtocolLoginRequest::GenResourceId() -// --------------------------------------------------------------------------- -// -TPtrC COSSProtocolLoginRequest::GenResourceId( const TDesC& aResourceId ) - { - TBuf tempRId = aResourceId; - //initialise client id - iResourceId.SetLength(0); - - //generate Resourse here - iResourceId.Append(tempRId); - - TTime time; - time.HomeTime(); - TInt64 seed = time.Int64(); - - TInt i = Math::Rand( seed ); - - iResourceId.AppendFormat( _L("%d"), i); - - return iResourceId; - } - -// End of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/cossprotocollogoutrequest.cpp --- a/imservices/ossprotocoladaptation/src/cossprotocollogoutrequest.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,200 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Login Request to the Network Server. -* -*/ - - -#include "cossprotocollogoutrequest.h" -#include -#include "mossprotocolconnectionmanager.h" -#include "ossprotocolpluginlogger.h" -#include "cossprotocolconnection.h" -#include "cossprotocolconnectionmanager.h" -#include -#include "stringutils.h" -#include -#include "msgliterals.h" -#include "xmppparameters.h" -#include "msg_enums.h" -#include - - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// COSSProtocolLogoutRequest::COSSProtocolLogoutRequest() -// --------------------------------------------------------------------------- -// -COSSProtocolLogoutRequest::COSSProtocolLogoutRequest ( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) : - CActive ( CActive::EPriorityStandard ), - iRequestId ( aRequestId ), - iConnMan ( aConnMan ) - { - LOGGER ( TXT ( "COSSProtocolLogoutRequest::COSSProtocolLogoutRequest Start" ) ); - CActiveScheduler::Add ( this ); - LOGGER ( TXT ( "COSSProtocolLogoutRequest::COSSProtocolLogoutRequest End" ) ); - } - - -// --------------------------------------------------------------------------- -// COSSProtocolLogoutRequest::ConstructL() -// --------------------------------------------------------------------------- -// -void COSSProtocolLogoutRequest::ConstructL() - { - LOGGER ( TXT ( "COSSProtocolLogoutRequest::COSSProtocolLogoutRequest Start-End" ) ); - } - - -// --------------------------------------------------------------------------- -// COSSProtocolLogoutRequest::NewL() -// --------------------------------------------------------------------------- -// -COSSProtocolLogoutRequest* COSSProtocolLogoutRequest::NewL ( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) - { - LOGGER ( TXT ( "COSSProtocolLogoutRequest::NewL Start" ) ); - - COSSProtocolLogoutRequest* self = - new ( ELeave ) COSSProtocolLogoutRequest ( aConnMan, aRequestId ); - CleanupStack::PushL ( self ); - self->ConstructL(); - CleanupStack::Pop ( self ); - - LOGGER ( TXT ( "COSSProtocolLogoutRequest::NewL End" ) ); - return self; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolLogoutRequest::NewLC() -// --------------------------------------------------------------------------- -// -COSSProtocolLogoutRequest* COSSProtocolLogoutRequest::NewLC ( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) - { - LOGGER ( TXT ( "COSSProtocolLogoutRequest::NewLC Start" ) ); - - COSSProtocolLogoutRequest* self = - COSSProtocolLogoutRequest::NewL ( aConnMan, aRequestId ); - CleanupStack::PushL ( self ); - - LOGGER ( TXT ( "COSSProtocolLogoutRequest::NewLC End" ) ); - return self; - } - -// --------------------------------------------------------------------------- -// COSSProtocolLogoutRequest::~COSSProtocolLogoutRequest() -// --------------------------------------------------------------------------- -// -COSSProtocolLogoutRequest::~COSSProtocolLogoutRequest() - { - LOGGER ( TXT ( "::~COSSProtocolLogoutRequest Start" ) ); - Cancel(); - } - - -// --------------------------------------------------------------------------- -// COSSProtocolLogoutRequest::DoCancel() -// --------------------------------------------------------------------------- -// -void COSSProtocolLogoutRequest::DoCancel() - { - } - - -// --------------------------------------------------------------------------- -// COSSProtocolLogoutRequest::RunL() -// --------------------------------------------------------------------------- -// -void COSSProtocolLogoutRequest::RunL() - { - LOGGER ( TXT ( "COSSProtocolLogoutRequest::RunL Start" ) ); - message_hdr_resp* msg_struct = NULL; - - User::LeaveIfError ( iStatus.Int() ); - char* pResponse = NULL; - pResponse = iConnMan.DataHandler().ResponseL ( iSendId ); - msg_struct = ( message_hdr_resp* )pResponse ; - - if( !( msg_struct->response ) ) - { - switch( msg_struct->error_type ) - { - - default: //for all other error codes like ssl related are mapped to general error - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KXIMPErrServiceGeneralError ); - break; - } - } - else - { - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KErrNone ); - } - - free( pResponse ); - - - delete this; - - LOGGER ( TXT ( "COSSProtocolLogoutRequest::RunL End" ) ); - } - - -// --------------------------------------------------------------------------- -// COSSProtocolLogoutRequest::RunError() -// --------------------------------------------------------------------------- -// -TInt COSSProtocolLogoutRequest::RunError ( TInt aError ) - { - LOGGER ( TXT ( "COSSProtocolLogoutRequest::RunError Start" ) ); - - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, aError ); - - LOGGER ( TXT ( "COSSProtocolLogoutRequest::RunError - id: %d" ), aError ); - - delete this; - LOGGER ( TXT ( "COSSProtocolLogoutRequest::RunError End" ) ); - return KErrNone; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolLogoutRequest::IssueLogoutRequestL() -// --------------------------------------------------------------------------- -// -void COSSProtocolLogoutRequest::IssueLogoutRequestL() - { - LOGGER ( TXT ( "COSSProtocolLogoutRequest::IssueLogoutRequestL Start" ) ); - - message_hdr_req msgHdr = {0,}; - - msgHdr.message_type = ELogout_Request; - - iSendId = iConnMan.DataHandler().SendDataL ( iStatus, ( char* ) &msgHdr, sizeof ( message_hdr_req ) ); - - // signal the scheduler - SetActive(); - - LOGGER ( TXT ( "COSSProtocolConnection::IssueLogoutRequestL() End" ) ); - } - - -// End of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/cossprotocolplugin.cpp --- a/imservices/ossprotocoladaptation/src/cossprotocolplugin.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,289 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: adaptation for open source -* -*/ - -#include "cossprotocolplugin.h" - -#include "cossprotocolconnection.h" -#include "ossprotocolpluginlogger.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "processlaunher.h" -#include "cuserafter.h" - -_LIT ( KOSSProtocolPlugin, "COSSProtocolPlugin" ); -_LIT ( KIsoserver, "isoserver.exe" ); - - -// ======== MEMBER FUNCTIONS ======== - - -// --------------------------------------------------------------------------- -// Key value pair table to identify correct constructor -// function for the requested interface. -// --------------------------------------------------------------------------- -// -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY ( 0x101FB3E7, COSSProtocolPlugin::NewL ) - }; - - -// --------------------------------------------------------------------------- -// Exported function to return the implementation proxy table -// --------------------------------------------------------------------------- -// -EXPORT_C const TImplementationProxy* ImplementationGroupProxy ( TInt& aTableCount ) - { - - aTableCount = sizeof ( ImplementationTable ) / sizeof ( TImplementationProxy ); - - return ImplementationTable; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolPlugin::COSSProtocolPlugin() -// --------------------------------------------------------------------------- -// -COSSProtocolPlugin::COSSProtocolPlugin() - { - - LOGGER ( TXT ( "COSSProtocolPlugin::COSSProtocolPlugin() Start-End" ) ); - } - - -// --------------------------------------------------------------------------- -// COSSProtocolPlugin::ConstructL() -// --------------------------------------------------------------------------- -// -void COSSProtocolPlugin::ConstructL() - { - LOGGER ( TXT ( "COSSProtocolPlugin::ConstructL() Start" ) ); - iIsoServerLauncher = CProcessLauncher::NewL ( KIsoserver ); - LOGGER ( TXT ( "COSSProtocolPlugin::ConstructL() End" ) ); - } - - -// --------------------------------------------------------------------------- -// COSSProtocolPlugin::NewLC() -// --------------------------------------------------------------------------- -// -COSSProtocolPlugin* COSSProtocolPlugin::NewLC() - { - LOGGER ( TXT ( "COSSProtocolPlugin::NewLC() Start" ) ); - - COSSProtocolPlugin* self = COSSProtocolPlugin::NewL(); - CleanupStack::PushL ( self ); - - LOGGER ( TXT ( "COSSProtocolPlugin::NewLC() End" ) ); - return self; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolPlugin::NewL() -// --------------------------------------------------------------------------- -// -COSSProtocolPlugin* COSSProtocolPlugin::NewL() - { - LOGGER ( TXT ( "=============================START=========================================" ) ); - LOGGER ( TXT ( "COSSProtocolPlugin::NewL() Start" ) ); - - COSSProtocolPlugin* self = new ( ELeave ) COSSProtocolPlugin(); - CleanupStack::PushL ( self ); - self->ConstructL(); - CleanupStack::Pop ( self ); - - LOGGER ( TXT ( "COSSProtocolPlugin::NewL() End :Address of %d" ), &self ); - return self; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolPlugin::~COSSProtocolPlugin() -// --------------------------------------------------------------------------- -// -COSSProtocolPlugin::~COSSProtocolPlugin() - { - LOGGER ( TXT ( "COSSProtocolPlugin::~COSSProtocolPlugin() Start" ) ); - delete iIsoServerLauncher; - - iConnections.ResetAndDestroy(); - - LOGGER ( TXT ( "COSSProtocolPlugin::~COSSProtocolPlugin() End" ) ); - LOGGER ( TXT ( "=============================END=========================================" ) ); - } - - -// --------------------------------------------------------------------------- -// COSSProtocolPlugin::PrimeHost() -// --------------------------------------------------------------------------- -// -void COSSProtocolPlugin::PrimeHost ( MXIMPProtocolPluginHost& aHost ) - { - LOGGER ( TXT ( "COSSProtocolPlugin::PrimeHost() Start" ) ); - - iHost = &aHost; - - LOGGER ( TXT ( "COSSProtocolPlugin::PrimeHost() End" ) ); - } - - -// --------------------------------------------------------------------------- -// COSSProtocolPlugin::AcquireConnectionL() -// --------------------------------------------------------------------------- -// -MXIMPProtocolConnection& COSSProtocolPlugin::AcquireConnectionL ( - const MXIMPServiceInfo& aServiceInfo, - const MXIMPContextClientInfo& aClientCtxInfo ) - { - LOGGER ( TXT ( "COSSProtocolPlugin::AcquireConnectionL() Start" ) ); - - TInt count = iConnections.Count(); - //COSSProtocolConnection* connection = NULL; - // count how many connections are there in plugin - // create new connection if array is empty - // create existing connection based on check if it - if ( count == 0 ) - { - COSSProtocolConnection* connection = COSSProtocolConnection::NewL ( aServiceInfo, aClientCtxInfo ); - CleanupStack::PushL ( connection ); - iConnections.AppendL ( connection ); - CleanupStack::Pop ( connection ); - iIsoServerLauncher->LaunchProcessL(); - LOGGER ( TXT ( "COSSProtocolPlugin::isoserver launched" ) ); - LOGGER ( TXT ( "COSSProtocolPlugin::AcquireConnectionL() End" ) ); - return *connection; - - } - else if ( count == 1 ) - { - LOGGER(TXT("COSSProtocolPlugin::AcquireConnectionL() End") ); - return *iConnections[0]; - } - else - { - // even if there are many connection objects, we just return - // the reference to the first connection object which is - // initiated by CCH - return *iConnections[0]; - } - } - - -// --------------------------------------------------------------------------- -// COSSProtocolPlugin::ReleaseConnection() -// --------------------------------------------------------------------------- -// -void COSSProtocolPlugin::ReleaseConnection ( MXIMPProtocolConnection& aConnection ) - { - LOGGER ( TXT ( "COSSProtocolPlugin::ReleaseConnection() Start" ) ); - - TInt connectionsCount = iConnections.Count(); - - for ( TInt i ( connectionsCount - 1 ); i >= 0; i-- ) - { - MXIMPProtocolConnection* tmp = iConnections[i]; - - if ( tmp == &aConnection ) - { - TRAP_IGNORE( iConnections[i]->ReleaseConnectionL() ); - delete iConnections[i]; - iConnections.Remove ( i ); - } - } - - LOGGER ( TXT ( "COSSProtocolPlugin::ReleaseConnection() End" ) ); - } - - -// --------------------------------------------------------------------------- -// COSSProtocolPlugin::GetInterface() -// --------------------------------------------------------------------------- -// -TAny* COSSProtocolPlugin::GetInterface ( TInt32 aInterfaceId, - TIfGetOps aOptions ) - { - LOGGER ( TXT ( "COSSProtocolPlugin::GetInterface() Start" ) ); - - if ( aInterfaceId == MXIMPProtocolPlugin::KInterfaceId ) - { - MXIMPProtocolPlugin* self = this; - return self; - } - - if ( aOptions == MXIMPBase::EPanicIfUnknown ) - - { - User::Panic ( KOSSProtocolPlugin, KErrExtensionNotSupported ); - } - - LOGGER ( TXT ( "COSSProtocolPlugin::GetInterface() End" ) ); - - return NULL; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolPlugin::GetInterface() -// --------------------------------------------------------------------------- -// -const TAny* COSSProtocolPlugin::GetInterface ( TInt32 aInterfaceId, - TIfGetOps aOptions ) const - { - LOGGER ( TXT ( "COSSProtocolPlugin::GetInterface() const Start" ) ); - - if ( aInterfaceId == MXIMPProtocolPlugin::KInterfaceId ) - { - const MXIMPProtocolPlugin* self = this; - return self; - } - - if ( aOptions == MXIMPBase::EPanicIfUnknown ) - - { - User::Panic ( KOSSProtocolPlugin, KErrExtensionNotSupported ); - } - - LOGGER ( TXT ( "COSSProtocolPlugin::GetInterface() const End" ) ); - - return NULL; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolPlugin::GetInterfaceId() const -// --------------------------------------------------------------------------- -// -TInt32 COSSProtocolPlugin::GetInterfaceId() const - { - LOGGER ( TXT ( "COSSProtocolPlugin::GetInterface() without parameters Start-End" ) ); - return MXIMPProtocolPlugin::KInterfaceId; - } - - -// End of file - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/cossprotocolpresencefeatures.cpp --- a/imservices/ossprotocoladaptation/src/cossprotocolpresencefeatures.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,179 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: oss presence features implementation for XIMP Framework -* -*/ - -#include "cossprotocolpresencefeatures.h" -#include -#include -#include -#include -#include "cossprotocolpresentitygroups.h" -#include "ossprotocolpluginlogger.h" -#include "cossprotocolpresencepublishing.h" -#include "cossprotocolpresenceauthorization.h" - -_LIT ( KOSSProtocolPresenceFeatures, "COSSProtocolPresenceFeatures" ); - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// COSSProtocolConnection::COSSProtocolPresenceFeatures() -// --------------------------------------------------------------------------- -// -COSSProtocolPresenceFeatures::COSSProtocolPresenceFeatures() - { - } - -// --------------------------------------------------------------------------- -// COSSProtocolPresenceFeatures::ConstructL() -// --------------------------------------------------------------------------- -// -void COSSProtocolPresenceFeatures::ConstructL ( - COSSProtocolConnectionManager& aConnMan ) - { - iPresentityGroups = COSSProtocolpresentitygroups::NewL ( aConnMan ); - iPresencePublishing = COssProtocolPresencePublishing::NewL ( aConnMan ); - iAuthrozation = COssProtocolPresenceAuthorization::NewL ( aConnMan ); - } - -// --------------------------------------------------------------------------- -// COSSProtocolPresenceFeatures::NewL() -// --------------------------------------------------------------------------- -// -COSSProtocolPresenceFeatures* COSSProtocolPresenceFeatures::NewL ( - COSSProtocolConnectionManager& aConnMan ) - { - - COSSProtocolPresenceFeatures* self = new ( ELeave ) COSSProtocolPresenceFeatures; - CleanupStack::PushL ( self ); - self->ConstructL ( aConnMan ); - CleanupStack::Pop ( self ); - - return self; - } - -// --------------------------------------------------------------------------- -// COSSProtocolPresenceFeatures::~COSSProtocolPresenceFeatures() -// --------------------------------------------------------------------------- -// -COSSProtocolPresenceFeatures::~COSSProtocolPresenceFeatures() - { - delete iPresentityGroups; - delete iPresencePublishing; - delete iAuthrozation; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolPresenceFeatures::GetInterface() -// --------------------------------------------------------------------------- -// -TAny* COSSProtocolPresenceFeatures::GetInterface ( TInt32 aInterfaceId, - TIfGetOps aOptions ) - { - if ( aInterfaceId == MProtocolPresenceFeatures::KInterfaceId ) - { - MProtocolPresenceFeatures* self = this; - return self; - } - - if ( aOptions == MXIMPBase::EPanicIfUnknown ) - - { - User::Panic ( KOSSProtocolPresenceFeatures, KErrExtensionNotSupported ); - } - - return NULL; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolPresenceFeatures::GetInterface() -// --------------------------------------------------------------------------- -// -const TAny* COSSProtocolPresenceFeatures::GetInterface ( TInt32 aInterfaceId, - TIfGetOps aOptions ) const - { - - if ( aInterfaceId == MProtocolPresenceFeatures::KInterfaceId ) - { - const MProtocolPresenceFeatures* self = this; - return self; - } - - if ( aOptions == MXIMPBase::EPanicIfUnknown ) - { - User::Panic ( KOSSProtocolPresenceFeatures, KErrExtensionNotSupported ); - } - - return NULL; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolPresenceFeatures::GetInterfaceId() -// --------------------------------------------------------------------------- -// -TInt32 COSSProtocolPresenceFeatures::GetInterfaceId() const - { - return MProtocolPresenceFeatures::KInterfaceId; - } - -// --------------------------------------------------------------------------- -// COSSProtocolPresenceFeatures::PresenceWatching() -// --------------------------------------------------------------------------- -// -MProtocolPresenceWatching& COSSProtocolPresenceFeatures::PresenceWatching() - { - MProtocolPresenceWatching* dummyWatch = NULL; - return *dummyWatch; - } - -// --------------------------------------------------------------------------- -// COSSProtocolPresenceFeatures::PresencePublishing() -// --------------------------------------------------------------------------- -// -MProtocolPresencePublishing& COSSProtocolPresenceFeatures::PresencePublishing() - { - return *iPresencePublishing; - } - -// --------------------------------------------------------------------------- -// COSSProtocolPresenceFeatures::PresentityGroups() -// --------------------------------------------------------------------------- -// -MProtocolPresentityGroups& COSSProtocolPresenceFeatures::PresentityGroups() - { - return *iPresentityGroups; - } - -// --------------------------------------------------------------------------- -// COSSProtocolPresenceFeatures::PresenceAuthorization() -// --------------------------------------------------------------------------- -// -MProtocolPresenceAuthorization& COSSProtocolPresenceFeatures::PresenceAuthorization() - { - return *iAuthrozation; - } - -// End of file - - - - - - - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/cossprotocolsearchfeatures.cpp --- a/imservices/ossprotocoladaptation/src/cossprotocolsearchfeatures.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,151 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: oss protocol plugin search features -* -*/ - -#include "cossprotocolsearchfeatures.h" -#include -#include "cossprotocolsearch.h" -#include "ossprotocolpluginlogger.h" - -_LIT ( KOSSProtocolSearchFeatures, "COSSProtocolSearchFeature" ); - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// COSSProtocolConnection::COSSProtocolSearchFeature() -// --------------------------------------------------------------------------- -// -COSSProtocolSearchFeature::COSSProtocolSearchFeature(COSSProtocolConnectionManager& aConnMan) : iConnMan (aConnMan) - { - } - -// --------------------------------------------------------------------------- -// COSSProtocolSearchFeature::ConstructL() -// --------------------------------------------------------------------------- -// -void COSSProtocolSearchFeature::ConstructL ( - COSSProtocolConnectionManager& aConnMan ) - { - iSearch = COSSProtocolSearch::NewL ( aConnMan ); - } - -// --------------------------------------------------------------------------- -// COSSProtocolSearchFeature::NewL() -// --------------------------------------------------------------------------- -// -COSSProtocolSearchFeature* COSSProtocolSearchFeature::NewL ( - COSSProtocolConnectionManager& aConnMan ) - { - - COSSProtocolSearchFeature* self = new ( ELeave ) COSSProtocolSearchFeature(aConnMan); - CleanupStack::PushL ( self ); - self->ConstructL ( aConnMan ); - CleanupStack::Pop ( self ); - - return self; - } - -// --------------------------------------------------------------------------- -// COSSProtocolSearchFeature::~COSSProtocolSearchFeature() -// --------------------------------------------------------------------------- -// -COSSProtocolSearchFeature::~COSSProtocolSearchFeature() - { - delete iSearch; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolSearchFeature::GetInterface() -// --------------------------------------------------------------------------- -// -TAny* COSSProtocolSearchFeature::GetInterface ( TInt32 aInterfaceId, - TIfGetOps aOptions ) - { - MProtocolSearchFeature* self = NULL; - if ( aInterfaceId == MProtocolSearchFeature::KInterfaceId ) - { - self = this; - } - else - { - if ( aOptions == MXIMPBase::EPanicIfUnknown ) - - { - User::Panic ( KOSSProtocolSearchFeatures, KErrExtensionNotSupported ); - } - } - - return self; - } - -// --------------------------------------------------------------------------- -// COSSProtocolSearchFeature::SetHost -// --------------------------------------------------------------------------- -// - -void COSSProtocolSearchFeature::SetHost(MProtocolSearchDataHost& aSearchHost ) - { - iConnMan.SetSearchHost(aSearchHost) ; // set this in connection manager. - } - -// --------------------------------------------------------------------------- -// COSSProtocolSearchFeature::GetInterface() -// --------------------------------------------------------------------------- -// -const TAny* COSSProtocolSearchFeature::GetInterface ( TInt32 aInterfaceId, - TIfGetOps aOptions ) const - { - - const MProtocolSearchFeature* self = NULL; - if ( aInterfaceId == MProtocolSearchFeature::KInterfaceId ) - { - self = this; - } - else - { - if ( aOptions == MXIMPBase::EPanicIfUnknown ) - - { - User::Panic ( KOSSProtocolSearchFeatures, KErrExtensionNotSupported ); - } - } - - return self; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolSearchFeature::GetInterfaceId() const -// --------------------------------------------------------------------------- -// -TInt32 COSSProtocolSearchFeature::GetInterfaceId() const - { - return MProtocolSearchFeature::KInterfaceId; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolSearchFeature::search() -// --------------------------------------------------------------------------- -// -MProtocolSearch& COSSProtocolSearchFeature::Search() - { - return *iSearch; - } - - -// End of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/cossprotocolservererrorhandler.cpp --- a/imservices/ossprotocoladaptation/src/cossprotocolservererrorhandler.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,212 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: server error handler -* -*/ - - -#include -#include "cossprotocolservererrorhandler.h" -#include "mossprotocolconnectionmanager.h" -#include "ossprotocolpluginlogger.h" -#include "waittimer.h" -#include "cossprotocolconnectionmanager.h" - -#include -#include -#include -#include -#include -#include -#include -#include "msgliterals.h" -#include - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// COssprotocolServerErrorHandler::COssprotocolServerErrorHandler -// --------------------------------------------------------------------------- -// -COssprotocolServerErrorHandler::COssprotocolServerErrorHandler ( - MOSSProtocolConnectionManager& aConnMan ) : - CActive ( EPriorityNormal ), - iConnMan ( aConnMan ) - { - LOGGER ( TXT ( "COssprotocolServerErrorHandler::COssprotocolServerErrorHandler Start" ) ); - CActiveScheduler::Add ( this ); - - LOGGER ( TXT ( "COssprotocolServerErrorHandler::COssprotocolServerErrorHandler End" ) ); - } - - -// --------------------------------------------------------------------------- -// COssprotocolServerErrorHandler::ConstructL -// --------------------------------------------------------------------------- -// -void COssprotocolServerErrorHandler::ConstructL() - { - LOGGER ( TXT ( "COssprotocolServerErrorHandler::ConstructL Start-End" ) ); - - } - - -// --------------------------------------------------------------------------- -// COssprotocolServerErrorHandler::NewL -// --------------------------------------------------------------------------- -// -COssprotocolServerErrorHandler* COssprotocolServerErrorHandler::NewL ( - MOSSProtocolConnectionManager& aConnMan ) - { - LOGGER ( TXT ( "COssprotocolServerErrorHandler::NewL Start" ) ); - - COssprotocolServerErrorHandler* self = new ( ELeave ) - COssprotocolServerErrorHandler ( aConnMan ); - CleanupStack::PushL ( self ); - self->ConstructL(); - CleanupStack::Pop ( self ); - - LOGGER ( TXT ( "COssprotocolServerErrorHandler::NewL End" ) ); - return self; - } - - -// --------------------------------------------------------------------------- -// COssprotocolServerErrorHandler::NewLC -// --------------------------------------------------------------------------- -// -COssprotocolServerErrorHandler* COssprotocolServerErrorHandler::NewLC ( - MOSSProtocolConnectionManager& aConnMan ) - { - LOGGER ( TXT ( "COssprotocolServerErrorHandler::NewLC Start" ) ); - - COssprotocolServerErrorHandler* self = - COssprotocolServerErrorHandler::NewL ( aConnMan ); - CleanupStack::PushL ( self ); - - LOGGER ( TXT ( "COssprotocolServerErrorHandler::NewLC End" ) ); - return self; - } - -// --------------------------------------------------------------------------- -// COssprotocolServerErrorHandler::~COssprotocolServerErrorHandler -// --------------------------------------------------------------------------- -// -COssprotocolServerErrorHandler::~COssprotocolServerErrorHandler() - { - LOGGER ( TXT ( "::~COssprotocolServerErrorHandler Start" ) ); - - Cancel(); - - LOGGER ( TXT ( "::~COssprotocolServerErrorHandler End" ) ); - } - - -// --------------------------------------------------------------------------- -// COssprotocolServerErrorHandler::DoCancel() -// --------------------------------------------------------------------------- -// -void COssprotocolServerErrorHandler::DoCancel() - { - LOGGER ( TXT ( "COssprotocolServerErrorHandler::DoCancel Start" ) ); - - iConnMan.DataHandler().CancelListeningServerErrors(); - - LOGGER ( TXT ( "COssprotocolServerErrorHandler::DoCancel End" ) ); - } - -// --------------------------------------------------------------------------- -// COssprotocolServerErrorHandler::RunL() -// --------------------------------------------------------------------------- -// -void COssprotocolServerErrorHandler::RunL() - { - LOGGER ( TXT ( "COssprotocolServerErrorHandler::RunL Start" ) ); - - // something is coming from the xmpp server - User::LeaveIfError ( iStatus.Int() ); - - ProcessIncomingDataL(); -// StartListeningL(); - - LOGGER ( TXT ( "COssprotocolServerErrorHandler::RunL End" ) ); - } - -// --------------------------------------------------------------------------- -// COssprotocolServerErrorHandler::ProcessIncomingDataL() -// --------------------------------------------------------------------------- -// -void COssprotocolServerErrorHandler::ProcessIncomingDataL() - { - LOGGER ( TXT ( "COssprotocolServerErrorHandler::ProcessIncomingDataL Start" ) ); - TInt senderidlen = 0; - TInt messagelen = 0; - char* sender = NULL; - char* recvdmessage = NULL; - guint messagetype = NULL; - guint time; - char* pResponse = NULL, *pOrigResponse = NULL; - User::LeaveIfError ( iStatus.Int() ); - pOrigResponse = pResponse = iConnMan.DataHandler().ResponseL ( 3 ); - CleanupStack::PushL(pOrigResponse) ; - //parse message type - - memcpy ( &messagetype, pResponse, sizeof ( guint ) ); - memcpy ( &time, pResponse + sizeof ( guint ), sizeof ( guint ) ); - - senderidlen = strlen(pResponse + sizeof ( guint ) * 2 ); - sender = ( char* ) User::AllocLC ( senderidlen + 1 ); - memset ( sender, '\0', senderidlen ); - memcpy ( sender, pResponse + sizeof ( guint ) * 2, senderidlen + 1); - - messagelen = strlen(pResponse + sizeof ( guint ) * 2 + senderidlen + 1 ); - recvdmessage = ( char* ) User::AllocLC ( messagelen + 1 ); - memset ( recvdmessage, '\0', messagelen ); - memcpy ( recvdmessage, pResponse + sizeof ( guint ) * 2 + 1 + senderidlen, messagelen + 1 ); - CleanupStack::PopAndDestroy ( recvdmessage ); - CleanupStack::PopAndDestroy ( sender ); - CleanupStack::PopAndDestroy(pOrigResponse) ;//pOrigResponse - LOGGER ( TXT ( "COssprotocolServerErrorHandler::ProcessIncomingDataL End" ) ); - } - - -// --------------------------------------------------------------------------- -// COssprotocolServerErrorHandler::RunError -// --------------------------------------------------------------------------- -// -TInt COssprotocolServerErrorHandler::RunError ( TInt aError ) - { - LOGGER ( TXT ( "COssprotocolServerErrorHandler::RunError Start %d" ), aError ); - - LOGGER ( TXT ( "COssprotocolServerErrorHandler::RunError End" ) ); - return KErrNone; - } - -// --------------------------------------------------------------------------- -// COssprotocolServerErrorHandler::StartListeningL -// --------------------------------------------------------------------------- -// -void COssprotocolServerErrorHandler::StartListeningL() - { - LOGGER ( TXT ( "COssprotocolServerErrorHandler::StartListeningL Start" ) ); - - if ( ! ( this->IsActive() ) ) - { - iConnMan.DataHandler().ListenIncomingServerError ( iStatus ); - SetActive(); - } - LOGGER ( TXT ( "COssprotocolServerErrorHandler::StartListeningL End" ) ); - } - -// End of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/cosssenddataoperation.cpp --- a/imservices/ossprotocoladaptation/src/cosssenddataoperation.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,157 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: cosssenddataoperation.cpp -* -*/ - -// INCLUDES -#include - -#include "cosssenddataoperation.h" -#include "ossprotocolpluginlogger.h" - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// COssSendDataOperation::COssSendDataOperation() -// --------------------------------------------------------------------------- -// -COssSendDataOperation::COssSendDataOperation () - : iOpId ( KErrNone ) - { - iData = NULL; - LOGGER ( TXT ( "COssSendDataOperation::COssSendDataOperation Start End" ) ); - } -// --------------------------------------------------------------------------- -// COssSendDataOperation::~COssSendDataOperation() -// --------------------------------------------------------------------------- -// -COssSendDataOperation::~COssSendDataOperation () - { - LOGGER ( TXT ( "COssSendDataOperation::~COssSendDataOperation Start" ) ); - delete iData; - - if ( iStatus ) - { - User::RequestComplete ( iStatus, KErrCancel ); - } - - LOGGER ( TXT ( "COssSendDataOperation::~COssSendDataOperation End" ) ); - } - -// --------------------------------------------------------------------------- -// COssSendDataOperation::SetIds() -// --------------------------------------------------------------------------- -// -void COssSendDataOperation::SetIds ( TInt aOperationId, TInt aLogId ) - { - LOGGER ( TXT ( "COssSendDataOperation::SetIds Start" ) ); - iOpId = aOperationId; - iLogId = aLogId; - LOGGER ( TXT ( "COssSendDataOperation::SetIds End" ) ); - } - - -// --------------------------------------------------------------------------- -// COssSendDataOperation::SetRequestStatus() -// --------------------------------------------------------------------------- -// -void COssSendDataOperation::SetRequestStatus ( TRequestStatus& aStatus ) - { - LOGGER ( TXT ( "COssSendDataOperation::SetRequestStatus Start" ) ); - iStatus = &aStatus; - LOGGER ( TXT ( "COssSendDataOperation::SetRequestStatus End" ) ); - } - -// --------------------------------------------------------------------------- -// COssSendDataOperation::Status() -// --------------------------------------------------------------------------- -// -TRequestStatus* COssSendDataOperation::Status() - { - LOGGER ( TXT ( "COssSendDataOperation::Status Start-End" ) ); - return iStatus; - } - -// --------------------------------------------------------------------------- -// COssSendDataOperation::OperationId() -// --------------------------------------------------------------------------- -// -TInt COssSendDataOperation::OperationId() const - { - LOGGER ( TXT ( "COssSendDataOperation::OperationId Start-End" ) ); - return iOpId; - } -// --------------------------------------------------------------------------- -// COssSendDataOperation::NewLC() -// --------------------------------------------------------------------------- -// - COssSendDataOperation* COssSendDataOperation::NewLC() - { - LOGGER ( TXT ( "COssSendDataOperation::NewLC Start-End" ) ); - COssSendDataOperation* self = new ( ELeave ) - COssSendDataOperation(); - - CleanupStack::PushL ( self ); - LOGGER ( TXT ( "COssSendDataOperation::NewLC End" ) ); - return self; - } - -// --------------------------------------------------------------------------- -// COssSendDataOperation::CompletedOperation() -// --------------------------------------------------------------------------- -// - void COssSendDataOperation::CompletedOperation ( TInt aCode ) - { - LOGGER ( TXT ( "COssSendDataOperation::CompletedOperation Start :id:%d,code:%d" ), - iOpId, - aCode ); - - if ( !iStatus ) - { - LOGGER ( TXT ( "COssSendDataOperation::CompletedOperation:!!Double Completion!!!" ) ); - return; - } - - User::RequestComplete ( iStatus, aCode ); - - iStatus = NULL; - } - -// --------------------------------------------------------------------------- -// COssSendDataOperation::SetResponse() -// --------------------------------------------------------------------------- - void COssSendDataOperation::SetResponse ( char* aBuff ) - { - LOGGER ( TXT ( "CPEngPureDataHandler::SetResponse - id: %d" ), iOpId ); - delete iData; - iData = aBuff; - LOGGER ( TXT ( "COssSendDataOperation::SetResponse End" ) ); - } - -// --------------------------------------------------------------------------- -// COssSendDataOperation::Response() -// --------------------------------------------------------------------------- -// - char* COssSendDataOperation::Response() - { - LOGGER ( TXT ( "CPEngPureDataHandler::Response Start" ) ); - char* b = iData; - iData = NULL; - LOGGER ( TXT ( "CPEngPureDataHandler::Response End" ) ); - return b; - } - - -// End of File diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/im/cossprotocolimconversation.cpp --- a/imservices/ossprotocoladaptation/src/im/cossprotocolimconversation.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,269 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Oss Protocol im conversation implementation -* -*/ - -#include -#include -#include -#include "cossprotocolimconversation.h" -#include "cossprotocolconnectionmanager.h" -#include "cosssendmessagerequest.h" -#include "mossprotocolconnectionmanager.h" -#include "ossprotocolpluginlogger.h" -#include "ossprotocolpluginpanics.h" -#include "ossprotocolpluginlogger.h" -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// COSSProtocolImConversation::GetInterface() -// --------------------------------------------------------------------------- -// -TAny* COSSProtocolImConversation::GetInterface ( TInt32 aInterfaceId, - TIfGetOps aOptions ) - { - LOGGER ( TXT ( "COSSProtocolImConversation::GetInterface() Start" ) ); - - if ( aInterfaceId == MProtocolImConversation::KInterfaceId ) - { - MProtocolImConversation* self = this; - return self; - } - - if ( aOptions == MXIMPBase::EPanicIfUnknown ) - - { - User::Panic ( KOSSProtocolConversation, KErrExtensionNotSupported ); - } - - LOGGER ( TXT ( "COSSProtocolImConversation::GetInterface() End" ) ); - - return NULL; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolImConversation::GetInterface() -// --------------------------------------------------------------------------- -// -const TAny* COSSProtocolImConversation::GetInterface ( TInt32 aInterfaceId, - TIfGetOps aOptions ) const - { - LOGGER ( TXT ( "COSSProtocolImConversation::GetInterface() Start" ) ); - - if ( aInterfaceId == MProtocolImConversation::KInterfaceId ) - { - const MProtocolImConversation* self = this; - return self; - } - - if ( aOptions == MXIMPBase::EPanicIfUnknown ) - - { - User::Panic ( KOSSProtocolConversation, KErrExtensionNotSupported ); - } - - LOGGER ( TXT ( "COSSProtocolImConversation::GetInterface() End" ) ); - - return NULL; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolImConversation::GetInterfaceId() -// --------------------------------------------------------------------------- -// -TInt32 COSSProtocolImConversation::GetInterfaceId() const - { - LOGGER ( TXT ( "COSSProtocolImConversation::GetInterfaceId() Start-End" ) ); - return MProtocolImConversation::KInterfaceId; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolImConversation::COSSProtocolImConversation() -// --------------------------------------------------------------------------- -// -COSSProtocolImConversation::COSSProtocolImConversation ( - MOSSProtocolConnectionManager& aConnMan ) - : iConnMan ( aConnMan ) - { - LOGGER ( TXT ( "Groups::COSSProtocolImConversation() Start-End" ) ); - } - - -// --------------------------------------------------------------------------- -// COSSProtocolImConversation::ConstructL() -// --------------------------------------------------------------------------- -// -void COSSProtocolImConversation::ConstructL() - { - LOGGER ( TXT ( "COSSProtocolImConversation::ConstructL() Start" ) ); - LOGGER ( TXT ( "COSSProtocolImConversation::ConstructL() End" ) ); - } - - -// --------------------------------------------------------------------------- -// COSSProtocolImConversation::NewL() -// --------------------------------------------------------------------------- -// -COSSProtocolImConversation* COSSProtocolImConversation::NewL ( - MOSSProtocolConnectionManager& aConnMan ) - { - LOGGER ( TXT ( "COSSProtocolImConversation::NewL() Start" ) ); - - COSSProtocolImConversation* self = - new ( ELeave ) COSSProtocolImConversation ( aConnMan ); - CleanupStack::PushL ( self ); - self->ConstructL( ); - CleanupStack::Pop ( self ); - - LOGGER ( TXT ( "COSSProtocolImConversation::NewL() End" ) ); - return self; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolImConversation::~COSSProtocolImConversation() -// --------------------------------------------------------------------------- -// -COSSProtocolImConversation::~COSSProtocolImConversation() - { - LOGGER ( TXT ( "Groups::~COSSProtocolImConversation() Start" ) ); - - LOGGER ( TXT ( "Groups::~COSSProtocolImConversation() End" ) ); - } - - - -// --------------------------------------------------------------------------- -// COSSProtocolImConversation::DoSendMessageL() -// --------------------------------------------------------------------------- -// -void COSSProtocolImConversation::DoSendMessageL ( - const MImConversationInfo& aImMessage, - TXIMPRequestId aReqId ) - { - LOGGER ( TXT ( "Groups::DoSendMessageL() Start" ) ); - - - COSSSendMessageRequest* req = - COSSSendMessageRequest::NewLC ( iConnMan, aReqId ); - - req->SendMessageL ( aImMessage ); - - CleanupStack::Pop ( req ); - - LOGGER ( TXT ( "Groups::DoSendMessageL() End" ) ); - } - -// --------------------------------------------------------------------------- -// COSSProtocolImConversation::DoForwardMessageL() -// --------------------------------------------------------------------------- -// -void COSSProtocolImConversation::DoForwardMessageL ( - const MImConversationInfo& /*aImMessage*/, - TXIMPRequestId /*aReqId*/ ) - { - - } - -// --------------------------------------------------------------------------- -// COSSProtocolImConversation::DoSendMessageToGroupL() -// --------------------------------------------------------------------------- -// -void COSSProtocolImConversation::DoSendMessageToGroupL ( - const MImConversationInfo& /*aImMessage*/, - const TDesC* /*aGroupId*/, TXIMPRequestId /*aReqId*/ ) - { - - } - -// --------------------------------------------------------------------------- -// COSSProtocolImConversation::DoBlockUsersL() -// --------------------------------------------------------------------------- -// -TXIMPRequestId COSSProtocolImConversation::DoBlockUsersL ( - const MDesCArray* /*aUserIds*/, - TXIMPRequestId aReqId ) - { - //Not Supported - return aReqId; - } - -// --------------------------------------------------------------------------- -// COSSProtocolImConversation::DoUnBlockUsersL() -// --------------------------------------------------------------------------- -// -TXIMPRequestId COSSProtocolImConversation::DoUnBlockUsersL ( - const MDesCArray* /*aUserIds*/, - TXIMPRequestId aReqId ) - { - //Not Supported - return aReqId; - } - -// --------------------------------------------------------------------------- -// COSSProtocolImConversation::DoGetBlockedListRequestL() -// --------------------------------------------------------------------------- -// -void COSSProtocolImConversation::DoGetBlockedListRequestL ( - const MXIMPIdentity& /*aImMessageId*/, - TXIMPRequestId /*aReqId*/ ) - { - - } - -// --------------------------------------------------------------------------- -// COSSProtocolImConversation::DoGetMessageListL() -// --------------------------------------------------------------------------- -// -void COSSProtocolImConversation::DoGetMessageListL ( - const MXIMPIdentity& /*aImMessageId*/, - const TDesC* /*aGroupId*/, - const TInt /*aMessageCount*/, - TBool /*aDeliveryReportWanted*/, - TXIMPRequestId /*aReqId*/ ) - { - - } - -// --------------------------------------------------------------------------- -// COSSProtocolImConversation::DoRejectMessageL() -// --------------------------------------------------------------------------- -// -void COSSProtocolImConversation::DoRejectMessageL ( - const MXIMPIdentity& /*aImMessageId*/, - const TDesC& /*aMessageID*/, - TXIMPRequestId /*aReqId*/ ) - { - - } - -// --------------------------------------------------------------------------- -// COSSProtocolImConversation::CreateDataHandlerL() -// --------------------------------------------------------------------------- -// -void COSSProtocolImConversation::CreateDataHandlerL() - { - LOGGER ( TXT ( "COSSProtocolImConversation::CreateDataHandler() Start" ) ); - - iConnMan.ManufactureDataHandlerL(); - - LOGGER ( TXT ( "COSSProtocolImConversation::CreateDataHandler() End" ) ); - } - -// End of file - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/im/cosssendmessagerequest.cpp --- a/imservices/ossprotocoladaptation/src/im/cosssendmessagerequest.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,278 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Send message Request to the Network Server -* -*/ - -#include "cosssendmessagerequest.h" -#include -#include "cossprotocolconnectionmanager.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "ossprotocolpluginlogger.h" -#include "ossprotocloliterals.h" -#include -#include "stringutils.h" -#include -#include "msgliterals.h" -#include "msg_enums.h" -#include - -#include -#include -#include "ossprotocoladaptutils.h" - -/** -* operations state enums variables -*/ - -enum ImStates - { - RecipientOffline = 1, - SenderBlocked = 3, - NotSupported = 5, - - // add if required - }; -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// COSSSendMessageRequest::COSSSendMessageRequest() -// --------------------------------------------------------------------------- -// -COSSSendMessageRequest::COSSSendMessageRequest ( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) : - - CActive ( EPriorityNormal ), - iRequestId ( aRequestId ), - iConnMan ( aConnMan ) - { - LOGGER ( TXT ( "COSSSendMessageRequest::COSSSendMessageRequest Start" ) ); - CActiveScheduler::Add ( this ); - - LOGGER ( TXT ( "COSSSendMessageRequest::COSSSendMessageRequest End" ) ); - } - - -// --------------------------------------------------------------------------- -// COSSSendMessageRequest::ConstructL() -// --------------------------------------------------------------------------- -// -void COSSSendMessageRequest::ConstructL() - { - LOGGER ( TXT ( "COSSSendMessageRequest::ConstructL Start-End" ) ); - - - } - - -// --------------------------------------------------------------------------- -// COSSSendMessageRequest::NewL() -// --------------------------------------------------------------------------- -// -COSSSendMessageRequest* COSSSendMessageRequest::NewL ( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) - { - LOGGER ( TXT ( "COSSSendMessageRequest::NewL Start" ) ); - - COSSSendMessageRequest* self = new ( ELeave ) - COSSSendMessageRequest ( aConnMan, aRequestId ); - CleanupStack::PushL ( self ); - self->ConstructL(); - CleanupStack::Pop ( self ); - - LOGGER ( TXT ( "COSSSendMessageRequest::NewL End" ) ); - return self; - } - - -// --------------------------------------------------------------------------- -// COSSSendMessageRequest::NewLC() -// --------------------------------------------------------------------------- -// -COSSSendMessageRequest* COSSSendMessageRequest::NewLC ( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) - { - LOGGER ( TXT ( "COSSSendMessageRequest::NewLC Start" ) ); - - COSSSendMessageRequest* self = - COSSSendMessageRequest::NewL ( aConnMan, aRequestId ); - CleanupStack::PushL ( self ); - - LOGGER ( TXT ( "COSSSendMessageRequest::NewLC End" ) ); - return self; - } - -// --------------------------------------------------------------------------- -// COSSSendMessageRequest::~COSSSendMessageRequest() -// --------------------------------------------------------------------------- -// -COSSSendMessageRequest::~COSSSendMessageRequest() - { - LOGGER ( TXT ( "COSSSendMessageRequest::~COSSSendMessageRequest Start" ) ); - LOGGER ( TXT ( "COSSSendMessageRequest::~COSSSendMessageRequest End" ) ); - } - - -// --------------------------------------------------------------------------- -// COSSSendMessageRequest::DoCancel() -// --------------------------------------------------------------------------- -// -void COSSSendMessageRequest::DoCancel() - { - } - - -// --------------------------------------------------------------------------- -// COSSSendMessageRequest::RunL() -// --------------------------------------------------------------------------- -// -void COSSSendMessageRequest::RunL() - { - LOGGER ( TXT ( "COSSSendMessageRequest::RunL start" ) ); - message_hdr_resp* msg_struct = NULL; - User::LeaveIfError ( iStatus.Int() ); - char* pResponse = NULL; - pResponse = iConnMan.DataHandler().ResponseL ( iSendId ); - - msg_struct = ( message_hdr_resp* )pResponse ; - if( !( msg_struct->response ) ) - { - switch( msg_struct->error_type ) - { - - case RecipientOffline: //The username or password was invalid. - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KImApiErrRecipientNotLogged ); - break; - case SenderBlocked: //The username or password was invalid. - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KImApiErrSenderBlocked ); - break; - case NotSupported: //The username or password was invalid. - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KImErrServiceRequestTypeNotSupported ); - break; - default: //for all other error codes like ssl related are mapped to general error - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KImErrServiceGeneralError ); - break; - } - } - else - { - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KErrNone ); - } - - free( pResponse ); - - delete this; - - LOGGER ( TXT ( "COSSSendMessageRequest::RunL End" ) ); - } - - -// --------------------------------------------------------------------------- -// COSSSendMessageRequest::RunError() -// --------------------------------------------------------------------------- -// -TInt COSSSendMessageRequest::RunError ( TInt aError ) - { - LOGGER ( TXT ( "COSSSendMessageRequest::RunError Start" ) ); - - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, aError ); - - delete this; - LOGGER ( TXT ( "COSSSendMessageRequest::RunError End" ) ); - return KErrNone; - } - -// --------------------------------------------------------------------------- -// COSSSendMessageRequest::SendMessageL() -// --------------------------------------------------------------------------- -// -void COSSSendMessageRequest::SendMessageL ( const MImConversationInfo& aImMessage ) - { - LOGGER ( TXT ( "COSSSendMessageRequest::SendMessageL Start" ) ); - - TPtrC16 message = aImMessage.TextMessage(); - const MDesCArray& recipients = aImMessage.RecipientL(); - - int userLen = 0; - int totalLen = 0; - - message_hdr_req msgHdr = {0,}; - msgHdr.message_type = ESend_Request; - totalLen += sizeof ( message_hdr_req ); - - RArray recipientArray; - for ( TInt i = 0; i < recipients.MdcaCount(); i++ ) - { - TPtrC16 recipientsPtr = recipients.MdcaPoint( i ); - charFormatData recipient = OssProtocolAdapUtils::ConvertTUint16ToCharLC( recipientsPtr ); - recipientArray.AppendL( recipient );//will get it back when writting to final buffer. - userLen = recipient.dataSize; - totalLen += userLen; - } - totalLen++; - - charFormatData charData = OssProtocolAdapUtils::ConvertTUint16ToCharLC( message ); - char* msg = charData.data; - userLen = charData.dataSize; - totalLen += userLen; - - User::LeaveIfError ( totalLen > MAX_MSG_SIZE ); - - char* outMessage = ( char* ) User::AllocLC( totalLen ); - memset( outMessage , '\0' , totalLen ); - - userLen = 0; - totalLen = 0; - totalLen += sizeof ( message_hdr_req ); - - - memcpy( outMessage , &msgHdr , totalLen ); //copy header. - - //now copy recipients one by one. - TInt recipientCount = recipientArray.Count(); - for( TInt count = 0 ; count < recipientCount ; count++) - { - charFormatData receiver = recipientArray[count]; - userLen = receiver.dataSize; - memcpy( outMessage + totalLen , receiver.data , userLen ); - totalLen += userLen; - } - - totalLen++; - userLen = charData.dataSize; - memcpy ( outMessage + totalLen , msg , userLen ); - - totalLen += userLen; - iSendId = iConnMan.DataHandler().SendDataL ( iStatus, outMessage, totalLen ); - - // signal the scheduler - SetActive(); - CleanupStack::PopAndDestroy( recipientCount + 2 );//outMessage,msg, - recipientArray.Close(); - - LOGGER ( TXT ( "COSSSendMessageRequest::SendMessageL End" ) ); - } - -// End of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/im/creceivemessagehandler.cpp --- a/imservices/ossprotocoladaptation/src/im/creceivemessagehandler.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,250 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: implementation of receive message handler -* -*/ - - -#include -#include "creceivemessagehandler.h" -#include "mossprotocolconnectionmanager.h" -#include "ossprotocolpluginlogger.h" -#include "waittimer.h" -#include "cossprotocolconnectionmanager.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "ossprotocoladaptutils.h" - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CReceiveMessageHandler::CReceiveMessageHandler -// --------------------------------------------------------------------------- -// -CReceiveMessageHandler::CReceiveMessageHandler ( - MOSSProtocolConnectionManager& aConnMan ) : - - CActive ( EPriorityNormal ), - iConnMan ( aConnMan ) - { - LOGGER ( TXT ( "::CReceiveMessageHandler Start" ) ); - CActiveScheduler::Add ( this ); - - LOGGER ( TXT ( "::CReceiveMessageHandler End" ) ); - } - - -// --------------------------------------------------------------------------- -// CReceiveMessageHandler::ConstructL -// --------------------------------------------------------------------------- -// -void CReceiveMessageHandler::ConstructL() - { - LOGGER ( TXT ( "CReceiveMessageHandler::ConstructL Start-End" ) ); - - - } - - -// --------------------------------------------------------------------------- -// CReceiveMessageHandler::NewL -// --------------------------------------------------------------------------- -// -CReceiveMessageHandler* CReceiveMessageHandler::NewL ( - MOSSProtocolConnectionManager& aConnMan ) - { - LOGGER ( TXT ( "CReceiveMessageHandler::NewL Start" ) ); - - CReceiveMessageHandler* self = new ( ELeave ) - CReceiveMessageHandler ( aConnMan ); - CleanupStack::PushL ( self ); - self->ConstructL(); - CleanupStack::Pop ( self ); - - LOGGER ( TXT ( "CReceiveMessageHandler::NewL End" ) ); - return self; - } - - - -// --------------------------------------------------------------------------- -// CReceiveMessageHandler::~CReceiveMessageHandler -// --------------------------------------------------------------------------- -// -CReceiveMessageHandler::~CReceiveMessageHandler() - { - LOGGER ( TXT ( "::~CReceiveMessageHandler Start" ) ); - - Cancel(); - - LOGGER ( TXT ( "::~CReceiveMessageHandler End" ) ); - } - - -// --------------------------------------------------------------------------- -// CReceiveMessageHandler::DoCancel() -// --------------------------------------------------------------------------- -// -void CReceiveMessageHandler::DoCancel() - { - LOGGER ( TXT ( "CReceiveMessageHandler::DoCancel Start" ) ); - - iConnMan.DataHandler().CancelListeningMsg(); - - LOGGER ( TXT ( "CReceiveMessageHandler::DoCancel End" ) ); - } - -// --------------------------------------------------------------------------- -// CReceiveMessageHandler::RunL() -// --------------------------------------------------------------------------- -// -void CReceiveMessageHandler::RunL() - { - LOGGER ( TXT ( "CReceiveMessageHandler::RunL Start" ) ); - - // something is coming from the xmpp server - User::LeaveIfError ( iStatus.Int() ); - - TRAPD( error, ProcessIncomingDataL() ); - if ( error != KErrNone ) - { - Cancel(); - } - - // start listening again for next incoming message - StartListeningL(); - - LOGGER ( TXT ( "CReceiveMessageHandler::RunL End" ) ); - } - -// --------------------------------------------------------------------------- -// CReceiveMessageHandler::ProcessIncomingDataL() -// --------------------------------------------------------------------------- -// -void CReceiveMessageHandler::ProcessIncomingDataL() - { - LOGGER ( TXT ( "CReceiveMessageHandler::ProcessIncomingDataL Start" ) ); - - char* pResponse = iConnMan.DataHandler().ResponseL ( 1 ); - CleanupStack::PushL( pResponse ); - - //-----Response format-------- - //|------|------/0|-------/0| - //|header|sender/0|message/0| - - //parse sender. - char* sender = pResponse + sizeof( message_hdr_resp ); - HBufC16 *sendername = OssProtocolAdapUtils::ConvertCharToTUint16LC(sender); - - //parse message. - char* recvdmessage = pResponse + sizeof( message_hdr_resp ) + strlen(sender) + 1; - HBufC16 *message = OssProtocolAdapUtils::ConvertCharToTUint16LC(recvdmessage); - - MXIMPObjectFactory& objFact = iConnMan.HandleToHost().ObjectFactory(); - MImObjectFactory& imObjFact = iConnMan.GetImHost().ImObjectFactory(); - MXIMPIdentity* identity = objFact.NewIdentityLC(); - MImConversationInfo* convinfo = imObjFact.NewImConversationInfoLC(); - - identity->SetIdentityL ( *sendername ); - convinfo->SetMessageIdL ( identity ); - convinfo->SetTextMessageL ( *message ); //SetTextMessageL(const TDesC16& aMessage ) - iConnMan.GetImHost().ConversationDataHost().HandleNewTextMessageL ( convinfo ); - - CleanupStack::Pop( 2 ); //convinfo,identity - CleanupStack::PopAndDestroy( 3 ); //message,sendername,pResponse. - - LOGGER ( TXT ( "CReceiveMessageHandler::ProcessIncomingDataL End" ) ); - } - - -// --------------------------------------------------------------------------- -// CReceiveMessageHandler::RunError -// --------------------------------------------------------------------------- -// -TInt CReceiveMessageHandler::RunError ( TInt aError ) - { - LOGGER ( TXT ( "CReceiveMessageHandler::RunError Start %d" ), aError ); - - // restart listening incoming data - iConnMan.DataHandler().ListenIncomingMsg ( iStatus ); - SetActive(); - - LOGGER ( TXT ( "CReceiveMessageHandler::RunError End" ) ); - return KErrNone; - } - -// --------------------------------------------------------------------------- -// CReceiveMessageHandler::StartListeningL -// --------------------------------------------------------------------------- -// -void CReceiveMessageHandler::StartListeningL() - { - LOGGER ( TXT ( "CReceiveMessageHandler::StartListeningL Start" ) ); - - // Ready to receive notification from the server - TInt count = 0; - - // signal the scheduler - - if ( ! ( this->IsActive() ) ) - { - count = iConnMan.DataHandler().ListenIncomingMsg ( iStatus ); - SetActive(); - } - - for ( TInt x ( 0 ) ; x < count ; ++x ) - { - ProcessIncomingDataL(); - } - - LOGGER ( TXT ( "CReceiveMessageHandler::StartListeningL End" ) ); - } - - - -// End of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/ossprotocoladaptutils.cpp --- a/imservices/ossprotocoladaptation/src/ossprotocoladaptutils.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Utils for OSSProtocolAdaptation modules. -* -*/ - - -// INCLUDES -#include "ossprotocoladaptutils.h" -#include -#include -#include -#include "escapeutils.h" -#include "stringutils.h" - - -// --------------------------------------------------------------------------- -// OssProtocolAdapUtils::OssProtocolAdapUtils::ConvertCharToTUint16L -// --------------------------------------------------------------------------- -// -HBufC16* OssProtocolAdapUtils::ConvertCharToTUint16LC( const char *pcSrc ) - { - TUint8* scr = (TUint8*)pcSrc; - TPtrC8 ptr; - ptr.Set(scr); - HBufC16* buf = EscapeUtils::ConvertToUnicodeFromUtf8L(ptr); - CleanupStack::PushL(buf); - return buf; - } - - -// --------------------------------------------------------------------------- -// OssProtocolAdapUtils::OssProtocolAdapUtils::ConvertTUint16ToCharL -// --------------------------------------------------------------------------- -// -charFormatData OssProtocolAdapUtils::ConvertTUint16ToCharLC( const TDesC &aData ) - { - HBufC8 * data = EscapeUtils::ConvertFromUnicodeToUtf8L( aData ); - CleanupStack::PushL(data); - - TPtr8 ptr = data->Des(); - TInt length = ptr.Length(); - - //allocate new contiguous buffer as returned buffer may be fragmented. - HBufC8* newBuf = HBufC8::NewLC( length + 1 );//+1 space for '\0' - TPtr8 newBufPtr = newBuf->Des(); - newBufPtr.Copy(ptr); - - char* chPtrTemp = ( char* )newBufPtr.PtrZ(); - char* chPtr = (char*) User::AllocL( length + 1 ); - strcpy( chPtr , chPtrTemp ); - - CleanupStack::PopAndDestroy( 2 );//newBuf,data. - - charFormatData charData ; - charData.data = chPtr; - charData.dataSize = length + 1; //+1 space for '\0' - - CleanupStack::PushL(chPtr); - return charData; - } -// --------------------------------------------------------------------------- -// OssProtocolAdapUtils::ConvertTDesC8toChar -// --------------------------------------------------------------------------- -// -void OssProtocolAdapUtils::ConvertTDesC8toChar(const TDesC8& aSrc, char* aDes) -{ - char *temp = (char*)aSrc.Ptr(); - const TInt size = aSrc.Length(); - *(temp + size) = '\0'; - memcpy( aDes, temp, size ); -} - -// End of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/ossprotocolpluginlogger.cpp --- a/imservices/ossprotocoladaptation/src/ossprotocolpluginlogger.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Logger implementation -* -*/ - -// INCLUDE FILES - -#include -#include -#include - -#include "ossprotocolpluginlogger.h" - - -/** - * Handler used by logger to truncate the string - * rather than panic in case of buffer overflow. -*/ - -NONSHARABLE_CLASS ( TAdaptOverflowTruncate ) : public TDes16Overflow - { - -public: - void Overflow ( TDes16& /*aDes*/ ) {} - }; - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// TLogger::WriteLog() -// ----------------------------------------------------------------------------- -// -void TLogger::WriteLog ( TRefByValue aFmt, ... ) - { -#ifdef ENABLE_DEBUG_LOGS - ( void ) aFmt;//Suppress unused formal parameter warning - TBuf< KTAdaptMaxLogLineLength > buffer; - buffer.Append ( _L ( "[" ) ); // CSI: 78 # - buffer.Append ( RThread().Name() ); - buffer.Append ( _L ( "] " ) ); // CSI: 78 # - TAdaptOverflowTruncate overflow; - VA_LIST list; - VA_START ( list, aFmt ); - buffer.AppendFormatList ( aFmt, list, &overflow ); - RFileLogger logger; - - if ( logger.Connect() == KErrNone ) - { - logger.SetDateAndTime ( ETrue, ETrue ); - logger.CreateLog ( KTAdaptDebugOutputDir, KTAdaptDebugOutputFileName, - EFileLoggingModeAppend ); - logger.Write ( buffer ); - logger.CloseLog(); - logger.Close(); - } - -#endif - - } - - - - - - -// End of File - - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/presenceauthorization/cossprotocolpresenceauthorization.cpp --- a/imservices/ossprotocoladaptation/src/presenceauthorization/cossprotocolpresenceauthorization.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,393 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Oss Protocol implementation for Presence Framework -* -*/ - - -#include - -#include -#include -#include - -#include "cossprotocolpresenceauthorization.h" -#include "ossprotocolpluginlogger.h" -#include "cossprotocolconnectionmanager.h" - -#include "csubscribepresencegrantrequestlistrequest.h" -#include "ossprotocolpluginpanics.h" -#include "cpresenceauthuserrequest.h" -#include "cwithdrawpresencegrantfrompresentityrequest.h" - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CImpsConnection::GetInterface() -// --------------------------------------------------------------------------- -// -TAny* COssProtocolPresenceAuthorization::GetInterface( TInt32 aInterfaceId, - TIfGetOps aOptions ) - { - LOGGER ( TXT("COssProtocolPresenceAuthorization::GetInterface() Start") ); - if( aInterfaceId == MProtocolPresenceAuthorization::KInterfaceId ) - { - MProtocolPresenceAuthorization* self = this; - return self; - } - - if( aOptions == MXIMPBase::EPanicIfUnknown ) - { - User::Panic( KOSSProtocolPresenceAuthorization, KErrExtensionNotSupported ); - } - LOGGER ( TXT("COssProtocolPresenceAuthorization::GetInterface() End") ); - return NULL; - } - - -// --------------------------------------------------------------------------- -// CImpsConnection::GetInterface() -// --------------------------------------------------------------------------- -// -const TAny* COssProtocolPresenceAuthorization::GetInterface( TInt32 aInterfaceId, - TIfGetOps aOptions ) const - { - LOGGER ( TXT("COssProtocolPresenceAuthorization::GetInterface() Start") ); - if( aInterfaceId == MProtocolPresenceAuthorization::KInterfaceId ) - { - const MProtocolPresenceAuthorization* self = this; - return self; - } - - if( aOptions == MXIMPBase::EPanicIfUnknown ) - { - User::Panic( KOSSProtocolPresenceAuthorization, KErrExtensionNotSupported ); - } - LOGGER ( TXT("COssProtocolPresenceAuthorization::GetInterface() End") ); - return NULL; - } - - -// --------------------------------------------------------------------------- -// CImpsConnection::NewInstanceLC() -// --------------------------------------------------------------------------- -// -TInt32 COssProtocolPresenceAuthorization::GetInterfaceId() const - { - LOGGER ( TXT("COssProtocolPresenceAuthorization::GetInterfaceId() Start-End") ); - return MProtocolPresenceAuthorization::KInterfaceId; - } - - - -// --------------------------------------------------------------------------- -// COssProtocolPresenceAuthorization::COssProtocolPresenceAuthorization() -// --------------------------------------------------------------------------- -// -COssProtocolPresenceAuthorization::COssProtocolPresenceAuthorization( - MOSSProtocolConnectionManager& aConnMan) - :iConnMan(aConnMan) - { - LOGGER ( TXT("::COssProtocolPresenceAuthorization() Start-End") ); - } - - -// --------------------------------------------------------------------------- -// COssProtocolPresenceAuthorization::ConstructL() -// --------------------------------------------------------------------------- -// -void COssProtocolPresenceAuthorization::ConstructL() - { - LOGGER ( TXT("COssProtocolPresenceAuthorization::ConstructL() Start") ); - LOGGER ( TXT("COssProtocolPresenceAuthorization::ConstructL() End") ); - } - - -// --------------------------------------------------------------------------- -// COssProtocolPresenceAuthorization::NewL() -// --------------------------------------------------------------------------- -// -COssProtocolPresenceAuthorization* COssProtocolPresenceAuthorization::NewL( - MOSSProtocolConnectionManager& aConnMan ) - { - LOGGER ( TXT("COssProtocolPresenceAuthorization::NewL() Start") ); - - COssProtocolPresenceAuthorization* self = - new( ELeave ) COssProtocolPresenceAuthorization( aConnMan); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - LOGGER ( TXT("COssProtocolPresenceAuthorization::NewL() End") ); - return self; - } - - -// --------------------------------------------------------------------------- -// COssProtocolPresenceAuthorization::~COssProtocolPresenceAuthorization() -// --------------------------------------------------------------------------- -// -COssProtocolPresenceAuthorization::~COssProtocolPresenceAuthorization() - { - LOGGER ( TXT("Authorization::~COssProtocolPresenceAuthorization() Start") ); - - - LOGGER ( TXT("Authorization::~COssProtocolPresenceAuthorization() End") ); - } - - -// --------------------------------------------------------------------------- -// COssProtocolPresenceAuthorization::DoUnsubscribePresenceWatcherListL() -// --------------------------------------------------------------------------- -// -void COssProtocolPresenceAuthorization::DoSubscribePresenceGrantRequestListL( - TXIMPRequestId aReqId ) - { - LOGGER ( TXT("Authorization::DoSubscribePresenceGrantRequestListL() Start") ); - if( ! iConnMan.GetContactManager().IsFetchInvitationsForFirstTime() ) - { - iConnMan.GetContactManager().SetFetchInvitationsForFirstTime(ETrue); - CreateDataHandlerL(); - - iConnMan.GetAddNotificationHandler().StartListeningL(); - iConnMan.HandleToHost().HandleRequestCompleted( aReqId, KErrNone ); - } - else - { - iConnMan.GetContactManager().ReturnInvitationListL(); - iConnMan.HandleToHost().HandleRequestCompleted ( aReqId, KErrNone ); - } - - LOGGER ( TXT("Authorization::DoSubscribePresenceGrantRequestListL() End") ); - } - -// --------------------------------------------------------------------------- -// COssProtocolPresenceAuthorization::DoUnsubscribePresenceWatcherListL() -// --------------------------------------------------------------------------- -// -void COssProtocolPresenceAuthorization::DoUnsubscribePresenceGrantRequestListL( - TXIMPRequestId aReqId ) - { - LOGGER ( TXT("Authorization::DoUnsubscribePresenceGrantRequestListL() Start") ); - - // complete the request successfully - iConnMan.HandleToHost().HandleRequestCompleted( aReqId, KErrNone ); - - LOGGER ( TXT("Authorization::DoUnsubscribePresenceGrantRequestListL() End") ); - } - -// --------------------------------------------------------------------------- -// COssProtocolPresenceAuthorization::DoGrantPresenceForPresentityL() -// --------------------------------------------------------------------------- -// -void COssProtocolPresenceAuthorization::DoGrantPresenceForPresentityL( - const MXIMPIdentity& aIdentity, - const MPresenceInfoFilter& aPif, - TXIMPRequestId aReqId ) - { - LOGGER ( TXT("Authorization::DoGrantPresenceForPresentityL() Start") ); - CreateDataHandlerL(); - - CPresenceAuthUserRequest* req = - CPresenceAuthUserRequest::NewLC( iConnMan, aReqId ); - - - req->PresenceAuthUserRequestL(aIdentity,aPif); - - CleanupStack::Pop( req ); - LOGGER ( TXT("Authorization::DoGrantPresenceForPresentityL() End") ); - } - -// --------------------------------------------------------------------------- -// COssProtocolPresenceAuthorization::DoUpdateGrantPresenceForPresentityL() -// --------------------------------------------------------------------------- -// -void COssProtocolPresenceAuthorization::DoUpdatePresenceGrantPifForPresentityL( - const MXIMPIdentity&/*aIdentity*/, - const MPresenceInfoFilter &/*aPif*/, - TXIMPRequestId /*aReqId*/ ) - { - LOGGER ( TXT("Authorization::DoUpdatePresenceGrantPifForPresentityL() Start") ); - LOGGER ( TXT("Authorization::DoUpdatePresenceGrantPifForPresentityL() End") ); - } - -// --------------------------------------------------------------------------- -// COssProtocolPresenceAuthorization::DoUpdateGrantPresenceForPresentityGroupMembersL() -// --------------------------------------------------------------------------- -// -void COssProtocolPresenceAuthorization::DoWithdrawPresenceGrantFromPresentityL( - const MXIMPIdentity &aIdentity, - TXIMPRequestId aReqId ) - { - LOGGER ( TXT("Authorization::DoWithdrawPresenceGrantFromPresentityL() Start") ); - CreateDataHandlerL(); - - CWithdrawPresenceGrantFromPresentityRequest* req = - CWithdrawPresenceGrantFromPresentityRequest::NewLC( iConnMan, aReqId ); - - - req->WithdrawPresenceGrantFromPresentityL( aIdentity ); - - CleanupStack::Pop( req ); - - - LOGGER ( TXT("Authorization::DoWithdrawPresenceGrantFromPresentityL() End") ); - } - -// --------------------------------------------------------------------------- -// COssProtocolPresenceAuthorization::DoGrantPresenceForPresentityGroupMembersL() -// --------------------------------------------------------------------------- -// -void COssProtocolPresenceAuthorization::DoGrantPresenceForPresentityGroupMembersL( - const MXIMPIdentity&/*aIdentity*/, - const MPresenceInfoFilter& /*aPif*/, - TXIMPRequestId /*aReqId*/ ) - { - LOGGER ( TXT("Authorization::DoGrantPresenceForPresentityGroupMembersL() Start") ); - - LOGGER ( TXT("Authorization::DoGrantPresenceForPresentityGroupMembersL() End") ); - } - -// --------------------------------------------------------------------------- -// COssProtocolPresenceAuthorization::DoUpdateGrantPresenceForPresentityGroupMembersL() -// --------------------------------------------------------------------------- -// -void COssProtocolPresenceAuthorization::DoUpdatePresenceGrantPifForPresentityGroupMembersL( - const MXIMPIdentity&/*aIdentity*/, - const MPresenceInfoFilter&/*aPif*/, - TXIMPRequestId /*aReqId*/ ) - { - LOGGER ( TXT("DoUpdatePresenceGrantPifForPresentityGroupMembersL() Start") ); - - LOGGER ( TXT("DoUpdatePresenceGrantPifForPresentityGroupMembersL() End") ); - } - - -// --------------------------------------------------------------------------- -// COssProtocolPresenceAuthorization::DoUpdateGrantPresenceForPresentityGroupMembersL() -// --------------------------------------------------------------------------- -// -void COssProtocolPresenceAuthorization::DoWithdrawPresenceGrantFromPresentityGroupMembersL( - const MXIMPIdentity&/*aIdentity*/, - TXIMPRequestId /*aReqId*/ ) - { - LOGGER ( TXT("DoWithdrawPresenceGrantFromPresentityGroupMembersL() Start") ); - - LOGGER ( TXT("DoWithdrawPresenceGrantFromPresentityGroupMembersL() End") ); - } - -// --------------------------------------------------------------------------- -// COssProtocolPresenceAuthorization::DoGrantPresenceForEveryoneL() -// --------------------------------------------------------------------------- -// -void COssProtocolPresenceAuthorization::DoGrantPresenceForEveryoneL( - const MPresenceInfoFilter& /*aPif*/, - TXIMPRequestId /*aReqId*/ ) - { - LOGGER ( TXT("Authorization::DoGrantPresenceForEveryoneL() Start") ); - - LOGGER ( TXT("Authorization::DoGrantPresenceForEveryoneL() End") ); - } - -// --------------------------------------------------------------------------- -// COssProtocolPresenceAuthorization::DoUpdatePresenceGrantPifForEveryoneL() -// --------------------------------------------------------------------------- -// -void COssProtocolPresenceAuthorization::DoUpdatePresenceGrantPifForEveryoneL( - const MPresenceInfoFilter& /*aPif*/, - TXIMPRequestId /*aReqId*/ ) - { - LOGGER ( TXT("Authorization::DoUpdatePresenceGrantPifForEveryoneL() Start") ); - - LOGGER ( TXT("Authorization::DoUpdatePresenceGrantPifForEveryoneL() End") ); - } - -// --------------------------------------------------------------------------- -// COssProtocolPresenceAuthorization::DoWithdrawPresenceGrantFromEveryoneL() -// --------------------------------------------------------------------------- -// -void COssProtocolPresenceAuthorization::DoWithdrawPresenceGrantFromEveryoneL( - TXIMPRequestId /*aReqId*/ ) - { - LOGGER ( TXT("Authorization::DoWithdrawPresenceGrantFromEveryoneL() Start") ); - - LOGGER ( TXT("Authorization::DoWithdrawPresenceGrantFromEveryoneL() End") ); - } - -// --------------------------------------------------------------------------- -// COssProtocolPresenceAuthorization::DoSubscribePresenceBlockListL() -// --------------------------------------------------------------------------- -// -void COssProtocolPresenceAuthorization::DoSubscribePresenceBlockListL( - TXIMPRequestId /*aReqId*/ ) - { - LOGGER ( TXT("Authorization::DoSubscribePresenceBlockListL() Start") ); - - LOGGER ( TXT("Authorization::DoSubscribePresenceBlockListL() End") ); - } - - -// --------------------------------------------------------------------------- -// COssProtocolPresenceAuthorization::DoUnsubscribePresenceBlockListL() -// --------------------------------------------------------------------------- -// -void COssProtocolPresenceAuthorization::DoUnsubscribePresenceBlockListL( - TXIMPRequestId /*aReqId*/ ) - { - LOGGER ( TXT("Authorization::DoUnsubscribePresenceBlockListL() Start") ); - LOGGER ( TXT("Authorization::DoUnsubscribePresenceBlockListL() End") ); - } - - -// --------------------------------------------------------------------------- -// COssProtocolPresenceAuthorization::DoBlockPresenceForPresentityL() -// --------------------------------------------------------------------------- -// -void COssProtocolPresenceAuthorization::DoBlockPresenceForPresentityL( - const MXIMPIdentity& /*aPresentityId*/, - TXIMPRequestId /*aReqId*/ ) - { - LOGGER ( TXT("Authorization::DoBlockPresenceForPresentityL() Start") ); - - LOGGER ( TXT("Authorization::DoBlockPresenceForPresentityL() End") ); - } - -// --------------------------------------------------------------------------- -// COssProtocolPresenceAuthorization::DoCancelPresenceBlockFromPresentityL() -// --------------------------------------------------------------------------- -// -void COssProtocolPresenceAuthorization::DoCancelPresenceBlockFromPresentityL( - const MXIMPIdentity& /*aPresentityId*/, - TXIMPRequestId /*aReqId*/ ) - { - LOGGER ( TXT("Authorization::DoCancelPresenceBlockFromPresentityL() Start") ); - - LOGGER ( TXT("Authorization::DoCancelPresenceBlockFromPresentityL() End") ); - } - -// --------------------------------------------------------------------------- -// COssProtocolPresenceAuthorization::CreateDataHandlerL() -// --------------------------------------------------------------------------- -// -void COssProtocolPresenceAuthorization::CreateDataHandlerL() - { - LOGGER ( TXT("Authorization::CreateDataHandler() Start")); - iConnMan.ManufactureDataHandlerL(); - LOGGER ( TXT("Authorization::CreateDataHandler() End")); - } - - -// End of file - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/presenceauthorization/cpresenceauthuserrequest.cpp --- a/imservices/ossprotocoladaptation/src/presenceauthorization/cpresenceauthuserrequest.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,220 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Request for accepting add invite to the Network Server. -* -*/ - - -#include -#include "cpresenceauthuserrequest.h" -#include "mossprotocolconnectionmanager.h" -#include "ossprotocolpluginlogger.h" -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include "stringutils.h" -#include -#include -#include -#include -#include "msgliterals.h" -#include "msg_enums.h" -#include "waittimer.h" -#include -#include "ossprotocoladaptutils.h" - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CPresenceAuthUserRequest::CPresenceAuthUserRequest -// --------------------------------------------------------------------------- -// -CPresenceAuthUserRequest::CPresenceAuthUserRequest( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) : - CActive( EPriorityNormal ), - iRequestId( aRequestId ), - iConnMan( aConnMan ) - { - LOGGER ( TXT("::CPresenceAuthUserRequest Start") ); - CActiveScheduler::Add( this ); - LOGGER ( TXT("::CPresenceAuthUserRequest End") ); - } - - -// --------------------------------------------------------------------------- -// CPresenceAuthUserRequest::ConstructL -// --------------------------------------------------------------------------- -// -void CPresenceAuthUserRequest::ConstructL() - { - LOGGER ( TXT("CPresenceAuthUserRequest::ConstructL Start-End") ); - - } - - -// --------------------------------------------------------------------------- -// CPresenceAuthUserRequest::NewL -// --------------------------------------------------------------------------- -// -CPresenceAuthUserRequest* CPresenceAuthUserRequest::NewL( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) - { - LOGGER ( TXT("CPresenceAuthUserRequest::NewL Start") ); - - CPresenceAuthUserRequest* self = - new( ELeave ) CPresenceAuthUserRequest( aConnMan, aRequestId ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - LOGGER ( TXT("CPresenceAuthUserRequest::NewL End") ); - return self; - } - - -// --------------------------------------------------------------------------- -// CPresenceAuthUserRequest::NewLC -// --------------------------------------------------------------------------- -// -CPresenceAuthUserRequest* CPresenceAuthUserRequest::NewLC( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) - { - LOGGER ( TXT("CPresenceAuthUserRequest::NewLC Start") ); - - CPresenceAuthUserRequest* self = - CPresenceAuthUserRequest::NewL( aConnMan, aRequestId ); - CleanupStack::PushL( self ); - - LOGGER ( TXT("CPresenceAuthUserRequest::NewLC End") ); - return self; - } - -// --------------------------------------------------------------------------- -// CPresenceAuthUserRequest::~CPresenceAuthUserRequest -// --------------------------------------------------------------------------- -// -CPresenceAuthUserRequest::~CPresenceAuthUserRequest() - { - LOGGER ( TXT("CPresenceAuthUserRequest::~CPresenceAuthUserRequest Start") ); - - CActive::Cancel(); - LOGGER ( TXT("CPresenceAuthUserRequest::~CPresenceAuthUserRequest End") ); - } - - -// --------------------------------------------------------------------------- -// CPresenceAuthUserRequest::DoCancel() -// --------------------------------------------------------------------------- -// -void CPresenceAuthUserRequest::DoCancel() - { - LOGGER ( TXT("CPresenceAuthUserRequest::DoCancel Start") ); - } - - -// --------------------------------------------------------------------------- -// CPresenceAuthUserRequest::RunL() -// --------------------------------------------------------------------------- -// -void CPresenceAuthUserRequest::RunL() - { - LOGGER ( TXT("CPresenceAuthUserRequest::RunL Start") ); - - message_hdr_resp* msg_struct = NULL; - User::LeaveIfError( iStatus.Int() ); - char* pResponse = NULL; - pResponse = iConnMan.DataHandler().ResponseL( iSendId ); - - msg_struct = ( message_hdr_resp* )pResponse ; - - if( !( msg_struct->response ) ) - { - //for all other error codes like ssl related are mapped to general error - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KXIMPErrServiceGeneralError ); - } - else - { - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KErrNone ); - } - free(pResponse); - delete this; - LOGGER ( TXT("CPresenceAuthUserRequest::RunL End") ); - } - - -// --------------------------------------------------------------------------- -// CPresenceAuthUserRequest::RunError -// --------------------------------------------------------------------------- -// -TInt CPresenceAuthUserRequest::RunError( TInt aError ) - { - LOGGER ( TXT("CPresenceAuthUserRequest::RunError Start") ); - - iConnMan.HandleToHost().HandleRequestCompleted( iRequestId, aError ); - - delete this; - LOGGER ( TXT("CPresenceAuthUserRequest::RunError End") ); - return KErrNone; - } - -// --------------------------------------------------------------------------- -// CPresenceAuthUserRequest::PresenceAuthUserRequest -// --------------------------------------------------------------------------- -// -void CPresenceAuthUserRequest::PresenceAuthUserRequestL( - const MXIMPIdentity & aIdentity, - const MPresenceInfoFilter &/*aPif*/ ) - { - LOGGER ( TXT("CPresenceAuthUserRequest::PresenceAuthUserRequest Start") ); - - char *smsg = NULL; - int totalLen = 0; - - message_hdr_req msgHdr = {0,}; - msgHdr.message_type = EAccept_Contact_Request ; - TInt headerSize = sizeof( message_hdr_req ) ; - - charFormatData tmpmsgData = OssProtocolAdapUtils::ConvertTUint16ToCharLC( aIdentity.Identity() ); - char* tmpmsg = tmpmsgData.data; - TInt tmpmsgLength = tmpmsgData.dataSize; - totalLen = headerSize + tmpmsgLength; - - smsg = ( char* ) User::AllocLC(totalLen); - memcpy( smsg, &msgHdr, headerSize ); - memcpy ( smsg + headerSize, tmpmsg, tmpmsgLength ); - - iSendId = iConnMan.DataHandler().SendDataL ( iStatus, smsg, totalLen ); - - // signal the scheduler - SetActive(); - - CleanupStack::PopAndDestroy ( 2 ); //smsg, tmpmsg. - LOGGER ( TXT("CPresenceAuthUserRequest::PresenceAuthUserRequest End") ); - } - - -// End of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/presenceauthorization/csubscribepresencegrantrequestlistrequest.cpp --- a/imservices/ossprotocoladaptation/src/presenceauthorization/csubscribepresencegrantrequestlistrequest.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,180 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: subscribe to grant presence request list -* -*/ - - -#include -#include "csubscribepresencegrantrequestlistrequest.h" -#include "mossprotocolconnectionmanager.h" -#include "ossprotocolpluginlogger.h" -#include - -#include "cossprotocolconnectionmanager.h" - -#include -#include -#include -#include -#include -#include -#include - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CSubscribePresenceGrantRequestListRequest::CSubscribePresenceGrantRequestListRequest -// --------------------------------------------------------------------------- -// -CSubscribePresenceGrantRequestListRequest::CSubscribePresenceGrantRequestListRequest( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) : - CActive( EPriorityNormal ), - iRequestId( aRequestId ), - iConnMan( aConnMan ) - { - LOGGER ( TXT("::CSubscribePresenceGrantRequestListRequest Start") ); - CActiveScheduler::Add( this ); - LOGGER ( TXT("::CSubscribePresenceGrantRequestListRequest End") ); - } - - -// --------------------------------------------------------------------------- -// CSubscribePresenceGrantRequestListRequest::ConstructL -// --------------------------------------------------------------------------- -// -void CSubscribePresenceGrantRequestListRequest::ConstructL() - { - LOGGER ( TXT("::ConstructL Start") ); - LOGGER ( TXT("::ConstructL End") ); - } - - -// --------------------------------------------------------------------------- -// CSubscribePresenceGrantRequestListRequest::NewL -// --------------------------------------------------------------------------- -// -CSubscribePresenceGrantRequestListRequest* CSubscribePresenceGrantRequestListRequest::NewL( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) - { - LOGGER ( TXT("CSubscribePresenceGrantRequestListRequest::NewL Start") ); - - CSubscribePresenceGrantRequestListRequest* self = new( ELeave ) - CSubscribePresenceGrantRequestListRequest( aConnMan, aRequestId ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - LOGGER ( TXT("CSubscribePresenceGrantRequestListRequest::NewL End") ); - return self; - } - - -// --------------------------------------------------------------------------- -// CSubscribePresenceGrantRequestListRequest::NewLC -// --------------------------------------------------------------------------- -// -CSubscribePresenceGrantRequestListRequest* CSubscribePresenceGrantRequestListRequest::NewLC( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) - { - LOGGER ( TXT("CSubscribePresenceGrantRequestListRequest::NewLC Start") ); - - CSubscribePresenceGrantRequestListRequest* self = - CSubscribePresenceGrantRequestListRequest::NewL( aConnMan, aRequestId ); - CleanupStack::PushL( self ); - - LOGGER ( TXT("CSubscribePresenceGrantRequestListRequest::NewLC End") ); - return self; - } - -// --------------------------------------------------------------------------- -// CSubscribePresenceGrantRequestListRequest::~CSubscribePresenceGrantRequestListRequest -// --------------------------------------------------------------------------- -// -CSubscribePresenceGrantRequestListRequest::~CSubscribePresenceGrantRequestListRequest() - { - LOGGER ( TXT("::~CSubscribePresenceGrantRequestListRequest Start") ); - - CActive::Cancel(); - - LOGGER ( TXT("::~CSubscribePresenceGrantRequestListRequest End") ); - } - - -// --------------------------------------------------------------------------- -// CSubscribePresenceGrantRequestListRequest::DoCancel() -// --------------------------------------------------------------------------- -// -void CSubscribePresenceGrantRequestListRequest::DoCancel() - { - LOGGER ( TXT("CSubscribePresenceGrantRequestListRequest::DoCancel Start") ); - iConnMan.DataHandler().CancelListeningAddNotication(); - LOGGER ( TXT("CSubscribePresenceGrantRequestListRequest::DoCancel End") ); - } - - -// --------------------------------------------------------------------------- -// CSubscribePresenceGrantRequestListRequest::RunL() -// --------------------------------------------------------------------------- -// -void CSubscribePresenceGrantRequestListRequest::RunL() - { - LOGGER ( TXT("CSubscribePresenceGrantRequestListRequest::RunL Start") ); - - User::LeaveIfError( iStatus.Int() ); - - iConnMan.HandleToHost().HandleRequestCompleted( iRequestId, KErrNone); - - delete this; - LOGGER ( TXT("CSubscribePresenceGrantRequestListRequest::RunL End") ); - } - - -// --------------------------------------------------------------------------- -// CSubscribePresenceGrantRequestListRequest::RunError -// --------------------------------------------------------------------------- -// -TInt CSubscribePresenceGrantRequestListRequest::RunError( TInt aError ) - { - LOGGER ( TXT("CSubscribePresenceGrantRequestListRequest::RunError Start") ); - - iConnMan.HandleToHost().HandleRequestCompleted( iRequestId, aError ); - - delete this; - LOGGER ( TXT("CSubscribePresenceGrantRequestListRequest::RunError End") ); - return KErrNone; - } - -// --------------------------------------------------------------------------- -// CSubscribePresenceGrantRequestListRequest::SubscribePresenceGrantRequestListL -// --------------------------------------------------------------------------- -// -void CSubscribePresenceGrantRequestListRequest::SubscribePresenceGrantRequestListL() - { - LOGGER ( TXT("::SubscribePresenceGrantRequestListL Start") ); - // signal the scheduler - SetActive(); - - //by default adaptation 1.2 is ready for receiving presence authorisation requests from the server.no need to subscribe for it - TRequestStatus *status = &iStatus; - User::RequestComplete( status, KErrNone); - - LOGGER ( TXT("::SubscribePresenceGrantRequestListL End") ); - } - -// End of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/presenceauthorization/cwithdrawpresencegrantfrompresentityrequest.cpp --- a/imservices/ossprotocoladaptation/src/presenceauthorization/cwithdrawpresencegrantfrompresentityrequest.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,234 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Request for Rejecting add invite to the Network Server. -* -*/ - - -#include -#include "cwithdrawpresencegrantfrompresentityrequest.h" -#include "mossprotocolconnectionmanager.h" -#include "ossprotocolpluginlogger.h" -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include "stringutils.h" -#include -#include -#include -#include -#include "msgliterals.h" -#include "msg_enums.h" -#include "waittimer.h" -#include -#include "ossprotocoladaptutils.h" - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CWithdrawPresenceGrantFromPresentityRequest::CWithdrawPresenceGrantFromPresentityRequest -// --------------------------------------------------------------------------- -// -CWithdrawPresenceGrantFromPresentityRequest::CWithdrawPresenceGrantFromPresentityRequest( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) : - CActive( EPriorityNormal ), - iRequestId( aRequestId ), - iConnMan( aConnMan ) - { - LOGGER ( TXT("::CWithdrawPresenceGrantFromPresentityRequest Start") ); - CActiveScheduler::Add( this ); - LOGGER ( TXT("::CWithdrawPresenceGrantFromPresentityRequest End") ); - } - - -// --------------------------------------------------------------------------- -// CWithdrawPresenceGrantFromPresentityRequest::ConstructL -// --------------------------------------------------------------------------- -// -void CWithdrawPresenceGrantFromPresentityRequest::ConstructL() - { - LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::ConstructL Start-End") ); - - } - - -// --------------------------------------------------------------------------- -// CWithdrawPresenceGrantFromPresentityRequest::NewL -// --------------------------------------------------------------------------- -// -CWithdrawPresenceGrantFromPresentityRequest* CWithdrawPresenceGrantFromPresentityRequest::NewL( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) - { - LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::NewL Start") ); - - CWithdrawPresenceGrantFromPresentityRequest* self = - new( ELeave ) CWithdrawPresenceGrantFromPresentityRequest( aConnMan, aRequestId ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::NewL End") ); - return self; - } - - -// --------------------------------------------------------------------------- -// CWithdrawPresenceGrantFromPresentityRequest::NewLC -// --------------------------------------------------------------------------- -// -CWithdrawPresenceGrantFromPresentityRequest* CWithdrawPresenceGrantFromPresentityRequest::NewLC( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) - { - LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::NewLC Start") ); - - CWithdrawPresenceGrantFromPresentityRequest* self = - CWithdrawPresenceGrantFromPresentityRequest::NewL( aConnMan, aRequestId ); - CleanupStack::PushL( self ); - - LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::NewLC End") ); - return self; - } - -// --------------------------------------------------------------------------- -// CWithdrawPresenceGrantFromPresentityRequest::~CWithdrawPresenceGrantFromPresentityRequest -// --------------------------------------------------------------------------- -// -CWithdrawPresenceGrantFromPresentityRequest::~CWithdrawPresenceGrantFromPresentityRequest() - { - LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::~CWithdrawPresenceGrantFromPresentityRequest Start") ); - CActive::Cancel(); - LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::~CWithdrawPresenceGrantFromPresentityRequest End") ); - } - - -// --------------------------------------------------------------------------- -// CWithdrawPresenceGrantFromPresentityRequest::DoCancel() -// --------------------------------------------------------------------------- -// -void CWithdrawPresenceGrantFromPresentityRequest::DoCancel() - { - LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::DoCancel Start") ); - - // iConnMan.DataHandler().CancelSending( iSendId ); - - LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::DoCancel End") ); - } - - -// --------------------------------------------------------------------------- -// CWithdrawPresenceGrantFromPresentityRequest::RunL() -// --------------------------------------------------------------------------- -// -void CWithdrawPresenceGrantFromPresentityRequest::RunL() - { - LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::RunL Start") ); - - message_hdr_resp* msg_struct = NULL; - char* pResponse = NULL; - TInt error_code(KErrNone); - User::LeaveIfError( iStatus.Int() ); - - pResponse = iConnMan.DataHandler().ResponseL( iSendId ); - - msg_struct = ( message_hdr_resp* )pResponse ; - error_code = msg_struct->error_type; - if( !( msg_struct->response ) ) - { - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, error_code ); - } - else - { - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KErrNone ); - } - - free( pResponse ); - delete this; - LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::RunL End") ); - } - - -// --------------------------------------------------------------------------- -// CWithdrawPresenceGrantFromPresentityRequest::RunError -// --------------------------------------------------------------------------- -// -TInt CWithdrawPresenceGrantFromPresentityRequest::RunError( TInt aError ) - { - LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::RunError Start") ); - - iConnMan.HandleToHost().HandleRequestCompleted( iRequestId, aError ); - - delete this; - LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::RunError End") ); - return KErrNone; - } - -// --------------------------------------------------------------------------- -// CWithdrawPresenceGrantFromPresentityRequest::WithdrawPresenceGrantFromPresentityL -// --------------------------------------------------------------------------- -// -void CWithdrawPresenceGrantFromPresentityRequest::WithdrawPresenceGrantFromPresentityL( - const MXIMPIdentity& aIdentity) - { - LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::WithdrawPresenceGrantFromPresentity Start") ); - char *smsg = NULL; - char *tmpmsg = NULL; - int userLen = 0; - int totalLen = 0; - - message_hdr_req msgHdr = {0,}; - msgHdr.message_type = EReject_Contact_Request ; - - TInt headerLength = sizeof( message_hdr_req ); - totalLen += headerLength; - // adding add contact - charFormatData tmpmsgData = OssProtocolAdapUtils::ConvertTUint16ToCharLC( aIdentity.Identity() ); - tmpmsg = tmpmsgData.data; - userLen = tmpmsgData.dataSize; - totalLen += userLen; - - if ( totalLen > MAX_MSG_SIZE ) - { - User::Leave(KErrArgument); - } - - smsg = ( char* ) User::AllocLC(totalLen); - memcpy( smsg, &msgHdr, headerLength ); - memcpy ( smsg + headerLength, tmpmsg, userLen ); - - iSendId = iConnMan.DataHandler().SendDataL ( iStatus, smsg, totalLen ); - - // signal the scheduler - SetActive(); - - CleanupStack::PopAndDestroy ( 2 );//smsg, tmpmsg. - - LOGGER ( TXT("CWithdrawPresenceGrantFromPresentityRequest::WithdrawPresenceGrantFromPresentity End") ); - } - - - -// End of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/presencepublishing/cossprotocolpresencepublishing.cpp --- a/imservices/ossprotocoladaptation/src/presencepublishing/cossprotocolpresencepublishing.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,266 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: IMPS Protocol Publishing implementation for Presence Framework -* -*/ - - -#include - -#include -#include -#include - -#include "cossprotocolpresencepublishing.h" -#include "ossprotocolpluginlogger.h" -#include "cossprotocolconnectionmanager.h" -//#include "csubscribeownpresencerequest.h" -#include "cpresencenotificationhandler.h" -//#include "cunsubscribeownpresencerequest.h" -#include "cpublishownpresencerequest.h" -//#include "csubscribepresencewatcherlistrequest.h" -//#include "cupdateownpresencesubscriptionpifrequest.h" - -#include "ossprotocolpluginpanics.h" - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// COssProtocolPresencePublishing::GetInterface() -// --------------------------------------------------------------------------- -// -TAny* COssProtocolPresencePublishing::GetInterface( - TInt32 aInterfaceId, - TIfGetOps aOptions ) - { - LOGGER ( TXT("CImpsProtocolPresentityGroups::GetInterface() Start") ); - - - if( aInterfaceId == MProtocolPresencePublishing::KInterfaceId ) - { - MProtocolPresencePublishing* self = this; - return self; - } - - if( aOptions == MXIMPBase::EPanicIfUnknown ) - { - User::Panic( KOSSProtocolPresencePublishing, KErrExtensionNotSupported ); - } - - LOGGER ( TXT("COssProtocolPresencePublishing::GetInterface() End") ); - return NULL; - } - - -// --------------------------------------------------------------------------- -// COssProtocolPresencePublishing::GetInterface() -// --------------------------------------------------------------------------- -// -const TAny* COssProtocolPresencePublishing::GetInterface( - TInt32 aInterfaceId, - TIfGetOps aOptions ) const - { - LOGGER ( TXT("CImpsProtocolPresentityGroups::GetInterface() Start") ); - - if( aInterfaceId == MProtocolPresencePublishing::KInterfaceId ) - { - const MProtocolPresencePublishing* self = this; - return self; - } - - if( aOptions == MXIMPBase::EPanicIfUnknown ) - { - User::Panic( KOSSProtocolPresencePublishing, KErrExtensionNotSupported ); - } - - LOGGER ( TXT("COssProtocolPresencePublishing::GetInterface() End") ); - return NULL; - } - - -// --------------------------------------------------------------------------- -// COssProtocolPresencePublishing::NewInstanceLC() -// --------------------------------------------------------------------------- -// -TInt32 COssProtocolPresencePublishing::GetInterfaceId() const - { - LOGGER ( TXT("COssProtocolPresencePublishing::GetInterfaceId() Start-End") ); - return MProtocolPresencePublishing::KInterfaceId; - } - -// --------------------------------------------------------------------------- -// COssProtocolPresencePublishing::COssProtocolPresencePublishing() -// --------------------------------------------------------------------------- -// -COssProtocolPresencePublishing::COssProtocolPresencePublishing( - MOSSProtocolConnectionManager& aConnMan) -:iConnMan(aConnMan) - { - LOGGER ( TXT("Publishing::COssProtocolPresencePublishing() Start") ); - LOGGER ( TXT("Publishing::COssProtocolPresencePublishing() End") ); - } - - -// --------------------------------------------------------------------------- -// COssProtocolPresencePublishing::ConstructL() -// --------------------------------------------------------------------------- -// -void COssProtocolPresencePublishing::ConstructL() - { - LOGGER ( TXT("COssProtocolPresencePublishing::ConstructL() Start") ); - - //iNotificationHandler = CPresenceNotificationHandler::NewL( iConnMan ); - - - LOGGER ( TXT("COssProtocolPresencePublishing::ConstructL() End") ); - } - - -// --------------------------------------------------------------------------- -// COssProtocolPresencePublishing::NewL() -// --------------------------------------------------------------------------- -// -COssProtocolPresencePublishing* COssProtocolPresencePublishing::NewL( - MOSSProtocolConnectionManager& aConnMan ) - - { - LOGGER ( TXT("COssProtocolPresencePublishing::NewL() Start") ); - - COssProtocolPresencePublishing* self = - new( ELeave ) COssProtocolPresencePublishing(aConnMan); - CleanupStack::PushL( self ); - self->ConstructL( ); - CleanupStack::Pop( self ); - - LOGGER ( TXT("COssProtocolPresencePublishing::NewL() End") ); - return self; - } - - -// --------------------------------------------------------------------------- -// COssProtocolPresencePublishing::~COssProtocolPresencePublishing() -// --------------------------------------------------------------------------- -// -COssProtocolPresencePublishing::~COssProtocolPresencePublishing() - { - LOGGER ( TXT("Publishing::~COssProtocolPresencePublishing() Start") ); - - //delete iNotificationHandler; - - LOGGER ( TXT("Publishing::~COssProtocolPresencePublishing() End") ); - } - - -// --------------------------------------------------------------------------- -// COssProtocolPresencePublishing::DoSubscribeOwnPresenceL() -// --------------------------------------------------------------------------- -// -void COssProtocolPresencePublishing::DoSubscribeOwnPresenceL( - const MPresenceInfoFilter& /*aPif*/, - TXIMPRequestId /*aReqId*/ ) - { - LOGGER ( TXT("Publishing::DoSubscribeOwnPresenceL() Start") ); - - LOGGER ( TXT("Publishing::DoSubscribeOwnPresenceL() End") ); - } - - - -// --------------------------------------------------------------------------- -// COssProtocolPresencePublishing::DoUnsubscribeOwnPresenceL() -// --------------------------------------------------------------------------- -// -void COssProtocolPresencePublishing::DoUnsubscribeOwnPresenceL( - TXIMPRequestId /*aReqId*/ ) - { - LOGGER ( TXT("Publishing::DoUnsubscribeOwnPresenceL() Start") ); - - LOGGER ( TXT("Publishing::DoUnsubscribeOwnPresenceL() End") ); - } - - - -// --------------------------------------------------------------------------- -// COssProtocolPresencePublishing::DoUpdateOwnPresenceSubscriptionL() -// --------------------------------------------------------------------------- -// -void COssProtocolPresencePublishing::DoUpdateOwnPresenceSubscriptionPifL( - const MPresenceInfoFilter& /*aPif*/, - TXIMPRequestId /*aReqId*/ ) - { - LOGGER ( TXT("Publishing::DoUpdateOwnPresenceSubscriptionPifL() Start") ); - - - LOGGER ( TXT("Publishing::DoUpdateOwnPresenceSubscriptionPifL() End") ); - } - - - -// --------------------------------------------------------------------------- -// COssProtocolPresencePublishing::DoPublishOwnPresenceL() -// --------------------------------------------------------------------------- -// -void COssProtocolPresencePublishing::DoPublishOwnPresenceL( - const MPresenceInfo& aPresence, - TXIMPRequestId aReqId ) - { - LOGGER ( TXT("Publishing::DoPublishOwnPresenceL() Start") ); - - - - CPublishOwnPresencerequest* req = - CPublishOwnPresencerequest::NewLC( iConnMan, aReqId ); - - - req->PublishOwnPresenceL(aPresence); - - CleanupStack::Pop( req ); - - LOGGER ( TXT("Publishing::DoPublishOwnPresenceL() End") ); - } - -// --------------------------------------------------------------------------- -// COssProtocolPresencePublishing::DoSubscribePresenceWatcherListL() -// --------------------------------------------------------------------------- -// -void COssProtocolPresencePublishing::DoSubscribePresenceWatcherListL( - TXIMPRequestId /*aReqId*/ ) - { - LOGGER ( TXT("Publishing::DoSubscribePresenceWatcherListL() Start") ); - - - - LOGGER ( TXT("Publishing::DoSubscribePresenceWatcherListL() End") ); - } - - -// --------------------------------------------------------------------------- -// COssProtocolPresencePublishing::DoUnsubscribePresenceWatcherListL() -// --------------------------------------------------------------------------- -// -void COssProtocolPresencePublishing::DoUnsubscribePresenceWatcherListL( - TXIMPRequestId /*aReqId*/ ) - { - LOGGER ( TXT("Publishing::DoUnsubscribePresenceWatcherListL() Start") ); - - - LOGGER ( TXT("Publishing::DoUnsubscribePresenceWatcherListL() End") ); - } - - - - -// End of file - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/presencepublishing/cpresencenotificationhandler.cpp --- a/imservices/ossprotocoladaptation/src/presencepublishing/cpresencenotificationhandler.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,293 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation for handling presence notification - * -*/ - - -#include -#include "cpresencenotificationhandler.h" -#include "mossprotocolconnectionmanager.h" -#include "ossprotocolpluginlogger.h" -#include "waittimer.h" -#include "cossprotocolconnectionmanager.h" - -#include -#include -#include -#include -#include -#include "msgliterals.h" - -#include "ossprotocoladaptationuids.h" -#include "ossprotocoladaptutils.h" - -#include - - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CPresenceNotificationHandler::CPresenceNotificationHandler -// --------------------------------------------------------------------------- -// -CPresenceNotificationHandler::CPresenceNotificationHandler ( - MOSSProtocolConnectionManager& aConnMan ) : - CActive ( EPriorityNormal ), - iConnMan ( aConnMan ) - { - LOGGER ( TXT ( "CPresenceNotificationHandler::CPresenceNotificationHandler Start" ) ); - CActiveScheduler::Add ( this ); - LOGGER ( TXT ( "CPresenceNotificationHandler::CPresenceNotificationHandler End" ) ); - } - - -// --------------------------------------------------------------------------- -// CPresenceNotificationHandler::ConstructL -// --------------------------------------------------------------------------- -// -void CPresenceNotificationHandler::ConstructL() - { - LOGGER ( TXT ( "CPresenceNotificationHandler::ConstructL Start-End" ) ); - iPresenceCacheWriter = MPresenceCacheWriter2::CreateWriterL(); - - } - - -// --------------------------------------------------------------------------- -// CPresenceNotificationHandler::NewL -// --------------------------------------------------------------------------- -// -CPresenceNotificationHandler* CPresenceNotificationHandler::NewL ( - MOSSProtocolConnectionManager& aConnMan ) - { - LOGGER ( TXT ( "CPresenceNotificationHandler::NewL Start" ) ); - - CPresenceNotificationHandler* self = new ( ELeave ) CPresenceNotificationHandler ( aConnMan ); - CleanupStack::PushL ( self ); - self->ConstructL(); - CleanupStack::Pop ( self ); - - LOGGER ( TXT ( "CPresenceNotificationHandler::NewL End" ) ); - return self; - } - - -// --------------------------------------------------------------------------- -// CPresenceNotificationHandler::NewLC -// --------------------------------------------------------------------------- -// -CPresenceNotificationHandler* CPresenceNotificationHandler::NewLC ( - MOSSProtocolConnectionManager& aConnMan ) - { - LOGGER ( TXT ( "CPresenceNotificationHandler::NewLC Start" ) ); - - CPresenceNotificationHandler* self = CPresenceNotificationHandler::NewL ( aConnMan ); - CleanupStack::PushL ( self ); - - LOGGER ( TXT ( "CPresenceNotificationHandler::NewLC End" ) ); - return self; - } - -// --------------------------------------------------------------------------- -// CPresenceNotificationHandler::~CPresenceNotificationHandler -// --------------------------------------------------------------------------- -// -CPresenceNotificationHandler::~CPresenceNotificationHandler() - { - LOGGER ( TXT ( "::~CPresenceNotificationHandler Start" ) ); - - Cancel(); - // - if ( iPresenceCacheWriter ) - { - iPresenceCacheWriter->DeleteService( iConnMan.ServiceName() ); - delete iPresenceCacheWriter ; - } - LOGGER ( TXT ( "::~CPresenceNotificationHandler End" ) ); - } - -// --------------------------------------------------------------------------- -// CPresenceNotificationHandler::DoCancel() -// --------------------------------------------------------------------------- -// -void CPresenceNotificationHandler::DoCancel() - { - LOGGER ( TXT ( "CPresenceNotificationHandler::DoCancel Start" ) ); - - iConnMan.DataHandler().CancelListeningPres(); - - LOGGER ( TXT ( "CPresenceNotificationHandler::DoCancel End" ) ); - } - -// --------------------------------------------------------------------------- -// CPresenceNotificationHandler::RunL() -// --------------------------------------------------------------------------- -// -void CPresenceNotificationHandler::RunL() - { - LOGGER ( TXT ( "CPresenceNotificationHandler::RunL Start" ) ); - - // something is coming from the xmpp server - User::LeaveIfError ( iStatus.Int() ); - ProcessIncomingDataL(); - StartListeningL(); - - LOGGER ( TXT ( "CPresenceNotificationHandler::RunL End" ) ); - } - -// --------------------------------------------------------------------------- -// CPresenceNotificationHandler::ProcessIncomingDataL() -// --------------------------------------------------------------------------- -/* This Function is used to convert the received - * presence notification from Isolation Server Message queue - * into the ximpfw data types. and storing the presence information - * in to the presence cache ( available in ximpfw ) - * client has to read the presence information from the - * presence cache. when the change in status notification is received - * while updating presence cache, client will receive the notification if subscribed. - */ -void CPresenceNotificationHandler::ProcessIncomingDataL() - { - LOGGER ( TXT ( "CPresenceNotificationHandler::ProcessIncomingDataL Start" ) ); - - char* pResponse = NULL, *pOrigResponse = NULL; - pOrigResponse = pResponse = iConnMan.DataHandler().ResponseL ( 2 );// 2 is to differentiate presence notification from server initiated request - CleanupStack::PushL(pOrigResponse) ; - MPresenceBuddyInfo2* buddyPresInfo = MPresenceBuddyInfo2::NewLC(); - - // pResponse contians "ContactId/0AvailabilityStatus/0StatusMessage". - pResponse += sizeof ( message_hdr_resp ); // Skipping Message Header - - ///////// Geting Contact-id from message queue - char* contactid = pResponse; // contactid - HBufC16 *contactName = OssProtocolAdapUtils::ConvertCharToTUint16LC( contactid ); - HBufC* name = HBufC::NewLC( contactName->Length() + iConnMan.ServiceName().Length() + KColon().Length() ); - TPtr namePtr( name->Des() ); - namePtr.Zero(); - namePtr.Append(iConnMan.ServiceName() ); // prepend service name - namePtr.Append(KColon); - namePtr.Append(contactName->Des() ); - buddyPresInfo->SetIdentityL(namePtr); - LOGGER ( TXT ( "CPresenceNotificationHandler::ProcessIncomingDataL :ContactName:%S " ), contactName ); - CleanupStack::PopAndDestroy();//name - CleanupStack::PopAndDestroy();//contactName - - ///////// End Getting Contact-id - - int toklength = strlen(pResponse) + 1 ; // finding length of contactid + '/0' - pResponse += toklength; // skipping the contactid - - ///////// Getting availibility text - char* availability = pResponse; // availability text - HBufC16 *message = OssProtocolAdapUtils::ConvertCharToTUint16LC( availability ); - switch (*(pResponse)) - { - case 'd': //compares the first char of "dnd" - { - buddyPresInfo->SetAvailabilityL( MPresenceBuddyInfo2::EBusy,KDndState); - break; - } - case 'b': - { - buddyPresInfo->SetAvailabilityL( MPresenceBuddyInfo2::EBusy,*message); - break; - } - case 'o': //compares the first char of "offline" - { - buddyPresInfo->SetAvailabilityL( MPresenceBuddyInfo2::ENotAvailable,*message); - break; - } - case 'a': ////compares the first char of "away" and "available" - { - if ('v' == *(pResponse + 1)) - { - buddyPresInfo->SetAvailabilityL( MPresenceBuddyInfo2::EAvailable,*message); - } - else - { - // EAway - is not available in presence cache - buddyPresInfo->SetAvailabilityL( MPresenceBuddyInfo2::EBusy,*message); - } - break; - } - case 'x': - { - buddyPresInfo->SetAvailabilityL( MPresenceBuddyInfo2::EBusy,KAwayState ); - break; - } - case 'h': - { - buddyPresInfo->SetAvailabilityL( MPresenceBuddyInfo2::EUnknownAvailability,KInvisibleState ); - break; - } - default: - buddyPresInfo->SetAvailabilityL( MPresenceBuddyInfo2::EUnknownAvailability,*message); - break; - } - CleanupStack::PopAndDestroy( message ); - ///////// End getting availability message - - toklength = strlen(pResponse) + 1; // finding length of availability text + '/0' - pResponse += toklength; // skipping availability text - - ///////// Getting status message if exists - if(toklength >1) - { - char* statustext = pResponse; - HBufC16 *statusmessage = OssProtocolAdapUtils::ConvertCharToTUint16LC( statustext ); - buddyPresInfo->SetStatusMessageL(*statusmessage); - CleanupStack::PopAndDestroy( statusmessage ); - } - ///////// End Getting status message - - // Writing into Presence Cache - TInt cacheerror = iPresenceCacheWriter->WritePresenceL(buddyPresInfo); - User::LeaveIfError ( cacheerror); - // End - CleanupStack::PopAndDestroy ( 1 ); //buddyPresInfo - CleanupStack::PopAndDestroy(pOrigResponse) ;//pOrigResponse - LOGGER ( TXT ( "CPresenceNotificationHandler::ProcessIncomingDataL End" ) ); - } - - -// --------------------------------------------------------------------------- -// CPresenceNotificationHandler::RunError -// --------------------------------------------------------------------------- -// -TInt CPresenceNotificationHandler::RunError ( TInt aError ) - { - LOGGER ( TXT ( "CPresenceNotificationHandler::RunError Start %d" ), aError ); - - LOGGER ( TXT ( "CPresenceNotificationHandler::RunError End" ) ); - return KErrNone; - } - -// --------------------------------------------------------------------------- -// CPresenceNotificationHandler::StartListeningL -// --------------------------------------------------------------------------- -// -void CPresenceNotificationHandler::StartListeningL() - { - LOGGER ( TXT ( "CPresenceNotificationHandler::StartListeningL Start" ) ); - - if ( ! ( this->IsActive() ) ) - { - iConnMan.DataHandler().ListenIncomingPresence ( iStatus ); - SetActive(); - } - LOGGER ( TXT ( "CPresenceNotificationHandler::StartListeningL End" ) ); - } - -// End of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/presencepublishing/cpublishownpresencerequest.cpp --- a/imservices/ossprotocoladaptation/src/presencepublishing/cpublishownpresencerequest.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,488 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: IMplementaion for publising own presence -* -*/ - - -#include -#include "cpublishownpresencerequest.h" -#include "mossprotocolconnectionmanager.h" -#include "ossprotocolpluginlogger.h" -#include "waittimer.h" - -#include "cossprotocolconnectionmanager.h" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include "stringutils.h" -#include -#include "msgliterals.h" -#include "msg_enums.h" -#include "xmppparameters.h" -#include "waittimer.h" -#include -#include "ossprotocoladaptutils.h" -#include - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CPublishOwnPresencerequest::CPublishOwnPresencerequest -// --------------------------------------------------------------------------- -// -CPublishOwnPresencerequest::CPublishOwnPresencerequest( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) : - CActive( EPriorityNormal ), - iRequestId( aRequestId ), - iConnMan( aConnMan ) - { - LOGGER ( TXT("::CPublishOwnPresencerequest Start") ); - CActiveScheduler::Add( this ); - - LOGGER ( TXT("::CPublishOwnPresencerequest End") ); - } - - -// --------------------------------------------------------------------------- -// CPublishOwnPresencerequest::ConstructL -// --------------------------------------------------------------------------- -// -void CPublishOwnPresencerequest::ConstructL() - { - LOGGER ( TXT("CPublishOwnPresencerequest::ConstructL Start-End") ); - - - } - - -// --------------------------------------------------------------------------- -// CPublishOwnPresencerequest::NewL -// --------------------------------------------------------------------------- -// -CPublishOwnPresencerequest* CPublishOwnPresencerequest::NewL( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) - { - LOGGER ( TXT("CPublishOwnPresencerequest::NewL Start") ); - - CPublishOwnPresencerequest* self = new( ELeave ) - CPublishOwnPresencerequest( aConnMan, aRequestId ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - LOGGER ( TXT("CPublishOwnPresencerequest::NewL End") ); - return self; - } - - -// --------------------------------------------------------------------------- -// CPublishOwnPresencerequest::NewLC -// --------------------------------------------------------------------------- -// -CPublishOwnPresencerequest* CPublishOwnPresencerequest::NewLC( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) - { - LOGGER ( TXT("CPublishOwnPresencerequest::NewLC Start") ); - - CPublishOwnPresencerequest* self = - CPublishOwnPresencerequest::NewL(aConnMan, aRequestId); - CleanupStack::PushL( self ); - - LOGGER ( TXT("CPublishOwnPresencerequest::NewLC End") ); - return self; - } - -// --------------------------------------------------------------------------- -// CPublishOwnPresencerequest::~CPublishOwnPresencerequest -// --------------------------------------------------------------------------- -// -CPublishOwnPresencerequest::~CPublishOwnPresencerequest() - { - LOGGER ( TXT("::~CPublishOwnPresencerequest Start") ); - - CActive::Cancel(); - - delete iOwnPresenceInfo; - iOwnPresenceInfo = NULL; - LOGGER ( TXT("::~CPublishOwnPresencerequest End") ); - } - - -// --------------------------------------------------------------------------- -// CPublishOwnPresencerequest::DoCancel() -// --------------------------------------------------------------------------- -// -void CPublishOwnPresencerequest::DoCancel() - { - LOGGER ( TXT("CPublishOwnPresencerequest::DoCancel Start") ); - - // iConnMan.DataHandler().CancelSending( iSendId ); - - LOGGER ( TXT("CPublishOwnPresencerequest::DoCancel End") ); - } - - -// --------------------------------------------------------------------------- -// CPublishOwnPresencerequest::RunL() -// --------------------------------------------------------------------------- -// -void CPublishOwnPresencerequest::RunL() - { - LOGGER ( TXT("CPublishOwnPresencerequest::RunL Start") ); - message_hdr_resp* msg_struct = NULL; - User::LeaveIfError ( iStatus.Int() ); - char* pResponse = NULL; - pResponse = iConnMan.DataHandler().ResponseL ( iSendId ); - - msg_struct = ( message_hdr_resp* )pResponse ; - if( !( msg_struct->response ) ) - { - switch( msg_struct->error_type ) - { - - default: //for all other error codes like ssl related are mapped to general error - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KXIMPErrServiceGeneralError ); - break; - } - } - else - { - if( iOwnPresenceInfo ) - { - // set or clear avatar - MPresenceCacheWriter2* presenceCacheWriter = MPresenceCacheWriter2::CreateWriterL(); - TInt cacheerror = presenceCacheWriter->WritePresenceL( iOwnPresenceInfo ); - User::LeaveIfError ( cacheerror); - delete iOwnPresenceInfo ; - iOwnPresenceInfo = NULL; - delete presenceCacheWriter; - } - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KErrNone ); - } - - free( pResponse ); - - delete this; - - LOGGER ( TXT("CPublishOwnPresencerequest::RunL End") ); - } - - -// --------------------------------------------------------------------------- -// CPublishOwnPresencerequest::RunError -// --------------------------------------------------------------------------- -// -TInt CPublishOwnPresencerequest::RunError( TInt aError ) - { - LOGGER ( TXT("CPublishOwnPresencerequest::RunError Start") ); - - iConnMan.HandleToHost().HandleRequestCompleted( iRequestId, aError ); - - delete this; - LOGGER ( TXT("CPublishOwnPresencerequest::RunError End") ); - return KErrNone; - } - -// --------------------------------------------------------------------------- -// CPublishOwnPresencerequest::PublishOwnPresenceL -// --------------------------------------------------------------------------- -// -void CPublishOwnPresencerequest::PublishOwnPresenceL(const MPresenceInfo& aPresence) - { - LOGGER ( TXT("CPublishOwnPresencerequest::PublishOwnPresenceL Start") ); - char *smsg = NULL; - char *tmpmsg = NULL; - message_hdr_req msgHdr = {0,}; - - int err = 0; - int userLen = 0; - int totalLen = 0; - const MPersonPresenceInfo* personPresence = aPresence.PersonPresence(); - const MPresenceInfoFieldCollection& presenceFields = personPresence->Fields(); - const MPresenceInfoField& presenceField = presenceFields.FieldAt( 0 ); - //updating own avtar - if( !(presenceField.FieldType().Compare( NPresenceInfo::NFieldType::KAvatar )) ) - { - int messagelength = 0; - const MPresenceInfoFieldValueBinary* avtarfield = - TXIMPGetInterface< const MPresenceInfoFieldValueBinary >::From( - presenceField.FieldValue(), - MXIMPBase::EPanicIfUnknown ); - if( !(avtarfield->MimeType().Length() )) //clear avatar - { - // now manufacture the message for the clear avtar - msgHdr.message_type = EClearOwnAvatar; - messagelength = sizeof( message_hdr_req ); - smsg = ( char* ) User::AllocLC ( messagelength ); - memset ( smsg, '\0', messagelength ); - memcpy( smsg, &msgHdr, messagelength );//copies message header - iSendId = iConnMan.DataHandler().SendDataL ( iStatus, smsg, messagelength ); - SetActive();// signal the scheduler - CleanupStack::PopAndDestroy ( 1 ); //smsg - } - else //set or update avatar - { - // now manufacture the message for the avtar - msgHdr.message_type = EUpdateOwnAvtar; - messagelength = sizeof( message_hdr_req ) + avtarfield->MimeType().Length() + avtarfield->BinaryValue().Length()+2; // 2 for '\0' 's - smsg = ( char* ) User::AllocLC ( messagelength ); - tmpmsg = ( char* ) User::AllocLC ( messagelength ); - memset ( smsg, '\0', messagelength ); - memset ( tmpmsg, '\0', messagelength ); - if( messagelength > (MAX_MSG_SIZE - totalLen) ) - msgHdr.continue_flag = 1; - memcpy( smsg, &msgHdr, sizeof( message_hdr_req ) );//copies message header - totalLen += sizeof( message_hdr_req ); - OssProtocolAdapUtils::ConvertTDesC8toChar( avtarfield->MimeType(),tmpmsg); - userLen = avtarfield->MimeType().Length(); - memcpy( smsg + totalLen, tmpmsg, userLen );//copies mimetype - totalLen += userLen + 1; // for '\0' - memset ( tmpmsg, '\0', messagelength ); - OssProtocolAdapUtils::ConvertTDesC8toChar( avtarfield->BinaryValue(),tmpmsg); - userLen = avtarfield->BinaryValue().Length(); - memcpy( smsg + totalLen, tmpmsg, userLen );//copies avtar - totalLen += userLen + 1; - iSendId = iConnMan.DataHandler().SendDataL ( iStatus, smsg, totalLen ); - SetActive();// signal the scheduler - CleanupStack::PopAndDestroy ( 2 ); //tmpmsg,smsg - } - iOwnPresenceInfo = MPresenceBuddyInfo2::NewL(); - if( iOwnPresenceInfo ) - { - TPtrC ownUserPtr = iConnMan.UserName(); - HBufC* xspId = NULL; - if( ownUserPtr.Length() ) - { - xspId = HBufC::NewLC( ownUserPtr.Length() + iConnMan.ServiceName().Length() + KColon().Length() ); - TPtr xspIdPtr( xspId->Des() ); - xspIdPtr.Zero(); - xspIdPtr.Append(iConnMan.ServiceName() ); // prepend service name - xspIdPtr.Append(KColon); - xspIdPtr.Append( ownUserPtr ); - iOwnPresenceInfo->SetIdentityL(xspIdPtr); - CleanupStack::PopAndDestroy(xspId); //xspId - } - else - { - TPtrC xmppOwnId = iConnMan.XmppParams().UserName(); - xspId = HBufC::NewLC( xmppOwnId.Length() + iConnMan.ServiceName().Length() + KColon().Length() ); - TPtr xspIdPtr( xspId->Des() ); - xspIdPtr.Zero(); - xspIdPtr.Append(iConnMan.ServiceName() ); // prepend service name - xspIdPtr.Append(KColon); - xspIdPtr.Append( xmppOwnId ); - iOwnPresenceInfo->SetIdentityL(xspIdPtr); - CleanupStack::PopAndDestroy(xspId); //xspId - } - iOwnPresenceInfo->SetAvatarL( avtarfield->BinaryValue() ); - - TInt fieldCount = presenceFields.FieldCount(); - for( TInt i = 1; i < fieldCount; i++ ) // zero index is for avatar - { - const MPresenceInfoField& presenceField = presenceFields.FieldAt( i ); - TBuf8<32> temp = presenceField.FieldType(); - if( !( presenceField.FieldType().Compare( NPresenceInfo::NFieldType::KAvailabilityEnum )) ) - { - const MPresenceInfoFieldValueEnum* availability = - TXIMPGetInterface< const MPresenceInfoFieldValueEnum >::From( - presenceField.FieldValue(), - MXIMPBase::EPanicIfUnknown ); - MPresenceBuddyInfo2::TAvailabilityValues availabe = MPresenceBuddyInfo2::EUnknownAvailability; - switch (availability->Value()) - { - case NPresenceInfo::EAvailable : - { - availabe = MPresenceBuddyInfo2::EAvailable; - iOwnPresenceInfo->SetAvailabilityL( availabe ,KNullDesC ); - break; - } - - case NPresenceInfo::EBusy : - { - availabe = MPresenceBuddyInfo2::EBusy; - iOwnPresenceInfo->SetAvailabilityL( availabe ,KNullDesC ); - break; - } - - case NPresenceInfo::EHidden : - { - availabe = MPresenceBuddyInfo2::EAvailable; - iOwnPresenceInfo->SetAvailabilityL( availabe ,KNullDesC ); - break; - } - - case NPresenceInfo::EDoNotDisturb: - { - availabe = MPresenceBuddyInfo2::EBusy; - iOwnPresenceInfo->SetAvailabilityL( availabe,KDndState); - break; - } - - case NPresenceInfo::EAway: - { - availabe = MPresenceBuddyInfo2::EBusy; - iOwnPresenceInfo->SetAvailabilityL( availabe,KAwayState); - break; - } - - case NPresenceInfo::ENotAvailable: - { - availabe = MPresenceBuddyInfo2::ENotAvailable; - iOwnPresenceInfo->SetAvailabilityL( availabe ,KNullDesC ); - break; - } - - default: - break; - } - } - else if( !(presenceField.FieldType().Compare( NPresenceInfo::NFieldType::KStatusMessage )) ) - { - const MPresenceInfoFieldValueText* statustext = - TXIMPGetInterface< const MPresenceInfoFieldValueText >::From( - presenceField.FieldValue(), - MXIMPBase::EPanicIfUnknown ); - // now manufacture the message for the status text - if( statustext && statustext->TextValue().Length() ) - { - iOwnPresenceInfo->SetStatusMessageL( statustext->TextValue() ); - } - - } - } - - } - } - else //for update presence - { - TInt fieldCount = presenceFields.FieldCount(); - char* availablty = ( char* ) User::AllocLC ( MAX_MSG_SIZE ); - smsg = ( char* ) User::AllocLC ( MAX_MSG_SIZE ); - tmpmsg = ( char* ) User::AllocLC ( MAX_MSG_SIZE ); - msgHdr.message_type = EUpdateOwnPresence; - memset ( smsg, '\0', MAX_MSG_SIZE ); - memset ( tmpmsg, '\0', MAX_MSG_SIZE ); - memset ( availablty, '\0', MAX_MSG_SIZE ); - memcpy( smsg, &msgHdr, sizeof( message_hdr_req ) ); - totalLen += sizeof( message_hdr_req ); - // updating availability - const MPersonPresenceInfo* personPresence = aPresence.PersonPresence(); - const MPresenceInfoFieldCollection& presenceFields = personPresence->Fields(); - //TInt fieldCount = presenceFields.FieldCount(); - for( TInt i = 0; i < fieldCount; i++ ) - { - const MPresenceInfoField& presenceField = presenceFields.FieldAt( i ); - TBuf8<32> temp = presenceField.FieldType(); - LOGGER ( TXT( "ExtractPersonPresenceAttributes:%S "),&presenceField.FieldType()); - - if( !( presenceField.FieldType().Compare( NPresenceInfo::NFieldType::KAvailabilityEnum )) ) - { - const MPresenceInfoFieldValueEnum* availability = - TXIMPGetInterface< const MPresenceInfoFieldValueEnum >::From( - presenceField.FieldValue(), - MXIMPBase::EPanicIfUnknown ); - if ( availability->Value() == NPresenceInfo::EAvailable ) - { - char* temp = "avaliable"; - strcpy(availablty,temp); - userLen = strlen( availablty ); - memcpy( smsg + totalLen, availablty, userLen ); - totalLen += userLen + 1; - } - else if ( availability->Value() == NPresenceInfo::EBusy ) - { - char* temp = "dnd"; - strcpy(availablty,temp); - userLen = strlen( availablty ); - memcpy( smsg + totalLen, availablty, userLen ); - totalLen += userLen + 1; - } - else if(availability->Value() == NPresenceInfo::EAway) - { - char* temp = "away"; - strcpy(availablty,temp); - userLen = strlen( availablty ); - memcpy( smsg + totalLen, availablty, userLen ); - totalLen += userLen + 1; - } - else if(availability->Value() == NPresenceInfo::EHidden) - { - char* temp = "hidden"; - strcpy(availablty,temp); - userLen = strlen( availablty ); - memcpy( smsg + totalLen, availablty, userLen ); - totalLen += userLen + 1; - } - else if(availability->Value() == NPresenceInfo::ENotAvailable) - { - char* temp = "offline"; - strcpy(availablty,temp); - userLen = strlen( availablty ); - memcpy( smsg + totalLen, availablty, userLen ); - totalLen += userLen + 1; - } - - } - //updating status text - - if( !(presenceField.FieldType().Compare( NPresenceInfo::NFieldType::KStatusMessage )) ) - { - const MPresenceInfoFieldValueText* statustext = - TXIMPGetInterface< const MPresenceInfoFieldValueText >::From( - presenceField.FieldValue(), - MXIMPBase::EPanicIfUnknown ); - // now manufacture the message for the status text - if( statustext && statustext->TextValue().Length() ) - { - TPtrC bufferPtr ( statustext->TextValue() ); - err = tbufC16tochar ( bufferPtr, tmpmsg ); - if( KErrNotFound == err) - { - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, err ); - } - userLen = strlen ( tmpmsg ) + 1; //for '\0' - } - memcpy( smsg + totalLen, tmpmsg, userLen ); - totalLen += userLen + 1; - } - } - iSendId = iConnMan.DataHandler().SendDataL ( iStatus, smsg, totalLen ); - SetActive();// signal the scheduler - CleanupStack::PopAndDestroy ( 3 ); //tmpmsg,smsg,availability - } - LOGGER ( TXT("CPublishOwnPresencerequest::PublishOwnPresenceL End") ); - } - - -// End of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/presentitygroups/caddcontactnotificationhandler.cpp --- a/imservices/ossprotocoladaptation/src/presentitygroups/caddcontactnotificationhandler.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,256 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Add notification handler -* -*/ - - -#include -#include "caddcontactenotificationhandler.h" - -#include "mossprotocolconnectionmanager.h" -#include "ossprotocolpluginlogger.h" -#include "waittimer.h" -#include "cossprotocolconnectionmanager.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "msgliterals.h" - -#include "ossprotocoladaptationuids.h" -#include "ossprotocoladaptutils.h" - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CAddContactNotificationHandler::CAddContactNotificationHandler -// --------------------------------------------------------------------------- -// -CAddContactNotificationHandler::CAddContactNotificationHandler ( - MOSSProtocolConnectionManager& aConnMan ) : - CActive ( EPriorityNormal ), - iConnMan ( aConnMan ) - { - LOGGER ( TXT ( "CAddContactNotificationHandler::CAddContactNotificationHandler Start" ) ); - CActiveScheduler::Add ( this ); - - LOGGER ( TXT ( "CAddContactNotificationHandler::CAddContactNotificationHandler End" ) ); - } - - -// --------------------------------------------------------------------------- -// CAddContactNotificationHandler::ConstructL -// --------------------------------------------------------------------------- -// -void CAddContactNotificationHandler::ConstructL() - { - LOGGER ( TXT ( "CAddContactNotificationHandler::ConstructL Start-End" ) ); - - } - - -// --------------------------------------------------------------------------- -// CAddContactNotificationHandler::NewL -// --------------------------------------------------------------------------- -// -CAddContactNotificationHandler* CAddContactNotificationHandler::NewL ( - MOSSProtocolConnectionManager& aConnMan ) - { - LOGGER ( TXT ( "CAddContactNotificationHandler::NewL Start" ) ); - - CAddContactNotificationHandler* self = new ( ELeave ) CAddContactNotificationHandler ( aConnMan ); - CleanupStack::PushL ( self ); - self->ConstructL(); - CleanupStack::Pop ( self ); - - LOGGER ( TXT ( "CAddContactNotificationHandler::NewL End" ) ); - return self; - } - - -// --------------------------------------------------------------------------- -// CAddContactNotificationHandler::NewLC -// --------------------------------------------------------------------------- -// -CAddContactNotificationHandler* CAddContactNotificationHandler::NewLC ( - MOSSProtocolConnectionManager& aConnMan ) - { - LOGGER ( TXT ( "CAddContactNotificationHandler::NewLC Start" ) ); - - CAddContactNotificationHandler* self = CAddContactNotificationHandler::NewL ( aConnMan ); - CleanupStack::PushL ( self ); - - LOGGER ( TXT ( "CAddContactNotificationHandler::NewLC End" ) ); - return self; - } - -// --------------------------------------------------------------------------- -// CAddContactNotificationHandler::~CAddContactNotificationHandler -// --------------------------------------------------------------------------- -// -CAddContactNotificationHandler::~CAddContactNotificationHandler() - { - LOGGER ( TXT ( "::~CAddContactNotificationHandler Start" ) ); - - Cancel(); - - LOGGER ( TXT ( "::~CAddContactNotificationHandler End" ) ); - } - - -// --------------------------------------------------------------------------- -// CAddContactNotificationHandler::DoCancel() -// --------------------------------------------------------------------------- -// -void CAddContactNotificationHandler::DoCancel() - { - LOGGER ( TXT ( "CAddContactNotificationHandler::DoCancel Start" ) ); - - iConnMan.DataHandler().CancelListeningAddNotication(); - - LOGGER ( TXT ( "CAddContactNotificationHandler::DoCancel End" ) ); - } - -// --------------------------------------------------------------------------- -// CAddContactNotificationHandler::RunL() -// --------------------------------------------------------------------------- -// -void CAddContactNotificationHandler::RunL() - { - LOGGER ( TXT ( "CAddContactNotificationHandler::RunL Start" ) ); - - // something is coming from the xmpp server - User::LeaveIfError ( iStatus.Int() ); - - ProcessIncomingDataL(); - StartListeningL(); - - LOGGER ( TXT ( "CAddContactNotificationHandler::RunL End" ) ); - } - -// --------------------------------------------------------------------------- -// CAddContactNotificationHandler::ProcessIncomingDataL() -// --------------------------------------------------------------------------- -/* This Function is used to convert the received -* presence notification from Isolation Server Message queue -* into the ximpfw data types. and storing the presence information -* in to the presence cache ( available in ximpfw ) -* client has to read the presence information from the -* presence cache. when the change in status notification is received -* while updating presence cache, client will receive the notification if subscribed. -*/ -void CAddContactNotificationHandler::ProcessIncomingDataL() - { - LOGGER ( TXT ( "CAddContactNotificationHandler::ProcessIncomingDataL Start" ) ); - char* pResponse = NULL, *pOrigResponse = NULL; - TInt len = 0; - pOrigResponse = pResponse = iConnMan.DataHandler().ResponseL ( 4 ); - CleanupStack::PushL(pOrigResponse) ; - RPointerArray& invitations = iConnMan.GetContactManager().GetInvitationListL(); - if( pResponse ) - { - pResponse += sizeof ( message_hdr_resp ); - while(1) - { - len = strlen(pResponse) + 1; - if (1 == len) - { - break; - } - HBufC16* AuthreqId = OssProtocolAdapUtils::ConvertCharToTUint16LC( pResponse ); - pResponse += len; - TInt len1 = AuthreqId->Length(); - MXIMPObjectFactory& ObjFact = iConnMan.HandleToHost().ObjectFactory(); - MPresenceObjectFactory& prfwObjFact = iConnMan.HandleToHost().ProtocolPresenceDataHost().PresenceObjectFactory(); - - invitations.AppendL( AuthreqId ); - MPresenceGrantRequestInfo* presenceGrant; - presenceGrant = prfwObjFact.NewPresenceGrantRequestInfoLC();//1 - MXIMPIdentity* AuthReqIdentity; - AuthReqIdentity = ObjFact.NewIdentityLC();//2 - AuthReqIdentity->SetIdentityL(*AuthreqId); - AuthreqId->Des().Fold(); - presenceGrant->SetRequestorIdL(AuthReqIdentity); - iConnMan.HandleToHost().ProtocolPresenceDataHost().AuthorizationDataHost().HandlePresenceGrantRequestReceivedL (presenceGrant); - TInt count = iConnMan.PresenceAuthGrantReqList()->Count(); - iConnMan.PresenceAuthGrantReqList()->Append(*AuthreqId); - count = iConnMan.PresenceAuthGrantReqList()->Count(); - CleanupStack::Pop(2); //AuthReqIdentity,presenceGrant - CleanupStack::Pop ( 1 );//AuthreqId - } - } - CleanupStack::PopAndDestroy ( 1 );//pOrigResponse - LOGGER ( TXT ( "CAddContactNotificationHandler::ProcessIncomingDataL End" ) ); - } - - -// --------------------------------------------------------------------------- -// CAddContactNotificationHandler::RunError -// --------------------------------------------------------------------------- -// -TInt CAddContactNotificationHandler::RunError ( TInt aError ) - { - LOGGER ( TXT ( "CAddContactNotificationHandler::RunError Start %d" ), aError ); - - LOGGER ( TXT ( "CAddContactNotificationHandler::RunError End" ) ); - return KErrNone; - } - -// --------------------------------------------------------------------------- -// CAddContactNotificationHandler::StartListeningL -// --------------------------------------------------------------------------- -// -void CAddContactNotificationHandler::StartListeningL() - { - LOGGER ( TXT ( "CAddContactNotificationHandler::StartListeningL Start" ) ); - - if ( ! ( this->IsActive() ) ) - { - iConnMan.DataHandler().ListenAddNotification ( iStatus ); - SetActive(); - } - LOGGER ( TXT ( "CAddContactNotificationHandler::StartListeningL End" ) ); - } - -// End of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/presentitygroups/caddpresentitygroupmemberrequest.cpp --- a/imservices/ossprotocoladaptation/src/presentitygroups/caddpresentitygroupmemberrequest.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,259 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Add Presentity Group Member Request to the Network Server. -* -*/ - - -#include -#include "caddpresentitygroupmemberrequest.h" -#include "cossprotocolconnectionmanager.h" -#include "ossprotocolpluginlogger.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include "stringutils.h" -#include -#include -#include -#include -#include "msgliterals.h" -#include "msg_enums.h" -#include "ossprotocoladaptutils.h" -#include - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CAddPresentityGroupMemberRequest::CAddPresentityGroupMemberRequest -// --------------------------------------------------------------------------- -// -CAddPresentityGroupMemberRequest::CAddPresentityGroupMemberRequest( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) : - CActive( EPriorityNormal ), - iRequestId( aRequestId ), - iConnMan( aConnMan ) - { - LOGGER ( TXT("::CAddPresentityGroupMemberRequest Start") ); - CActiveScheduler::Add( this ); - - LOGGER ( TXT("::CAddPresentityGroupMemberRequest End") ); - } - - -// --------------------------------------------------------------------------- -// CAddPresentityGroupMemberRequest::ConstructL -// --------------------------------------------------------------------------- -// -void CAddPresentityGroupMemberRequest::ConstructL() - { - - LOGGER ( TXT("CAddPresentityGroupMemberRequest::ConstructL Start-End") ); - iContactId = NULL; - } - - - - - -// --------------------------------------------------------------------------- -// CAddPresentityGroupMemberRequest::NewLC -// --------------------------------------------------------------------------- -// -CAddPresentityGroupMemberRequest* CAddPresentityGroupMemberRequest::NewLC( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) - { - LOGGER ( TXT("CAddPresentityGroupMemberRequest::NewLC Start") ); - - CAddPresentityGroupMemberRequest* self = new( ELeave ) - CAddPresentityGroupMemberRequest( aConnMan, aRequestId ); - CleanupStack::PushL( self ); - self->ConstructL(); - - LOGGER ( TXT("CAddPresentityGroupMemberRequest::NewLC End") ); - return self; - } - -// --------------------------------------------------------------------------- -// CAddPresentityGroupMemberRequest::~CAddPresentityGroupMemberRequest -// --------------------------------------------------------------------------- -// -CAddPresentityGroupMemberRequest::~CAddPresentityGroupMemberRequest() - { - LOGGER ( TXT("::~CAddPresentityGroupMemberRequest Start") ); - - CActive::Cancel(); - if(iContactId) - { - delete iContactId; - } - LOGGER ( TXT("::~CAddPresentityGroupMemberRequest End") ); - } - - -// --------------------------------------------------------------------------- -// CAddPresentityGroupMemberRequest::DoCancel() -// --------------------------------------------------------------------------- -// -void CAddPresentityGroupMemberRequest::DoCancel() - { - LOGGER ( TXT("CAddPresentityGroupMemberRequest::DoCancel Start") ); - - LOGGER ( TXT("CAddPresentityGroupMemberRequest::DoCancel End") ); - } - - -// --------------------------------------------------------------------------- -// CAddPresentityGroupMemberRequest::RunL() -// --------------------------------------------------------------------------- -// -void CAddPresentityGroupMemberRequest::RunL() - { - LOGGER ( TXT("CAddPresentityGroupMemberRequest::RunL Start") ); - message_hdr_resp* msg_struct = NULL; - char* pResponse = NULL; - User::LeaveIfError( iStatus.Int() ); - - pResponse = iConnMan.DataHandler().ResponseL ( iSendId ); - - msg_struct = ( message_hdr_resp* )pResponse ; - if( !( msg_struct->response ) ) - { - switch( msg_struct->error_type ) - { - - default: //for all other error codes like ssl related are mapped to general error - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KXIMPErrServiceGeneralError ); - break; - } - } - else - { - //set presence as pending for the added contact - MPresenceBuddyInfo2* buddyPresInfo = MPresenceBuddyInfo2::NewLC(); - - MPresenceCacheWriter2* presenceCacheWriter = MPresenceCacheWriter2::CreateWriterL(); - CleanupDeletePushL(presenceCacheWriter); - HBufC* name = HBufC::NewLC( iContactId->Length() + iConnMan.ServiceName().Length() + KColon().Length() ); - TPtr namePtr( name->Des() ); - namePtr.Zero(); - namePtr.Append(iConnMan.ServiceName() ); // prepend service name - namePtr.Append(KColon); - namePtr.Append(iContactId->Des() ); - buddyPresInfo->SetIdentityL(namePtr); - LOGGER ( TXT ( "CPresenceNotificationHandler::ProcessIncomingDataL :ContactName:%S " ), iContactId ); - - buddyPresInfo->SetAnyFieldL(KExtensionKey,KPendingRequestExtensionValue()); - CleanupStack::PopAndDestroy(1);//name - - // Writing into Presence Cache - TInt cacheerror = presenceCacheWriter->WritePresenceL(buddyPresInfo); - User::LeaveIfError ( cacheerror); - CleanupStack::PopAndDestroy(2);//presenceCacheWriter,buddyPresInfo - - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KErrNone ); - } - free( pResponse ); - delete this; - LOGGER ( TXT("CAddPresentityGroupMemberRequest::RunL End") ); - } - - -// --------------------------------------------------------------------------- -// CAddPresentityGroupMemberRequest::RunError -// --------------------------------------------------------------------------- -// -TInt CAddPresentityGroupMemberRequest::RunError( TInt aError ) - { - LOGGER ( TXT("CAddPresentityGroupMemberRequest::RunError Start") ); - - iConnMan.HandleToHost().HandleRequestCompleted( iRequestId, aError ); - delete this; - - LOGGER ( TXT("CAddPresentityGroupMemberRequest::RunError End") ); - return KErrNone; - } - -// --------------------------------------------------------------------------- -// CAddPresentityGroupMemberRequest::AddPresentityGroupMemberL -// --------------------------------------------------------------------------- -// -void CAddPresentityGroupMemberRequest::AddPresentityGroupMemberL( - const MXIMPIdentity& /*aGroupId*/, - const MXIMPIdentity& aMemberId, - const TDesC16& aMemberDisplayName) - { - LOGGER ( TXT("CAddPresentityGroupMemberRequest::AddPresentityGroupMemberL Start") ); - if(iContactId) - { - delete iContactId; - iContactId = NULL; - } - iContactId = aMemberId.Identity().AllocL(); - char *smsg = NULL; - int totalLen = 0; - message_hdr_req msgHdr = {0,}; - msgHdr.message_type = EAdd_Contact_Request; - - TInt headerLength = sizeof( message_hdr_req ); - totalLen += headerLength; - - // adding add contact - charFormatData memberIdentityData = OssProtocolAdapUtils::ConvertTUint16ToCharLC( aMemberId.Identity() ); - char* memberIdentity = memberIdentityData.data; - TInt memberIdLength = memberIdentityData.dataSize; - totalLen += memberIdLength; - - charFormatData displayNameData = OssProtocolAdapUtils::ConvertTUint16ToCharLC( aMemberDisplayName ); - char* displayName = displayNameData.data; - TInt displayNameLength = displayNameData.dataSize; - totalLen += displayNameLength; - - if ( totalLen > MAX_MSG_SIZE ) - { - User::Leave(KErrArgument); - } - - //after getting size now allocate memory. - smsg = ( char* ) User::AllocLC(totalLen); - memset ( smsg, '\0', totalLen ); - - memcpy( smsg, &msgHdr, sizeof( message_hdr_req ) ); //header - memcpy( smsg + headerLength , memberIdentity , memberIdLength ); //id - memcpy( smsg + headerLength + memberIdLength + 1 , displayName , displayNameLength ); //display name - - iSendId = iConnMan.DataHandler().SendDataL ( iStatus, smsg, totalLen ); - - // signal the scheduler - SetActive(); - - CleanupStack::PopAndDestroy ( 3 );//smsg, memberIdentity, displayName. - - LOGGER ( TXT("CAddPresentityGroupMemberRequest::AddPresentityGroupMemberL End") ); - } - - -// End of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/presentitygroups/ccontactsynchandler.cpp --- a/imservices/ossprotocoladaptation/src/presentitygroups/ccontactsynchandler.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,212 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: handles synchronisation of contacts -* -*/ - - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include -#include -#include -#include -#include -#include "msgliterals.h" - -#include "ccontactsynchandler.h" - -#include "mossprotocolconnectionmanager.h" -#include "ossprotocolpluginlogger.h" -#include "waittimer.h" -#include "cossprotocolconnectionmanager.h" -#include "ossprotocoladaptationuids.h" -#include "ossprotocoladaptutils.h" - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CContactSyncHandler::CContactSyncHandler -// --------------------------------------------------------------------------- -// -CContactSyncHandler::CContactSyncHandler ( - MOSSProtocolConnectionManager& aConnMan ) : - CActive ( EPriorityNormal ), - iConnMan ( aConnMan ) - { - LOGGER ( TXT ( "CContactSyncHandler::CContactSyncHandler Start" ) ); - CActiveScheduler::Add ( this ); - - LOGGER ( TXT ( "CContactSyncHandler::CContactSyncHandler End" ) ); - } - - -// --------------------------------------------------------------------------- -// CContactSyncHandler::NewL -// --------------------------------------------------------------------------- -// -CContactSyncHandler* CContactSyncHandler::NewL ( - MOSSProtocolConnectionManager& aConnMan ) - { - LOGGER ( TXT ( "CContactSyncHandler::NewL Start" ) ); - - CContactSyncHandler* self = new ( ELeave ) CContactSyncHandler ( aConnMan ); - - LOGGER ( TXT ( "CContactSyncHandler::NewL End" ) ); - return self; - } - - -// --------------------------------------------------------------------------- -// CContactSyncHandler::~CContactSyncHandler -// --------------------------------------------------------------------------- -// -CContactSyncHandler::~CContactSyncHandler() - { - LOGGER ( TXT ( "::~CContactSyncHandler Start" ) ); - - Cancel(); - - LOGGER ( TXT ( "::~CContactSyncHandler End" ) ); - } - - -// --------------------------------------------------------------------------- -// CContactSyncHandler::DoCancel() -// --------------------------------------------------------------------------- -// -void CContactSyncHandler::DoCancel() - { - LOGGER ( TXT ( "CContactSyncHandler::DoCancel Start" ) ); - - iConnMan.DataHandler().CancelContactsChangeListening(); - - LOGGER ( TXT ( "CContactSyncHandler::DoCancel End" ) ); - } - -// --------------------------------------------------------------------------- -// CContactSyncHandler::RunL() -// --------------------------------------------------------------------------- -// -void CContactSyncHandler::RunL() - { - LOGGER ( TXT ( "CContactSyncHandler::RunL Start" ) ); - - // something is coming from the xmpp server - User::LeaveIfError ( iStatus.Int() ); - - ProcessAndSendL(); - StartListening(); - - LOGGER ( TXT ( "CContactSyncHandler::RunL End" ) ); - } - -// --------------------------------------------------------------------------- -// CContactSyncHandler::ProcessAndSendL() -// --------------------------------------------------------------------------- - -void CContactSyncHandler::ProcessAndSendL() - { - LOGGER ( TXT ( "CContactSyncHandler::ProcessIncomingDataL Start" ) ); - char* pResponse = NULL, *pOrigResponse = NULL; - message_hdr_resp* msg_struct = NULL; - - while( iConnMan.DataHandler().ContactsChangeResponseCount() ) // process all responses - { - pOrigResponse = pResponse = iConnMan.DataHandler().ResponseL (200 ); - CleanupStack::PushL(pOrigResponse) ; - - msg_struct = ( message_hdr_resp* )pResponse; - - char* contact= pResponse + sizeof ( message_hdr_resp ); - HBufC16* contactName = OssProtocolAdapUtils::ConvertCharToTUint16LC( contact ); - switch ( msg_struct->hdr_req.message_type ) - { - case ESubscribe_Remote_Pending: - { - break; - } - case ETrying_To_Add_Contact_Known: - { - iConnMan.GetContactManager().AddContactToLocalL(*contactName); - iConnMan.GetContactManager().RemoveInvitationFromLocalL(*contactName); - break; - } - case ESubscribe_RP_Accepted: - { - break; - } - case EPublish_RP_Accepted: - { - break; - } - case ESubscribe_Removed_Or_Rejected: - { - //removing from the local copy of the contacts - iConnMan.GetContactManager().RemoveContactFromLocalL(*contactName); - break; - } - case EPublish_Removed_Or_Rejected: - { - iConnMan.GetContactManager().RemoveInvitationFromLocalL(*contactName); - break; - } - } - CleanupStack::PopAndDestroy ( 2 );//pOrigResponse, contactName - } - LOGGER ( TXT ( "CContactSyncHandler::ProcessIncomingDataL End" ) ); - } - - -// --------------------------------------------------------------------------- -// CContactSyncHandler::RunError -// --------------------------------------------------------------------------- -// -TInt CContactSyncHandler::RunError ( TInt aError ) - { - LOGGER ( TXT ( "CContactSyncHandler::RunError Start %d" ), aError ); - - LOGGER ( TXT ( "CContactSyncHandler::RunError End" ) ); - return KErrNone; - } - -// --------------------------------------------------------------------------- -// CContactSyncHandler::StartListeningL -// --------------------------------------------------------------------------- -// -void CContactSyncHandler::StartListening() - { - LOGGER ( TXT ( "CContactSyncHandler::StartListeningL Start" ) ); - - if ( ! ( this->IsActive() ) ) - { - iConnMan.DataHandler().ListenContactsChange( iStatus ); - SetActive(); - } - LOGGER ( TXT ( "CContactSyncHandler::StartListeningL End" ) ); - } - -// End of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/presentitygroups/cossprotocolpresentitygroups.cpp --- a/imservices/ossprotocoladaptation/src/presentitygroups/cossprotocolpresentitygroups.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,334 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Oss protocol presentity groups implementation -* -*/ - -#include -#include -#include -#include "cossprotocolpresentitygroups.h" -#include "csubscribepresentitygroupcontentrequest.h" - -#include "cossprotocolconnectionmanager.h" -#include "mossprotocolconnectionmanager.h" -#include "ossprotocolpluginlogger.h" -#include "ossprotocolpluginpanics.h" -#include "ossprotocolpluginlogger.h" -#include "caddpresentitygroupmemberrequest.h" // add conatct request -#include "cremovepresentitygroupmemberrequest.h" // remove contact req. -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// COSSProtocolpresentitygroups::GetInterface() -// --------------------------------------------------------------------------- -// -TAny* COSSProtocolpresentitygroups::GetInterface ( TInt32 aInterfaceId, - TIfGetOps aOptions ) - { - LOGGER ( TXT ( "COSSProtocolpresentitygroups::GetInterface() Start" ) ); - - if ( aInterfaceId == MProtocolPresentityGroups::KInterfaceId ) - { - MProtocolPresentityGroups* self = this; - return self; - } - - if ( aOptions == MXIMPBase::EPanicIfUnknown ) - - { - User::Panic ( KOSSProtocolPresentityGroups, KErrExtensionNotSupported ); - } - - LOGGER ( TXT ( "COSSProtocolpresentitygroups::GetInterface() End" ) ); - - return NULL; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolpresentitygroups::GetInterface() -// --------------------------------------------------------------------------- -// -const TAny* COSSProtocolpresentitygroups::GetInterface ( TInt32 aInterfaceId, - TIfGetOps aOptions ) const - { - LOGGER ( TXT ( "COSSProtocolpresentitygroups::GetInterface() Start" ) ); - - if ( aInterfaceId == MProtocolPresentityGroups::KInterfaceId ) - { - const MProtocolPresentityGroups* self = this; - return self; - } - - if ( aOptions == MXIMPBase::EPanicIfUnknown ) - - { - User::Panic ( KOSSProtocolPresentityGroups, KErrExtensionNotSupported ); - } - - LOGGER ( TXT ( "COSSProtocolpresentitygroups::GetInterface() End" ) ); - - return NULL; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolpresentitygroups::GetInterfaceId() -// --------------------------------------------------------------------------- -// -TInt32 COSSProtocolpresentitygroups::GetInterfaceId() const - { - LOGGER ( TXT ( "COSSProtocolpresentitygroups::GetInterfaceId() Start-End" ) ); - return MProtocolPresentityGroups::KInterfaceId; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolpresentitygroups::COSSProtocolpresentitygroups() -// --------------------------------------------------------------------------- -// -COSSProtocolpresentitygroups::COSSProtocolpresentitygroups ( - MOSSProtocolConnectionManager& aConnMan ) - : iConnMan ( aConnMan ) - { - LOGGER ( TXT ( "Groups::COSSProtocolpresentitygroups() Start-End" ) ); - } - - -// --------------------------------------------------------------------------- -// COSSProtocolpresentitygroups::ConstructL() -// --------------------------------------------------------------------------- -// -void COSSProtocolpresentitygroups::ConstructL() - { - LOGGER ( TXT ( "COSSProtocolpresentitygroups::ConstructL() Start" ) ); - LOGGER ( TXT ( "COSSProtocolpresentitygroups::ConstructL() End" ) ); - } - - -// --------------------------------------------------------------------------- -// COSSProtocolpresentitygroups::NewL() -// --------------------------------------------------------------------------- -// -COSSProtocolpresentitygroups* COSSProtocolpresentitygroups::NewL ( - MOSSProtocolConnectionManager& aConnMan ) - { - LOGGER ( TXT ( "COSSProtocolpresentitygroups::NewL() Start" ) ); - - COSSProtocolpresentitygroups* self = - new ( ELeave ) COSSProtocolpresentitygroups ( aConnMan ); - CleanupStack::PushL ( self ); - self->ConstructL( ); - CleanupStack::Pop ( self ); - - LOGGER ( TXT ( "COSSProtocolpresentitygroups::NewL() End" ) ); - return self; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolpresentitygroups::~COSSProtocolpresentitygroups() -// --------------------------------------------------------------------------- -// -COSSProtocolpresentitygroups::~COSSProtocolpresentitygroups() - { - LOGGER ( TXT ( "Groups::~COSSProtocolpresentitygroups() Start" ) ); - - - LOGGER ( TXT ( "Groups::~COSSProtocolpresentitygroups() End" ) ); - } - - - -// --------------------------------------------------------------------------- -// COSSProtocolpresentitygroups::DoSubscribePresentityGroupListL() -// --------------------------------------------------------------------------- -// -void COSSProtocolpresentitygroups::DoSubscribePresentityGroupListL ( - TXIMPRequestId /*aReqId */) - { - // not supported - } - - -// --------------------------------------------------------------------------- -// COSSProtocolpresentitygroups::DoUnsubscribePresentityGroupListL() -// --------------------------------------------------------------------------- -// -void COSSProtocolpresentitygroups::DoUnsubscribePresentityGroupListL ( - TXIMPRequestId /*aReqId*/ ) - { - //not supported - } - - -// --------------------------------------------------------------------------- -// COSSProtocolpresentitygroups::DoCreatePresentityGroupL() -// --------------------------------------------------------------------------- -// -void COSSProtocolpresentitygroups::DoCreatePresentityGroupL ( - const MXIMPIdentity& /*aIdentity*/, - const TDesC16& /*aDisplayName*/, - TXIMPRequestId /*aReqId*/ ) - { - LOGGER ( TXT ( "Groups::DoCreatePresentityGroupL() Start" ) ); - //not supported - - LOGGER ( TXT ( "Groups::DoCreatePresentityGroupL() End" ) ); - } - -// --------------------------------------------------------------------------- -// COSSProtocolpresentitygroups::DoDeletePresentityGroupL() -// --------------------------------------------------------------------------- -// -void COSSProtocolpresentitygroups::DoDeletePresentityGroupL ( - const MXIMPIdentity& /*Identity*/, - TXIMPRequestId /*aReqId*/ ) - { - LOGGER ( TXT ( "Groups::DoDeletePresentityGroupL() Start" ) ); - //not supported - - LOGGER ( TXT ( "Groups::DoDeletePresentityGroupL() End" ) ); - } - -// --------------------------------------------------------------------------- -// COSSProtocolpresentitygroups::DoUpdatePresentityGroupDisplayNameL() -// --------------------------------------------------------------------------- -// -void COSSProtocolpresentitygroups::DoUpdatePresentityGroupDisplayNameL ( - const MXIMPIdentity& /*aIdentity*/, - const TDesC16& /*aDisplayName*/, - TXIMPRequestId /*aReqId*/ ) - { - LOGGER ( TXT ( "Groups::DoUpdatePresentityGroupDisplayNameL() Start" ) ); - - LOGGER ( TXT ( "Groups::DoUpdatePresentityGroupDisplayNameL() End" ) ); - } - -// --------------------------------------------------------------------------- -// COSSProtocolpresentitygroups::DoSubscribePresentityGroupContentL() -// --------------------------------------------------------------------------- -// -void COSSProtocolpresentitygroups::DoSubscribePresentityGroupContentL ( - const MXIMPIdentity& aGroupId, - TXIMPRequestId aReqId ) - { - - LOGGER ( TXT ( "Groups::DoSubscribePresentityGroupContentL() Start" ) ); - if( ! iConnMan.GetContactManager().IsFetchContactsFirstTime()) - { - iConnMan.GetContactManager().SetFetchContactsFirstTime(ETrue); - CreateDataHandlerL(); - CSubscribePresentityGroupContentRequest* req = - CSubscribePresentityGroupContentRequest::NewLC ( iConnMan, aReqId ); - req->SubscribePresentityGroupContentL ( aGroupId ); - CleanupStack::Pop ( req ); - } - //keep a locol copy of the contacts and return to ximp fw - else - { - iConnMan.GetContactManager().ReturnContactsListL(); - iConnMan.HandleToHost().HandleRequestCompleted ( aReqId, KErrNone ); - } - LOGGER ( TXT ( "Groups::DoSubscribePresentityGroupContentL() End" ) ); - } - -// --------------------------------------------------------------------------- -// COSSProtocolpresentitygroups::DoUnsubscribePresentityGroupContentL() -// --------------------------------------------------------------------------- -// -void COSSProtocolpresentitygroups::DoUnsubscribePresentityGroupContentL ( - const MXIMPIdentity& /*aGroupId*/, - TXIMPRequestId aReqId ) - { - LOGGER ( TXT ( "Groups::DoUnsubscribePresentityGroupContentL() Start" ) ); - - // just complete the request to PrFw Successfully - - iConnMan.HandleToHost().HandleRequestCompleted ( aReqId, KErrNone ); - - LOGGER ( TXT ( "Groups::DoUnsubscribePresentityGroupContentL() End" ) ); - } - -// --------------------------------------------------------------------------- -// COSSProtocolpresentitygroups::DoAddPresentityGroupMemberL() -// --------------------------------------------------------------------------- -// -void COSSProtocolpresentitygroups::DoAddPresentityGroupMemberL ( - const MXIMPIdentity& aGroupId, - const MXIMPIdentity& aMemberId, - const TDesC16& aMemberDisplayName, - TXIMPRequestId aReqId ) - { - LOGGER ( TXT ( "Groups::DoAddPresentityGroupMemberL() Start" ) ); - - CAddPresentityGroupMemberRequest* addreq = - CAddPresentityGroupMemberRequest::NewLC(iConnMan, aReqId ); - - addreq->AddPresentityGroupMemberL(aGroupId,aMemberId,aMemberDisplayName); - - CleanupStack::Pop ( addreq ); - - LOGGER ( TXT ( "Groups::DoAddPresentityGroupMemberL() End" ) ); - } - -// --------------------------------------------------------------------------- -// COSSProtocolpresentitygroups::DoRemovePresentityGroupMemberL() -// --------------------------------------------------------------------------- -// -void COSSProtocolpresentitygroups::DoRemovePresentityGroupMemberL ( - const MXIMPIdentity& aGroupId, - const MXIMPIdentity& aMemberId, - TXIMPRequestId aReqId ) - { - LOGGER ( TXT ( "Groups::DoRemovePresentityGroupMemberL() Start" ) ) ; - CRemovePresentityGroupMemberRequest* removereq = - CRemovePresentityGroupMemberRequest::NewLC(iConnMan, aReqId ); - - removereq->RemovePresentityGroupMemberL(aGroupId,aMemberId); - - CleanupStack::Pop ( removereq ); - LOGGER ( TXT ( "Groups::DoRemovePresentityGroupMemberL() End" ) ); - } - -// --------------------------------------------------------------------------- -// COSSProtocolpresentitygroups::DoUpdatePresentityGroupMemberDisplayNameL() -// --------------------------------------------------------------------------- -// -void COSSProtocolpresentitygroups::DoUpdatePresentityGroupMemberDisplayNameL ( - const MXIMPIdentity& /*aGroupId*/, - const MXIMPIdentity& /*aMemberId*/, - const TDesC16& /*aMemberDisplayName*/, - TXIMPRequestId /*aReqId*/ ) - { - LOGGER ( TXT ( "Groups::DoUpdatePresentityGroupMemberDisplayNameL() Start" ) ); - LOGGER ( TXT ( "Groups::DoUpdatePresentityGroupMemberDisplayNameL() End" ) ); - } - -// --------------------------------------------------------------------------- -// COSSProtocolpresentitygroups::CreateDataHandler() -// --------------------------------------------------------------------------- -// -void COSSProtocolpresentitygroups::CreateDataHandlerL() - { - LOGGER ( TXT ( "COSSProtocolpresentitygroups::CreateDataHandler() Start" ) ); - - iConnMan.ManufactureDataHandlerL(); - - LOGGER ( TXT ( "COSSProtocolpresentitygroups::CreateDataHandler() End" ) ); - } - -// End of file - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/presentitygroups/cremovepresentitygroupmemberrequest.cpp --- a/imservices/ossprotocoladaptation/src/presentitygroups/cremovepresentitygroupmemberrequest.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,238 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Remove presentity group member request to the network server -* -*/ - - -#include -#include "cremovepresentitygroupmemberrequest.h" -#include "mossprotocolconnectionmanager.h" -#include "cossprotocolconnectionmanager.h" -#include "ossprotocolpluginlogger.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include "stringutils.h" -#include -#include -#include -#include -#include "msgliterals.h" -#include "msg_enums.h" -#include "ossprotocoladaptutils.h" - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CRemovePresentityGroupMemberRequest::CRemovePresentityGroupMemberRequest -// --------------------------------------------------------------------------- -// -CRemovePresentityGroupMemberRequest::CRemovePresentityGroupMemberRequest( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) : - CActive( EPriorityNormal ), - iRequestId( aRequestId ), - iConnMan( aConnMan ) - { - LOGGER ( TXT("::CRemovePresentityGroupMemberRequest Start") ); - CActiveScheduler::Add( this ); - - LOGGER ( TXT("::CRemovePresentityGroupMemberRequest End") ); - } - - -// --------------------------------------------------------------------------- -// CRemovePresentityGroupMemberRequest::ConstructL -// --------------------------------------------------------------------------- -// -void CRemovePresentityGroupMemberRequest::ConstructL() - { - LOGGER ( TXT("CRemovePresentityGroupMemberRequest::ConstructL Start") ); - iUserId = NULL; - LOGGER ( TXT("CRemovePresentityGroupMemberRequest::ConstructL End") ); - } - - - -// --------------------------------------------------------------------------- -// CRemovePresentityGroupMemberRequest::NewLC -// --------------------------------------------------------------------------- -// -CRemovePresentityGroupMemberRequest* CRemovePresentityGroupMemberRequest::NewLC( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) - { - LOGGER ( TXT("CRemovePresentityGroupMemberRequest::NewLC Start") ); - - CRemovePresentityGroupMemberRequest* self = new( ELeave ) - CRemovePresentityGroupMemberRequest( aConnMan, aRequestId ); - CleanupStack::PushL( self ); - self->ConstructL(); - - - LOGGER ( TXT("CRemovePresentityGroupMemberRequest::NewLC End") ); - return self; - } - -// --------------------------------------------------------------------------- -// CRemovePresentityGroupMemberRequest::~CRemovePresentityGroupMemberRequest -// --------------------------------------------------------------------------- -// -CRemovePresentityGroupMemberRequest::~CRemovePresentityGroupMemberRequest() - { - LOGGER ( TXT("::~CRemovePresentityGroupMemberRequest Start") ); - - CActive::Cancel(); - delete iUserId; - LOGGER ( TXT("::~CRemovePresentityGroupMemberRequest End") ); - } - - -// --------------------------------------------------------------------------- -// CRemovePresentityGroupMemberRequest::DoCancel() -// --------------------------------------------------------------------------- -// -void CRemovePresentityGroupMemberRequest::DoCancel() - { - LOGGER ( TXT("CRemovePresentityGroupMemberRequest::DoCancel Start") ); - - LOGGER ( TXT("CRemovePresentityGroupMemberRequest::DoCancel End") ); - } - - -// --------------------------------------------------------------------------- -// CRemovePresentityGroupMemberRequest::RunL() -// --------------------------------------------------------------------------- -// -void CRemovePresentityGroupMemberRequest::RunL() - { - LOGGER ( TXT("CRemovePresentityGroupMemberRequest::RunL Start") ); - message_hdr_resp* msg_struct = NULL; - char* pResponse = NULL; - User::LeaveIfError( iStatus.Int() ); - - pResponse = iConnMan.DataHandler().ResponseL ( iSendId ); - - msg_struct = ( message_hdr_resp* )pResponse ; - if( !( msg_struct->response )) - { - switch( msg_struct->error_type ) - { - - default: //for all other error codes like ssl related are mapped to general error - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KXIMPErrServiceGeneralError ); - break; - } - } - else - { - if( iUserId ) - { - HBufC* sxpId = HBufC::NewLC( iConnMan.ServiceName().Length() + iUserId->Length() +1 ); - TPtr sxpIdPtr( sxpId->Des() ); - - sxpIdPtr.Zero(); - sxpIdPtr.Append( iConnMan.ServiceName() ); - sxpIdPtr.Append(KColon); - sxpIdPtr.Append( *iUserId ); - MPresenceCacheWriter2* presenceCacheWriter = MPresenceCacheWriter2::CreateWriterL(); - TInt cacheerror = presenceCacheWriter->DeletePresenceL( sxpIdPtr ); - User::LeaveIfError ( cacheerror); - CleanupStack::PopAndDestroy(); // sxpId - delete presenceCacheWriter; - presenceCacheWriter = NULL; - delete iUserId; - iUserId = NULL; - } - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KErrNone ); - } - - free( pResponse ); - delete this; - LOGGER ( TXT("CRemovePresentityGroupMemberRequest::RunL End") ); - } - - -// --------------------------------------------------------------------------- -// CRemovePresentityGroupMemberRequest::RunError -// --------------------------------------------------------------------------- -// -TInt CRemovePresentityGroupMemberRequest::RunError( TInt aError ) - { - LOGGER ( TXT("CRemovePresentityGroupMemberRequest::RunError Start") ); - - iConnMan.HandleToHost().HandleRequestCompleted( iRequestId, aError ); - - delete this; - LOGGER ( TXT("CRemovePresentityGroupMemberRequest::RunError End") ); - return KErrNone; - } - -// --------------------------------------------------------------------------- -// CRemovePresentityGroupMemberRequest::RemovePresentityGroupMemberL -// --------------------------------------------------------------------------- -// -void CRemovePresentityGroupMemberRequest::RemovePresentityGroupMemberL( - const MXIMPIdentity& /*aGroupId*/, - const MXIMPIdentity& aMemberId) - { - - LOGGER ( TXT("CRemovePresentityGroupMemberRequest::RemovePresentityGroupMemberL Start") ); - - int userLen=0; - int totalLen = 0; - iUserId = aMemberId.Identity().AllocL(); - - message_hdr_req msgHdr = {0,}; - msgHdr.message_type = EDelete_Contact_Request; - - TInt headerLength = sizeof( message_hdr_req ); - totalLen += headerLength; - - // adding add contact - charFormatData tmpmsgData = OssProtocolAdapUtils::ConvertTUint16ToCharLC ( aMemberId.Identity() ); - char *tmpmsg = tmpmsgData.data; - userLen = tmpmsgData.dataSize; - totalLen += userLen; - - User::LeaveIfError ( totalLen > MAX_MSG_SIZE ); - - //now allocate memory. - char* smsg = ( char* ) User::AllocLC( totalLen ); - memcpy( smsg, &msgHdr, headerLength ); - memcpy ( smsg + headerLength, tmpmsg, userLen ); - - iSendId = iConnMan.DataHandler().SendDataL ( iStatus, smsg, totalLen ); - - // signal the scheduler - SetActive(); - - CleanupStack::PopAndDestroy ( 2 );//smsg, tmpmsg. - - LOGGER ( TXT("::RemovePresentityGroupMemberL End") ); - } - - -// End of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/presentitygroups/csubscribepresentitygroupcontentrequest.cpp --- a/imservices/ossprotocoladaptation/src/presentitygroups/csubscribepresentitygroupcontentrequest.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,309 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Subscribe Presentity Group content request to the Network Server. -* -*/ - - -#include -#include "csubscribepresentitygroupcontentrequest.h" -#include "cossprotocolconnectionmanager.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "ossprotocolpluginlogger.h" - -#include -#include -#include -#include "stringutils.h" -#include -#include -#include -#include -#include "msgliterals.h" -#include "msg_enums.h" -#include "ossprotocoladaptutils.h" - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CSubscribePresentityGroupContentRequest::CSubscribePresentityGroupContentRequest() -// --------------------------------------------------------------------------- -// -CSubscribePresentityGroupContentRequest::CSubscribePresentityGroupContentRequest ( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) : - CActive ( EPriorityNormal ), - iRequestId ( aRequestId ), - iConnMan ( aConnMan ), - iListcount ( 0 ) - { - LOGGER ( TXT ( "::CSubscribePresentityGroupContentRequest Start" ) ); - CActiveScheduler::Add ( this ); - LOGGER ( TXT ( "::CSubscribePresentityGroupContentRequest End" ) ); - } - - -// --------------------------------------------------------------------------- -// CSubscribePresentityGroupContentRequest::ConstructL() -// --------------------------------------------------------------------------- -// -void CSubscribePresentityGroupContentRequest::ConstructL() - { - LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::ConstructL Start-End" ) ); - iGroupName = NULL; - - } - - -// --------------------------------------------------------------------------- -// CSubscribePresentityGroupContentRequest::NewL -// --------------------------------------------------------------------------- -// -CSubscribePresentityGroupContentRequest* CSubscribePresentityGroupContentRequest::NewL ( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) - { - LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::NewL Start" ) ); - - CSubscribePresentityGroupContentRequest* self = new ( ELeave ) - CSubscribePresentityGroupContentRequest ( aConnMan, aRequestId ); - CleanupStack::PushL ( self ); - self->ConstructL(); - CleanupStack::Pop ( self ); - - LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::NewL End" ) ); - return self; - } - - -// --------------------------------------------------------------------------- -// CSubscribePresentityGroupContentRequest::NewLC() -// --------------------------------------------------------------------------- -// -CSubscribePresentityGroupContentRequest* CSubscribePresentityGroupContentRequest::NewLC ( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) - { - LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::NewLC Start" ) ); - - CSubscribePresentityGroupContentRequest* self = - CSubscribePresentityGroupContentRequest::NewL ( aConnMan, aRequestId ); - CleanupStack::PushL ( self ); - - LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::NewLC End" ) ); - return self; - } - -// --------------------------------------------------------------------------- -// CSubscribePresentityGroupContentRequest::~CSubscribePresentityGroupContentRequest() -// --------------------------------------------------------------------------- -// -CSubscribePresentityGroupContentRequest::~CSubscribePresentityGroupContentRequest() - { - LOGGER ( TXT ( "::~CSubscribePresentityGroupContentRequest Start" ) ); - delete iGroupName; - iGroupName = NULL; - Cancel(); - //iContacts.ResetAndDestroy(); - LOGGER ( TXT ( "::~CSubscribePresentityGroupContentRequest End" ) ); - } - - -// --------------------------------------------------------------------------- -// CSubscribePresentityGroupContentRequest::DoCancel() -// --------------------------------------------------------------------------- -// -void CSubscribePresentityGroupContentRequest::DoCancel() - { - LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::DoCancel Start" ) ); - iConnMan.DataHandler().CancelListening(); - LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::DoCancel End" ) ); - } - -// --------------------------------------------------------------------------- -// CSubscribePresentityGroupContentRequest::RunL() -// --------------------------------------------------------------------------- -// -void CSubscribePresentityGroupContentRequest::RunL() - { - LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::RunL Start" ) ); - User::LeaveIfError( iStatus.Int() ); - TRAPD( error, ProcessIncomingDataL( ) ); - if ( error != KErrNone ) - { - Cancel(); - } - - LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::RunL End" ) ); - } - - -// --------------------------------------------------------------------------- -// CSubscribePresentityGroupContentRequest::RunError -// --------------------------------------------------------------------------- -// -TInt CSubscribePresentityGroupContentRequest::RunError ( TInt aError ) - { - LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::RunError Start" ) ); - - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, aError ); - - delete this; - LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::RunError End" ) ); - return KErrNone; - } - -// --------------------------------------------------------------------------- -// CSubscribePresentityGroupContentRequest::SubscribePresentityGroupContentL -// --------------------------------------------------------------------------- -// -void CSubscribePresentityGroupContentRequest::SubscribePresentityGroupContentL ( - const MXIMPIdentity& aIdentity ) - { - LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::SubscribePresentityGroupContentL Start" ) ); - if(iGroupName) - { - delete iGroupName; - iGroupName = NULL; - } - iGroupName = aIdentity.Identity().AllocL(); - iConnMan.SetGroupIDL( *iGroupName ); // this groupname is used by contactsync class for synchronisation - - if(iConnMan.DataHandler().IsFetchContactsCompleted()) - { - ProcessIncomingDataL( ); - } - else - { - if ( ! ( this->IsActive() ) ) - { - iConnMan.DataHandler().ListenIncomingData ( iStatus ); - SetActive(); - } - } - - - LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::SubscribePresentityGroupContentL End" ) ); - } - - -// --------------------------------------------------------------------------- -// CSubscribePresentityGroupContentRequest::ProcessIncomingDataL() -// --------------------------------------------------------------------------- -// -void CSubscribePresentityGroupContentRequest::ProcessIncomingDataL() - { - LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::ProcessIncomingDataL Start" ) ); - - PopulateDataL(); - - MXIMPObjectFactory& prfwObjFact = iConnMan.HandleToHost().ObjectFactory(); - - MPresenceObjectFactory& prObjFact = - iConnMan.HandleToHost().ProtocolPresenceDataHost().PresenceObjectFactory(); - - MXIMPIdentity* contactIdentity = NULL; - MPresentityGroupMemberInfo* groupMemberInfo = NULL; - MXIMPObjectCollection* listOfContacts = prfwObjFact.NewObjectCollectionLC(); - - //get the ref to contacts which was already stored in PopulateDataL - RPointerArray& contacts = iConnMan.GetContactManager().GetContactsListL(); - - for(TInt i = 0;iSetIdentityL ( *(contacts[ i ] )); - groupMemberInfo->SetGroupMemberIdL ( contactIdentity ); - groupMemberInfo->SetGroupMemberDisplayNameL ( *(contacts[ i ] ) ); - listOfContacts->AddObjectL ( groupMemberInfo ); - CleanupStack::Pop ( 2 );//groupMemberInfo, contactIdentity - - } - - MXIMPIdentity* groupIdentity = prfwObjFact.NewIdentityLC(); - - groupIdentity->SetIdentityL ( *iGroupName ); - - iConnMan.HandleToHost().ProtocolPresenceDataHost().GroupsDataHost().HandlePresentityGroupContentL ( - groupIdentity, listOfContacts ); - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KErrNone ); - CleanupStack::Pop ( 2 );//groupIdentity,listOfContacts - - delete this; - - LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::ProcessIncomingDataL End" ) ); - - } - -// --------------------------------------------------------------------------- -// CSubscribePresentityGroupContentRequest::PopulateDataL -// --------------------------------------------------------------------------- -// -void CSubscribePresentityGroupContentRequest::PopulateDataL() - { - LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::PopulateDataL Start" ) ); - - int len = MAX_SIZE_DATA; - char* pResponse = NULL, *pOrigResponse = NULL; - - TInt datacount = iConnMan.DataHandler().IncomingDataCount(); - //to keep the local copy of contacts in adaptation till logout - RPointerArray& contacts = iConnMan.GetContactManager().GetContactsListL(); - - while( datacount ) - { - // get the incoming response from the server with transaction id equals zero - pOrigResponse = pResponse = iConnMan.DataHandler().ResponseL ( 0 ); - CleanupStack::PushL(pOrigResponse) ; - if( pResponse ) - { - pResponse += sizeof ( message_hdr_resp ); - - while(1) - { - len = strlen(pResponse) + 1; - if (1 == len) - { - break; - } - char* contact = pResponse; - pResponse += len; - - HBufC16 *contactName = OssProtocolAdapUtils::ConvertCharToTUint16LC( contact ); - contacts.AppendL(contactName); - LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::PopulateDataL:ContactName:%S " ), contactName ); - CleanupStack::Pop ( contactName ); - } - } - - CleanupStack::PopAndDestroy(pOrigResponse) ;//pOrigResponse - - datacount = iConnMan.DataHandler().IncomingDataCount(); - } - - LOGGER ( TXT ( "CSubscribePresentityGroupContentRequest::PopulateDataL End" ) ); - } - - - -// End of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/processlauncher/processlaunher.cpp --- a/imservices/ossprotocoladaptation/src/processlauncher/processlaunher.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,153 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: implementation of launching of process -* -*/ - - -// INCLUDE FILES -#include "processlaunher.h" - -#include -#include "ossprotocolpluginlogger.h" - - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CProcessLauncher::CProcessLauncher -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CProcessLauncher::CProcessLauncher() : - CActive ( EPriorityStandard ) - { - CActiveScheduler::Add ( this ); - } - -// ----------------------------------------------------------------------------- -// CProcessLauncher::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CProcessLauncher::ConstructL ( const TDesC16& aprocessname ) - { - LOGGER ( TXT ( "CProcessLauncher::ConstructL()" ) ); - iProcessName = aprocessname.AllocL(); - } - -// ----------------------------------------------------------------------------- -// CProcessLauncher::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CProcessLauncher* CProcessLauncher::NewL ( const TDesC16& aprocessname ) - { - LOGGER ( TXT ( "CProcessLauncher::NewL()" ) ); - - CProcessLauncher* self = - new ( ELeave ) CProcessLauncher(); - - CleanupStack::PushL ( self ); - self->ConstructL ( aprocessname ); - CleanupStack::Pop(); - - return self; - } - -// Destructor -CProcessLauncher::~CProcessLauncher() - { - Cancel(); - delete iProcessName; - } - - -// --------------------------------------------------------- -// CProcessLauncher::DoCancel -// -// --------------------------------------------------------- -// -void CProcessLauncher::DoCancel() - { - iLauncher.LogonCancel ( iStatus ); - - } - -// --------------------------------------------------------- -// CProcessLauncher::RunL -// -// --------------------------------------------------------- -// -void CProcessLauncher::RunL() - { - TInt answer ( iStatus.Int() ); - - if ( answer != KErrNone ) - { - LOGGER ( TXT ( "CProcessLauncher::dd terminated with the reason %d" ), answer ); - - User::LeaveIfError ( answer ); - } - - Cancel(); - } - -// --------------------------------------------------------- -// CProcessLauncher::RunError -// -// --------------------------------------------------------- -// -TInt CProcessLauncher::RunError ( TInt aError ) - { - if ( IsActive() ) - { - Cancel(); - } - - return aError; - } -// --------------------------------------------------------- -// CProcessLauncher::LaunchProcessL -// --------------------------------------------------------- -// -void CProcessLauncher::LaunchProcessL() - { - LOGGER ( TXT ( "CProcessLauncher::LaunchProcessL() start" ) ); - TInt result = KErrNotFound; - - result = iLauncher.Create ( *iProcessName, KNullDesC ); - - if ( result != KErrNone ) - { - LOGGER ( TXT ( "CProcessLauncher::launching isoserver is failed with the reason %d" ), result ); - User::Leave ( result ); - } - - // When the launcher exits we'll get the exit code in iStatus - iStatus = KRequestPending; - - SetActive(); - - iLauncher.Logon ( iStatus ); - - iLauncher.Resume(); - - //iLauncher.Close(); - LOGGER ( TXT ( "CProcessLauncher::LaunchProcessL() End " ) ); - } - -// End of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/search/cossprotocolsearch.cpp --- a/imservices/ossprotocoladaptation/src/search/cossprotocolsearch.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,200 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Oss Protocol search implementation -* -*/ - -#include -#include -#include -#include - -#include "cossprotocolsearch.h" -#include "cossprotocolconnectionmanager.h" -#include "csearchrequest.h" -#include "mossprotocolconnectionmanager.h" -#include "ossprotocolpluginlogger.h" -#include "ossprotocolpluginpanics.h" - -#include "csearchgetsearchkeys.h" - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// COSSProtocolSearch::GetInterface() -// --------------------------------------------------------------------------- -// -TAny* COSSProtocolSearch::GetInterface ( TInt32 aInterfaceId, - TIfGetOps aOptions ) - { - LOGGER ( TXT ( "COSSProtocolSearch::GetInterface() Start" ) ); - - MProtocolSearch* self= NULL; - if ( aInterfaceId == MProtocolSearch::KInterfaceId ) - { - self = this ; - } - else - { - if (aOptions == MXIMPBase::EPanicIfUnknown ) - - { - User::Panic ( _L("serach"), KErrExtensionNotSupported ); - } - } - - - - LOGGER ( TXT ( "COSSProtocolSearch::GetInterface() End" ) ); - - return self; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolSearch::GetInterface() -// --------------------------------------------------------------------------- -// -const TAny* COSSProtocolSearch::GetInterface ( TInt32 aInterfaceId, - TIfGetOps aOptions ) const - { - LOGGER ( TXT ( "COSSProtocolSearch::GetInterface() Start" ) ); - - const MProtocolSearch* self= NULL; - if ( aInterfaceId == MProtocolSearch::KInterfaceId ) - { - self = this ; - } - else - { - if (aOptions == MXIMPBase::EPanicIfUnknown ) - - { - User::Panic ( _L("serach"), KErrExtensionNotSupported ); - } - } - - LOGGER ( TXT ( "COSSProtocolSearch::GetInterface() End" ) ); - - return self; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolSearch::GetInterfaceId() -// --------------------------------------------------------------------------- -// -TInt32 COSSProtocolSearch::GetInterfaceId() const - { - LOGGER ( TXT ( "COSSProtocolSearch::GetInterfaceId() Start-End" ) ); - return MProtocolSearch::KInterfaceId; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolSearch::COSSProtocolSearch() -// --------------------------------------------------------------------------- -// -COSSProtocolSearch::COSSProtocolSearch ( - MOSSProtocolConnectionManager& aConnMan ) - : iConnMan ( aConnMan ) - { - LOGGER ( TXT ( "Groups::COSSProtocolSearch() Start-End" ) ); - } - - -// --------------------------------------------------------------------------- -// COSSProtocolSearch::ConstructL() -// --------------------------------------------------------------------------- -// -void COSSProtocolSearch::ConstructL() - { - LOGGER ( TXT ( "COSSProtocolSearch::ConstructL() Start" ) ); - LOGGER ( TXT ( "COSSProtocolSearch::ConstructL() End" ) ); - } - - -// --------------------------------------------------------------------------- -// COSSProtocolSearch::NewL() -// --------------------------------------------------------------------------- -// -COSSProtocolSearch* COSSProtocolSearch::NewL ( - MOSSProtocolConnectionManager& aConnMan ) - { - LOGGER ( TXT ( "COSSProtocolSearch::NewL() Start" ) ); - - COSSProtocolSearch* self = - new ( ELeave ) COSSProtocolSearch ( aConnMan ); - CleanupStack::PushL ( self ); - self->ConstructL( ); - CleanupStack::Pop ( self ); - - LOGGER ( TXT ( "COSSProtocolSearch::NewL() End" ) ); - return self; - } - - -// --------------------------------------------------------------------------- -// COSSProtocolSearch::~COSSProtocolSearch() -// --------------------------------------------------------------------------- -// -COSSProtocolSearch::~COSSProtocolSearch() - { - LOGGER ( TXT ( "COSSProtocolSearch::~COSSProtocolSearch() Start" ) ); - - LOGGER ( TXT ( "COSSProtocolSearch::~COSSProtocolSearch() End" ) ); - } - - - -// --------------------------------------------------------------------------- -// COSSProtocolSearch::DoSearchL() -// --------------------------------------------------------------------------- -// -void COSSProtocolSearch::DoSearchL( const MXIMPIdentity& aSearchId, - const RPointerArray< MSearchElement >& aObjs, - TInt aSearchLimit, - TXIMPRequestId aReqId ) - { - LOGGER ( TXT ( "COSSProtocolSearch::DoSearchL() Start" ) ); - - CSearchrequest* req = CSearchrequest::NewLC ( iConnMan, aReqId ); - req->SearchL(aSearchId,aObjs,aSearchLimit); - - CleanupStack::Pop ( req ); // req is deleted by itself once it completes the operation - - LOGGER ( TXT ( "COSSProtocolSearch::DoSearchL() End" ) ); - } - - -// --------------------------------------------------------------------------- -// COSSProtocolSearch::DoSearchL() -// --------------------------------------------------------------------------- -// -void COSSProtocolSearch::DoGetSearchKeysL( TXIMPRequestId aReqId ) - { - LOGGER ( TXT ( "COSSProtocolSearch::DoSearchL() Start" ) ); - //Shoudl be changed to NewLC - CSearchGetSearchKeys* req = CSearchGetSearchKeys::NewL ( - iConnMan, aReqId ); - // req->SearchL(aSearchId,aObjs,aSearchLimit); - - req->GetSearchKeysL(); - - //CleanupStack::Pop ( req ); // req is deleted by itself once it completes the operation - - LOGGER ( TXT ( "COSSProtocolSearch::DoSearchL() End" ) ); - } -// End of file - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/search/csearchgetsearchkeys.cpp --- a/imservices/ossprotocoladaptation/src/search/csearchgetsearchkeys.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,228 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This class handles dynamic search label-key pair storing. -* -*/ - -//For malloc -#include -//For protocol connection host -#include -//For Connection manager -#include "cossprotocolconnectionmanager.h" -#include "csearchgetsearchkeys.h" -#include "msg_enums.h" - -#include "ossprotocolpluginlogger.h" -//For Converting C style string to S60 style HBufC -#include "ossprotocoladaptutils.h" -//For open c string functions -#include - -#include - -#include -#include -#include -#include -#include - -/*! /brief Documented in header file -*/ -CSearchGetSearchKeys* CSearchGetSearchKeys::NewL( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) - { - LOGGER ( TXT("::CSearchGetSearchKeys NewL Start") ); - - CSearchGetSearchKeys* self = new ( ELeave ) CSearchGetSearchKeys( - aConnMan, aRequestId ); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - LOGGER ( TXT("::CSearchGetSearchKeys NewL End") ); - return self; - } - - -/*! /brief Documented in header file -*/ -CSearchGetSearchKeys::CSearchGetSearchKeys( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) : CActive ( EPriorityNormal ), - iRequestId ( aRequestId ), - iConnMan ( aConnMan ) - { - - LOGGER ( TXT("::CSearchGetSearchKeys Start") ); - - CActiveScheduler::Add( this ); - - LOGGER ( TXT("::CSearchGetSearchKeys End") ); - - } - -/*! /brief Documented in header file -*/ -CSearchGetSearchKeys::~CSearchGetSearchKeys() - { - - } - -/*! /brief Documented in header file -*/ -void CSearchGetSearchKeys::DoCancel() - { - - } - -/*! /brief Documented in header file -*/ -void CSearchGetSearchKeys::RunL() - { - LOGGER( TXT( "CSearchGetSearchKeys::RunL start" ) ); - - User::LeaveIfError( iStatus.Int() ); - message_hdr_resp* msg_resp = NULL; - - char* response = NULL; - CSearchKeyStore& keyStore = iConnMan.GetSearchKeyStore(); - - response = iConnMan.DataHandler().ResponseL( iSendId ); - - msg_resp = ( message_hdr_resp* ) response; - - if ( !msg_resp->response ) - { - if ( msg_resp->error_type ) - { - //Complete the request with an error - iConnMan.HandleToHost().HandleRequestCompleted( iRequestId, - KErrNotSupported ); - } - } - else - { - - { - //This part reads all the possible labels from cen rep and tries to - //match the search labels got to those.. If match found search labels - //are assigned appropriate Enum values - TInt index = sizeof( message_hdr_resp ); - char* keyStr = NULL; - RPointerArray keyList; - TInt len = 0; - - while( !( *( response + index ) == '\0' - && *( response + index + 1 ) == '\0' ) ) - { - len = strlen( response + index ) + 1; - keyStr = ( char* ) User::AllocLC( len ); - strcpy ( keyStr, response + index ); - index += len; - - HBufC* key = OssProtocolAdapUtils::ConvertCharToTUint16LC( keyStr ); - keyList.Append( key ); - CleanupStack::Pop(); //key - CleanupStack::PopAndDestroy(); //keyStr - } - - keyStore.MapLabelsToEnumL( keyList ); - } - //Send all the labels to XIMP/UI - MXIMPObjectFactory& objFact = iConnMan.HandleToHost().ObjectFactory(); - MSearchObjectFactory& searchObjFact = iConnMan.GetSearchHost().SearchObjectFactory(); - MXIMPObjectCollection* labelArray = objFact.NewObjectCollectionLC(); - - RPointerArray lablEnum = keyStore.GetSupportedEnums(); - - for ( TInt i = 0; i < lablEnum.Count(); i++ ) - { - MSearchKeyInfo* srchKey = searchObjFact.NewSearchKeyInfoLC(); - srchKey->SetType( EKey ); - srchKey->SetKey((TSearchKey) *( lablEnum[i] ) ); - labelArray->AddObjectL( srchKey );//ownership transfered - CleanupStack::Pop(); //srchKey - } - - RPointerArray label = keyStore.GetNotSupportedLabels(); - - for ( TInt i = 0; i < label.Count(); i++ ) - { - MSearchKeyInfo* srchLabel = searchObjFact.NewSearchKeyInfoLC(); - srchLabel->SetType( ELabel ); - srchLabel->SetLabelL( *( label[i] ) ); - labelArray->AddObjectL( srchLabel );//ownership transfered - CleanupStack::Pop(); //srchLabel - } - - - iConnMan.GetSearchHost().SearchFeatureDataAccess().HandleSearchKeysL ( - labelArray );//ownership transfered - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KErrNone ); - - CleanupStack::Pop( ); //labelArray - } - - free( response ); - - LOGGER( TXT( "CSearchGetSearchKeys::RunL end" ) ); - delete this; - - } - -/*! /brief Documented in header file -*/ -TInt CSearchGetSearchKeys::RunError( TInt aError ) - { - LOGGER( TXT( "CSearchGetSearchKeys::RunError start" ) ); - - iConnMan.HandleToHost().HandleRequestCompleted( iRequestId, aError ); - - LOGGER( TXT( "CSearchGetSearchKeys::RunError end" ) ); - - return 0; - } - -/*! /brief Documented in header file -*/ -void CSearchGetSearchKeys::ConstructL() - { - - } - -/*! /brief Documented in header file -*/ -void CSearchGetSearchKeys::GetSearchKeysL() - { - LOGGER ( TXT("::CSearchGetSearchKeys GetSearchKeysL Start") ); - - TInt len = sizeof ( message_hdr_req ); - message_hdr_req* msgHdr = ( message_hdr_req* ) User::AllocLC( len ); - - msgHdr->message_type = ESearch_Get_Keys; - - iSendId = iConnMan.DataHandler().SendDataL( iStatus, ( char* )msgHdr, - len ); - - SetActive(); - - CleanupStack::PopAndDestroy ( 1 );//msgHdr - - LOGGER ( TXT("::CSearchGetSearchKeys GetSearchKeysL End") ); - } - -// End of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/search/csearchkeystore.cpp --- a/imservices/ossprotocoladaptation/src/search/csearchkeystore.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,227 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This class handles dynamic search label-key pair storing. -* -*/ - - -#include "csearchkeystore.h" -#include "ossprotocolpluginlogger.h" - -/*! /file -* /brief Implimentation of interfaces defined in csearchkeystore.h -*/ - -/*! /brief documented in the header file -*/ -CSearchKeyStore* CSearchKeyStore::NewL() - { - LOGGER ( TXT("::CSearchKeyStore NewL Start") ); - - CSearchKeyStore* self = new ( ELeave ) CSearchKeyStore; - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - - LOGGER ( TXT("::CSearchKeyStore NewL End") ); - return self; - - } - -/*! /brief documented in the header file -*/ -CSearchKeyStore::CSearchKeyStore() - { - - } - -/*! /brief documented in the header file -*/ -CSearchKeyStore::~CSearchKeyStore() - { - LOGGER ( TXT("::CSearchKeyStore ~CSearchKeyStore Start") ); - - //Close the hash map - // any leaks here? - iEnumLabels.Close(); - - // any leaks here? - //Close the hash map - iSupportedLabels.Close(); - - - //reset and destroy - iNotSupportedLabels.ResetAndDestroy(); - - delete iLabelKeyHashRep; - - LOGGER ( TXT("::CSearchKeyStore ~CSearchKeyStore End") ); - } - -/*! /brief documented in the header file -*/ -void CSearchKeyStore::MapLabelsToEnumL( RPointerArray& aLabels ) - { - LOGGER ( TXT("::CSearchKeyStore MapLabelsToEnum Start") ); - - RArray enumBool; - //TO avoid excessive computation, we mark enumBool[i] if - //a label is already attched to that enum - for ( TInt i = 0; i < iEnumLabels.Count(); i++ ) - { - //unmark all of it - enumBool.Append( 0 ); - } - - for ( TInt i = 0; i < aLabels.Count(); i++ ) - { - //Boolean to say if the label we are matching is supported - TBool supported = EFalse; - - //Iterate thru the hash table of cenrep labels - THashMapIter iter( iEnumLabels ); - //Initialize to 0 - TInt j = 0; - //Loop till thr is a key - while( NULL != iter.NextKey() ) - { - //Check if a label has been assigned to the enum - if ( enumBool[j] ) - { - j++; - continue; - } - //If not - //Get the possible labels for this enum from cen rep - TPtr16 bufPtr = *(iter.CurrentValue()); - - TBuf<1024> buf; - //LC is not leaving/cleanup - //It converts the aLabels to lower case - buf.CopyLC( *( aLabels[i] ) ); - - //Match if the current label from isoserver is in the enum labels - TInt match = bufPtr.Find( buf ); - - if ( KErrNotFound != match ) - { - //If a match is found, mark the corresponding enum - enumBool[j] = 1; - TSearchKey enumvalue = ( TSearchKey )*( iter.CurrentKey() ); - //Add to supported labels hash key and label - iSupportedLabels.InsertL( enumvalue, - aLabels[i]->AllocL()->Des() ); - //Set the flag as supported, so that it is not added in - //not supported label - supported = ETrue; - //Break from the loop - //Get next label try to match to the cen rep labels(supported enums) - break; - } - //update the enum index tracker - j++; - } - //If the label has not matched to any of the supported enum labels - //add that to not supported list - if ( EFalse == supported ) - { - //Add to not supported labels - iNotSupportedLabels.Append( ( aLabels[i]->AllocL() ) ); - } - - - } - - LOGGER ( TXT("::CSearchKeyStore MapLabelsToEnum End") ); - } - -/*! /brief documented in the header file -*/ -HBufC* CSearchKeyStore::GetLabelFromEnumL( TSearchKey aEnum ) - { - LOGGER ( TXT("::CSearchKeyStore GetLabelFromEnum Start") ); - - TPtr* buf = NULL; - //Find if the labels corresponding to enum is there - //and return the alloced label. - //Ownership is transfered to the callee - buf = iSupportedLabels.Find( aEnum ); - if ( buf ) - { - return buf->AllocL(); - } - - LOGGER ( TXT("::CSearchKeyStore GetLabelFromEnum End") ); - - return NULL; - - } - -/*! /brief documented in the header file -*/ -void CSearchKeyStore::ConstructL() - { - LOGGER ( TXT("::CSearchKeyStore ConstructL Start") ); - - iLabelKeyHashRep = CRepository::NewL( KLabelKeyStoreHash ); - TBuf<1024> buf; - - //Read all the labels supported for localization from cen rep - //and have a map for the enum and search field - for ( TInt i = 0; i < NO_OF_KEYS_SUPPORTED; i++ ) - { - iLabelKeyHashRep->Get( ( TSearchKey )( i ), buf ); - iEnumLabels.InsertL( ( TSearchKey )( EUserFirstName + i ), buf.AllocL()->Des() ); - } - - LOGGER ( TXT("::CSearchKeyStore ConstructL End") ); - } -/*! /brief Get the supported enums -* /return An array of pointers to the supported enums -*/ -RPointerArray CSearchKeyStore::GetSupportedEnums() - { - LOGGER ( TXT("::CSearchKeyStore GetSupportedEnums Start") ); - - RPointerArray supportedEnums; - THashMapIter iter( iSupportedLabels ); - - while ( NULL != iter.NextKey() ) - { - - supportedEnums.Append( ( TSearchKey* )iter.CurrentKey() ); - - } - - LOGGER ( TXT("::CSearchKeyStore GetSupportedEnums End") ); - - return supportedEnums; - - } - -/*! /brief This function returns a handle to the array of not -* supported label strings. Not supported here means that -* there are no logical strings in UI for these labels -* /return const handle to not supported strings -*/ - -const RPointerArray CSearchKeyStore::GetNotSupportedLabels() - { - LOGGER ( TXT("::CSearchKeyStore GetNotSupportedLabels Start") ); - - return iNotSupportedLabels; - } -//End of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/search/csearchrequest.cpp --- a/imservices/ossprotocoladaptation/src/search/csearchrequest.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,417 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Search implementation -* -*/ - - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "stringutils.h" - -#include "msg_enums.h" -#include "waittimer.h" -#include "msgliterals.h" -#include "ossprotocoladaptutils.h" -#include "csearchrequest.h" -#include "mossprotocolconnectionmanager.h" -#include "ossprotocolpluginlogger.h" - -#include "cossprotocolconnectionmanager.h" - - -// search strings used -const char* FirstName ="first_name"; -const char* LastName ="last_name"; -const char* UserId ="user_id"; -const char* Jid ="jid"; - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CSearchrequest::CSearchrequest -// --------------------------------------------------------------------------- -// -CSearchrequest::CSearchrequest( MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) : - CActive( EPriorityNormal ), - iRequestId( aRequestId ), - iConnMan( aConnMan ) - { - LOGGER ( TXT("::CSearchrequest Start") ); - CActiveScheduler::Add( this ); - - LOGGER ( TXT("::CSearchrequest End") ); - } - - -// --------------------------------------------------------------------------- -// CSearchrequest::ConstructL -// --------------------------------------------------------------------------- -// -void CSearchrequest::ConstructL() - { - LOGGER ( TXT("CSearchrequest::ConstructL Start-End") ); - - iSearchId=NULL; - } - - -// --------------------------------------------------------------------------- -// CSearchrequest::NewLC -// --------------------------------------------------------------------------- -// -CSearchrequest* CSearchrequest::NewLC( - MOSSProtocolConnectionManager& aConnMan, - TXIMPRequestId aRequestId ) - { - LOGGER ( TXT("CSearchrequest::NewLC Start") ); - - CSearchrequest* self = new( ELeave ) - CSearchrequest( aConnMan, aRequestId ); - CleanupStack::PushL( self ); - self->ConstructL(); - - LOGGER ( TXT("CSearchrequest::NewLC End") ); - return self; - } - -// --------------------------------------------------------------------------- -// CSearchrequest::~CSearchrequest -// --------------------------------------------------------------------------- -// -CSearchrequest::~CSearchrequest() - { - LOGGER ( TXT("::~CSearchrequest Start") ); - delete iSearchId; - iSearchId=NULL; - - CActive::Cancel(); - - LOGGER ( TXT("::~CSearchrequest End") ); - } - - -// --------------------------------------------------------------------------- -// CSearchrequest::DoCancel() -// --------------------------------------------------------------------------- -// -void CSearchrequest::DoCancel() - { - LOGGER ( TXT("CSearchrequest::DoCancel Start") ); - LOGGER ( TXT("CSearchrequest::DoCancel End") ); - } - - -// --------------------------------------------------------------------------- -// CSearchrequest::RunL() -// --------------------------------------------------------------------------- -// -void CSearchrequest::RunL() - { - LOGGER ( TXT("CSearchrequest::RunL Start") ); - User::LeaveIfError ( iStatus.Int() ); - - int len = MAX_SIZE_DATA; - char* pResponse = NULL, *pOrigResponse = NULL;; - char* key = NULL; - - MXIMPObjectFactory& objFact = iConnMan.HandleToHost().ObjectFactory(); - MSearchObjectFactory& searchObjFact = iConnMan.GetSearchHost().SearchObjectFactory(); - MXIMPIdentity* identity = objFact.NewIdentityLC(); - MXIMPObjectCollection* fieldlist = objFact.NewObjectCollectionLC(); - - TInt datacount = iConnMan.DataHandler().SearchDataCount(); - - while( datacount ) - { - LOGGER ( TXT("CONTACT NO : %d"), datacount ); - pOrigResponse =pResponse = iConnMan.DataHandler().ResponseL ( 5 ); - CleanupStack::PushL(pOrigResponse) ; - MSearchInfo* searchInfo = searchObjFact.NewSearchInfoLC(); - pResponse += sizeof ( message_hdr_resp ); - len = strlen(pResponse) + 1; - while( !( *(pResponse) == '\0' && *(pResponse + 1) == '\0' )) - { - len = strlen(pResponse) + 1; - key = ( char* ) User::AllocLC(len); - strcpy(key,pResponse); - pResponse += len; - len = strlen(pResponse) + 1; - if( strcmp(key,FirstName) == 0) - { - LOGGER ( TXT("FIRSTNAME :") ); - ParseAndSetL(pResponse,len,*searchInfo, EFirstName); - } - else if( strcmp(key,LastName) == 0 ) - { - LOGGER ( TXT("LASTNAME :")); - ParseAndSetL(pResponse,len,*searchInfo, ELastName); - } - else if( strcmp(key,Jid) == 0 ) - { - LOGGER ( TXT("JID :") ); - ParseAndSetL(pResponse,len,*searchInfo, EEmailAddress); - } - pResponse += len; - CleanupStack::PopAndDestroy ();// key - } - fieldlist->AddObjectL ( searchInfo ); - CleanupStack::Pop();//searchInfo - CleanupStack::PopAndDestroy(pOrigResponse) ;//pOrigResponse - datacount = iConnMan.DataHandler().SearchDataCount(); - } - iConnMan.DataHandler().ResponseL ( 5 ); // this removes the operation from the array - identity->SetIdentityL(*iSearchId ); - iConnMan.GetSearchHost().SearchFeatureDataAccess().HandleSearchResultsL ( identity,fieldlist ); - iConnMan.HandleToHost().HandleRequestCompleted ( iRequestId, KErrNone ); - CleanupStack::Pop ( 2 );//identity,fieldlist - delete this; - - LOGGER ( TXT("CSearchrequest::RunL End") ); - } - -// --------------------------------------------------------------------------- -// CSearchrequest::RunError -// --------------------------------------------------------------------------- -// -TInt CSearchrequest::RunError( TInt aError ) - { - LOGGER ( TXT("CSearchrequest::RunError : %d Start"), aError ); - - iConnMan.HandleToHost().HandleRequestCompleted( iRequestId, aError ); - TRAP_IGNORE(iConnMan.DataHandler().ResponseL ( 5 )); // this removes the operation from the array - delete this; - LOGGER ( TXT("CSearchrequest::RunError End") ); - return KErrNone; - } - -// --------------------------------------------------------------------------- -// CSearchrequest::SearchL -// --------------------------------------------------------------------------- -// -void CSearchrequest::SearchL( const MXIMPIdentity& aSearchId, - const RPointerArray< MSearchElement >& aObjs, - TInt /*aSearchLimit*/) - { - LOGGER ( TXT("CSearchrequest::SearchL Start") ); - char *smsg = NULL; - char *tmpmsg = NULL; - message_hdr_req msgHdr = {0,}; - int userLen = 0; - int totalLen = 0; - smsg = ( char* ) User::AllocLC(MAX_MSG_SIZE); - memset ( smsg, '\0', MAX_MSG_SIZE ); - msgHdr.message_type = ESearch; - memcpy ( smsg, &msgHdr, sizeof ( message_hdr_req ) ); - - HBufC* keyStr = NULL;//HBufC::NewL( 1024 ); - - CSearchKeyStore& keyStore = iConnMan.GetSearchKeyStore(); - - totalLen += sizeof( message_hdr_req ); - - TInt elementCount=aObjs.Count(); - - for (TInt i=0; i< elementCount; ++i) - { - const MSearchElement* searchElement = aObjs[i]; - - switch( searchElement->GetSearchKey() ) - { - case EUserFirstName: - { - keyStr = keyStore.GetLabelFromEnumL( EUserFirstName ); - - break; - } - - case EUser: - { - keyStr = keyStore.GetLabelFromEnumL( EUser ); - - break; - } - - case EUserLastName: - { - keyStr = keyStore.GetLabelFromEnumL( EUserLastName ); - - break; - } - - case EUserMiddleName: - { - keyStr = keyStore.GetLabelFromEnumL( EUserMiddleName ); - - break; - } - - case EUserFullName: - { - keyStr = keyStore.GetLabelFromEnumL( EUserFullName ); - - break; - } - - case EUserCountry: - { - keyStr = keyStore.GetLabelFromEnumL( EUserCountry ); - - break; - } - - case EUserCity: - { - keyStr = keyStore.GetLabelFromEnumL( EUserCity ); - - break; - } - - case EBirthday: - { - keyStr = keyStore.GetLabelFromEnumL( EBirthday ); - - break; - } - - case EState: - { - keyStr = keyStore.GetLabelFromEnumL( EState ); - - break; - } - - case EUserEmailAddress: - { - keyStr = keyStore.GetLabelFromEnumL( EUserEmailAddress ); - - break; - } - - case EUserNickName: - { - keyStr = keyStore.GetLabelFromEnumL( EUserNickName ); - - break; - } - - case EOrganisation: - { - keyStr = keyStore.GetLabelFromEnumL( EOrganisation ); - - break; - } - - case EOrganisationUnit: - { - keyStr = keyStore.GetLabelFromEnumL( EOrganisationUnit ); - - break; - } - - case EReadLabel: - { - //If key is not supported(case of not localized string) - keyStr = searchElement->GetSearchLabel().Identity().AllocL(); - - break; - } - default: - { - //If any other case just continue with next one - continue; - } - } - - if ( NULL == keyStr ) - { - continue; - } - //Add key - CleanupStack::PushL( keyStr ); - - charFormatData tmpmsgData = OssProtocolAdapUtils::ConvertTUint16ToCharLC( *keyStr ); - tmpmsg = tmpmsgData.data; - userLen = tmpmsgData.dataSize; - - if ( totalLen + userLen > MAX_MSG_SIZE ) - { - User::Leave(KErrArgument); - } - - memcpy ( smsg + totalLen, tmpmsg, userLen ); - - totalLen += userLen; - - //Add value - - - - charFormatData tmpmsgDataValue = OssProtocolAdapUtils::ConvertTUint16ToCharLC( - searchElement->GetSearchId().Identity() ); - - tmpmsg = tmpmsgDataValue.data; - userLen = tmpmsgDataValue.dataSize; - - if ( totalLen + userLen > MAX_MSG_SIZE ) - { - User::Leave(KErrArgument); - } - - memcpy ( smsg + totalLen, tmpmsg, userLen ); - - totalLen += userLen; - - CleanupStack::PopAndDestroy ( 3 );//For keyStr, tmpmsgData, tmpmsgDataValue - - } // end : for loop - iSendId = iConnMan.DataHandler().SendDataL ( iStatus, smsg, totalLen++ ); - - delete iSearchId; - iSearchId=NULL; - iSearchId=aSearchId.Identity().AllocL(); - // signal the scheduler - SetActive(); - CleanupStack::PopAndDestroy ( 1 );//smsg - LOGGER ( TXT("CSearchrequest::SearchL End") ); - - } - -// --------------------------------------------------------------------------- -// CSearchrequest::SearchUtil -// --------------------------------------------------------------------------- -// -void CSearchrequest::ParseAndSetL(char* aResponse, TInt /*alen*/, MSearchInfo& aSearchInfo, TInfoType aKeytype) - { - char* keyvalue = aResponse; - HBufC16* key_value = OssProtocolAdapUtils::ConvertCharToTUint16LC( keyvalue ); - aSearchInfo.SetFieldInfoL(*key_value,aKeytype); - CleanupStack::PopAndDestroy( key_value ); - } - -// End of file - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/src/waittimer.cpp --- a/imservices/ossprotocoladaptation/src/waittimer.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1150 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: oss protocol plugin im features -* -*/ - - -#include "waittimer.h" -#include "cosssenddataoperation.h" -#include "msgliterals.h" -#include "msg_enums.h" -#include -#include "ossprotocloliterals.h" -#include "stringutils.h" -#include "ossadappanics.h" -#include -#include -#include -#include "ossprotocolpluginlogger.h" -#include -#include "mossprotocolconnectionmanager.h" -#include "cossprotocolconnectionmanager.h" -#include -#include -#include -#include -#include "ossprotocoladaptutils.h" -// CONSTANTS -const TInt KOpIdInitvalue = 1000; - -#define KTimerInterval 50000 - -#define ONE_K_OPENC_FIX 1020 -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------------------------- -// CWaitTimer::COSSProtocolImFeatures() -// --------------------------------------------------------------------------- -// -CWaitTimer::CWaitTimer (MOSSProtocolConnectionManager& aConnMan) : - CActive ( EPriorityHigh ), // Standard priority - iOpidIterator ( KOpIdInitvalue ), iOpId ( 5 ),iConnMan ( aConnMan ), - iResponseMsgQCreated(EFalse),iServerDisconnected(EFalse), - iFetchingStep(EDataFetchingStep1) // -2 for fetching all three types of contacts - { - CActiveScheduler::Add ( this ); // Add to scheduler - } - - -// --------------------------------------------------------------------------- -// CWaitTimer::NewL() -// --------------------------------------------------------------------------- -// -CWaitTimer* CWaitTimer::NewL (MOSSProtocolConnectionManager& aConnMan) - { - CWaitTimer* self = new ( ELeave ) CWaitTimer (aConnMan); - CleanupStack::PushL ( self ); - self->ConstructL (); - CleanupStack::Pop (); // self; - return self; - } - -// --------------------------------------------------------------------------- -// CWaitTimer::ConstructL() -// --------------------------------------------------------------------------- -// -void CWaitTimer::ConstructL() - { - User::LeaveIfError( iTimer.CreateLocal() ); - } - -// --------------------------------------------------------------------------- -// CWaitTimer::~CWaitTimer() -// --------------------------------------------------------------------------- -// -CWaitTimer::~CWaitTimer() - { - LOGGER ( TXT ( "CWaitTimer::~CWaitTimer start" ) ); - TInt error = 0; - MsgQDelete ( REQUEST_QUEUE, &error ); - MsgQDelete ( RESPONSE_QUEUE, &error ); - iIncomingData.ResetAndDestroy(); - iIncomingMsg.ResetAndDestroy(); - iIncomingPres.ResetAndDestroy(); - iIncomingServerError.ResetAndDestroy(); - iAddNotification.ResetAndDestroy(); - if (iIncReqStatus) - { - User::RequestComplete( iIncReqStatus, KErrCancel ); - iIncReqStatus = NULL; - } - if (iIncMsgReqStatus) - { - User::RequestComplete( iIncMsgReqStatus, KErrCancel ); - iIncMsgReqStatus = NULL; - } - if (iIncPresReqStatus) - { - User::RequestComplete( iIncPresReqStatus, KErrCancel ); - iIncPresReqStatus = NULL; - } - if (iIncAddReqStatus) - { - User::RequestComplete( iIncAddReqStatus, KErrCancel ); - iIncAddReqStatus = NULL; - } - CancelContactsChangeListening(); - Cancel (); // Cancel any request, if outstanding - iTimer.Close (); // Destroy the RTimer object - iOperations.ResetAndDestroy(); - iSearchElements.ResetAndDestroy(); - iContactChangeList.ResetAndDestroy(); - LOGGER ( TXT ( "CWaitTimer::~CWaitTimer end" ) ); - - } - -// --------------------------------------------------------------------------- -// CWaitTimer::DoCancel() -// --------------------------------------------------------------------------- -// -void CWaitTimer::DoCancel() - { - iTimer.Cancel (); - } - -// ---------------------------------------------------------------------------- -// CWaitTimer::IncreaseOpId -// ---------------------------------------------------------------------------- -void CWaitTimer::IncreaseOpId( ) - { - - iOpId++; - - } - - -// ---------------------------------------------------------------------------- -// CWaitTimer::GetOpId -// ---------------------------------------------------------------------------- -TInt CWaitTimer::GetOpId( ) - { - - return iOpId; - } -// ---------------------------------------------------------------------------- -// CWaitTimer::IsFetchingContinue -// ---------------------------------------------------------------------------- -TInt CWaitTimer::IsFetchingContinue( ) - { - - return iFetchingContinue; - - } - -// ----------------------------------------------------------------------------- -// CWaitTimer::SendDataL() -// ----------------------------------------------------------------------------- -// -TInt CWaitTimer::SendDataL ( TRequestStatus& aStatus, char* msg, TInt nBytes ) - { - int result; - int err = 0; - int timeout = NO_WAIT; - LOGGER ( TXT ( "CWaitTimer::SendData start" ) ); - // allocate slot in array by adding NULL pointer and removing it - iOperations.AppendL ( NULL ); - iOperations.Remove ( iOperations.Count() - 1 ); - COssSendDataOperation* operation = - COssSendDataOperation::NewLC(); - operation->SetIds ( iOpId, iOpidIterator++ ); - iOperations.Append ( operation ); - CleanupStack::Pop ( operation ); // operation - // now it is safe to set request status - operation->SetRequestStatus ( aStatus ); - aStatus = KRequestPending; - /* Try to Create queueOne - */ - message_hdr_req* msgHdr = ( message_hdr_req* ) msg; - result = MsgQCreate ( REQUEST_QUEUE, MAX_MSG_Q_SIZE , MSG_Q_FIFO, &err ); - User::LeaveIfError ( result ); - /* Send Message to queueOne */ - if ( msgHdr->message_type == EUpdateOwnAvtar ) - { - TInt header_size = sizeof( message_hdr_req ); - char* one_pdu = ( char* ) User::AllocLC ( ONE_K_OPENC_FIX ); - //run a loop for rest of the data and keep track of the case of nBytes being - //multiple of 1020 - sizeof(msghdr) and it being not - //Amount of payload that can be sent - TInt single_read = ONE_K_OPENC_FIX - header_size; - //Data recieved from PublishOwnPresenceL has message header at begining - TInt actual_data = nBytes - header_size; - //No of packets needed to send the image data - TInt total_packets = (TInt)ceil( ( double ) ( actual_data ) / single_read ); - //This offset moves thru the msg pointer - TInt navigate_offset = header_size; - message_hdr_req msg_hdr; - memset( (void*)&msg_hdr, '\0', header_size ); - msg_hdr.message_type = EUpdateOwnAvtar; - for ( TInt i = 0; i < total_packets; i++ ) - { - //till the last packet size_tobe_sent will be ONE_K_OPENC_FIX - //last packet data is actual_data % single_read if less than single_read else ONE_K_OPENC_FIX - TInt size_tobe_sent = ( i < total_packets - 1 ) ? ONE_K_OPENC_FIX : - ( actual_data % single_read ? - actual_data % single_read + header_size : ONE_K_OPENC_FIX ); - - if ( i < total_packets - 1 ) - { - msg_hdr.continue_flag = 1; - } - else - { - msg_hdr.continue_flag = 0; - } - - //memcpy ( msg + header_size , msg + navigate_offset, size_tobe_sent - header_size ); - memcpy( one_pdu , &msg_hdr, header_size ); - memcpy( one_pdu + header_size, msg + navigate_offset, size_tobe_sent - header_size ); - result = MsgQSend ( REQUEST_QUEUE, one_pdu, size_tobe_sent, - MSG_PRI_NORMAL, timeout, &err ); - User::LeaveIfError ( result ); - navigate_offset += single_read; - } - CleanupStack::PopAndDestroy( one_pdu ); - one_pdu = NULL; - } - else - { - result = MsgQSend ( REQUEST_QUEUE, msg, nBytes, MSG_PRI_NORMAL, timeout, &err ); - - User::LeaveIfError ( result ); - } - LOGGER ( TXT ( "CWaitTimer::SendData end" ) ); - - return iOpId; - - } -// ----------------------------------------------------------------------------- -// CWaitTimer::ListenConatcsChange() //contacts -// ----------------------------------------------------------------------------- -// -void CWaitTimer::ListenContactsChange ( TRequestStatus& aStatus ) - { - LOGGER ( TXT ( "CWaitTimer::ListenContactsChange Start" ) ); - - if ( !iContactsChangeStatus ) - { - iContactsChangeStatus = &aStatus; - aStatus = KRequestPending; - } - LOGGER ( TXT ( "CWaitTimer::ListenContactsChange End" ) ); - } - -// ----------------------------------------------------------------------------- -// CWaitTimer::CancelListening() -// ----------------------------------------------------------------------------- -// -void CWaitTimer::CancelContactsChangeListening() - { - LOGGER ( TXT ( "CWaitTimer::CancelContactsChangeListening Start" ) ); - - if ( iContactsChangeStatus ) - { - User::RequestComplete ( iContactsChangeStatus, KErrCancel ); - iContactsChangeStatus = NULL; - } - - LOGGER ( TXT ( "CWaitTimer::CancelContactsChangeListening End" ) ); - } - - -// ----------------------------------------------------------------------------- -// CWaitTimer::ListenIncomingData() //contacts -// ----------------------------------------------------------------------------- -// -void CWaitTimer::ListenIncomingData ( TRequestStatus& aStatus ) - { - LOGGER ( TXT ( "CWaitTimer::ListenIncomingData Start" ) ); - - if ( !iIncReqStatus ) - { - iIncReqStatus = &aStatus; - aStatus = KRequestPending; - } - } - -// ----------------------------------------------------------------------------- -// CWaitTimer::IncomingDataCount() //contacts -// ----------------------------------------------------------------------------- -// -TInt CWaitTimer::IncomingDataCount() - { - LOGGER ( TXT ( "CWaitTimer::IncomingDataCount Start" ) ); - - return iIncomingData.Count(); - } -// ----------------------------------------------------------------------------- -// CWaitTimer::SearchDataCount() //Searched data -// ----------------------------------------------------------------------------- -// -TInt CWaitTimer::SearchDataCount() - { - return iSearchElements.Count(); - } -// ----------------------------------------------------------------------------- -// CWaitTimer::ContactsChangeResponseCount() //Searched data -// ----------------------------------------------------------------------------- -// -TInt CWaitTimer::ContactsChangeResponseCount() - { - return iContactChangeList.Count(); - } -// ----------------------------------------------------------------------------- -// CWaitTimer::CancelListening() -// ----------------------------------------------------------------------------- -// -void CWaitTimer::CancelListening() - { - LOGGER ( TXT ( "CWaitTimer::CancelListening Start" ) ); - - if ( iIncReqStatus ) - { - User::RequestComplete ( iIncReqStatus, KErrCancel ); - iIncReqStatus = NULL; - } - - LOGGER ( TXT ( "CWaitTimer::CancelListening End" ) ); - } - -// ----------------------------------------------------------------------------- -// CWaitTimer::ListenIncomingMsg() // messages -// ----------------------------------------------------------------------------- -// -TInt CWaitTimer::ListenIncomingMsg ( TRequestStatus& aStatus ) - { - LOGGER ( TXT ( "CWaitTimer::ListenIncomingMsg Start" ) ); - - if ( !iIncMsgReqStatus ) - { - iIncMsgReqStatus = &aStatus; - aStatus = KRequestPending; - } - - LOGGER ( TXT ( "CWaitTimer::ListenIncomingMsg End Count is %d" ), iIncomingMsg.Count() ); - - return iIncomingMsg.Count(); - } - -// ----------------------------------------------------------------------------- -// CWaitTimer::ListenIncomingPresenceL() // presence notifications -// ----------------------------------------------------------------------------- -// -TInt CWaitTimer::ListenIncomingPresence ( TRequestStatus& aStatus ) - { - LOGGER ( TXT ( "CWaitTimer::ListenIncomingPresence Start" ) ); - - if ( !iIncPresReqStatus ) - { - iIncPresReqStatus = &aStatus; - aStatus = KRequestPending; - } - - LOGGER ( TXT ( "CWaitTimer::ListenIncomingPresence End Count is %d" ), iIncomingPres.Count() ); - - return iIncomingPres.Count(); - } -// ----------------------------------------------------------------------------- -// CWaitTimer::ListenAddNotification() // Add contact notifications -// ----------------------------------------------------------------------------- -// -TInt CWaitTimer::ListenAddNotification ( TRequestStatus& aStatus ) - { - LOGGER ( TXT ( "CWaitTimer::ListenAddNotification Start" ) ); - - if ( !iIncAddReqStatus ) - { - iIncAddReqStatus = &aStatus; - aStatus = KRequestPending; - } - - LOGGER ( TXT ( "CWaitTimer::ListenAddNotification End Count is %d" ), iAddNotification.Count() ); - - return iAddNotification.Count(); - } -// ----------------------------------------------------------------------------- -// CWaitTimer::ListenIncomingServerError() // presence notifications -// ----------------------------------------------------------------------------- -// -TInt CWaitTimer::ListenIncomingServerError ( TRequestStatus& aStatus ) - { - LOGGER ( TXT ( "CWaitTimer::ListenIncomingServerError Start" ) ); - - if ( !iIncErrorReqStatus ) - { - iIncErrorReqStatus = &aStatus; - aStatus = KRequestPending; - } - - LOGGER ( TXT ( "CWaitTimer::ListenIncomingServerError End Count is %d" ), iIncomingServerError.Count() ); - - return iIncomingServerError.Count(); - } -// CWaitTimer::CancelListeningMsg() -// ----------------------------------------------------------------------------- -// -void CWaitTimer::CancelListeningMsg() - { - LOGGER ( TXT ( "CWaitTimer::CancelListening Start" ) ); - - if ( iIncMsgReqStatus ) - { - User::RequestComplete ( iIncMsgReqStatus, KErrCancel ); - iIncMsgReqStatus = NULL; - } - - LOGGER ( TXT ( "CWaitTimer::CancelListening End" ) ); - } -// ----------------------------------------------------------------------------- -// CWaitTimer::CancelListeningPres() -// ----------------------------------------------------------------------------- -// -void CWaitTimer::CancelListeningPres() - { - LOGGER ( TXT ( "CWaitTimer::CancelListeningPres Start" ) ); - - if ( iIncPresReqStatus ) - { - User::RequestComplete ( iIncPresReqStatus, KErrCancel ); - iIncPresReqStatus = NULL; - } - - LOGGER ( TXT ( "CWaitTimer::CancelListeningPres End" ) ); - } -// ----------------------------------------------------------------------------- -// CWaitTimer::CancelListeningAddNotication() -// ----------------------------------------------------------------------------- -// -void CWaitTimer::CancelListeningAddNotication() - { - LOGGER ( TXT ( "CWaitTimer::CancelListeningAddNotication Start" ) ); - - if ( iIncAddReqStatus ) - { - User::RequestComplete ( iIncAddReqStatus, KErrCancel ); - iIncAddReqStatus = NULL; - } - - LOGGER ( TXT ( "CWaitTimer::CancelListeningAddNotication End" ) ); - } -// ----------------------------------------------------------------------------- -// CWaitTimer::CancelListeningServerErrors() -// ----------------------------------------------------------------------------- -// -void CWaitTimer::CancelListeningServerErrors() - { - LOGGER ( TXT ( "CWaitTimer::CancelListeningServerErrors Start" ) ); - - if ( iIncErrorReqStatus ) - { - User::RequestComplete ( iIncErrorReqStatus, KErrCancel ); - iIncErrorReqStatus = NULL; - } - - LOGGER ( TXT ( "CWaitTimer::CancelListeningServerErrors End" ) ); - } - -// ----------------------------------------------------------------------------- -// CWaitTimer::StartListeningL() -// ----------------------------------------------------------------------------- -// - -void CWaitTimer::StartListeningL() - { - LOGGER ( TXT ( "CWaitTimer::StartListening Start" ) ); -// Cancel (); // Cancel any request, just to be sure -// iProperty.Subscribe(iStatus); - iTimer.After ( iStatus, KTimerInterval ); - SetActive (); // Tell scheduler a request is active - LOGGER ( TXT ( "CWaitTimer::StartListening End" ) ); - - } - -// ----------------------------------------------------------------------------- -// CWaitTimer::RunL() -// ----------------------------------------------------------------------------- -// - -void CWaitTimer::RunL() - { - - int timeout = IPC_NOWAIT; //TIME_OUT; - int err = 0; - int status = 0; - int size_msg = sizeof ( message_hdr_resp ); - TBool msgreadcontinue = EFalse; - message_hdr_resp* msg_struct = NULL; - char* rmsg = NULL; - - if( !iResponseMsgQCreated ) - { - status = MsgQCreate ( RESPONSE_QUEUE, MAX_MSG_Q_SIZE, MSG_Q_FIFO, &err ); - iResponseMsgQCreated = ETrue; - } - - if(-1 == status) - { - LOGGER ( TXT ( "CWaitTimer::leave " ) ); - User::Leave( status ); - } - do - { - rmsg = ( char* ) User::AllocLC ( MAX_MSG_SIZE ); - - // Receive Message from queueTwo - - status = MsgQReceive ( RESPONSE_QUEUE, rmsg, MAX_MSG_SIZE, timeout, &err ); - User::LeaveIfError ( err ); - //size should be atleast size of message_hdr_resp - if( -1 == status ) - { - CleanupStack::PopAndDestroy ( rmsg ); - } - - if ( status >= size_msg ) - { - LOGGER ( TXT ( "CWaitTimer::MsgQReceive responce recvd" ) ); - msg_struct = ( message_hdr_resp* )rmsg ; - LOGGER ( TXT ( "CWaitTimer::data recvd of type %d" ), msg_struct->hdr_req.message_type ); - - switch( msg_struct->hdr_req.message_type ) - { - TInt operationindex; - case EText_Message_Receive: - { - LOGGER ( TXT ( "CWaitTimer::EText_Message_Receive" ) ); - // complete prfw request - iIncomingMsg.AppendL ( rmsg ); - if ( iIncMsgReqStatus ) - { - User::RequestComplete ( iIncMsgReqStatus, KErrNone ); - iIncMsgReqStatus = NULL; - } - CleanupStack::Pop( rmsg ); - break; - } - case EPresenceNotification: - { - - LOGGER ( TXT ( "CWaitTimer::EPresence_Notification_Received" ) ); - // complete prfw request - // iIncomingPres.AppendL ( rmsg ); - iIncomingPres.Insert (rmsg,0); - if ( iIncPresReqStatus ) - { - User::RequestComplete ( iIncPresReqStatus, KErrNone ); - iIncPresReqStatus = NULL; - } - CleanupStack::Pop( rmsg ); - break; - } - case ETrying_To_Add_Contact_Publish: - { - LOGGER ( TXT ( "CWaitTimer::ETrying_To_Add_Contact" ) ); - // complete prfw request - iAddNotification.AppendL ( rmsg ); - if ( iIncAddReqStatus ) - { - User::RequestComplete ( iIncAddReqStatus, KErrNone ); - iIncAddReqStatus = NULL; - } - CleanupStack::Pop( rmsg ); - break; - } - case ESubscribe_Remote_Pending: - case ETrying_To_Add_Contact_Known: - { - LOGGER ( TXT ( "CWaitTimer::Sync of contacts state" ) ); - iContactChangeList.Append(rmsg); - if ( iContactsChangeStatus ) - { - User::RequestComplete ( iContactsChangeStatus, KErrNone ); - iContactsChangeStatus = NULL; - } - CleanupStack::Pop( rmsg ); - break; - } - - case ESubscribe_RP_Accepted: - { - CleanupStack::PopAndDestroy( rmsg ); - break; - } - case EPublish_RP_Accepted: - { - CleanupStack::PopAndDestroy( rmsg ); - break; - } - case EPublish_Removed_Or_Rejected: - { - LOGGER ( TXT ( "CWaitTimer::Sync of contacts state" ) ); - iContactChangeList.Append(rmsg); - if ( iContactsChangeStatus ) - { - User::RequestComplete ( iContactsChangeStatus, KErrNone ); - iContactsChangeStatus = NULL; - } - CleanupStack::Pop( rmsg ); - break; - } - case ESubscribe_Removed_Or_Rejected: - { - LOGGER ( TXT ( "CWaitTimer::Sync of contacts state" ) ); - iContactChangeList.Append(rmsg); - if ( iContactsChangeStatus ) - { - User::RequestComplete ( iContactsChangeStatus, KErrNone ); - iContactsChangeStatus = NULL; - } - CleanupStack::Pop( rmsg ); - break; - } - case ECurrent_Member_Contacts: - { - iFetchingContinue = EFalse; - // complete ximpfw request - iIncomingData.AppendL ( rmsg ); - if(msg_struct->continue_flag == 1) - { - iFetchingContinue = ETrue; - } - else - { - iFetchingStep++ ; // move to next step - } - - if ( iIncReqStatus && iFetchingStep == EDataFetchComplete )// complete request only if step is 1 - { - User::RequestComplete ( iIncReqStatus, KErrNone ); - iIncReqStatus = NULL; - } - CleanupStack::Pop( rmsg ); - break; - } - case ELocal_Pending_Contacts: - { - LOGGER ( TXT ( "CWaitTimer::ELocal_Pending_Contacts" ) ); - // complete prfw request - iAddNotification.AppendL ( rmsg ); - if ( iIncAddReqStatus ) - { - LOGGER ( TXT ( "CWaitTimer::ELocal_Pending_Contacts" ) ); - User::RequestComplete ( iIncAddReqStatus, KErrNone ); - iIncAddReqStatus = NULL; - } - CleanupStack::Pop( rmsg ); - break; - } - case ERemote_Pending_Contacts: - { - LOGGER ( TXT ( "CWaitTimer::ECurrent_Member_Contacts" ) ); - iFetchingContinue = EFalse; - // complete ximpfw request - iIncomingData.AppendL ( rmsg ); - PendingPresenceContactsL(rmsg); - if(msg_struct->continue_flag == 1) - { - iFetchingContinue = ETrue; - } - else - { - iFetchingStep++ ; // move next step - } - if ( iIncReqStatus && iFetchingStep == EDataFetchComplete) // complete request only if step is 1 - { - User::RequestComplete ( iIncReqStatus, KErrNone ); - iIncReqStatus = NULL; - } - CleanupStack::Pop( rmsg ); - break; - } - case ESend_Error: - { - LOGGER ( TXT ( "CWaitTimer::ESend_Error" ) ); - // complete ximpfw request - iIncomingServerError.AppendL ( rmsg ); - if ( iIncErrorReqStatus ) - { - User::RequestComplete ( iIncErrorReqStatus, KErrNone ); - iIncErrorReqStatus = NULL; - } - CleanupStack::Pop( rmsg ); - break; - } - - case EUserEndGprs: - LOGGER ( TXT ( "CWaitTimer::EUserCancelAccessPoint start" ) ); - - case EServer_DisConnect_Request: - { - iServerDisconnected = ETrue; - LOGGER ( TXT ( "CWaitTimer::EServer_DisConnect_Request start" ) ); - CancelListeningMsg(); - CancelListening(); - CancelListeningPres(); - CancelListeningAddNotication(); - CancelListeningServerErrors(); - CancelContactsChangeListening(); - - MXIMPObjectFactory& prfwObjFact = iConnMan.HandleToHost().ObjectFactory(); - MXIMPStatus* status = prfwObjFact.NewStatusLC();// status - status->SetResultCode( KErrDisconnected ); - iConnMan.HandleToHost().HandleConnectionTerminated( status ); - //IssueReleaseRequestL();//Release the connection - CleanupStack::PopAndDestroy(); // status - CleanupStack::Pop( rmsg ); - LOGGER ( TXT ( "CWaitTimer::EServer_DisConnect_Request end" ) ); - break; - } - case ESearch_State_Finished: - { - LOGGER ( TXT ( "CWaitTimer::ESearch_State_Finished" ) ); - operationindex = ( FindOperationL ( iOpId, COssSendDataOperation::OperationId ) ); - - if ( operationindex != KErrNotFound ) - { - LOGGER ( TXT ( "CWaitTimer::FindOperationL found" ) ); - iOperations[ operationindex ]->SetResponse ( rmsg ); //ownership of rmsg is transferred - iOperations[ operationindex ]->CompletedOperation ( KErrNone ); - } - CleanupStack::Pop( rmsg ); - break; - } - case ESearch: - { - LOGGER ( TXT ( "CWaitTimer::ESearch" ) ); - if ( msg_struct->response != 0 ) - { - LOGGER ( TXT ( "CWaitTimer::ESearch : Result" ) ); - char* pResponse = ( char* ) User::AllocLC ( status ); - memset ( pResponse, '\0', status ); - memcpy ( pResponse, rmsg, status ); - iSearchElements.AppendL ( pResponse ); - CleanupStack::Pop( pResponse ); - CleanupStack::PopAndDestroy( rmsg ); - } - else - { - LOGGER ( TXT ( "CWaitTimer::ESearch: ERROR !!" ) ); - operationindex = ( FindOperationL ( iOpId, COssSendDataOperation::OperationId ) ); - iOperations[ operationindex ]->SetResponse ( rmsg ); //ownership of rmsg is transferred - iOperations[ operationindex ]->CompletedOperation ( KErrNotSupported );// for all errors - CleanupStack::Pop( rmsg ); - // send not supported, since the error mapping is not done - } - break; - } - case ESearch_Get_Keys: - { - - LOGGER ( TXT ( "CWaitTimer::ESearch_Get_Keys" ) ); - operationindex = ( FindOperationL ( iOpId, COssSendDataOperation::OperationId ) ); - - if ( operationindex != KErrNotFound ) - { - LOGGER ( TXT ( "CWaitTimer::FindOperationL found" ) ); - iOperations[ operationindex ]->SetResponse ( rmsg ); //ownership of rmsg is transferred - iOperations[ operationindex ]->CompletedOperation ( KErrNone ); - } - CleanupStack::Pop( rmsg ); - LOGGER ( TXT ( "CWaitTimer::ESearch_Get_Keys end" ) ); - break; - } - case ESearch_State_During : - { - LOGGER ( TXT ( "CWaitTimer::ESearch_State_During" ) ); - iSearchElements.ResetAndDestroy(); - CleanupStack::PopAndDestroy( rmsg ); - LOGGER ( TXT ( "CWaitTimer::ESearch_State_During end" ) ); - break; - } - case EUpdateOwnAvtar : - { - LOGGER ( TXT ( "CWaitTimer::EUpdateOwnAvtar" ) ); - operationindex = ( FindOperationL ( iOpId, COssSendDataOperation::OperationId ) ); - - if ( operationindex != KErrNotFound ) - { - LOGGER ( TXT ( "CWaitTimer::FindOperationL found" ) ); - - iOperations[ operationindex ]->SetResponse ( rmsg ); //ownership of rmsg is transferred - iOperations[ operationindex ]->CompletedOperation ( KErrNone ); - } - CleanupStack::Pop( rmsg ); - break; - } - default: - { - LOGGER ( TXT ( "CWaitTimer::default start" ) ); - operationindex = ( FindOperationL ( iOpId, COssSendDataOperation::OperationId ) ); - - if ( operationindex != KErrNotFound ) - { - LOGGER ( TXT ( "CWaitTimer::FindOperationL found" ) ); - - iOperations[ operationindex ]->SetResponse ( rmsg ); //ownership of rmsg is transferred - iOperations[ operationindex ]->CompletedOperation ( KErrNone ); - } - CleanupStack::Pop( rmsg ); - LOGGER ( TXT ( "CWaitTimer::default end" ) ); - break; - } - } - - TInt pendingMsgCount = MsgQCheck(RESPONSE_QUEUE, &err ); - if( pendingMsgCount > 0) - { - msgreadcontinue = ETrue; - } - else - { - msgreadcontinue = EFalse; - } - LOGGER ( TXT ( "CWaitTimer::pendingMsgCount is %d" ), pendingMsgCount ); - } - }while( msgreadcontinue ); - /* - // there is no pending message in msgqueue, - // set active and subscribe for incomming queue message - iProperty.Subscribe(iStatus); - SetActive(); // Tell scheduler a request is active */ - - iTimer.After( iStatus, KTimerInterval ); - SetActive(); - } -// ----------------------------------------------------------------------------- -// CWaitTimer::PendingPresenceContactsL() -// ----------------------------------------------------------------------------- -// -void CWaitTimer::PendingPresenceContactsL(char* aRmessage) - { - char* prmsg = NULL; - prmsg = aRmessage; - HBufC16 *contactName = NULL; - HBufC* name = NULL; - int len = 0; - if( aRmessage ) - { - prmsg += sizeof ( message_hdr_resp ); - MPresenceBuddyInfo2* buddyPresInfo = MPresenceBuddyInfo2::NewLC(); - - MPresenceCacheWriter2* presenceCacheWriter = MPresenceCacheWriter2::CreateWriterL(); - CleanupDeletePushL(presenceCacheWriter); - while(1) - { - len = strlen(prmsg) + 1; - if (1 == len) - { - break; - } - char* contact = prmsg; - prmsg += len; - - contactName = OssProtocolAdapUtils::ConvertCharToTUint16LC( contact ); - LOGGER ( TXT ( "CWaitTimer::PendingPresenceContacts:ContactName:%S " ), contactName ); - - // contacts.AppendL(contactName); - name = HBufC::NewLC( contactName->Length() + iConnMan.ServiceName().Length() + KColon().Length() ); - TPtr namePtr( name->Des() ); - namePtr.Zero(); - namePtr.Append(iConnMan.ServiceName() ); // prepend service name - namePtr.Append(KColon); - namePtr.Append(contactName->Des() ); - buddyPresInfo->SetIdentityL(namePtr); - LOGGER ( TXT ( "CPresenceNotificationHandler::ProcessIncomingDataL :ContactName:%S " ), contactName ); - - buddyPresInfo->SetAnyFieldL(KExtensionKey,KPendingRequestExtensionValue()); - CleanupStack::PopAndDestroy(2);//name,contactName - name = NULL; - contactName = NULL; - // Writing into Presence Cache - TInt cacheerror = presenceCacheWriter->WritePresenceL(buddyPresInfo); - User::LeaveIfError ( cacheerror); - - } - CleanupStack::PopAndDestroy(2);//presenceCacheWriter,buddyPresInfo - - } - } -// ----------------------------------------------------------------------------- -// CWaitTimer::ResponseL() -// ----------------------------------------------------------------------------- -// - -char* CWaitTimer::ResponseL ( TInt aTransId ) - { - - if ( aTransId == 0 ) // for contact list - { - if ( iIncomingData.Count() == 0 ) - { - User::Leave ( KErrNotFound ); - } - - // take first one from the array - char* buff = iIncomingData[ 0 ]; - - iIncomingData.Remove ( 0 ); - iIncomingData.Compress(); - return buff; - } - - if ( aTransId == 1 ) //for receive message - { - if ( iIncomingMsg.Count() == 0 ) - { - User::Leave ( KErrNotFound ); - } - - // take first one from the array - char* buff = iIncomingMsg[ 0 ]; - - iIncomingMsg.Remove ( 0 ); - - return buff; - } - if ( aTransId == 2 ) //for presence notifications - { - TInt pCount = iIncomingPres.Count(); - - if ( pCount == 0 ) - { - User::Leave ( KErrNotFound ); - } - - // take first one from the array - char* buff = iIncomingPres[ pCount-1 ]; - - iIncomingPres.Remove ( pCount-1 ); - iIncomingPres.Compress(); - return buff; - } - if ( aTransId == 3 ) //for send error - { - if ( iIncomingServerError.Count() == 0 ) - { - User::Leave ( KErrNotFound ); - } - - // take first one from the array - char* buff = iIncomingServerError[ 0 ]; - - iIncomingServerError.Remove ( 0 ); - - return buff; - } - if ( aTransId == 4 ) //for Add notifications - { - if ( iAddNotification.Count() == 0 ) - { - User::Leave ( KErrNotFound ); - } - - // take first one from the array - char* buff = iAddNotification[ 0 ]; - - iAddNotification.Remove ( 0 ); - - return buff; - } - if( aTransId == 5 ) // search results - { - // take first one from the array - char* buff=NULL; - - if ( iSearchElements.Count() != 0 ) - { - buff = iSearchElements[ 0 ]; - iSearchElements.Remove ( 0 ); - iSearchElements.Compress(); - } - else - { - TInt x ( FindOperationL ( 6, COssSendDataOperation::OperationId ) ); - if( x != -1) - { // is operation completed? - TRequestStatus* status = iOperations[ x ]->Status(); - - if ( status && ( *status == KRequestPending ) ) - { - User::Leave ( KErrNotReady ); - } - delete iOperations[ x ]; - iOperations.Remove ( x ); - } - - } - - return buff; // return the buffer - } - if ( aTransId == 200 ) //for contact sync - { - if ( iContactChangeList.Count() == 0 ) - { - User::Leave ( KErrNotFound ); - } - - // take first one from the array - char* buff = iContactChangeList[ 0 ]; - - iContactChangeList.Remove ( 0 ); - iContactChangeList.Compress(); - return buff; - } - // try to find operation - TInt x ( FindOperationL ( aTransId, COssSendDataOperation::OperationId ) ); - - // is operation completed? - TRequestStatus* status = iOperations[ x ]->Status(); - - if ( status && ( *status == KRequestPending ) ) - { - User::Leave ( KErrNotReady ); - } - - char* buff = iOperations[ x ]->Response(); - - delete iOperations[ x ]; - iOperations.Remove ( x ); - return buff; - } - -// ----------------------------------------------------------------------------- -// CWaitTimer::RunError() -// ----------------------------------------------------------------------------- -// - -TInt CWaitTimer::RunError ( TInt aError ) - { - return aError; - } - -// ============================================================================= -// =============== New private Functions of the base class ===================== -// ============================================================================= - -// ----------------------------------------------------------------------------- -// CWaitTimer::FindOperation() -// Find operation in array -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt CWaitTimer::FindOperation ( - TInt aOpId, - TInt ( COssSendDataOperation:: *aIdFunc ) () const ) const - { - LOGGER ( TXT ( "CWaitTimer::FindOperation Start" ) ); - TInt count ( iOperations.Count() ); - - for ( TInt x ( 0 ) ; x < count ; ++x ) - { - if ( aOpId == ( ( *iOperations[ x ] ).*aIdFunc ) () ) - { - LOGGER ( TXT ( "CWaitTimer::FindOperation Returns %d" ), x ); - return x; - } - } - - LOGGER ( TXT ( "CWaitTimer::FindOperation End" ) ); - - return KErrNotFound; - } - -// ----------------------------------------------------------------------------- -// CWaitTimer::FindOperationL() -// Find operation in array, leave if not found -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt CWaitTimer::FindOperationL ( - TInt aOpId, - TInt ( COssSendDataOperation:: *aIdFunc ) () const ) const - { - LOGGER ( TXT ( "CWaitTimer::FindOperation Start" ) ); - TInt x ( FindOperation ( aOpId, aIdFunc ) ); - - LOGGER ( TXT ( "CWaitTimer::FindOperation End Returns %d" ), x ); - - return x; - } - -// ----------------------------------------------------------------------------- -// CWaitTimer::IssueReleaseRequestL() -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void CWaitTimer::IssueReleaseRequestL() - { - LOGGER ( TXT ( "CWaitTimer::IssueReleaseRequestL Start" ) ); - int err = 0; - int timeout = NO_WAIT; - message_hdr_req *msgHdr = NULL; - msgHdr = ( message_hdr_req* ) User::AllocLC(sizeof ( message_hdr_req )); - memset ( msgHdr, '\0', sizeof ( message_hdr_req ) ); - msgHdr->message_type = EKill_Process; - - TInt nBytes = sizeof ( message_hdr_req ); - - MsgQCreate ( REQUEST_QUEUE, MAX_MSG_Q_SIZE , MSG_Q_FIFO, &err ); - - MsgQSend ( REQUEST_QUEUE, ( char* ) msgHdr , nBytes, MSG_PRI_NORMAL, timeout, &err ); - - CleanupStack::PopAndDestroy ( msgHdr ); - - LOGGER ( TXT ( "CWaitTimer::IssueReleaseRequestL end" ) ); - - } -// --------------------------------------------------------------------------- -// CWaitTimer::IsServerDisconnect() -// --------------------------------------------------------------------------- -// -TBool CWaitTimer::IsServerDisconnect() - { - return iServerDisconnected; - } -// --------------------------------------------------------------------------- -// CWaitTimer::IsFetchContactsCompleted() -// --------------------------------------------------------------------------- -// -TBool CWaitTimer::IsFetchContactsCompleted() - { - if(iFetchingStep == EDataFetchComplete) - { - return ETrue; - } - return EFalse; - } - - -// End of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/tsrc/ossadapmt/bmarm/ossadapmtu.def --- a/imservices/ossprotocoladaptation/tsrc/ossadapmt/bmarm/ossadapmtu.def Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/tsrc/ossadapmt/bwins/ossadapmtu.def --- a/imservices/ossprotocoladaptation/tsrc/ossadapmt/bwins/ossadapmtu.def Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/tsrc/ossadapmt/conf/ossadapmt.cfg --- a/imservices/ossprotocoladaptation/tsrc/ossadapmt/conf/ossadapmt.cfg Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,665 +0,0 @@ -// Definitions -[Define] -SERVER chat.gizmoproject.com -//USERNAME testlmnokia@chat.gizmoproject.com -//PASSWORD loudmouth -RECIPIENT basu.bellary@gmail.com -MESSAGE Hello -RESOURCE mytest12345rt - -USERNAME ximptelepathy@gmail.com -PASSWORD tele1236 -SETTINGSID 3 -SERVICE_ID 3 -InvalidSettingsId -100 -UnexistJID testlmnokia1111@chat.gizmoproject.com -badpassword 12345 -badserver chat.gizmoprojeeeect.com -UsernameWithBadServer testlmnokia@chat.gizmoprojeeeeect.com -SpecialUSERNAME im:here%27s_a_wild_%26_%2Fcr%zy%2F_address@chat.gizmoproject.com -LONGUSERNAME im:here%27s_a_wild_%26_%2Fcr%zy%2F_address_here%27s_a_wild_%26_%2Fcr%zy%2F_address_here%27s_a_wild_%26_%2Fcr%zy%2F_address@chat.gizmoproject.com -LONGPASSWORD loudmouthloudmouthloudmouthloudmouthloudmouthloudmouthloudmouthloudmouthloudmouthloudmouthloudmouth -LONGMESSAGE HelloworldHelloworldHelloworldHelloworldHelloworldHelloworldHelloworldHelloworldHelloworlsfsdfdgdfgdfgdfgdfgdf -REPEATEDMESSAGE RepeatingHello -SMILEYMESSAGE :):-);-):-D:D:-(:( - -LONGGMAILUSERID abcd123456abcd123456abcd123456 -GMAILPWD nokia123 - -//PROXY_SERVER 172.16.42.135 -PROXY_SERVER 172.16.9.182 -PROXY_PORT 8080 - -WrongPassword wrongpassword -NoContactUserName emptycontactlist@gmail.com -NoContactPassword emptylist -300contactsUsername rakesh.harsh@gmail.com -300contactsPassword live_life -InvalidUserName invalidxmppid@gmail.com -CapitalUserName XIMPTELEPATHY@gmail.com -MixedUserName XIMPteLePathy@gmail.com -MaxCharUserName abcd123456abcd123456abcd123456@gmail.com -MaxCharIdPassword nokia123 -MaxCharExceedUserName abcd123456abcd123456abcd123456abcd123456abcd123456@gmail.com -MinCharUserName ab123d@gmail.com -MinCharIdPassword nokia123 -LessthanMincharUserName #*%4@gmail.com -BlankUserName " " -UserNamewithspace ximptelepathy @gmail.com -SpecialCharUserName #$%^&*(*&^$#@gmail.com -WrongDomainUserName ximptelepathy@hello.com -//contact management -Validcontact tele1236@gmail.com -NonExistingContact invalidxmppid@gmail.com -BlankContact " " -NonDomainUserName amsmartuknow - - -Message Hello -MsgSpecialChars #^(&$@!~`+_)/>.,<|%25? -450CharLenghthMsg abcdefghij1234567890abcdefghij1234567890\abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890\abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890\abcdefghij1234567890abcdefghij1234567890abcdefghij1234567890\ - -BlankMsg ' ' -Recipient junk1236@gmail.com -Recipient1 basu.bellary@gmail.com -Recipient2 ximptelepathy@gmail.com -Recipient3 me.papillon@gmail.com -InvalidRecipientId invalidxmppid@gmail.com -OfflineContact offline45@gmail.com - -statustext i am always available -InstantMessaging instant-messaging -DeviceName mobile_phone -Onlinestatus T -UserAvailibility1 0 //NPresenceInfo::ENotAvailable -UserAvailibility2 1 //NPresenceInfo::EBusy -UserAvailibility3 2 //0NPresenceInfo::EAvailable -UserAvailibilityText1 I am available -UserAvailibilityText2 I am busy -UserAvailibilityText3 I am away -Language PreferredLanguage -StatusContentfield StatusContent -DirectContentfield DirectContent -ContentTypefield, ContentType - -// ClientInfo attribute value tags -ClientInfo ClientInfo -ClientType ClientType -ClientLanguage Language -DevManufacturer DevManufacturer -ClientProducer ClientProducer -DeviceModel Model -ClientVersion ClientVersion -ClientTypeMobilePhone MOBILE_PHONE -ClientTypeComputer COMPUTER -ClientTypePDA PDA -ClientTypeCLI CLI -ClientTypeOther OTHER - -StatusMoodfield StatusMood -Aliasfield Alias -Age Age - -//Presence Attributes -Registration Registration -TimeZone TimeZone -GeoLocation GeoLocation -Address Address -FreeTextLocation FreeTextLocation -Plmn PLMN -PreferredContacts PreferredContacts -PreferredLanguage PreferredLanguage -StatusMood StatusMood -ContactInfo ContactInfo - -// StatusText attribute value tags -StatusTextfield StatusText - -// Online Status attribute value tags -OnlineStatusfield OnlineStatus - - -//avtar file -AVATARFILE C:\data\Images\test.jpg - -[Enddefine] -// ossadaptation related test cases - - -[Test] -title GetSearchKeyEnumL -create ossadapmt ossadap -ossadap GetSearchKeyEnumL USERNAME PASSWORD SETTINGSID -delete ossadap -[Endtest] - - -[Test] -title GetSearchKeyLabelL -create ossadapmt ossadap -ossadap GetSearchKeyLabelL USERNAME PASSWORD SETTINGSID -delete ossadap -[Endtest] - - -[Test] -title GetSearchKeyEnumNLabelL -create ossadapmt ossadap -ossadap GetSearchKeyEnumNLabelL USERNAME PASSWORD SETTINGSID -delete ossadap -[Endtest] - - -[Test] -title SecondSearchL -create ossadapmt ossadap -ossadap SecondSearchL USERNAME PASSWORD SERVICE_ID Message Recipient Validcontact -delete ossadap -[Endtest] - - - -[Test] -title SearchAndAddToIML -create ossadapmt ossadap -ossadap SearchAndAddToIML USERNAME PASSWORD SERVICE_ID Message Recipient Validcontact -delete ossadap -[Endtest] - -[Test] -title Login -create ossadapmt ossadap -ossadap Login USERNAME PASSWORD SERVICE_ID -delete ossadap -[Endtest] - -[Test] -title LoginInvalidUser -create ossadapmt ossadap -ossadap Login_InvalidData InvalidUserName PASSWORD SERVICE_ID -delete ossadap -[Endtest] - -[Test] -title LoginWrongPassword -create ossadapmt ossadap -ossadap Login_InvalidData USERNAME WrongPassword SERVICE_ID -delete ossadap -[Endtest] -[Test] -title Login_Logout_sequential -create ossadapmt ossadap -ossadap Login_Logout_sequential USERNAME PASSWORD SERVICE_ID -delete ossadap -[Endtest] - -[Test] -title LoginUserIdCapital -create ossadapmt ossadap -ossadap Login CapitalUserName PASSWORD SERVICE_ID -delete ossadap -[Endtest] - -[Test] -title LoginMixedLetterId -create ossadapmt ossadap -ossadap Login MixedUserName PASSWORD SERVICE_ID -delete ossadap -[Endtest] - -[Test] -title LoginMaxCharId -create ossadapmt ossadap -ossadap Login MaxCharUserName MaxCharIdPassword SERVICE_ID -delete ossadap -[Endtest] - -[Test] -title LoginMaxCharExceeded -create ossadapmt ossadap -ossadap Login_InvalidData MaxCharExceedUserName WrongPassword SERVICE_ID -delete ossadap -[Endtest] - -[Test] -title LoginMinCharId -create ossadapmt ossadap -ossadap Login MinCharUserName MinCharIdPassword SERVICE_ID -delete ossadap -[Endtest] - -[Test] -title LoginLessthanMinCharId -create ossadapmt ossadap -ossadap Login_InvalidData LessthanMincharUserName MinCharIdPassword SERVICE_ID -delete ossadap -[Endtest] - -[Test] -title LoginBlankUserId -create ossadapmt ossadap -ossadap Login_InvalidData BlankUserName MinCharIdPassword SERVICE_ID -delete ossadap -[Endtest] - -[Test] -title LoginUserIdwithSpace -create ossadapmt ossadap -ossadap Login_InvalidData UserNamewithspace PASSWORD SERVICE_ID -delete ossadap -[Endtest] - -[Test] -title LoginInvalidSettingsId -create ossadapmt ossadap -ossadap Login_InvalidData USERNAME PASSWORD InvalidSettingsId -delete ossadap -[Endtest] - -[Test] -title Unbind -create ossadapmt ossadap -ossadap Unbind USERNAME PASSWORD SERVICE_ID -delete ossadap -[Endtest] - -[Test] -title Get contacts -create ossadapmt ossadap -ossadap GetContacts USERNAME PASSWORD SERVICE_ID -delete ossadap -[Endtest] - -[Test] -title Fetch_300_Contacts -create ossadapmt ossadap -ossadap GetContacts 300contactsUsername 300contactsPassword SERVICE_ID -delete ossadap -[Endtest] - -[Test] -title FetchEmptyContactList -create ossadapmt ossadap -ossadap GetContacts NoContactUserName NoContactPassword SERVICE_ID -delete ossadap -[Endtest] - -[Test] -title Send message -create ossadapmt ossadap -ossadap Sendmessage USERNAME PASSWORD SERVICE_ID Message Recipient -delete ossadap -[Endtest] - -[Test] -title Send empty message -create ossadapmt ossadap -ossadap Sendemptymessage USERNAME PASSWORD SERVICE_ID Recipient -delete ossadap -[Endtest] - -[Test] -title Sendmessage_invaliduserid -create ossadapmt ossadap -ossadap Sendmessage USERNAME PASSWORD SERVICE_ID Message InvalidRecipientId -delete ossadap -[Endtest] - -[Test] -title Sendmessage_specialchars -create ossadapmt ossadap -ossadap Sendmessage USERNAME PASSWORD SERVICE_ID MsgSpecialChars Recipient -delete ossadap -[Endtest] - -[Test] -title Sendmessage_offlinecontact -create ossadapmt ossadap -ossadap Sendmessage USERNAME PASSWORD SERVICE_ID Message OfflineContact -delete ossadap -[Endtest] - -[Test] -title Sendmessage_longmessage -create ossadapmt ossadap -ossadap Sendmessage USERNAME PASSWORD SERVICE_ID LongMsg Recipient -delete ossadap -[Endtest] - -[Test] -title Send_450_char_message -create ossadapmt ossadap -ossadap Sendmessage USERNAME PASSWORD SERVICE_ID 450CharLenghthMsg Recipient -delete ossadap -[Endtest] - -[Test] -title Send_ten_messages -create ossadapmt ossadap -ossadap Send_ten_messages USERNAME PASSWORD SERVICE_ID Message Recipient -delete ossadap -[Endtest] - -[Test] -title Send_twenty_messages -create ossadapmt ossadap -ossadap Send_twenty_messages USERNAME PASSWORD SERVICE_ID Message Recipient -delete ossadap -[Endtest] - -[Test] -title Sendmessage_multiplecontacts -create ossadapmt ossadap -ossadap Sendmessage_multiplecontacts USERNAME PASSWORD SERVICE_ID Message Recipient Recipient1 Recipient2 Recipient3 -delete ossadap -[Endtest] - -[Test] -title Receivemessage -create ossadapmt ossadap -ossadap Receivemessage USERNAME PASSWORD SERVICE_ID Message -delete ossadap -[Endtest] - -[Test] -title Receiveemptymessage -create ossadapmt ossadap -ossadap Receiveemptymessage USERNAME PASSWORD SERVICE_ID -delete ossadap -[Endtest] - -[Test] -title Receivelongmessage -create ossadapmt ossadap -ossadap Receivemessage USERNAME PASSWORD SERVICE_ID Message -delete ossadap -[Endtest] - -[Test] -title Receive_450_char_message -create ossadapmt ossadap -ossadap Receivemessage USERNAME PASSWORD SERVICE_ID Message -delete ossadap -[Endtest] - -[Test] -title Receivemessage_specialchars -create ossadapmt ossadap -ossadap Receivemessage USERNAME PASSWORD SERVICE_ID Message -delete ossadap -[Endtest] - -[Test] -title Receive_ten_messages -create ossadapmt ossadap -ossadap Receive_ten_messages USERNAME PASSWORD SERVICE_ID Message -delete ossadap -[Endtest] - -[Test] -title Receive_twenty_message -create ossadapmt ossadap -ossadap Receive_twenty_message USERNAME PASSWORD SERVICE_ID Message -delete ossadap -[Endtest] - -[Test] -title Add_valid_conatct -create ossadapmt ossadap -ossadap Add_conatct USERNAME PASSWORD SERVICE_ID Validcontact -delete ossadap -[Endtest] - -[Test] -title AddNonExistingContact -create ossadapmt ossadap -ossadap Add_conatct USERNAME PASSWORD SERVICE_ID NonExistingContact -delete ossadap -[Endtest] - -[Test] -title AddMaxCharContact -create ossadapmt ossadap -ossadap Add_conatct USERNAME PASSWORD SERVICE_ID MaxCharUserName -delete ossadap -[Endtest] - -[Test] -title AddMoreThanMaxCharContact -create ossadapmt ossadap -ossadap Add_conatct USERNAME PASSWORD SERVICE_ID MaxCharExceedUserName -delete ossadap -[Endtest] - -[Test] -title AddMinCharContact -create ossadapmt ossadap -ossadap Add_conatct USERNAME PASSWORD SERVICE_ID MinCharUserName -delete ossadap -[Endtest] - -[Test] -title AddLessThanMinCharContact -create ossadapmt ossadap -ossadap Add_conatct USERNAME PASSWORD SERVICE_ID LessthanMincharUserName -delete ossadap -[Endtest] - -[Test] -title AddSpecialCharInvalidContact -create ossadapmt ossadap -ossadap Add_conatct USERNAME PASSWORD SERVICE_ID SpecialCharUserName -delete ossadap -[Endtest] - -[Test] -title AddBlankContact -create ossadapmt ossadap -ossadap Add_Blank_Conatct USERNAME PASSWORD SERVICE_ID -delete ossadap -[Endtest] - - -[Test] -title AddWithoutDomainContact -create ossadapmt ossadap -ossadap Add_conatct USERNAME PASSWORD SERVICE_ID NonDomainUserName -delete ossadap -[Endtest] - -[Test] -title AddAlreadyAddedConatct -create ossadapmt ossadap -ossadap Add_conatct USERNAME PASSWORD SERVICE_ID Validcontact -delete ossadap -[Endtest] - -[Test] -title AddWrongDomainContactL -create ossadapmt ossadap -ossadap Add_conatct USERNAME PASSWORD SERVICE_ID WrongDomainUserName -delete ossadap -[Endtest] - -[Test] -title Delete_valid_conatct -create ossadapmt ossadap -ossadap Delete_conatct USERNAME PASSWORD SERVICE_ID Validcontact -delete ossadap -[Endtest] - - -[Test] -title DeleteNonExistingContact -create ossadapmt ossadap -ossadap Delete_conatct USERNAME PASSWORD SERVICE_ID NonExistingContact -delete ossadap -[Endtest] - -[Test] -title DeleteMaxCharContact -create ossadapmt ossadap -ossadap Delete_conatct USERNAME PASSWORD SERVICE_ID MaxCharUserName -delete ossadap -[Endtest] - -[Test] -title DeleteMoreThanMaxCharContact -create ossadapmt ossadap -ossadap Delete_conatct USERNAME PASSWORD SERVICE_ID MaxCharExceedUserName -delete ossadap -[Endtest] - -[Test] -title DeleteMinCharContact -create ossadapmt ossadap -ossadap Delete_conatct USERNAME PASSWORD SERVICE_ID MinCharUserName -delete ossadap -[Endtest] - -[Test] -title DeleteLessThanMinxCharContact -create ossadapmt ossadap -ossadap Delete_conatct USERNAME PASSWORD SERVICE_ID LessthanMincharUserName -delete ossadap -[Endtest] - -[Test] -title DeleteSpecialCharInvalidContact -create ossadapmt ossadap -ossadap Delete_conatct USERNAME PASSWORD SERVICE_ID SpecialCharUserName -delete ossadap -[Endtest] - -[Test] -title DeleteBlankContact -create ossadapmt ossadap -ossadap Delete_Blank_Conatct USERNAME PASSWORD SERVICE_ID -delete ossadap -[Endtest] - -[Test] -title DeleteWithoutDomainContact -create ossadapmt ossadap -ossadap Delete_conatct USERNAME PASSWORD SERVICE_ID NonDomainUserName -delete ossadap -[Endtest] - -[Test] -title DeleteWrongDomainContact -create ossadapmt ossadap -ossadap Delete_conatct USERNAME PASSWORD SERVICE_ID WrongDomainUserName -delete ossadap -[Endtest] - -[Test] -title Publish_ownpresence_available -create ossadapmt ossadap -ossadap Publish_ownpresence USERNAME PASSWORD SERVICE_ID UserAvailibility1 UserAvailibilityText1 -delete ossadap -[Endtest] - -[Test] -title Publish_ownpresence_busy -create ossadapmt ossadap -ossadap Publish_ownpresence USERNAME PASSWORD SERVICE_ID UserAvailibility2 UserAvailibilityText2 -delete ossadap -[Endtest] - -[Test] -title Publish_ownpresence_not_available -create ossadapmt ossadap -ossadap Publish_ownpresence USERNAME PASSWORD SERVICE_ID UserAvailibility3 UserAvailibilityText3 -delete ossadap -[Endtest] - -[Test] -title Publish_ownpresence_emptytext -create ossadapmt ossadap -ossadap Publish_ownpresence_emptytext USERNAME PASSWORD SERVICE_ID UserAvailibility3 -delete ossadap -[Endtest] - -[Test] -title AcceptAddnotificationRequest -create ossadapmt ossadap -ossadap AcceptnotificationRequest USERNAME PASSWORD SERVICE_ID -delete ossadap -[Endtest] - -[Test] -title RejectAddnotificationRequest -create ossadapmt ossadap -ossadap RejectAddnotificationRequest USERNAME PASSWORD SERVICE_ID -delete ossadap -[Endtest] - -[Test] -title ImOperations_Coverage -create ossadapmt ossadap -ossadap ImOperations_Coverage USERNAME PASSWORD SERVICE_ID Message Recipient Validcontact -delete ossadap -[Endtest] - -[Test] -title SimpleSearchL -create ossadapmt ossadap -ossadap SimpleSearchL USERNAME PASSWORD SERVICE_ID Message Recipient Validcontact -delete ossadap -[Endtest] - -[Test] -title MultipleSearchL -create ossadapmt ossadap -ossadap MultipleSearchL USERNAME PASSWORD SERVICE_ID Message Recipient Validcontact -delete ossadap -[Endtest] - -[Test] -title NoResultSearchL -create ossadapmt ossadap -ossadap NoResultSearchL USERNAME PASSWORD SERVICE_ID Message Recipient Validcontact -delete ossadap -[Endtest] - -[Test] -title ManyResultsSearchL -create ossadapmt ossadap -ossadap ManyResultsSearchL USERNAME PASSWORD SERVICE_ID Message Recipient Validcontact -delete ossadap -[Endtest] - -[Test] -title BlankSearchL -create ossadapmt ossadap -ossadap BlankSearchL USERNAME PASSWORD SERVICE_ID Message Recipient Validcontact -delete ossadap -[Endtest] - -[Test] -title MaxCharSearchL -create ossadapmt ossadap -ossadap MaxCharSearchL USERNAME PASSWORD SERVICE_ID Message Recipient Validcontact -delete ossadap -[Endtest] - -[Test] -title SpecialCharSearchL -create ossadapmt ossadap -ossadap SpecialCharSearchL USERNAME PASSWORD SERVICE_ID Message Recipient Validcontact -delete ossadap -[Endtest] - -[Test] -title SearchEmailIDL -create ossadapmt ossadap -ossadap SearchEmailIDL USERNAME PASSWORD SERVICE_ID Message Recipient Validcontact -delete ossadap -[Endtest] - -[Test] -title Set_Avtar -create ossadapmt ossadap -ossadap SetAvtar USERNAME PASSWORD SERVICE_ID AVATARFILE -delete ossadap -[Endtest] diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/tsrc/ossadapmt/eabi/ossadapmtu.def --- a/imservices/ossprotocoladaptation/tsrc/ossadapmt/eabi/ossadapmtu.def Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - _Z9LibEntryLR13CTestModuleIf @ 1 NONAME - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/tsrc/ossadapmt/group/bld.inf --- a/imservices/ossprotocoladaptation/tsrc/ossadapmt/group/bld.inf Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: bld.inf -* -*/ - - - -PRJ_PLATFORMS -// specify the platforms your component needs to be built for here -// defaults to WINS MARM so you can ignore this if you just build these -DEFAULT - -PRJ_TESTEXPORTS -// NOTE: If using ARS requirements all export operations should be done under this. -// 'abld test export' -../conf/ossadapmt.cfg /epoc32/winscw/c/TestFramework/ossadapmt.cfg -PRJ_EXPORTS -// Specify the source file followed by its destination here -// copy will be used to copy the source file to its destination -// If there's no destination then the source file will be copied -// to the same name in /epoc32/include -// Example: -/* -/agnmodel/inc/AGMCOMON.H -*/ - -PRJ_TESTMMPFILES -// NOTE: If using ARS requirements .mmp file operation should be done under this. -// 'abld test build' -ossadapmt.mmp -PRJ_MMPFILES -// Specify the .mmp files required for building the important component -// releasables. -// -// Specify "tidy" if the component you need to build doesn't need to be -// released. Specify "ignore" if the MMP file exists but should be -// ignored. - - - - -// End of File \ No newline at end of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/tsrc/ossadapmt/group/ossadapmt.mmp --- a/imservices/ossprotocoladaptation/tsrc/ossadapmt/group/ossadapmt.mmp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* -* Copyright (c) 2007 - 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ossadapmt.mmp -* -*/ - - -#if defined(__S60_) - // To get the OSEXT_LAYER_SYSTEMINCLUDE-definition - #include -#endif - -TARGET ossadapmt.dll -TARGETTYPE dll -UID 0x1000008D 0x101FB3E3 - -CAPABILITY ALL -TCB -/* Remove comments and replace 0x00000000 with correct vendor id */ -// VENDORID 0x00000000 -/* Remove comments and replace 0x00000000 with correct secure id */ -// SECUREID 0x00000000 - -//TARGETPATH ?target_path -DEFFILE ossadapmt.def - -SOURCEPATH ../src -SOURCE ossadapmt.cpp -SOURCE ossadapmtBlocks.cpp -SOURCE uscontextobserver.cpp -//RESOURCE resource_file -//RESOURCE resource_file2 - -USERINCLUDE ../inc - -SYSTEMINCLUDE /epoc32/include/ecom - -MW_LAYER_SYSTEMINCLUDE - - -LIBRARY euser.lib -LIBRARY stiftestinterface.lib -LIBRARY bafl.lib -LIBRARY aknnotify.lib -LIBRARY efsrv.lib -LIBRARY commdb.lib -LIBRARY stiftestengine.lib -LIBRARY flogger.lib -LIBRARY ecom.lib -LIBRARY ximpdatamodel.lib -LIBRARY charconv.lib - -LANG SC - -/* -START WINS -?wins_specific_information -END - -START MARM -?marm_specific_information -END -*/ -// Other possible keywords: - -// DOCUMENT ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes) -/* -START BITMAP ?target -TARGETPATH ?emulated_path_on_target_machine -HEADER -SOURCE ?color_depth ?source_bitmap -END -*/ -// DEFFILE ?filename -// AIF ?filename - -// End of File diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/tsrc/ossadapmt/group/ossadaptmt.pkg --- a/imservices/ossprotocoladaptation/tsrc/ossadapmt/group/ossadaptmt.pkg Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -; -; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: ossadaptmt.pkg -; -;Header -#{"TestOssAdaptation"}, (0x101FB3E3), 1, 2, 3, TYPE=SP - -;Language - standard language definitions -&EN - -;Vendor ID -:"Nokia Corporation" - -;Localised vendor -%{"Vendor-EN"} - -;Supports Series 60 v 0.9 -[0x101F7961], 0, 0, 0, {"Series60ProductID"} - - -;INI FILE -"..\init\testframework.ini" -"c:\Testframework\testframework.ini" - -;CFG FILES -"..\conf\ossadapmt.cfg" -"c:\Testframework\ossadapmt.cfg" - -;ossadaptmt_test dll files - -"\EPOC32\RELEASE\ARMV5\UREL\ossadapmt.dll" -"!:\sys\bin\ossadapmt.dll" - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/tsrc/ossadapmt/inc/cuserafter.h --- a/imservices/ossprotocoladaptation/tsrc/ossadapmt/inc/cuserafter.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,159 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Active object based wait. -* -*/ - -#ifndef CUSERAFTER_H__ -#define CUSERAFTER_H__ - -// INCLUDES -#include - - -// CLASS DESCRIPTION - -/** - * Active object based wait. - * - * Similar like User::After() but doesn't block - * whole thread, but current RunL() with - * CActiveSchedulerWait. - */ - -class CUserAfter : public CTimer - { - - public: //Construction - static inline CUserAfter* NewL(); - static inline CUserAfter* NewLC(); - ~CUserAfter(); - - - public: //Wait support - - /** - * Static "one shot" wait method. - */ - static inline void AfterL ( TInt aWaitTimeMicroSeconds ); - /** - * Static "one shot" wait method. - */ - static inline void After8HrsL (); - - /** - * Member wait method. - */ - inline void After ( TInt aWaitTimeMicroSeconds ); - - - private: - CUserAfter(); - - void RunL(); - void RunError(); - void DoCancel(); - - - private: //data - CActiveSchedulerWait iWait; - - }; - - - - -// ----------------------------------------------------------------------------- -// CUserAfter public functions -// ----------------------------------------------------------------------------- -// -inline CUserAfter* CUserAfter::NewL() - { - CUserAfter* self = CUserAfter::NewLC(); - CleanupStack::Pop ( self ); - return self; - } - -inline CUserAfter* CUserAfter::NewLC() - { - CUserAfter* self = new ( ELeave ) CUserAfter(); - CleanupStack::PushL ( self ); - self->ConstructL(); - return self; - } - - -inline CUserAfter::~CUserAfter() - { - CTimer::Cancel(); - } - -inline void CUserAfter::After ( TInt aWaitTimeMicroSeconds ) - { - CTimer::After ( aWaitTimeMicroSeconds ); - iWait.Start(); - } - - -inline void CUserAfter::AfterL ( TInt aWaitTimeMicroSeconds ) - { - CUserAfter* after = CUserAfter::NewL(); - after->After ( aWaitTimeMicroSeconds ); - delete after; - } - -inline void CUserAfter::After8HrsL ( ) - { - CUserAfter* after = CUserAfter::NewL(); - //aWaitTimeMicroSeconds range is +-2147483647, which is +-35 minutes, 47 seconds. - for(TInt i =0 ; i<=16 ; i++) - { - after->After ( 2147483647 ); - } - delete after; - } - - -// ----------------------------------------------------------------------------- -// CUserAfter private functions -// ----------------------------------------------------------------------------- -// -inline CUserAfter::CUserAfter() - : CTimer ( CActive::EPriorityStandard ) - { - CActiveScheduler::Add ( this ); - } - - -inline void CUserAfter::RunL() - { - iWait.AsyncStop(); - Cancel(); - } - -inline void CUserAfter::RunError() - { - } - -inline void CUserAfter::DoCancel() - { - iWait.AsyncStop(); - CTimer::DoCancel(); - } - - -#endif // CUSERAFTER_H__ - -// End of File - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/tsrc/ossadapmt/inc/ossadapmt.h --- a/imservices/ossprotocoladaptation/tsrc/ossadapmt/inc/ossadapmt.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,269 +0,0 @@ -/* -* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ossadapmt.h -* -*/ - - - -#ifndef OSSADAPMT_H -#define OSSADAPMT_H - -// INCLUDES -#include -#include -#include -#include - -// CONSTANTS -//const ?type ?constant_var = ?constant; - -// MACROS -//#define ?macro ?macro_def -// Logging path -_LIT ( KossadapmtLogPath, "\\logs\\testframework\\ossadapmt\\" ); -// Log file -_LIT ( KossadapmtLogFile, "ossadapmt.txt" ); -_LIT ( KossadapmtLogFileWithTitle, "ossadapmt_[%S].txt" ); - -// FUNCTION PROTOTYPES -//?type ?function_name(?arg_list); - -// FORWARD DECLARATIONS -//class ?FORWARD_CLASSNAME; - -class Cossadapmt; - -enum TSearch - { - ESimpleSearch, - EMultipleSearch, - ESearchNoResults, - ESearchManyResults, - ESearchBlank, - ESearchMaxChars, - ESearchSpecialChars, - ESearchEmailid, - ESearchAndAddToIm, - ESecondSearch, - EGetSearchKeyEnum, - EGetSearchKeyLabel, - EGetSearchKeyEnumNLabel, - }; - -// DATA TYPES -//enum ?declaration -//typedef ?declaration -//extern ?data_type; - -// CLASS DECLARATION - -/** -* Cossadapmt test class for STIF Test Framework TestScripter. -* ?other_description_lines -* -* @lib ?library -* @since ?Series60_version -*/ -NONSHARABLE_CLASS ( Cossadapmt ) : public CScriptBase - { - -public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static Cossadapmt* NewL ( CTestModuleIf& aTestModuleIf ); - - /** - * Destructor. - */ - virtual ~Cossadapmt(); - -public: // New functions - - /** - * ?member_description. - * @since ?Series60_version - * @param ?arg1 ?description - * @return ?description - */ - //?type ?member_function( ?type ?arg1 ); - -public: // Functions from base classes - - /** - * From CScriptBase Runs a script line. - * @since ?Series60_version - * @param aItem Script line containing method name and parameters - * @return Symbian OS error code - */ - virtual TInt RunMethodL ( CStifItemParser& aItem ); - -protected: // New functions - - /** - * ?member_description. - * @since ?Series60_version - * @param ?arg1 ?description - * @return ?description - */ - //?type ?member_function( ?type ?arg1 ); - -protected: // Functions from base classes - - /** - * From ?base_class ?member_description - */ - //?type ?member_function(); - -private: - - /** - * C++ default constructor. - */ - Cossadapmt ( CTestModuleIf& aTestModuleIf ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - // Prohibit copy constructor if not deriving from CBase. - // ?classname( const ?classname& ); - // Prohibit assigment operator if not deriving from CBase. - // ?classname& operator=( const ?classname& ); - - /** - * Frees all resources allocated from test methods. - * @since ?Series60_version - */ - void Delete(); - - /** - * Test methods are listed below. - */ - - /** - * Bind test method. - * @since ?Series60_version - * @param aItem Script line containing parameters. - * @return Symbian OS error code. - */ - virtual TInt LoginL ( CStifItemParser& aItem ); - virtual TInt Login_InvalidDataL ( CStifItemParser& aItem ); - virtual TInt Login8HrsLogoutL ( CStifItemParser& aItem ); - virtual TInt LoginLogout_LoginLogoutL ( CStifItemParser& aItem ); - /** - * UnBind test method. - */ - virtual TInt UnBindL ( CStifItemParser& aItem ); - /** - * Fetch contacts method - */ - virtual TInt GetContactsL ( CStifItemParser& aItem ); - - /** - * Send message test method. - */ - virtual TInt SendMessageL ( CStifItemParser& aItem ); - virtual TInt SendEmptyMessageL ( CStifItemParser& aItem ); - virtual TInt SendTenMessageL ( CStifItemParser& aItem ); - virtual TInt SendTwentyMessageL ( CStifItemParser& aItem ); - virtual TInt SendMessage_MultipleContactsL ( CStifItemParser& aItem ); - - /** - * Receive message test method - */ - virtual TInt ReceiveMessageL ( CStifItemParser& aItem ); - virtual TInt ReceiveEmptyMessageL ( CStifItemParser& aItem ); - virtual TInt ReceiveTenMessageL ( CStifItemParser& aItem ); - virtual TInt ReceiveTwentyMessageL ( CStifItemParser& aItem ); - - /** - *contact list manangement test methods - */ - virtual TInt AddConatctL ( CStifItemParser& aItem ); - virtual TInt AcceptnotificationRequestL ( CStifItemParser& aItem ); - virtual TInt AddBlankConatctL ( CStifItemParser& aItem ); - virtual TInt AddBlankConatct1L ( CStifItemParser& aItem ); - - virtual TInt DeleteConatctL ( CStifItemParser& aItem ); - virtual TInt DeleteBlankConatctL ( CStifItemParser& aItem ); - /** - * Presence publishing test method - */ - virtual TInt PublishOwnPresenceL ( CStifItemParser& aItem ); - virtual TInt PublishOwnPresenceEmptyTextL ( CStifItemParser& aItem ); - virtual TInt RejectAddnotificationRequestL ( CStifItemParser& aItem ); - virtual TInt ImOperationsCoverageL ( CStifItemParser& aItem ); - - virtual TInt SearchL ( CStifItemParser& aItem, TSearch aSearchType ); - virtual TInt SimpleSearchL( CStifItemParser& aItem ); - virtual TInt MultipleSearchL( CStifItemParser& aItem ); - virtual TInt NoResultSearchL( CStifItemParser& aItem ); - virtual TInt ManyResultsSearchL( CStifItemParser& aItem ); - virtual TInt BlankSearchL( CStifItemParser& aItem ); - virtual TInt MaxCharSearchL( CStifItemParser& aItem ); - virtual TInt SpecialCharSearchL( CStifItemParser& aItem ); - virtual TInt SearchEmailIDL( CStifItemParser& aItem ); - virtual TInt SearchAndAddToIML( CStifItemParser& aItem ); - virtual TInt SecondSearchL( CStifItemParser& aItem ); - virtual TInt GetSearchKeyEnumL( CStifItemParser& aItem ); - virtual TInt GetSearchKeyLabelL( CStifItemParser& aItem ); - virtual TInt GetSearchKeyEnumNLabelL( CStifItemParser& aItem ); - virtual TInt SetAvtarL( CStifItemParser& aItem ); -public: // Data - // ?one_line_short_description_of_data - //?data_declaration; - -protected: // Data - // ?one_line_short_description_of_data - //?data_declaration; - -private: // Data - - // ?one_line_short_description_of_data - //?data_declaration; - - // Reserved pointer for future extension - //TAny* iReserved; - -public: // Friend classes - //?friend_class_declaration; - -protected: // Friend classes - //?friend_class_declaration; - -private: // Friend classes - //?friend_class_declaration; - - }; - -class TOssAdapMtLogger - { - - public: // New functions - /** - * Writes log to log file - */ - static void Log ( TRefByValue aFmt, ... ); - - }; - - - -#endif // OSSADAPMT_H - -// End of File diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/tsrc/ossadapmt/inc/uscontextobserver.h --- a/imservices/ossprotocoladaptation/tsrc/ossadapmt/inc/uscontextobserver.h Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: uscontextobserver.h -* -*/ - - -#ifndef USCONTEXTOBSERVER_H__ -#define USCONTEXTOBSERVER_H__ - - -// INCLUDES -#include -#include - -_LIT( KAddContactFileName, "c:\\add_contact.txt" ); - -// CLASS DESCRIPTION - -/** - * Presence context observer for usage scenario tests. - */ - -class CUSContextObserver : public CBase, - public MXIMPContextObserver - { - - public: - static CUSContextObserver* CUSContextObserver::NewLC(); - ~CUSContextObserver(); - - private: - CUSContextObserver(); - - - public: - - /** - * Method to wait with CActiveSchedulerWait - * the given request completion. If request - * is completed with error, leaves with failure code. - * - * NOTE! Only one request can be waited at time. - * - * @param aReqToWait The request to wait. - */ - void WaitOpToCompleteL ( const TXIMPRequestId& aReqToWait ); - - - - private: //From MXIMPContextObserver - - void HandlePresenceContextEvent ( const MXIMPContext& aContext, - const MXIMPBase& aEvent ); - - - private: //Data - - //OWN: Active scheduler wait for waiting the completion - CActiveSchedulerWait iWait; - - //OWN: Request ID identifying request to wait - TXIMPRequestId iReqToWait; - - //OWN: Result code from waited request - TInt iReqResult; - TBuf<50> gid[10]; - TInt gidcount; - - }; - - - -#endif //USCONTEXTOBSERVER_H__ - - diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/tsrc/ossadapmt/init/TestFramework.ini --- a/imservices/ossprotocoladaptation/tsrc/ossadapmt/init/TestFramework.ini Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,196 +0,0 @@ -# -# This is STIF initialization file -# Comment lines start with '#'-character. -# See STIF TestFramework users guide.doc for instructions - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set following test engine settings: -# - Set Test Reporting mode. TestReportMode's possible values are: -# + 'Summary': Summary of the tested test cases. -# + 'Environment': Hardware and software info. -# + 'TestCases': Test case report. -# + 'FullReport': Set of all above ones. -# + Example 'TestReportMode= Summary TestCases' -# -# - CreateTestReport setting controls report creation mode -# + YES, Test report will created. -# + NO, No Test report. -# -# - File path indicates the base path of the test report. -# - File name indicates the name of the test report. -# -# - File format indicates the type of the test report. -# + TXT, Test report file will be txt type, for example 'TestReport.txt'. -# + HTML, Test report will be html type, for example 'TestReport.html'. -# -# - File output indicates output source of the test report. -# + FILE, Test report logging to file. -# + RDEBUG, Test report logging to using rdebug. -# -# - File Creation Mode indicates test report overwriting if file exist. -# + OVERWRITE, Overwrites if the Test report file exist. -# + APPEND, Continue logging after the old Test report information if -# report exist. -# - Sets a device reset module's dll name(Reboot). -# + If Nokia specific reset module is not available or it is not correct one -# StifHWResetStub module may use as a template for user specific reset -# module. -# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation -# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 -# - -[Engine_Defaults] - -TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', - 'TestCases' or 'FullReport' - -CreateTestReport= YES # Possible values: YES or NO - -TestReportFilePath= C:\LOGS\TestFramework\ -TestReportFileName= TestReport - -TestReportFormat= TXT # Possible values: TXT or HTML -TestReportOutput= FILE # Possible values: FILE or RDEBUG -TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting - -DisableMeasurement= stifmeasurementdisablenone # Possible values are: - # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' - # 'stifmeasurementplugin01', 'stifmeasurementplugin02', - # 'stifmeasurementplugin03', 'stifmeasurementplugin04', - # 'stifmeasurementplugin05' or 'stifbappeaprofiler' - -Timeout= 0 # Default timeout value for each test case. In milliseconds - -[End_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Module configurations start -# Modules are added between module tags -# tags. Module name is specified after ModuleName= tag, like -# ModuleName= XXXXXXXXX -# Modules might have initialisation file, specified as -# IniFile= c:\testframework\YYYYYY -# Modules might have several configuration files, like -# TestCaseFile= c:\testframework\NormalCases.txt -# TestCaseFile= c:\testframework\SmokeCases.txt -# TestCaseFile= c:\testframework\ManualCases.txt - -# (TestCaseFile is synonym for old term ConfigFile) - -# Following case specifies demo module settings. Demo module -# does not read any settings from file, so tags -# IniFile and TestCaseFile are not used. -# In the simplest case it is enough to specify only the -# name of the test module when adding new test module - -[New_Module] -ModuleName= testscripter -TestCaseFile= C:\testframework\ossadapmt.cfg -[End_Module] - -# Load testmoduleXXX, optionally with initialization file and/or test case files -#[New_Module] -#ModuleName= testmodulexxx - -#TestModuleXXX used initialization file -#IniFile= c:\testframework\init.txt - -#TestModuleXXX used configuration file(s) -#TestCaseFile= c:\testframework\testcases1.cfg -#TestCaseFile= c:\testframework\testcases2.cfg -#TestCaseFile= c:\testframework\manualtestcases.cfg - -#[End_Module] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set STIF logging overwrite parameters for Logger. -# Hardware and emulator environment logging path and styles can -# be configured from here to overwrite the Logger's implemented values. -# -# Settings description: -# - Indicates option for creation log directory/directories. If log directory/directories -# is/are not created by user they will make by software. -# + YES, Create log directory/directories if not allready exist. -# + NO, Log directory/directories not created. Only created one is used. -# -# - Overwrite emulator path setting. -# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined -# Logger's path 'D:\\LOGS\\Module\\' with those definition the path -# will be 'C:\LOGS\TestFramework\LOGS\Module\' -# -# - Overwrite emulator's logging format. -# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. -# + HTML, Log file(s) will be html type(s), for example 'Module.html'. -# -# - Overwrited emulator logging output source. -# + FILE, Logging to file(s). -# + RDEBUG, Logging to using rdebug(s). -# -# - Overwrite hardware path setting (Same description as above in emulator path). -# - Overwrite hardware's logging format(Same description as above in emulator format). -# - Overwrite hardware's logging output source(Same description as above in emulator output). -# -# - File Creation Mode indicates file overwriting if file exist. -# + OVERWRITE, Overwrites if file(s) exist. -# + APPEND, Continue logging after the old logging information if file(s) exist. -# -# - Will thread id include to the log filename. -# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. -# + NO, No thread id to log file(s), Example filename 'Module.txt'. -# -# - Will time stamps include the to log file. -# + YES, Time stamp added to each line in log file(s). Time stamp is -# for example'12.Nov.2003 115958 LOGGING INFO' -# + NO, No time stamp(s). -# -# - Will line breaks include to the log file. -# + YES, Each logging event includes line break and next log event is in own line. -# + NO, No line break(s). -# -# - Will event ranking include to the log file. -# + YES, Event ranking number added to each line in log file(s). Ranking number -# depends on environment's tics, for example(includes time stamp also) -# '012 12.Nov.2003 115958 LOGGING INFO' -# + NO, No event ranking. -# -# - Will write log file in unicode format. -# + YES, Log file will be written in unicode format -# + NO, Log will be written as normal, not unicode, file. -# - -[Logger_Defaults] - -#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' -#NOTE: TestEngine and TestServer logging settings cannot change here - -#CreateLogDirectories= YES # Possible values: YES or NO - -#EmulatorBasePath= C:\LOGS\TestFramework\ -#EmulatorFormat= HTML # Possible values: TXT or HTML -#EmulatorOutput= FILE # Possible values: FILE or RDEBUG - -#HardwareBasePath= D:\LOGS\TestFramework\ -#HardwareFormat= HTML # Possible values: TXT or HTML -#HardwareOutput= FILE # Possible values: FILE or RDEBUG - -#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -#ThreadIdToLogFile= YES # Possible values: YES or NO -#WithTimeStamp= YES # Possible values: YES or NO -#WithLineBreak= YES # Possible values: YES or NO -#WithEventRanking= YES # Possible values: YES or NO - -#FileUnicode= YES # Possible values: YES or NO -#AddTestCaseTitle= YES # Possible values: YES or NO -[End_Logger_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - -# End of file diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/tsrc/ossadapmt/src/ossadapmt.cpp --- a/imservices/ossprotocoladaptation/tsrc/ossadapmt/src/ossadapmt.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,208 +0,0 @@ -/* -* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ossadapmt.cpp -* -*/ - - - -// INCLUDE FILES -#include -#include "ossadapmt.h" -#include -#include - -// EXTERNAL DATA STRUCTURES -//extern ?external_data; - -// EXTERNAL FUNCTION PROTOTYPES -//extern ?external_function( ?arg_type,?arg_type ); - -// CONSTANTS -//const ?type ?constant_var = ?constant; - -// MACROS -//#define ?macro ?macro_def - -// LOCAL CONSTANTS AND MACROS -//const ?type ?constant_var = ?constant; -//#define ?macro_name ?macro_def - -// MODULE DATA STRUCTURES -//enum ?declaration -//typedef ?declaration - -// LOCAL FUNCTION PROTOTYPES -//?type ?function_name( ?arg_type, ?arg_type ); - -// FORWARD DECLARATIONS -//class ?FORWARD_CLASSNAME; - -// ============================= LOCAL FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// ?function_name ?description. -// ?description -// Returns: ?value_1: ?description -// ?value_n: ?description_line1 -// ?description_line2 -// ----------------------------------------------------------------------------- -// -/* -?type ?function_name( - ?arg_type arg, // ?description - ?arg_type arg) // ?description - { - - ?code // ?comment - - // ?comment - ?code - } -*/ - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// Cossadapmt::Cossadapmt -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -Cossadapmt::Cossadapmt ( - CTestModuleIf& aTestModuleIf ) : - CScriptBase ( aTestModuleIf ) - { - } - -// ----------------------------------------------------------------------------- -// Cossadapmt::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void Cossadapmt::ConstructL() - { - //Read logger settings to check whether test case name is to be - //appended to log file name. - RSettingServer settingServer; - TInt ret = settingServer.Connect(); - - if ( ret != KErrNone ) - { - User::Leave ( ret ); - } - - // Struct to StifLogger settigs. - TLoggerSettings loggerSettings; - - // Parse StifLogger defaults from STIF initialization file. - ret = settingServer.GetLoggerSettings ( loggerSettings ); - - if ( ret != KErrNone ) - { - User::Leave ( ret ); - } - - // Close Setting server session - settingServer.Close(); - - TFileName logFileName; - - if ( loggerSettings.iAddTestCaseTitle ) - { - TName title; - TestModuleIf().GetTestCaseTitleL ( title ); - logFileName.Format ( KossadapmtLogFileWithTitle, &title ); - } - else - { - logFileName.Copy ( KossadapmtLogFile ); - } - - iLog = CStifLogger::NewL ( KossadapmtLogPath, - - logFileName, - CStifLogger::ETxt, - CStifLogger::EFile, - EFalse ); - TestModuleIf().SetBehavior ( CTestModuleIf::ETestLeaksHandles ); - - } - -// ----------------------------------------------------------------------------- -// Cossadapmt::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -Cossadapmt* Cossadapmt::NewL ( - CTestModuleIf& aTestModuleIf ) - { - Cossadapmt* self = new ( ELeave ) Cossadapmt ( aTestModuleIf ); - - CleanupStack::PushL ( self ); - self->ConstructL(); - CleanupStack::Pop(); - - return self; - - } - -// Destructor -Cossadapmt::~Cossadapmt() - { - - // Delete resources allocated from test methods - Delete(); - - // Delete logger - delete iLog; - - } - -// ========================== OTHER EXPORTED FUNCTIONS ========================= - -// ----------------------------------------------------------------------------- -// LibEntryL is a polymorphic Dll entry point. -// Returns: CScriptBase: New CScriptBase derived object -// ----------------------------------------------------------------------------- -// -EXPORT_C CScriptBase* LibEntryL ( - CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework - { - - return ( CScriptBase* ) Cossadapmt::NewL ( aTestModuleIf ); - - } - -// CONSTANTS -const TInt KTLogBufferLength = 256; - -_LIT ( KTLogDir, "osmt" ); -_LIT ( KTLogFile, "ossadapmt.txt" ); - -void TOssAdapMtLogger::Log ( TRefByValue aFmt, ... ) - { - VA_LIST list; - VA_START ( list, aFmt ); - - // Print to log file - TBuf buf; - buf.FormatList ( aFmt, list ); - - // Write to log file - RFileLogger::Write ( KTLogDir, KTLogFile, EFileLoggingModeAppend, buf ); - - } - -// End of File diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/tsrc/ossadapmt/src/ossadapmtBlocks.cpp --- a/imservices/ossprotocoladaptation/tsrc/ossadapmt/src/ossadapmtBlocks.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3168 +0,0 @@ -/* -* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: ossadapmtBlocks.cpp -* -*/ - - - -// [INCLUDE FILES] - do not remove -#include -#include -#include -#include "ossadapmt.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "uscontextobserver.h" -#include -#include -#include -#include -#include -#include -#include "cuserafter.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -//#include "immessageinfoimp.h" -const TInt KProtocolUid = 0x101FB3E7; // 0x10282EE9; -_LIT8( KInstantMessaging, "instant-messaging"); - -// StatusText attribute value tags -_LIT8( KStatusTextfield, "StatusText"); - -// Online Status attribute value tags -_LIT8( KOnlineStatusfield, "OnlineStatus" ); -_LIT ( KMsgId, "MessageID1" ); -_LIT( KContact1, "meco5555@gmail.com"); - -// EXTERNAL DATA STRUCTURES -//extern ?external_data; - -// EXTERNAL FUNCTION PROTOTYPES -//extern ?external_function( ?arg_type,?arg_type ); - -// CONSTANTS -//const ?type ?constant_var = ?constant; - -// MACROS -//#define ?macro ?macro_def - -// LOCAL CONSTANTS AND MACROS -//const ?type ?constant_var = ?constant; -//#define ?macro_name ?macro_def - -// MODULE DATA STRUCTURES -//enum ?declaration -//typedef ?declaration - -// LOCAL FUNCTION PROTOTYPES -//?type ?function_name( ?arg_type, ?arg_type ); - -// FORWARD DECLARATIONS -//class ?FORWARD_CLASSNAME; - -// ============================= LOCAL FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// ?function_name ?description. -// ?description -// Returns: ?value_1: ?description -// ?value_n: ?description_line1 -// ?description_line2 -// ----------------------------------------------------------------------------- -// -/* -?type ?function_name( - ?arg_type arg, // ?description - ?arg_type arg) // ?description - { - - ?code // ?comment - - // ?comment - ?code - } -*/ - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// Cossadapmt::Delete -// Delete here all resources allocated and opened from test methods. -// Called from destructor. -// ----------------------------------------------------------------------------- -// -void Cossadapmt::Delete() - { - - } - -// ----------------------------------------------------------------------------- -// Cossadapmt::RunMethodL -// Run specified method. Contains also table of test mothods and their names. -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::RunMethodL ( - CStifItemParser& aItem ) - { - - static TStifFunctionInfo const KFunctions[] = - { - // Copy this line for every implemented function. - // First string is the function name used in TestScripter script file. - // Second is the actual implementation member function. - ENTRY ( "SecondSearchL",Cossadapmt::SecondSearchL ), - ENTRY ( "Login", Cossadapmt::LoginL ), - ENTRY ( "Login_InvalidData", Cossadapmt::Login_InvalidDataL ), - ENTRY ( "AcceptnotificationRequest", Cossadapmt::AcceptnotificationRequestL ), - ENTRY ( "Login_Logout_sequential", Cossadapmt::LoginLogout_LoginLogoutL ), - ENTRY ( "Login_8Hrs_Logout", Cossadapmt::Login8HrsLogoutL ), - ENTRY ( "Unbind", Cossadapmt::UnBindL ), - ENTRY ( "GetContacts", Cossadapmt::GetContactsL ), - ENTRY ( "Add_conatct", Cossadapmt::AddConatctL ), - ENTRY ( "Add_Blank_Conatct", Cossadapmt::AddBlankConatctL ), - ENTRY ( "Add_Blank_Conatct1", Cossadapmt::AddBlankConatct1L ), - ENTRY ( "Delete_conatct", Cossadapmt::DeleteConatctL ), - ENTRY ( "Delete_Blank_Conatct", Cossadapmt::DeleteBlankConatctL ), - ENTRY ( "Sendmessage", Cossadapmt::SendMessageL ), - ENTRY ( "Sendemptymessage", Cossadapmt::SendEmptyMessageL ), - ENTRY ( "Send_ten_messages", Cossadapmt::SendTenMessageL ), - ENTRY ( "Send_twenty_messages", Cossadapmt::SendTwentyMessageL ), - ENTRY ( "Sendmessage_multiplecontacts", Cossadapmt::SendMessage_MultipleContactsL ), - ENTRY ( "Receivemessage", Cossadapmt::ReceiveMessageL ), - ENTRY ( "Receiveemptymessage", Cossadapmt::ReceiveEmptyMessageL ), - ENTRY ( "Receive_ten_messages", Cossadapmt::ReceiveTenMessageL ), - ENTRY ( "Receive_twenty_message", Cossadapmt::ReceiveTwentyMessageL ), - ENTRY ( "Publish_ownpresence", Cossadapmt::PublishOwnPresenceL ), - ENTRY ( "Publish_ownpresence_emptytext", Cossadapmt::PublishOwnPresenceEmptyTextL ), - ENTRY ( "RejectAddnotificationRequest", Cossadapmt::RejectAddnotificationRequestL ), - ENTRY ( "ImOperations_Coverage", Cossadapmt::ImOperationsCoverageL ), - - ENTRY ( "SimpleSearchL", Cossadapmt::SimpleSearchL ), - ENTRY ( "MultipleSearchL", Cossadapmt::MultipleSearchL ), - ENTRY ( "NoResultSearchL", Cossadapmt::NoResultSearchL ), - ENTRY ( "ManyResultsSearchL", Cossadapmt::ManyResultsSearchL ), - ENTRY ( "BlankSearchL", Cossadapmt::BlankSearchL ), - ENTRY ( "MaxCharSearchL", Cossadapmt::MaxCharSearchL ), - ENTRY ( "SpecialCharSearchL", Cossadapmt::SpecialCharSearchL ), - ENTRY ( "SearchEmailIDL",Cossadapmt::SearchEmailIDL ), - ENTRY ( "SearchAndAddToIML",Cossadapmt::SearchAndAddToIML ), - ENTRY ( "GetSearchKeyEnumL",Cossadapmt::GetSearchKeyEnumL ), - ENTRY ( "GetSearchKeyLabelL",Cossadapmt::GetSearchKeyLabelL ), - ENTRY ( "GetSearchKeyEnumNLabelL",Cossadapmt::GetSearchKeyEnumNLabelL ), - ENTRY ( "SetAvtar",Cossadapmt::SetAvtarL ), - //ADD NEW ENTRY HERE - // [test cases entries] - Do not remove - - }; - - const TInt count = sizeof ( KFunctions ) / - sizeof ( TStifFunctionInfo ); - - return RunInternalL ( KFunctions, count, aItem ); - - } - - - -// ----------------------------------------------------------------------------- -// Cossadapmt::SearchL -// Search test method function. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::SearchL ( CStifItemParser& aItem, TSearch aSearchType ) - { - - - - //Initialize XIMP client - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::LoginL() start" ) ); - - MXIMPClient* ximpClient = MXIMPClient::NewClientL(); - CleanupDeletePushL ( ximpClient ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); - - //Create new sink to receive presence context events - CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); - - //Create new presence context - MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); - presecenCtx->RegisterObserverL ( *eventObserver ); - - - //read data from cfg file - TPtrC username; - TPtrC password; - TInt serviceId; - - - MSearchFeature* srFeature = NULL; - srFeature = MSearchFeature::NewL ( presecenCtx ); -// CleanupStack::PushL( srFeature ); - - MSearch& srch=srFeature->Search(); - MSearchObjectFactory& searchObjFact=srFeature->SearchObjectFactory(); - - - aItem.GetNextString ( username ); - aItem.GetNextString ( password ); - aItem.GetNextInt ( serviceId ); - - TUid protocolUid = TUid::Uid ( KProtocolUid ); - - //Bind context to desired presence service - TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); - //Wait with CActiveSchedulerWait the binding to complete - //If binding fails, it is handled with leave - eventObserver->WaitOpToCompleteL ( req ); - -//------------------------------------------Fetch Start------------------------------------------ - MPresenceFeatures* presenceFeatures = NULL; - presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( presenceFeatures ); - MXIMPIdentity* newGroupId = presecenCtx->ObjectFactory().NewIdentityLC(); - MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; - MXIMPIdentity* newmemberId = presecenCtx->ObjectFactory().NewIdentityLC(); - - TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); - _LIT ( KDummyListId, "list" ); - HBufC16* iListId; - iListId = KDummyListId().AllocL(); - iListId->Des().Fold(); - newGroupId->SetIdentityL ( *iListId ); - delete iListId; - iListId = NULL; - - - req = groups.SubscribePresentityGroupContentL ( *newGroupId ); - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); - - eventObserver->WaitOpToCompleteL ( req ); - - CUserAfter::AfterL ( 1000000 ); - -//------------------------------------------Fetch End------------------------------------------ - - - MXIMPIdentity* searchId = presecenCtx->ObjectFactory().NewIdentityLC(); - searchId->SetIdentityL(_L("SEARCH")); - - MXIMPIdentity* firstId = presecenCtx->ObjectFactory().NewIdentityLC(); - - - MSearchElement* srchElement1=searchObjFact.NewSearchElementLC(); - - - MXIMPIdentity* secondId = presecenCtx->ObjectFactory().NewIdentityLC(); - - - MSearchElement* srchElement2=searchObjFact.NewSearchElementLC(); - - - RPointerArray< MSearchElement > searchList; - CleanupClosePushL( searchList ); - - switch ( aSearchType ) - { - - case EGetSearchKeyEnum: - { - - req = srch.GetSearchKeysL(); - eventObserver->WaitOpToCompleteL ( req ); - - firstId->SetIdentityL(_L("james")); - srchElement1->SetRequestL( *firstId, EUserFirstName ); - - searchList.Append(srchElement1); - - req=srch.SearchL(*searchId,searchList,10 ); - break; - - } - - - case EGetSearchKeyLabel: - { - - req = srch.GetSearchKeysL(); - eventObserver->WaitOpToCompleteL ( req ); - - MXIMPIdentity* label = presecenCtx->ObjectFactory().NewIdentityLC(); - label->SetIdentityL( _L( "Family Name" ) ); - - secondId->SetIdentityL(_L("BOND")); - - srchElement2->SetRequestL( *secondId, *label ); - - searchList.Append( srchElement1 ); - searchList.Append( srchElement2 ); - - req=srch.SearchL(*searchId,searchList,10 ); - - CleanupStack::PopAndDestroy (); - - break; - - } - - - case EGetSearchKeyEnumNLabel: - { - - req = srch.GetSearchKeysL(); - eventObserver->WaitOpToCompleteL ( req ); - - - firstId->SetIdentityL(_L("james")); - srchElement1->SetRequestL( *firstId, EUserFirstName ); - - secondId->SetIdentityL(_L("BOND")); - - MXIMPIdentity* label = presecenCtx->ObjectFactory().NewIdentityLC(); - label->SetIdentityL( _L( "Family Name" ) ); - - srchElement2->SetRequestL( *secondId, *label ); - - searchList.Append( srchElement1 ); - searchList.Append( srchElement2 ); - - req=srch.SearchL(*searchId,searchList,10 ); - - CleanupStack::PopAndDestroy (); - - break; - } - - - case ESimpleSearch : - { - - req = srch.GetSearchKeysL(); - eventObserver->WaitOpToCompleteL ( req ); - - firstId->SetIdentityL(_L("james")); - srchElement1->SetRequestL( *firstId, EUserFirstName ); - - searchList.Append(srchElement1); - - req=srch.SearchL(*searchId,searchList,10 ); - - break; - } - - - case EMultipleSearch : - { - - req = srch.GetSearchKeysL(); - eventObserver->WaitOpToCompleteL ( req ); - - - firstId->SetIdentityL(_L("james")); - srchElement1->SetRequestL( *firstId, EUserFirstName ); - - secondId->SetIdentityL(_L("BOND")); - - MXIMPIdentity* label = presecenCtx->ObjectFactory().NewIdentityLC(); - label->SetIdentityL( _L( "Family Name" ) ); - - srchElement2->SetRequestL( *secondId, *label ); - - searchList.Append( srchElement1 ); - searchList.Append( srchElement2 ); - - req=srch.SearchL(*searchId,searchList,10 ); - - CleanupStack::PopAndDestroy (); - - break; - } - - - case ESearchNoResults : - { - firstId->SetIdentityL(_L("Santhosh")); - srchElement1->SetRequestL( *firstId, EUserFirstName ); - - secondId->SetIdentityL(_L("I C")); - srchElement2->SetRequestL( *secondId, EUserLastName ); - - searchList.Append( srchElement1 ); - searchList.Append( srchElement2 ); - - req=srch.SearchL(*searchId,searchList,10 ); - break; - } - - - case ESearchManyResults : - { - firstId->SetIdentityL(_L("a")); - srchElement1->SetRequestL( *firstId, EUserFirstName ); - - searchList.Append(srchElement1); - - req=srch.SearchL(*searchId,searchList,10 ); - - break; - } - - - case ESearchBlank : - { - firstId->SetIdentityL(_L("")); - srchElement1->SetRequestL( *firstId, EUserFirstName ); - - searchList.Append(srchElement1); - - req=srch.SearchL(*searchId,searchList,10 ); - break; - } - - - - case ESearchMaxChars : - { - firstId->SetIdentityL( _L( "fbg agh ggd sad ghda gh dhg hgasdg dh jggd gsdg g \ - kjdg g gsd gfhsdg fhasgd hasdh ghfgahfg hgsdg dg gdgsgkj" ) ); - srchElement1->SetRequestL( *firstId, EUserFirstName ); - - searchList.Append( srchElement1 ); - - req=srch.SearchL( *searchId,searchList,10 ); - break; - } - - - case ESearchSpecialChars : - { - firstId->SetIdentityL( _L( "*%#@$%^#%^&^^%)(" ) ); - srchElement1->SetRequestL( *firstId, EUserFirstName ); - - searchList.Append( srchElement1 ); - - req=srch.SearchL( *searchId,searchList,10 ); - - break; - } - case ESearchEmailid: - { - firstId->SetIdentityL( _L( "wordjames@chat.gizmoproject.com" ) ); - srchElement1->SetRequestL( *firstId, EUserFirstName ); - - searchList.Append( srchElement1 ); - - req=srch.SearchL( *searchId,searchList,10 ); - break; - } - - case ESearchAndAddToIm: - { - firstId->SetIdentityL( _L( "sharath" ) ); - srchElement1->SetRequestL( *firstId, EUserFirstName ); - - searchList.Append( srchElement1 ); - - req=srch.SearchL( *searchId,searchList,10 ); - //Wait for search to complete - eventObserver->WaitOpToCompleteL( req ); - CUserAfter::AfterL ( 5000000 ); - - //And then call the AddToContactList - RFs fs; - RFile file; - TBuf8<100> buf; - User::LeaveIfError( fs.Connect() ); - User::LeaveIfError( file.Open( fs, KAddContactFileName, EFileRead ) ); - file.Read( buf ); - file.Close(); - fs.Close(); - TBuf16<100> h_buf; - CnvUtfConverter::ConvertToUnicodeFromUtf8( h_buf, - buf ); -//-------------------Adding Contact Start----------------------------------------- - - newmemberId->SetIdentityL ( h_buf ); - - req = groups.AddPresentityGroupMemberL( - *newGroupId, - *newmemberId, - KNullDesC()) ; - - //eventObserver->WaitOpToCompleteL ( req ); - //CUserAfter::AfterL ( 5000000 ); - //Wait at the below eventObserver->WaitOpToCompleteL( req ); - - -//-------------------Adding Contact End----------------------------------------- - break; - } - case ESecondSearch: - { - - firstId->SetIdentityL(_L("sharath")); - srchElement1->SetRequestL( *firstId, EUserFirstName ); - - searchList.Append(srchElement1); - - req=srch.SearchL(*searchId,searchList,10 ); - - eventObserver->WaitOpToCompleteL( req ); - - CUserAfter::AfterL(100000); - searchList.Reset(); - - //Second Search - secondId->SetIdentityL(_L("Jeppu")); - srchElement1->SetRequestL( *secondId, EUserLastName ); - - searchList.Append(srchElement1); - - req=srch.SearchL(*searchId,searchList,10 ); - - break; - } - - } - - CleanupStack::PopAndDestroy (); //newmemberId - CleanupStack::PopAndDestroy ();//newGroupId - CleanupStack::PopAndDestroy ();//presenceFeatures - - CleanupStack::PopAndDestroy (); // - CleanupStack::PopAndDestroy (); - CleanupStack::PopAndDestroy (); - - CleanupStack::PopAndDestroy (); - CleanupStack::PopAndDestroy (); - - CleanupStack::PopAndDestroy (); - - eventObserver->WaitOpToCompleteL( req ); - //Unbind the context and wait completion - req = presecenCtx->UnbindL(); - eventObserver->WaitOpToCompleteL( req ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); - -// CleanupStack::PopAndDestroy ();//Search feature plugin - CleanupStack::PopAndDestroy ( 3 ); //presecenCtx,eventObserver,ximpClient - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::SearchL() End" ) ); - return KErrNone; - - } -// ----------------------------------------------------------------------------- -// Cossadapmt::GetSearchKeyEnum -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::GetSearchKeyEnumL( CStifItemParser& aItem ) - { - return SearchL ( aItem, EGetSearchKeyEnum ); - } - -// ----------------------------------------------------------------------------- -// Cossadapmt::GetSearchKeyLabel -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::GetSearchKeyLabelL( CStifItemParser& aItem ) - { - return SearchL ( aItem, EGetSearchKeyLabel ); - } - -// ----------------------------------------------------------------------------- -// Cossadapmt::GetSearchKeyEnumNLabel -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::GetSearchKeyEnumNLabelL( CStifItemParser& aItem ) - { - return SearchL ( aItem, EGetSearchKeyEnumNLabel ); - } - -// ----------------------------------------------------------------------------- -// Cossadapmt::SearchAndAddToIML -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// - -TInt Cossadapmt::SecondSearchL( CStifItemParser& aItem ) - { - return SearchL ( aItem, ESecondSearch ); - } - - -// ----------------------------------------------------------------------------- -// Cossadapmt::SearchAndAddToIML -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// - -TInt Cossadapmt::SearchAndAddToIML( CStifItemParser& aItem ) - { - return SearchL ( aItem, ESearchAndAddToIm ); - } - -// ----------------------------------------------------------------------------- -// Cossadapmt::SimpleSearchL -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// - -TInt Cossadapmt::SimpleSearchL( CStifItemParser& aItem ) - { - return SearchL ( aItem, ESimpleSearch ); - } -// ----------------------------------------------------------------------------- -// Cossadapmt::MultipleSearchL -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::MultipleSearchL( CStifItemParser& aItem ) - { - return SearchL ( aItem, EMultipleSearch ); - } -// ----------------------------------------------------------------------------- -// Cossadapmt::NoResultSearchL -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::NoResultSearchL( CStifItemParser& aItem ) - { - return SearchL ( aItem, ESearchNoResults ); - } -// ----------------------------------------------------------------------------- -// Cossadapmt::ManyResultsSearchL -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::ManyResultsSearchL( CStifItemParser& aItem ) - { - return SearchL ( aItem, ESearchManyResults ); - } -// ----------------------------------------------------------------------------- -// Cossadapmt::BlankSearchL. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::BlankSearchL( CStifItemParser& aItem ) - { - return SearchL ( aItem, ESearchBlank ); - } -// ----------------------------------------------------------------------------- -// Cossadapmt::MaxCharSearchL -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::MaxCharSearchL( CStifItemParser& aItem ) - { - return SearchL ( aItem, ESearchMaxChars ); - } -// ----------------------------------------------------------------------------- -// Cossadapmt::SpecialCharSearchL -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::SpecialCharSearchL( CStifItemParser& aItem ) - { - return SearchL ( aItem, ESearchSpecialChars ); - } -// ----------------------------------------------------------------------------- -// Cossadapmt::SearchEmailIDL -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::SearchEmailIDL( CStifItemParser& aItem ) - { - return SearchL ( aItem, ESearchEmailid ); - } -// ----------------------------------------------------------------------------- -// Cossadapmt::LoginL -// Login test method function. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::LoginL ( CStifItemParser& aItem ) - { - - - - //Initialize XIMP client - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::LoginL() start" ) ); - - MXIMPClient* ximpClient = MXIMPClient::NewClientL(); - CleanupDeletePushL ( ximpClient ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); - - //Create new sink to receive presence context events - CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); - - //Create new presence context - MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); - presecenCtx->RegisterObserverL ( *eventObserver ); - - //read data from cfg file - TPtrC username; - TPtrC password; - TInt serviceId; - - aItem.GetNextString ( username ); - aItem.GetNextString ( password ); - aItem.GetNextInt ( serviceId ); - - TUid protocolUid = TUid::Uid ( KProtocolUid ); - - //Bind context to desired presence service - TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); - //Wait with CActiveSchedulerWait the binding to complete - //If binding fails, it is handled with leave - eventObserver->WaitOpToCompleteL ( req ); - - - //Unbind the context and wait completion - req = presecenCtx->UnbindL(); - eventObserver->WaitOpToCompleteL( req ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); - - CleanupStack::PopAndDestroy ( 3 ); //presecenCtx,eventObserver,ximpClient - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::LoginL() End" ) ); - return KErrNone; - - } -// ----------------------------------------------------------------------------- -// Cossadapmt::Login_InvalidDataL -// Login test method function. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::Login_InvalidDataL ( CStifItemParser& aItem ) - { - - - - //Initialize XIMP client - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::Login_InvalidDataL() start" ) ); - - MXIMPClient* ximpClient = MXIMPClient::NewClientL(); - CleanupDeletePushL ( ximpClient ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); - - //Create new sink to receive presence context events - CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); - - //Create new presence context - MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); - presecenCtx->RegisterObserverL ( *eventObserver ); - - //read data from cfg file - TPtrC username; - TPtrC password; - TInt serviceId; - - aItem.GetNextString ( username ); - aItem.GetNextString ( password ); - aItem.GetNextInt ( serviceId ); - - TUid protocolUid = TUid::Uid ( KProtocolUid ); - - //Bind context to desired presence service - TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); - //Wait with CActiveSchedulerWait the binding to complete - //If binding fails, it is handled with leave - eventObserver->WaitOpToCompleteL ( req ); - - CleanupStack::PopAndDestroy ( 3 ); //presecenCtx,eventObserver,ximpClient - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::Login_InvalidDataL() End" ) ); - return KErrNone; - - } -// ----------------------------------------------------------------------------- -// Cossadapmt::Login8HrsLogoutL -// Login test method function. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::Login8HrsLogoutL ( CStifItemParser& aItem ) - { - - - - //Initialize XIMP client - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::Login8HrsLogoutL() start" ) ); - - MXIMPClient* ximpClient = MXIMPClient::NewClientL(); - CleanupDeletePushL ( ximpClient ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); - - //Create new sink to receive presence context events - CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); - - //Create new presence context - MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); - presecenCtx->RegisterObserverL ( *eventObserver ); - - - //read data from cfg file - TPtrC username; - TPtrC password; - TInt serviceId; - - aItem.GetNextString ( username ); - aItem.GetNextString ( password ); - aItem.GetNextInt ( serviceId ); - - TUid protocolUid = TUid::Uid ( KProtocolUid ); - - //Bind context to desired presence service - TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); - //Wait with CActiveSchedulerWait the binding to complete - //If binding fails, it is handled with leave - eventObserver->WaitOpToCompleteL ( req ); - CUserAfter::After8HrsL (); - - //Unbind the context and wait completion - req = presecenCtx->UnbindL(); - eventObserver->WaitOpToCompleteL( req ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); - - CleanupStack::PopAndDestroy ( 3 ); //presecenCtx,eventObserver,ximpClient - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::Login8HrsLogoutL() End" ) ); - return KErrNone; - - } - -// ----------------------------------------------------------------------------- -// Cossadapmt::LoginLogout_LoginLogoutL -// Login test method function. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::LoginLogout_LoginLogoutL ( CStifItemParser& aItem ) - { - - - - //Initialize XIMP client - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::LoginLogout_Log() start" ) ); - - MXIMPClient* ximpClient = MXIMPClient::NewClientL(); - CleanupDeletePushL ( ximpClient ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); - - //Create new sink to receive presence context events - CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); - - //Create new presence context - MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); - presecenCtx->RegisterObserverL ( *eventObserver ); - //read data from cfg file - TPtrC username; - TPtrC password; - TInt serviceId; - - aItem.GetNextString ( username ); - aItem.GetNextString ( password ); - aItem.GetNextInt ( serviceId ); - - TUid protocolUid = TUid::Uid ( KProtocolUid ); - - //Bind context to desired presence service - TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called - Sequence 1" ) ); - //Wait with CActiveSchedulerWait the binding to complete - //If binding fails, it is handled with leave - eventObserver->WaitOpToCompleteL ( req ); - - //Unbind the context and wait completion - req = presecenCtx->UnbindL(); - eventObserver->WaitOpToCompleteL( req ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end- Sequence 1 complete" ) ); - - -/// Login --- Logout - Sequence 2 - //Bind context to desired presence service - req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called - Sequence 2" ) ); - //Wait with CActiveSchedulerWait the binding to complete - //If binding fails, it is handled with leave - eventObserver->WaitOpToCompleteL ( req ); - - //Unbind the context and wait completion - req = presecenCtx->UnbindL(); - eventObserver->WaitOpToCompleteL( req ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end - Sequence 2 complete" ) ); - - - CleanupStack::PopAndDestroy ( 3 ); //presecenCtx,eventObserver,ximpClient - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::LoginLogout_Log() End" ) ); - return KErrNone; - - } - - -// ----------------------------------------------------------------------------- -// Cossadapmt::GetContactsL -// Fetch contacts test method function. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::GetContactsL ( CStifItemParser& aItem ) - { - - //Initialize XIMP client - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::GetContactsL() start" ) ); - - MXIMPClient* ximpClient = MXIMPClient::NewClientL(); - CleanupDeletePushL ( ximpClient ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); - - //Create new sink to receive presence context events - CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); - - //Create new presence context - MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); - presecenCtx->RegisterObserverL ( *eventObserver ); - MPresenceFeatures* presenceFeatures = NULL; - presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( presenceFeatures ); - TOssAdapMtLogger::Log ( _L ( "Loading presence plugin Done" ) ); - MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); - MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); - MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; - - TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); - _LIT ( KDummyListId, "list" ); - HBufC16* iListId; - iListId = KDummyListId().AllocL(); - iListId->Des().Fold(); - newGroupId->SetIdentityL ( *iListId ); - delete iListId; - iListId = NULL; - - //read data from cfg file - TPtrC username; - TPtrC password; - TInt serviceId; - - aItem.GetNextString ( username ); - aItem.GetNextString ( password ); - aItem.GetNextInt ( serviceId ); - - TUid protocolUid = TUid::Uid ( KProtocolUid ); - - //Bind context to desired presence service - TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); - //Wait with CActiveSchedulerWait the binding to complete - //If binding fails, it is handled with leave - eventObserver->WaitOpToCompleteL ( req ); - - - req = groups.SubscribePresentityGroupContentL ( *newGroupId ); - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); - - eventObserver->WaitOpToCompleteL ( req ); - - CUserAfter::AfterL ( 1000000 ); - //Unbind the context and wait completion - req = presecenCtx->UnbindL(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->UnbindL() called" ) ); - - eventObserver->WaitOpToCompleteL ( req ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); - - CleanupStack::PopAndDestroy ( 5 );//newGroupId,presenceFeatures,presecenCtx,eventObserver,ximpClient - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::GetContactsL() end" ) ); - - return KErrNone; - - } -// ----------------------------------------------------------------------------- -// Cossadapmt::AddConatctL -// AddConatctL contacts test method function. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::AddConatctL ( CStifItemParser& aItem ) - { - - //Initialize XIMP client - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::AddContactsL() start" ) ); - - MXIMPClient* ximpClient = MXIMPClient::NewClientL(); - CleanupDeletePushL ( ximpClient ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); - - //Create new sink to receive presence context events - CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); - - //Create new presence context - MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); - presecenCtx->RegisterObserverL ( *eventObserver ); - MPresenceFeatures* presenceFeatures = NULL; - presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( presenceFeatures ); - TOssAdapMtLogger::Log ( _L ( "Loading presence plugin Done" ) ); - MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); - MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); - MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; - MXIMPIdentity* newmemberId = objFactory.NewIdentityLC(); - - TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); - _LIT ( KDummyListId, "list" ); - HBufC16* iListId; - iListId = KDummyListId().AllocL(); - iListId->Des().Fold(); - newGroupId->SetIdentityL ( *iListId ); - delete iListId; - iListId = NULL; - - //read data from cfg file - TPtrC username; - TPtrC password; - TInt serviceId; - TPtrC contact; - - aItem.GetNextString ( username ); - aItem.GetNextString ( password ); - aItem.GetNextInt ( serviceId ); - aItem.GetNextString ( contact ); - - TUid protocolUid = TUid::Uid ( KProtocolUid ); - - //Bind context to desired presence service - TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); - //Wait with CActiveSchedulerWait the binding to complete - //If binding fails, it is handled with leave - eventObserver->WaitOpToCompleteL ( req ); - - req = groups.SubscribePresentityGroupContentL ( *newGroupId ); - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); - - eventObserver->WaitOpToCompleteL ( req ); - - CUserAfter::AfterL ( 1000000 ); - - newmemberId->SetIdentityL ( contact ); - - req = groups.AddPresentityGroupMemberL( - *newGroupId, - *newmemberId, - KNullDesC()) ; - - eventObserver->WaitOpToCompleteL ( req ); - CUserAfter::AfterL ( 5000000 ); - CleanupStack::PopAndDestroy();//newmemberId - //Unbind the context and wait completion - req = presecenCtx->UnbindL(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->UnbindL() called" ) ); - - eventObserver->WaitOpToCompleteL ( req ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); - - CleanupStack::PopAndDestroy ( 5 );//newGroupId,presenceFeatures,presecenCtx,eventObserver,ximpClient - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::AddContactsL() end" ) ); - - return KErrNone; - - } -// ----------------------------------------------------------------------------- -// Cossadapmt::AddBlankConatctL -// AddConatctL contacts test method function. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::AddBlankConatctL ( CStifItemParser& aItem ) - { - - //Initialize XIMP client - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::AddBlankConatctL() start" ) ); - - MXIMPClient* ximpClient = MXIMPClient::NewClientL(); - CleanupDeletePushL ( ximpClient ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); - - //Create new sink to receive presence context events - CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); - - //Create new presence context - MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); - presecenCtx->RegisterObserverL ( *eventObserver ); - MPresenceFeatures* presenceFeatures = NULL; - presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( presenceFeatures ); - TOssAdapMtLogger::Log ( _L ( "Loading presence plugin Done" ) ); - MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); - MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); - MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; - MXIMPIdentity* newmemberId = objFactory.NewIdentityLC(); - - TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); - _LIT ( KDummyListId, "list" ); - HBufC16* iListId; - iListId = KDummyListId().AllocL(); - iListId->Des().Fold(); - newGroupId->SetIdentityL ( *iListId ); - delete iListId; - iListId = NULL; - - //read data from cfg file - TPtrC username; - TPtrC password; - TInt serviceId; - - aItem.GetNextString ( username ); - aItem.GetNextString ( password ); - aItem.GetNextInt ( serviceId ); - - TUid protocolUid = TUid::Uid ( KProtocolUid ); - - //Bind context to desired presence service - TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); - //Wait with CActiveSchedulerWait the binding to complete - //If binding fails, it is handled with leave - eventObserver->WaitOpToCompleteL ( req ); - - - req = groups.SubscribePresentityGroupContentL ( *newGroupId ); - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); - - eventObserver->WaitOpToCompleteL ( req ); - - CUserAfter::AfterL ( 1000000 ); - _LIT ( KBlankContact, "" ); - newmemberId->SetIdentityL ( KBlankContact ); - - - req = groups.AddPresentityGroupMemberL( - *newGroupId, - *newmemberId, - KNullDesC()) ; - - eventObserver->WaitOpToCompleteL ( req ); - //Unbind the context and wait completion - req = presecenCtx->UnbindL(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->UnbindL() called" ) ); - - eventObserver->WaitOpToCompleteL ( req ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); - CleanupStack::PopAndDestroy(); - CleanupStack::PopAndDestroy ( 5 );//newGroupId,presenceFeatures,presecenCtx,eventObserver,ximpClient - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::AddBlankConatctL() end" ) ); - - return KErrNone; - - } -// ----------------------------------------------------------------------------- -// Cossadapmt::AddBlankConatct1L -// AddConatctL contacts test method function. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::AddBlankConatct1L ( CStifItemParser& aItem ) - { - - //Initialize XIMP client - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::AddBlankConatctL() start" ) ); - - MXIMPClient* ximpClient = MXIMPClient::NewClientL(); - CleanupDeletePushL ( ximpClient ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); - - //Create new sink to receive presence context events - CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); - - //Create new presence context - MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); - presecenCtx->RegisterObserverL ( *eventObserver ); - MPresenceFeatures* presenceFeatures = NULL; - presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( presenceFeatures ); - TOssAdapMtLogger::Log ( _L ( "Loading presence plugin Done" ) ); - MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); - MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); - MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; - MXIMPIdentity* newmemberId = objFactory.NewIdentityLC(); - - TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); - _LIT ( KDummyListId, "list" ); - HBufC16* iListId; - iListId = KDummyListId().AllocL(); - iListId->Des().Fold(); - newGroupId->SetIdentityL ( *iListId ); - delete iListId; - iListId = NULL; - - //read data from cfg file - TPtrC username; - TPtrC password; - TInt serviceId; - - aItem.GetNextString ( username ); - aItem.GetNextString ( password ); - aItem.GetNextInt ( serviceId ); - - TUid protocolUid = TUid::Uid ( KProtocolUid ); - - //Bind context to desired presence service - TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); - //Wait with CActiveSchedulerWait the binding to complete - //If binding fails, it is handled with leave - eventObserver->WaitOpToCompleteL ( req ); - - - req = groups.SubscribePresentityGroupContentL ( *newGroupId ); - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); - - eventObserver->WaitOpToCompleteL ( req ); - - CUserAfter::AfterL ( 1000000 ); - _LIT ( KBlankContact, "" ); - newmemberId->SetIdentityL ( KBlankContact ); - - req = groups.AddPresentityGroupMemberL( - *newGroupId, - *newmemberId, - KNullDesC()) ; - - eventObserver->WaitOpToCompleteL ( req ); - CleanupStack::PopAndDestroy(); //newmemberId - //Unbind the context and wait completion - req = presecenCtx->UnbindL(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->UnbindL() called" ) ); - - eventObserver->WaitOpToCompleteL ( req ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); - - CleanupStack::PopAndDestroy ( 5 );//newGroupId,presenceFeatures,presecenCtx,eventObserver,ximpClient - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::AddBlankConatctL() end" ) ); - - return KErrNone; - - } -// ----------------------------------------------------------------------------- -// Cossadapmt::DeleteConatctL -// DeleteConatctL contacts test method function. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::DeleteConatctL ( CStifItemParser& aItem ) - { - - //Initialize XIMP client - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::DeleteConatctL() start" ) ); - - MXIMPClient* ximpClient = MXIMPClient::NewClientL(); - CleanupDeletePushL ( ximpClient ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); - - //Create new sink to receive presence context events - CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); - - //Create new presence context - MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); - presecenCtx->RegisterObserverL ( *eventObserver ); - MPresenceFeatures* presenceFeatures = NULL; - presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( presenceFeatures ); - TOssAdapMtLogger::Log ( _L ( "Loading presence plugin Done" ) ); - MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); - MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); - MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; - MXIMPIdentity* newmemberId = objFactory.NewIdentityLC(); - - TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); - _LIT ( KDummyListId, "list" ); - HBufC16* iListId; - iListId = KDummyListId().AllocL(); - iListId->Des().Fold(); - newGroupId->SetIdentityL ( *iListId ); - delete iListId; - iListId = NULL; - - //read data from cfg file - TPtrC username; - TPtrC password; - TInt serviceId; - TPtrC contact; - - aItem.GetNextString ( username ); - aItem.GetNextString ( password ); - aItem.GetNextInt ( serviceId ); - aItem.GetNextString ( contact ); - - TUid protocolUid = TUid::Uid ( KProtocolUid ); - - //Bind context to desired presence service - TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); - //Wait with CActiveSchedulerWait the binding to complete - //If binding fails, it is handled with leave - eventObserver->WaitOpToCompleteL ( req ); - - - req = groups.SubscribePresentityGroupContentL ( *newGroupId ); - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); - - eventObserver->WaitOpToCompleteL ( req ); - - CUserAfter::AfterL ( 1000000 ); - - newmemberId->SetIdentityL ( contact ); - - req = groups.RemovePresentityGroupMemberL( - *newGroupId, - *newmemberId) ; - - eventObserver->WaitOpToCompleteL ( req ); - CleanupStack::PopAndDestroy();//newmemberId - //Unbind the context and wait completion - req = presecenCtx->UnbindL(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->UnbindL() called" ) ); - - eventObserver->WaitOpToCompleteL ( req ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); - - CleanupStack::PopAndDestroy ( 5 );//newGroupId,presenceFeatures,presecenCtx,eventObserver,ximpClient - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::DeleteConatctL() end" ) ); - - return KErrNone; - - } -// ----------------------------------------------------------------------------- -// Cossadapmt::DeleteBlankConatctL -// DeleteConatctL contacts test method function. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::DeleteBlankConatctL ( CStifItemParser& aItem ) - { - - //Initialize XIMP client - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::DeleteBlankConatctL() start" ) ); - - MXIMPClient* ximpClient = MXIMPClient::NewClientL(); - CleanupDeletePushL ( ximpClient ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); - - //Create new sink to receive presence context events - CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); - - //Create new presence context - MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); - presecenCtx->RegisterObserverL ( *eventObserver ); - MPresenceFeatures* presenceFeatures = NULL; - presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( presenceFeatures ); - TOssAdapMtLogger::Log ( _L ( "Loading presence plugin Done" ) ); - MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); - MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); - MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; - MXIMPIdentity* newmemberId = objFactory.NewIdentityLC(); - - TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); - _LIT ( KDummyListId, "list" ); - HBufC16* iListId; - iListId = KDummyListId().AllocL(); - iListId->Des().Fold(); - newGroupId->SetIdentityL ( *iListId ); - delete iListId; - iListId = NULL; - - //read data from cfg file - TPtrC username; - TPtrC password; - TInt serviceId; - - aItem.GetNextString ( username ); - aItem.GetNextString ( password ); - aItem.GetNextInt ( serviceId ); - - TUid protocolUid = TUid::Uid ( KProtocolUid ); - - //Bind context to desired presence service - TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); - //Wait with CActiveSchedulerWait the binding to complete - //If binding fails, it is handled with leave - eventObserver->WaitOpToCompleteL ( req ); - - - req = groups.SubscribePresentityGroupContentL ( *newGroupId ); - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); - - eventObserver->WaitOpToCompleteL ( req ); - - CUserAfter::AfterL ( 1000000 ); - _LIT ( KBlankContact, "" ); - newmemberId->SetIdentityL (KBlankContact); - - req = groups.RemovePresentityGroupMemberL( - *newGroupId, - *newmemberId) ; - - eventObserver->WaitOpToCompleteL ( req ); - CleanupStack::PopAndDestroy(); //newmemberId - //Unbind the context and wait completion - req = presecenCtx->UnbindL(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->UnbindL() called" ) ); - - eventObserver->WaitOpToCompleteL ( req ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); - - CleanupStack::PopAndDestroy ( 5 );//newGroupId,presenceFeatures,presecenCtx,eventObserver,ximpClient - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::DeleteBlankConatctL() end" ) ); - - return KErrNone; - - } -// ----------------------------------------------------------------------------- -// Cossadapmt::UnBindL -// UnBind test method function. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::UnBindL ( CStifItemParser& aItem ) - { - - //Initialize XIMP client - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::UnBindL() start" ) ); - - MXIMPClient* ximpClient = MXIMPClient::NewClientL(); - CleanupDeletePushL ( ximpClient ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); - - //Create new sink to receive presence context events - CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); - - //Create new presence context - MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); - presecenCtx->RegisterObserverL ( *eventObserver ); - - //read data from cfg file - TPtrC username; - TPtrC password; - TInt serviceId; - - aItem.GetNextString ( username ); - aItem.GetNextString ( password ); - aItem.GetNextInt ( serviceId ); - - TUid protocolUid = TUid::Uid ( KProtocolUid ); - - //Bind context to desired presence service - TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); - //Wait with CActiveSchedulerWait the binding to complete - //If binding fails, it is handled with leave - eventObserver->WaitOpToCompleteL ( req ); - - - //Unbind the context and wait completion - req = presecenCtx->UnbindL(); - eventObserver->WaitOpToCompleteL( req ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); - - - CleanupStack::Pop ( 3 ); //presecenCtx,eventObserver,ximpClient - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::UnBindL() End" ) ); - return KErrNone; - - - } - -// ----------------------------------------------------------------------------- -// Cossadapmt::SendMessageL -// SendMessage test method function. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::SendMessageL ( CStifItemParser& aItem ) - { - - //Initialize XIMP client - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::SendMessageL() start" ) ); - MXIMPClient* ximpClient = MXIMPClient::NewClientL(); - CleanupDeletePushL ( ximpClient ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); - //Create new sink to receive presence context events - CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); - //Create new presence context - MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); - //Bind context to desired presence service - presecenCtx->RegisterObserverL ( *eventObserver ); - MPresenceFeatures* presenceFeatures = NULL; - presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( presenceFeatures ); - - //read data from cfg file - TPtrC username; - TPtrC password; - TInt serviceId; - TPtrC message; - TPtrC recipient; - - aItem.GetNextString ( username ); - aItem.GetNextString ( password ); - aItem.GetNextInt ( serviceId ); - aItem.GetNextString ( message ); - aItem.GetNextString ( recipient ); - - TUid protocolUid = TUid::Uid ( KProtocolUid ); - - //Bind context to desired presence service - TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called\n" ) ); - eventObserver->WaitOpToCompleteL ( req ); - MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); - MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); - MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; - - TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); - _LIT ( KDummyListId, "" ); - HBufC16* iListId; - iListId = KDummyListId().AllocL(); - iListId->Des().Fold(); - newGroupId->SetIdentityL ( *iListId ); - delete iListId; - iListId = NULL; - req = groups.SubscribePresentityGroupContentL ( *newGroupId ); - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); - - eventObserver->WaitOpToCompleteL ( req ); - CleanupStack::PopAndDestroy(2); //newGroupId,presenceFeatures - - CUserAfter::AfterL ( 1000000 ); - //Bind context to desired presence service - MImFeatures* imFeatures = NULL; - imFeatures = MImFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( imFeatures ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imFeatures created\n" ) ); - MImConversation& imconversation = imFeatures->ImConversation(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imconversation created\n" ) ); - MImConversationInfo *aImMessage = NULL; - aImMessage = imFeatures->ImObjectFactory().NewImConversationInfoLC(); - MXIMPIdentity* identity = objFactory.NewIdentityLC(); - identity->SetIdentityL ( KMsgId ); - aImMessage->SetMessageIdL ( identity ); - aImMessage->SetTextMessageL ( message ); - CDesCArrayFlat* aRecipients = new ( ELeave ) CDesCArrayFlat ( 2 ); - CleanupStack::PushL ( aRecipients ); - aRecipients->AppendL ( recipient );//userid's - aImMessage->SetRecipientL ( aRecipients ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::before sendmessage called\n" ) ); - - req = imconversation.SendMessageL ( *aImMessage ); - eventObserver->WaitOpToCompleteL ( req ); - CleanupStack::Pop ( 3 );//identity,aRecipients,aImMessage - //Unbind the context and wait completion - CUserAfter::AfterL ( 2000000 ); - req = presecenCtx->UnbindL(); - eventObserver->WaitOpToCompleteL( req ); - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::message sent\n " ) ); - CleanupStack::PopAndDestroy(4); //imFeatures,presecenCtx,eventObserver,ximpClient, - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::SendMessageL() end" ) ); - - return KErrNone; - - } -// ----------------------------------------------------------------------------- -// Cossadapmt::SendEmptyMessageL -// SendMessage test method function. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::SendEmptyMessageL ( CStifItemParser& aItem ) - { - - //Initialize XIMP client - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::SendEmptyMessageL() start" ) ); - MXIMPClient* ximpClient = MXIMPClient::NewClientL(); - CleanupDeletePushL ( ximpClient ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); - //Create new sink to receive presence context events - CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); - //Create new presence context - MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); - //Bind context to desired presence service - presecenCtx->RegisterObserverL ( *eventObserver ); - MPresenceFeatures* presenceFeatures = NULL; - presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( presenceFeatures ); - - //read data from cfg file - TPtrC username; - TPtrC password; - TInt serviceId; - TPtrC recipient; - - aItem.GetNextString ( username ); - aItem.GetNextString ( password ); - aItem.GetNextInt ( serviceId ); - aItem.GetNextString ( recipient ); - - TUid protocolUid = TUid::Uid ( KProtocolUid ); - - //Bind context to desired presence service - TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called\n" ) ); - eventObserver->WaitOpToCompleteL ( req ); - MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); - MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); - MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; - - TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); - _LIT ( KDummyListId, "" ); - _LIT ( KEmptyMessage, "" ); - HBufC16* iListId; - iListId = KDummyListId().AllocL(); - iListId->Des().Fold(); - newGroupId->SetIdentityL ( *iListId ); - delete iListId; - iListId = NULL; - req = groups.SubscribePresentityGroupContentL ( *newGroupId ); - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); - - eventObserver->WaitOpToCompleteL ( req ); - CleanupStack::PopAndDestroy(2); //newGroupId,presenceFeatures - - CUserAfter::AfterL ( 1000000 ); - //Bind context to desired presence service - MImFeatures* imFeatures = NULL; - imFeatures = MImFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( imFeatures ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imFeatures created\n" ) ); - MImConversation& imconversation = imFeatures->ImConversation(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imconversation created\n" ) ); - MImConversationInfo *aImMessage = NULL; - aImMessage = imFeatures->ImObjectFactory().NewImConversationInfoLC(); - MXIMPIdentity* identity = objFactory.NewIdentityLC(); - identity->SetIdentityL ( KMsgId ); - aImMessage->SetMessageIdL ( identity ); - aImMessage->SetTextMessageL ( KEmptyMessage ); - CDesCArrayFlat* aRecipients = new ( ELeave ) CDesCArrayFlat ( 2 ); - CleanupStack::PushL ( aRecipients ); - aRecipients->AppendL ( recipient );//userid's - aImMessage->SetRecipientL ( aRecipients ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::before sendmessage called\n" ) ); - - req = imconversation.SendMessageL ( *aImMessage ); - eventObserver->WaitOpToCompleteL ( req ); - CleanupStack::Pop ( 3 );//identity,aRecipients,aImMessage - //Unbind the context and wait completion - req = presecenCtx->UnbindL(); - eventObserver->WaitOpToCompleteL( req ); - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::message sent\n " ) ); - CleanupStack::PopAndDestroy(4); //imFeatures,presecenCtx,eventObserver,ximpClient, - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::SendEmptyMessageL() end" ) ); - - return KErrNone; - - } - -// ----------------------------------------------------------------------------- -// Cossadapmt::SendTenMessageL -// SendMessage test method function. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::SendTenMessageL ( CStifItemParser& aItem ) - { - - //Initialize XIMP client - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::SendTenMessageL() start" ) ); - MXIMPClient* ximpClient = MXIMPClient::NewClientL(); - CleanupDeletePushL ( ximpClient ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); - //Create new sink to receive presence context events - CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); - //Create new presence context - MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); - //Bind context to desired presence service - presecenCtx->RegisterObserverL ( *eventObserver ); - MPresenceFeatures* presenceFeatures = NULL; - presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( presenceFeatures ); - - //read data from cfg file - TPtrC username; - TPtrC password; - TInt serviceId; - TPtrC message; - TPtrC recipient; - - aItem.GetNextString ( username ); - aItem.GetNextString ( password ); - aItem.GetNextInt ( serviceId ); - aItem.GetNextString ( message ); - aItem.GetNextString ( recipient ); - - TUid protocolUid = TUid::Uid ( KProtocolUid ); - - //Bind context to desired presence service - TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called\n" ) ); - eventObserver->WaitOpToCompleteL ( req ); - MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); - MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); - MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; - - TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); - _LIT ( KDummyListId, "" ); - HBufC16* iListId; - iListId = KDummyListId().AllocL(); - iListId->Des().Fold(); - newGroupId->SetIdentityL ( *iListId ); - delete iListId; - iListId = NULL; - req = groups.SubscribePresentityGroupContentL ( *newGroupId ); - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); - - eventObserver->WaitOpToCompleteL ( req ); - CleanupStack::PopAndDestroy(2); //newGroupId,presenceFeatures - - CUserAfter::AfterL ( 1000000 ); - //Bind context to desired presence service - MImFeatures* imFeatures = NULL; - imFeatures = MImFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( imFeatures ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imFeatures created\n" ) ); - MImConversation& imconversation = imFeatures->ImConversation(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imconversation created\n" ) ); - MImConversationInfo *aImMessage = NULL; - aImMessage = imFeatures->ImObjectFactory().NewImConversationInfoLC(); - MXIMPIdentity* identity = objFactory.NewIdentityLC(); - identity->SetIdentityL ( KMsgId ); - aImMessage->SetMessageIdL ( identity ); - aImMessage->SetTextMessageL ( message ); - CDesCArrayFlat* aRecipients = new ( ELeave ) CDesCArrayFlat ( 2 ); - CleanupStack::PushL ( aRecipients ); - aRecipients->AppendL ( recipient ); //userid's - aImMessage->SetRecipientL ( aRecipients ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::before sendmessage called\n" ) ); - - for ( TInt i = 0;i < 10;i++ ) - { - req = imconversation.SendMessageL ( *aImMessage ); - eventObserver->WaitOpToCompleteL ( req ); - - } - CleanupStack::Pop ( 3 );//identity,aRecipients,aImMessage - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::message sent\n " ) ); - //Unbind the context and wait completion - req = presecenCtx->UnbindL(); - eventObserver->WaitOpToCompleteL( req ); - CleanupStack::PopAndDestroy(4); //imFeatures,presecenCtx,eventObserver,ximpClient, - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::SendTenMessageL() end" ) ); - - return KErrNone; - - } - -// ----------------------------------------------------------------------------- -// Cossadapmt::SendTwentyMessageL -// SendMessage test method function. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::SendTwentyMessageL ( CStifItemParser& aItem ) - { - - //Initialize XIMP client - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::SendTwentyMessageL() start" ) ); - MXIMPClient* ximpClient = MXIMPClient::NewClientL(); - CleanupDeletePushL ( ximpClient ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); - //Create new sink to receive presence context events - CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); - //Create new presence context - MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); - //Bind context to desired presence service - presecenCtx->RegisterObserverL ( *eventObserver ); - MPresenceFeatures* presenceFeatures = NULL; - presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( presenceFeatures ); - - //read data from cfg file - TPtrC username; - TPtrC password; - TInt serviceId; - TPtrC message; - TPtrC recipient; - - aItem.GetNextString ( username ); - aItem.GetNextString ( password ); - aItem.GetNextInt ( serviceId ); - aItem.GetNextString ( message ); - aItem.GetNextString ( recipient ); - - TUid protocolUid = TUid::Uid ( KProtocolUid ); - - //Bind context to desired presence service - TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called\n" ) ); - eventObserver->WaitOpToCompleteL ( req ); - MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); - MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); - MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; - - TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); - _LIT ( KDummyListId, "" ); - HBufC16* iListId; - iListId = KDummyListId().AllocL(); - iListId->Des().Fold(); - newGroupId->SetIdentityL ( *iListId ); - delete iListId; - iListId = NULL; - req = groups.SubscribePresentityGroupContentL ( *newGroupId ); - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); - - eventObserver->WaitOpToCompleteL ( req ); - CleanupStack::PopAndDestroy(2); //newGroupId,presenceFeatures - - CUserAfter::AfterL ( 1000000 ); - //Bind context to desired presence service - MImFeatures* imFeatures = NULL; - imFeatures = MImFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( imFeatures ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imFeatures created\n" ) ); - MImConversation& imconversation = imFeatures->ImConversation(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imconversation created\n" ) ); - MImConversationInfo *aImMessage = NULL; - aImMessage = imFeatures->ImObjectFactory().NewImConversationInfoLC(); - MXIMPIdentity* identity = objFactory.NewIdentityLC(); - identity->SetIdentityL ( KMsgId ); - aImMessage->SetMessageIdL ( identity ); - aImMessage->SetTextMessageL ( message ); - CDesCArrayFlat* aRecipients = new ( ELeave ) CDesCArrayFlat ( 2 ); - CleanupStack::PushL ( aRecipients ); //userid's - aRecipients->AppendL ( recipient ); - aImMessage->SetRecipientL ( aRecipients ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::before sendmessage called\n" ) ); - - for ( TInt i = 0;i < 20;i++ ) - { - req = imconversation.SendMessageL ( *aImMessage ); - eventObserver->WaitOpToCompleteL ( req ); - - } - CleanupStack::Pop ( 3 );//identity,aRecipients,aImMessage - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::message sent\n " ) ); - //Unbind the context and wait completion - req = presecenCtx->UnbindL(); - eventObserver->WaitOpToCompleteL( req ); - CleanupStack::PopAndDestroy(4); //imFeatures,presecenCtx,eventObserver,ximpClient, - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::SendTwentyMessageL() end" ) ); - - return KErrNone; - - } - -// ----------------------------------------------------------------------------- -// Cossadapmt::SendMessage_MultipleContactsL -// SendMessage test method function. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::SendMessage_MultipleContactsL ( CStifItemParser& aItem ) - { - - //Initialize XIMP client - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::SendMessage_MultipleContactsL() start" ) ); - MXIMPClient* ximpClient = MXIMPClient::NewClientL(); - CleanupDeletePushL ( ximpClient ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); - //Create new sink to receive presence context events - CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); - //Create new presence context - MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); - //Bind context to desired presence service - presecenCtx->RegisterObserverL ( *eventObserver ); - MPresenceFeatures* presenceFeatures = NULL; - presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( presenceFeatures ); - - //read data from cfg file - TPtrC username; - TPtrC password; - TInt serviceId; - TPtrC message; - TPtrC recipient; - TPtrC recipient1; - TPtrC recipient2; - TPtrC recipient3; - - aItem.GetNextString ( username ); - aItem.GetNextString ( password ); - aItem.GetNextInt ( serviceId ); - aItem.GetNextString ( message ); - aItem.GetNextString ( recipient ); - aItem.GetNextString ( recipient1 ); - aItem.GetNextString ( recipient2 ); - aItem.GetNextString ( recipient3 ); - - TUid protocolUid = TUid::Uid ( KProtocolUid ); - - //Bind context to desired presence service - TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called\n" ) ); - eventObserver->WaitOpToCompleteL ( req ); - MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); - MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); - MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; - - TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); - _LIT ( KDummyListId, "" ); - HBufC16* iListId; - iListId = KDummyListId().AllocL(); - iListId->Des().Fold(); - newGroupId->SetIdentityL ( *iListId ); - delete iListId; - iListId = NULL; - req = groups.SubscribePresentityGroupContentL ( *newGroupId ); - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); - - eventObserver->WaitOpToCompleteL ( req ); - CleanupStack::PopAndDestroy(2); //newGroupId,presenceFeatures - - CUserAfter::AfterL ( 1000000 ); - //Bind context to desired presence service - MImFeatures* imFeatures = NULL; - imFeatures = MImFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( imFeatures ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imFeatures created\n" ) ); - MImConversation& imconversation = imFeatures->ImConversation(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imconversation created\n" ) ); - MImConversationInfo *aImMessage = NULL; - aImMessage = imFeatures->ImObjectFactory().NewImConversationInfoLC(); - MXIMPIdentity* identity = objFactory.NewIdentityLC(); - identity->SetIdentityL ( KMsgId ); - aImMessage->SetMessageIdL ( identity ); - aImMessage->SetTextMessageL ( message ); - CDesCArrayFlat* aRecipients = new ( ELeave ) CDesCArrayFlat ( 2 ); - CleanupStack::PushL ( aRecipients ); - aRecipients->AppendL ( recipient ); //userid's - aRecipients->AppendL ( recipient1 ); - aRecipients->AppendL ( recipient2 ); - aRecipients->AppendL ( recipient3 ); - - aImMessage->SetRecipientL ( aRecipients ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::before sendmessage called\n" ) ); - - req = imconversation.SendMessageL ( *aImMessage ); - eventObserver->WaitOpToCompleteL ( req ); - CleanupStack::Pop ( 3 );//identity,aRecipients,aImMessage - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::message sent\n " ) ); - CUserAfter::AfterL ( 1000000 ); - - //Unbind the context and wait completion - req = presecenCtx->UnbindL(); - eventObserver->WaitOpToCompleteL( req ); - CleanupStack::PopAndDestroy(4); //imFeatures,presecenCtx,eventObserver,ximpClient, - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::SendMessage_MultipleContactsL() end" ) ); - - return KErrNone; - - } - -// ----------------------------------------------------------------------------- -// Cossadapmt::ReceiveMessageL -// SendMessage test method function. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::ReceiveMessageL ( CStifItemParser& aItem ) - { - - //Initialize XIMP client - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ReceiveMessageL() start" ) ); - MXIMPClient* ximpClient = MXIMPClient::NewClientL(); - CleanupDeletePushL ( ximpClient ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); - //Create new sink to receive presence context events - CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); - //Create new presence context - MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); - //Bind context to desired presence service - presecenCtx->RegisterObserverL ( *eventObserver ); - MPresenceFeatures* presenceFeatures = NULL; - presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( presenceFeatures ); - - //read data from cfg file - TPtrC username; - TPtrC password; - TInt serviceId; - TPtrC message; - - aItem.GetNextString ( username ); - aItem.GetNextString ( password ); - aItem.GetNextInt ( serviceId ); - aItem.GetNextString ( message ); - - TUid protocolUid = TUid::Uid ( KProtocolUid ); - - //Bind context to desired presence service - TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called\n" ) ); - eventObserver->WaitOpToCompleteL ( req ); - MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); - MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); - MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; - - TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); - _LIT ( KDummyListId, "" ); - HBufC16* iListId; - iListId = KDummyListId().AllocL(); - iListId->Des().Fold(); - newGroupId->SetIdentityL ( *iListId ); - delete iListId; - iListId = NULL; - req = groups.SubscribePresentityGroupContentL ( *newGroupId ); - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); - - eventObserver->WaitOpToCompleteL ( req ); - CleanupStack::PopAndDestroy(2); //newGroupId,presenceFeatures - - CUserAfter::AfterL ( 1000000 ); - //Bind context to desired presence service - MImFeatures* imFeatures = NULL; - imFeatures = MImFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( imFeatures ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imFeatures created\n" ) ); - MImConversation& imconversation = imFeatures->ImConversation(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imconversation created\n" ) ); - MImConversationInfo *aImMessage = NULL; - aImMessage = imFeatures->ImObjectFactory().NewImConversationInfoLC(); - MXIMPIdentity* identity = objFactory.NewIdentityLC(); - identity->SetIdentityL ( KMsgId ); - aImMessage->SetMessageIdL ( identity ); - aImMessage->SetTextMessageL ( message ); - CDesCArrayFlat* aRecipients = new ( ELeave ) CDesCArrayFlat ( 1 ); - CleanupStack::PushL ( aRecipients ); - aRecipients->AppendL ( username ); //userid of own - aImMessage->SetRecipientL ( aRecipients ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::before sendmessage called\n" ) ); - //send message is to own - req = imconversation.SendMessageL ( *aImMessage ); - eventObserver->WaitOpToCompleteL ( req ); - CleanupStack::Pop ( 3 );//identity,aRecipients,aImMessage - //send message to other guy - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::message sent\n " ) ); - //Unbind the context and wait completion - req = presecenCtx->UnbindL(); - eventObserver->WaitOpToCompleteL( req ); - CleanupStack::PopAndDestroy(4); //imFeatures,presecenCtx,eventObserver,ximpClient, - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ReceiveMessageL() start" ) ); - - return KErrNone; - - } -// ----------------------------------------------------------------------------- -// Cossadapmt::ReceiveEmptyMessageL -// SendMessage test method function. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::ReceiveEmptyMessageL ( CStifItemParser& aItem ) - { - - //Initialize XIMP client - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ReceiveEmptyMessageL() start" ) ); - MXIMPClient* ximpClient = MXIMPClient::NewClientL(); - CleanupDeletePushL ( ximpClient ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); - //Create new sink to receive presence context events - CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); - //Create new presence context - MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); - //Bind context to desired presence service - presecenCtx->RegisterObserverL ( *eventObserver ); - MPresenceFeatures* presenceFeatures = NULL; - presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( presenceFeatures ); - - //read data from cfg file - TPtrC username; - TPtrC password; - TInt serviceId; - - aItem.GetNextString ( username ); - aItem.GetNextString ( password ); - aItem.GetNextInt ( serviceId ); - - TUid protocolUid = TUid::Uid ( KProtocolUid ); - - //Bind context to desired presence service - TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called\n" ) ); - eventObserver->WaitOpToCompleteL ( req ); - MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); - MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); - MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; - - TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); - _LIT ( KDummyListId, "" ); - _LIT ( KEmptyMessage, "" ); - HBufC16* iListId; - iListId = KDummyListId().AllocL(); - iListId->Des().Fold(); - newGroupId->SetIdentityL ( *iListId ); - delete iListId; - iListId = NULL; - req = groups.SubscribePresentityGroupContentL ( *newGroupId ); - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); - - eventObserver->WaitOpToCompleteL ( req ); - CleanupStack::PopAndDestroy(2); //newGroupId,presenceFeatures - - CUserAfter::AfterL ( 1000000 ); - //Bind context to desired presence service - MImFeatures* imFeatures = NULL; - imFeatures = MImFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( imFeatures ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imFeatures created\n" ) ); - MImConversation& imconversation = imFeatures->ImConversation(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imconversation created\n" ) ); - MImConversationInfo *aImMessage = NULL; - aImMessage = imFeatures->ImObjectFactory().NewImConversationInfoLC(); - MXIMPIdentity* identity = objFactory.NewIdentityLC(); - identity->SetIdentityL ( KMsgId ); - aImMessage->SetMessageIdL ( identity ); - aImMessage->SetTextMessageL ( KEmptyMessage ); - CDesCArrayFlat* aRecipients = new ( ELeave ) CDesCArrayFlat ( 1 ); - CleanupStack::PushL ( aRecipients ); - aRecipients->AppendL ( username ); //userid of own - aImMessage->SetRecipientL ( aRecipients ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::before sendmessage called\n" ) ); - //send message is to own - req = imconversation.SendMessageL ( *aImMessage ); - eventObserver->WaitOpToCompleteL ( req ); - CleanupStack::Pop ( 3 );//identity,aRecipients,aImMessage - //send message to other guy - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::message sent\n " ) ); - //Unbind the context and wait completion - req = presecenCtx->UnbindL(); - eventObserver->WaitOpToCompleteL( req ); - CleanupStack::PopAndDestroy(4); //imFeatures,presecenCtx,eventObserver,ximpClient, - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ReceiveEmptyMessageL() start" ) ); - - return KErrNone; - - } - -// ----------------------------------------------------------------------------- -// Cossadapmt::ReceiveTenMessageL -// SendMessage test method function. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::ReceiveTenMessageL ( CStifItemParser& aItem ) - { - - //Initialize XIMP client - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ReceiveTenMessageL() start" ) ); - MXIMPClient* ximpClient = MXIMPClient::NewClientL(); - CleanupDeletePushL ( ximpClient ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); - //Create new sink to receive presence context events - CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); - //Create new presence context - MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); - //Bind context to desired presence service - presecenCtx->RegisterObserverL ( *eventObserver ); - MPresenceFeatures* presenceFeatures = NULL; - presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( presenceFeatures ); - - //read data from cfg file - TPtrC username; - TPtrC password; - TInt serviceId; - TPtrC message; - - aItem.GetNextString ( username ); - aItem.GetNextString ( password ); - aItem.GetNextInt ( serviceId ); - aItem.GetNextString ( message ); - - TUid protocolUid = TUid::Uid ( KProtocolUid ); - - //Bind context to desired presence service - TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called\n" ) ); - eventObserver->WaitOpToCompleteL ( req ); - MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); - MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); - MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; - - TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); - _LIT ( KDummyListId, "" ); - HBufC16* iListId; - iListId = KDummyListId().AllocL(); - iListId->Des().Fold(); - newGroupId->SetIdentityL ( *iListId ); - delete iListId; - iListId = NULL; - req = groups.SubscribePresentityGroupContentL ( *newGroupId ); - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); - - eventObserver->WaitOpToCompleteL ( req ); - CleanupStack::PopAndDestroy(2); //newGroupId,presenceFeatures - - CUserAfter::AfterL ( 1000000 ); - //Bind context to desired presence service - MImFeatures* imFeatures = NULL; - imFeatures = MImFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( imFeatures ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imFeatures created\n" ) ); - MImConversation& imconversation = imFeatures->ImConversation(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imconversation created\n" ) ); - MImConversationInfo *aImMessage = NULL; - aImMessage = imFeatures->ImObjectFactory().NewImConversationInfoLC(); - MXIMPIdentity* identity = objFactory.NewIdentityLC(); - identity->SetIdentityL ( KMsgId ); - aImMessage->SetMessageIdL ( identity ); - aImMessage->SetTextMessageL ( message ); - CDesCArrayFlat* aRecipients = new ( ELeave ) CDesCArrayFlat ( 2 ); - CleanupStack::PushL ( aRecipients ); - aRecipients->AppendL ( username ); //userid of own - aImMessage->SetRecipientL ( aRecipients ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::before sendmessage called\n" ) ); - - for ( TInt i = 0;i < 10;i++ ) - { - req = imconversation.SendMessageL ( *aImMessage ); - eventObserver->WaitOpToCompleteL ( req ); - - } - CleanupStack::Pop ( 3 );//identity,aRecipients,aImMessage - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::message sent\n " ) ); - //Unbind the context and wait completion - req = presecenCtx->UnbindL(); - eventObserver->WaitOpToCompleteL( req ); - CleanupStack::PopAndDestroy(4); //imFeatures,presecenCtx,eventObserver,ximpClient, - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ReceiveTenMessageL() end" ) ); - - return KErrNone; - - } - -// ----------------------------------------------------------------------------- -// Cossadapmt::ReceiveTwentyMessageL -// SendMessage test method function. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::ReceiveTwentyMessageL ( CStifItemParser& aItem ) - { - - //Initialize XIMP client - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ReceiveTwentyMessageL() start" ) ); - MXIMPClient* ximpClient = MXIMPClient::NewClientL(); - CleanupDeletePushL ( ximpClient ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); - //Create new sink to receive presence context events - CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); - //Create new presence context - MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); - //Bind context to desired presence service - presecenCtx->RegisterObserverL ( *eventObserver ); - MPresenceFeatures* presenceFeatures = NULL; - presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( presenceFeatures ); - - //read data from cfg file - TPtrC username; - TPtrC password; - TInt serviceId; - TPtrC message; - - aItem.GetNextString ( username ); - aItem.GetNextString ( password ); - aItem.GetNextInt ( serviceId ); - aItem.GetNextString ( message ); - - TUid protocolUid = TUid::Uid ( KProtocolUid ); - - //Bind context to desired presence service - TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called\n" ) ); - eventObserver->WaitOpToCompleteL ( req ); - MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); - MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); - MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; - - TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); - _LIT ( KDummyListId, "" ); - HBufC16* iListId; - iListId = KDummyListId().AllocL(); - iListId->Des().Fold(); - newGroupId->SetIdentityL ( *iListId ); - delete iListId; - iListId = NULL; - req = groups.SubscribePresentityGroupContentL ( *newGroupId ); - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); - - eventObserver->WaitOpToCompleteL ( req ); - CleanupStack::PopAndDestroy(2); //newGroupId,presenceFeatures - - CUserAfter::AfterL ( 1000000 ); - //Bind context to desired presence service - MImFeatures* imFeatures = NULL; - imFeatures = MImFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( imFeatures ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imFeatures created\n" ) ); - MImConversation& imconversation = imFeatures->ImConversation(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imconversation created\n" ) ); - MImConversationInfo *aImMessage = NULL; - aImMessage = imFeatures->ImObjectFactory().NewImConversationInfoLC(); - MXIMPIdentity* identity = objFactory.NewIdentityLC(); - identity->SetIdentityL ( KMsgId ); - aImMessage->SetMessageIdL ( identity ); - aImMessage->SetTextMessageL ( message ); - CDesCArrayFlat* aRecipients = new ( ELeave ) CDesCArrayFlat ( 2 ); - CleanupStack::PushL ( aRecipients ); - aRecipients->AppendL ( username ); //userid's of own - aImMessage->SetRecipientL ( aRecipients ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::before sendmessage called\n" ) ); - - for ( TInt i = 0;i < 20;i++ ) - { - req = imconversation.SendMessageL ( *aImMessage ); - eventObserver->WaitOpToCompleteL ( req ); - } - CleanupStack::Pop ( 3 );//identity,aRecipients,aImMessage - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::message sent\n " ) ); - //Unbind the context and wait completion - req = presecenCtx->UnbindL(); - eventObserver->WaitOpToCompleteL( req ); - CleanupStack::PopAndDestroy(4); //imFeatures,presecenCtx,eventObserver,ximpClient, - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ReceiveTwentyMessageL() end" ) ); - - return KErrNone; - - } - - -// ----------------------------------------------------------------------------- -// Cossadapmt::PublishOwnPresenceL -// Login test method function. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::PublishOwnPresenceL ( CStifItemParser& aItem ) - { - - - - //Initialize XIMP client - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::PublishOwnPresenceL() start" ) ); - - MXIMPClient* ximpClient = MXIMPClient::NewClientL(); - CleanupDeletePushL ( ximpClient ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); - - //Create new sink to receive presence context events - CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); - - //Create new presence context - MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); - presecenCtx->RegisterObserverL ( *eventObserver ); - - MPresenceFeatures* presenceFeatures = NULL; - presenceFeatures = MPresenceFeatures::NewL(presecenCtx); - CleanupDeletePushL( presenceFeatures ); - - - //read data from cfg file - TPtrC username; - TPtrC password; - TInt serviceId; - TInt availability; - TPtrC statustext; - - aItem.GetNextString ( username ); - aItem.GetNextString ( password ); - aItem.GetNextInt ( serviceId ); - aItem.GetNextInt ( availability ); - aItem.GetNextString ( statustext ); - - TUid protocolUid = TUid::Uid ( KProtocolUid ); - - //Bind context to desired presence service - TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); - //Wait with CActiveSchedulerWait the binding to complete - //If binding fails, it is handled with leave - eventObserver->WaitOpToCompleteL ( req ); - // Take handles to object factory and publish interface - MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); - MPresencePublishing& publisher = presenceFeatures->PresencePublishing(); - //Fill presence doc with presence components and attributes - MPresenceInfo* myPresence = presenceFeatures->PresenceObjectFactory().NewPresenceInfoLC();//1 - MServicePresenceInfo* myServicePresence = presenceFeatures->PresenceObjectFactory().NewServicePresenceInfoLC();//2 - myServicePresence->SetServiceTypeL( NPresenceInfo::NServiceType::KInstantMessaging ); - //MPresenceInfoFieldCollection& attributeFields = myServicePresence->Fields(); - - MPersonPresenceInfo *PersonPresence = presenceFeatures->PresenceObjectFactory().NewPersonPresenceInfoLC(); - MPresenceInfoFieldCollection& attributeFields = PersonPresence->Fields(); - - MPresenceInfoField* infoField = presenceFeatures->PresenceObjectFactory().NewInfoFieldLC();//3 - - // "availability" attribute - MPresenceInfoFieldValueEnum* availabilityField = presenceFeatures->PresenceObjectFactory().NewEnumInfoFieldLC();//4 - availabilityField->SetValueL( availability ); - infoField->SetFieldTypeL( NPresenceInfo::NFieldType::KAvailability ); - infoField->SetFieldValue( availabilityField ); - CleanupStack::Pop(); // availabilityField - - attributeFields.AddOrReplaceFieldL(infoField ); - //TInt count = serviceFields.FieldCount(); - CleanupStack::Pop(); // infoField - - //status text - infoField = presenceFeatures->PresenceObjectFactory().NewInfoFieldLC();//7 - MPresenceInfoFieldValueText* statustextField = presenceFeatures->PresenceObjectFactory().NewTextInfoFieldLC();//8 - statustextField->SetTextValueL( statustext ); // some status text - infoField->SetFieldTypeL( KStatusTextfield ); - infoField->SetFieldValue( statustextField ); - CleanupStack::Pop(); // statustextField - attributeFields.AddOrReplaceFieldL( infoField ); - CleanupStack::Pop(); // infoField - - - //online status - - infoField = presenceFeatures->PresenceObjectFactory().NewInfoFieldLC();//7 - MPresenceInfoFieldValueText* onlineField = presenceFeatures->PresenceObjectFactory().NewTextInfoFieldLC();//8 - onlineField->SetTextValueL( _L("T" ) ); // some status text - infoField->SetFieldTypeL( KOnlineStatusfield ); - infoField->SetFieldValue( onlineField ); - CleanupStack::Pop(); // devmodelField - attributeFields.AddOrReplaceFieldL( infoField ); - CleanupStack::Pop(); // infoField - - - myPresence->AddServicePresenceL( myServicePresence ); - myPresence->SetPersonPresenceL(PersonPresence); - TInt count = attributeFields.FieldCount(); - CleanupStack::Pop(2); // myServicePresence,PersonPresence - - - //publish the presence - req = publisher.PublishOwnPresenceL( *myPresence ); - - // wait completion - eventObserver->WaitOpToCompleteL( req ); - CleanupStack::PopAndDestroy(1); // myPresence - - CUserAfter::AfterL ( 1000000 ); - req = presecenCtx->UnbindL(); - eventObserver->WaitOpToCompleteL( req ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); - - CleanupStack::PopAndDestroy ( 4 ); //presenceFeatures,presecenCtx,eventObserver,ximpClient - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::PublishOwnPresenceL() End" ) ); - return KErrNone; - - } -// ----------------------------------------------------------------------------- -// Cossadapmt::PublishOwnPresenceEmptyTextL -// Login test method function. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::PublishOwnPresenceEmptyTextL ( CStifItemParser& aItem ) - { - - - - //Initialize XIMP client - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::PublishOwnPresenceEmptyTextL() start" ) ); - - MXIMPClient* ximpClient = MXIMPClient::NewClientL(); - CleanupDeletePushL ( ximpClient ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); - - //Create new sink to receive presence context events - CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); - - //Create new presence context - MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); - presecenCtx->RegisterObserverL ( *eventObserver ); - - MPresenceFeatures* presenceFeatures = NULL; - presenceFeatures = MPresenceFeatures::NewL(presecenCtx); - CleanupDeletePushL( presenceFeatures ); - - - //read data from cfg file - TPtrC username; - TPtrC password; - TInt serviceId; - TInt availability; - - aItem.GetNextString ( username ); - aItem.GetNextString ( password ); - aItem.GetNextInt ( serviceId ); - aItem.GetNextInt ( availability ); - _LIT ( KBlankStatusText, "" ); - - TUid protocolUid = TUid::Uid ( KProtocolUid ); - - //Bind context to desired presence service - TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); - //Wait with CActiveSchedulerWait the binding to complete - //If binding fails, it is handled with leave - eventObserver->WaitOpToCompleteL ( req ); - // Take handles to object factory and publish interface - MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); - MPresencePublishing& publisher = presenceFeatures->PresencePublishing(); - //Fill presence doc with presence components and attributes - MPresenceInfo* myPresence = presenceFeatures->PresenceObjectFactory().NewPresenceInfoLC();//1 - MServicePresenceInfo* myServicePresence = presenceFeatures->PresenceObjectFactory().NewServicePresenceInfoLC();//2 - myServicePresence->SetServiceTypeL( NPresenceInfo::NServiceType::KInstantMessaging ); - //MPresenceInfoFieldCollection& attributeFields = myServicePresence->Fields(); - - MPersonPresenceInfo *PersonPresence = presenceFeatures->PresenceObjectFactory().NewPersonPresenceInfoLC(); - MPresenceInfoFieldCollection& attributeFields = PersonPresence->Fields(); - - MPresenceInfoField* infoField = presenceFeatures->PresenceObjectFactory().NewInfoFieldLC();//3 - - // "availability" attribute - MPresenceInfoFieldValueEnum* availabilityField = presenceFeatures->PresenceObjectFactory().NewEnumInfoFieldLC();//4 - availabilityField->SetValueL( availability ); - infoField->SetFieldTypeL( NPresenceInfo::NFieldType::KAvailability ); - infoField->SetFieldValue( availabilityField ); - CleanupStack::Pop(); // availabilityField - - attributeFields.AddOrReplaceFieldL(infoField ); - //TInt count = serviceFields.FieldCount(); - CleanupStack::Pop(); // infoField - - //status text - infoField = presenceFeatures->PresenceObjectFactory().NewInfoFieldLC();//7 - MPresenceInfoFieldValueText* statustextField = presenceFeatures->PresenceObjectFactory().NewTextInfoFieldLC();//8 - statustextField->SetTextValueL( KBlankStatusText ); // some status text - infoField->SetFieldTypeL( KStatusTextfield ); - infoField->SetFieldValue( statustextField ); - CleanupStack::Pop(); // statustextField - attributeFields.AddOrReplaceFieldL( infoField ); - CleanupStack::Pop(); // infoField - - - //online status - - infoField = presenceFeatures->PresenceObjectFactory().NewInfoFieldLC();//7 - MPresenceInfoFieldValueText* onlineField = presenceFeatures->PresenceObjectFactory().NewTextInfoFieldLC();//8 - onlineField->SetTextValueL( _L("T" ) ); // some status text - infoField->SetFieldTypeL( KOnlineStatusfield ); - infoField->SetFieldValue( onlineField ); - CleanupStack::Pop(); // devmodelField - attributeFields.AddOrReplaceFieldL( infoField ); - CleanupStack::Pop(); // infoField - - - myPresence->AddServicePresenceL( myServicePresence ); - myPresence->SetPersonPresenceL(PersonPresence); - TInt count = attributeFields.FieldCount(); - CleanupStack::Pop(2); // myServicePresence,PersonPresence - - - //publish the presence - req = publisher.PublishOwnPresenceL( *myPresence ); - - // wait completion - eventObserver->WaitOpToCompleteL( req ); - CleanupStack::PopAndDestroy(1); // myPresence - - CUserAfter::AfterL ( 1000000 ); - req = presecenCtx->UnbindL(); - eventObserver->WaitOpToCompleteL( req ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); - - CleanupStack::PopAndDestroy ( 4 ); //presenceFeatures,presecenCtx,eventObserver,ximpClient - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::PublishOwnPresenceEmptyTextL() End" ) ); - return KErrNone; - - } -TInt Cossadapmt::AcceptnotificationRequestL ( CStifItemParser& aItem ) - { - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::AcceptAddnotificationRequestL() start" ) ); - - MXIMPClient* ximpClient = MXIMPClient::NewClientL(); - CleanupDeletePushL ( ximpClient ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); - - //Create new sink to receive presence context events - CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); - - //Create new presence context - MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); - presecenCtx->RegisterObserverL ( *eventObserver ); - MPresenceFeatures* presenceFeatures = NULL; - presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( presenceFeatures ); - TOssAdapMtLogger::Log ( _L ( "Loading presence plugin Done" ) ); - MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); - MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); - MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; - MPresenceAuthorization& authorization = presenceFeatures->PresenceAuthorization(); - MPresenceInfoFilter* infoFilt = presenceFeatures->PresenceObjectFactory().NewPresenceInfoFilterLC(); - - infoFilt->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAcceptAll ); - - TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); - _LIT ( KDummyListId, "list" ); - HBufC16* iListId; - iListId = KDummyListId().AllocL(); - iListId->Des().Fold(); - newGroupId->SetIdentityL ( *iListId ); - delete iListId; - iListId = NULL; - - //read data from cfg file - TPtrC username; - TPtrC password; - TInt serviceId; - - aItem.GetNextString ( username ); - aItem.GetNextString ( password ); - aItem.GetNextInt ( serviceId ); - - TUid protocolUid = TUid::Uid ( KProtocolUid ); - - //Bind context to desired presence service - TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); - //Wait with CActiveSchedulerWait the binding to complete - //If binding fails, it is handled with leave - eventObserver->WaitOpToCompleteL ( req ); - req = authorization.SubscribePresenceGrantRequestListL(); - - // wait completion - - eventObserver->WaitOpToCompleteL( req ); - - CUserAfter::AfterL( 1000000 ); - - req = groups.SubscribePresentityGroupContentL ( *newGroupId ); - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); - - eventObserver->WaitOpToCompleteL ( req ); - - CUserAfter::AfterL ( 5000000 ); - - MXIMPIdentity* testContactId = objFactory.NewIdentityLC(); - testContactId->SetIdentityL( KContact1 ); - req = authorization.GrantPresenceForPresentityL(*testContactId ,*infoFilt ); - - // wait completion - eventObserver->WaitOpToCompleteL( req ); - - - CleanupStack::PopAndDestroy();//testContactId - //Unbind the context and wait completion - req = presecenCtx->UnbindL(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->UnbindL() called" ) ); - - eventObserver->WaitOpToCompleteL ( req ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); - - CleanupStack::PopAndDestroy ( 6 );//newGroupId,presenceFeatures,presecenCtx,eventObserver,ximpClient,infoFilt - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::AcceptAddnotificationRequestL() end" ) ); - - return KErrNone; - } - - -// ----------------------------------------------------------------------------- -// Cossadapmt::RejectAddnotificationRequestL -// AddConatctL contacts test method function. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::RejectAddnotificationRequestL ( CStifItemParser& aItem ) - { - - //Initialize XIMP client - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::RejectAddnotificationRequestL() start" ) ); - - MXIMPClient* ximpClient = MXIMPClient::NewClientL(); - CleanupDeletePushL ( ximpClient ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); - - //Create new sink to receive presence context events - CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); - - //Create new presence context - MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); - presecenCtx->RegisterObserverL ( *eventObserver ); - MPresenceFeatures* presenceFeatures = NULL; - presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( presenceFeatures ); - TOssAdapMtLogger::Log ( _L ( "Loading presence plugin Done" ) ); - MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); - MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); - MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; - MPresenceAuthorization& authorization = presenceFeatures->PresenceAuthorization(); - MPresenceInfoFilter* infoFilt = presenceFeatures->PresenceObjectFactory().NewPresenceInfoFilterLC(); - - infoFilt->AcceptPersonFilterL( NPresenceInfo::NFieldType::KAcceptAll ); - - TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); - _LIT ( KDummyListId, "list" ); - HBufC16* iListId; - iListId = KDummyListId().AllocL(); - iListId->Des().Fold(); - newGroupId->SetIdentityL ( *iListId ); - delete iListId; - iListId = NULL; - - //read data from cfg file - TPtrC username; - TPtrC password; - TInt serviceId; - - aItem.GetNextString ( username ); - aItem.GetNextString ( password ); - aItem.GetNextInt ( serviceId ); - - TUid protocolUid = TUid::Uid ( KProtocolUid ); - - //Bind context to desired presence service - TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); - //Wait with CActiveSchedulerWait the binding to complete - //If binding fails, it is handled with leave - eventObserver->WaitOpToCompleteL ( req ); - req = authorization.SubscribePresenceGrantRequestListL(); - - // wait completion - - eventObserver->WaitOpToCompleteL( req ); - - CUserAfter::AfterL( 1000000 ); - - req = groups.SubscribePresentityGroupContentL ( *newGroupId ); - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); - - eventObserver->WaitOpToCompleteL ( req ); - CUserAfter::AfterL ( 5000000 ); - - MXIMPIdentity* testContactId = objFactory.NewIdentityLC(); - testContactId->SetIdentityL( KContact1 ); - req = authorization.WithdrawPresenceGrantFromPresentityL(*testContactId); - - // wait completion - eventObserver->WaitOpToCompleteL( req ); - - CUserAfter::AfterL( 1000000 ); - - CleanupStack::PopAndDestroy();//testContactId - //Unbind the context and wait completion - req = presecenCtx->UnbindL(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->UnbindL() called" ) ); - - eventObserver->WaitOpToCompleteL ( req ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); - - CleanupStack::PopAndDestroy ( 6 );//infoFilt,newGroupId,presenceFeatures,presecenCtx,eventObserver,ximpClient - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::RejectAddnotificationRequestL() end" ) ); - - return KErrNone; - - } -// ----------------------------------------------------------------------------- -// Cossadapmt::ImOperationsCoverageL -// ImOperationsCoverageL test method function. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::ImOperationsCoverageL ( CStifItemParser& aItem ) - { - - //Initialize XIMP client - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ImOperationsCoverageL() start" ) ); - MXIMPClient* ximpClient = MXIMPClient::NewClientL(); - CleanupDeletePushL ( ximpClient ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); - //Create new sink to receive presence context events - CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); - //Create new presence context - MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); - //Bind context to desired presence service - presecenCtx->RegisterObserverL ( *eventObserver ); - MPresenceFeatures* presenceFeatures = NULL; - presenceFeatures = MPresenceFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( presenceFeatures ); - - //read data from cfg file - TPtrC username; - TPtrC password; - TInt serviceId; - TPtrC message; - TPtrC contact; - aItem.GetNextString ( username ); - aItem.GetNextString ( password ); - aItem.GetNextInt ( serviceId ); - aItem.GetNextString ( message ); - aItem.GetNextString ( contact ); - TUid protocolUid = TUid::Uid ( KProtocolUid ); - - //Bind context to desired presence service - TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called\n" ) ); - eventObserver->WaitOpToCompleteL ( req ); - MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); - MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); - MPresentityGroups& groups = presenceFeatures->PresentityGroups() ; - - TOssAdapMtLogger::Log ( _L ( "presentity groups object created" ) ); - _LIT ( KDummyListId, "" ); - HBufC16* iListId; - iListId = KDummyListId().AllocL(); - iListId->Des().Fold(); - newGroupId->SetIdentityL ( *iListId ); - delete iListId; - iListId = NULL; - req = groups.SubscribePresentityGroupContentL ( *newGroupId ); - - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::groups.SubscribePresentityGroupListL() called" ) ); - - eventObserver->WaitOpToCompleteL ( req ); - CleanupStack::PopAndDestroy(2); //newGroupId,presenceFeatures - - CUserAfter::AfterL ( 1000000 ); - //Bind context to desired presence service - MImFeatures* imFeatures = NULL; - imFeatures = MImFeatures::NewL ( presecenCtx ); - CleanupDeletePushL ( imFeatures ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imFeatures created\n" ) ); - MImConversation& imconversation = imFeatures->ImConversation(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::imconversation created\n" ) ); - MImConversationInfo *aImMessage = NULL; - aImMessage = imFeatures->ImObjectFactory().NewImConversationInfoLC(); - MXIMPIdentity* identity = objFactory.NewIdentityLC(); - identity->SetIdentityL ( KMsgId ); - aImMessage->SetMessageIdL ( identity ); - aImMessage->SetTextMessageL ( message ); - CDesCArrayFlat* aRecipients = new ( ELeave ) CDesCArrayFlat ( 1 ); - CleanupStack::PushL ( aRecipients ); - aRecipients->AppendL ( username ); //userid of own - aImMessage->SetRecipientL ( aRecipients ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::before sendmessage called\n" ) ); - //send message is to own - req = imconversation.SendMessageL ( *aImMessage ); - eventObserver->WaitOpToCompleteL ( req ); - CleanupStack::Pop ( 3 );//identity,aRecipients,aImMessage - //send message to other guy - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::message sent\n " ) ); - //Unbind the context and wait completion - req = presecenCtx->UnbindL(); - eventObserver->WaitOpToCompleteL( req ); - CleanupStack::PopAndDestroy(4); //imFeatures,presecenCtx,eventObserver,ximpClient, - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ImOperationsCoverageL() start" ) ); - - return KErrNone; - - } -// ----------------------------------------------------------------------------- -// Cossadapmt::SetAvtarL -// Login test method function. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cossadapmt::SetAvtarL ( CStifItemParser& aItem ) - { - - - - //Initialize XIMP client - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::SetAvtarL() start" ) ); - - MXIMPClient* ximpClient = MXIMPClient::NewClientL(); - CleanupDeletePushL ( ximpClient ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::MXIMPClient::NewClientL() start" ) ); - - //Create new sink to receive presence context events - CUSContextObserver* eventObserver = CUSContextObserver::NewLC(); - - //Create new presence context - MXIMPContext* presecenCtx = ximpClient->NewPresenceContextLC(); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::ximpClient->NewPresenceContextLC() called" ) ); - presecenCtx->RegisterObserverL ( *eventObserver ); - - MPresenceFeatures* presenceFeatures = NULL; - presenceFeatures = MPresenceFeatures::NewL(presecenCtx); - CleanupDeletePushL( presenceFeatures ); - - - //read data from cfg file - TPtrC username; - TPtrC password; - TInt serviceId; - TPtrC filename; - aItem.GetNextString ( username ); - aItem.GetNextString ( password ); - aItem.GetNextInt ( serviceId ); - aItem.GetNextString ( filename ); - TUid protocolUid = TUid::Uid ( KProtocolUid ); - - //Bind context to desired presence service - TXIMPRequestId req = presecenCtx->BindToL ( protocolUid, - username, - password, - serviceId ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::presecenCtx->BindToL() called" ) ); - //Wait with CActiveSchedulerWait the binding to complete - //If binding fails, it is handled with leave - eventObserver->WaitOpToCompleteL ( req ); - // Take handles to object factory and publish interface - // Take handles to object factory and publish interface - presenceFeatures = MPresenceFeatures::NewL(presecenCtx); - MXIMPObjectFactory& objFactory = presecenCtx->ObjectFactory(); - - MXIMPIdentity* newGroupId = objFactory.NewIdentityLC(); - MXIMPIdentity* newmemberId = objFactory.NewIdentityLC(); - - CleanupDeletePushL( presenceFeatures ); - - MPresencePublishing& publisher = presenceFeatures->PresencePublishing(); - - //Fill presence doc with presence components and attributes - MPresenceInfo* myPresence = presenceFeatures->PresenceObjectFactory().NewPresenceInfoLC();//1 - MPersonPresenceInfo *PersonPresence = presenceFeatures->PresenceObjectFactory().NewPersonPresenceInfoLC(); - MPresenceInfoFieldCollection& attributeFields = PersonPresence->Fields(); - - MPresenceInfoField* infoField = presenceFeatures->PresenceObjectFactory().NewInfoFieldLC();//3 - - //based on the state conver it to ximpfw status. - - - // "availability" attribute - MPresenceInfoFieldValueBinary* avatarField = presenceFeatures->PresenceObjectFactory().NewBinaryInfoFieldLC();//4 - //avatarField->SetBinaryValueL(*(aImageLoader->GetContentData())); - _LIT8(KMimeType,"image/gif"); - TBufC8<20> mimetype(KMimeType); - - avatarField->SetMimeTypeL(mimetype.Des()); - RFile file; - RFs iFs; - User::LeaveIfError( iFs.Connect() ); - User::LeaveIfError( file.Open( iFs, _L("c:\\index.gif"), EFileRead ) ); - CleanupClosePushL( file ); - - // Get file size - TInt fileSize = 0; - User::LeaveIfError( file.Size( fileSize ) ); - - // Check file size, if bigger than max transaction content -> leave - /* if ( fileSize > - iImpsFactory.CreateImClientL()->MaxTransactionContentLengthL() ) - { - User::Leave( KErrOverflow ); - }*/ - - // Get file content - HBufC8* Content = HBufC8::NewL( fileSize ); - TPtr8 ptr( Content->Des() ); - User::LeaveIfError( file.Read( ptr, fileSize ) ); - - avatarField->SetBinaryValueL(*Content); - infoField->SetFieldTypeL( NPresenceInfo::NFieldType::KAvatar ); - infoField->SetFieldValue( avatarField ); - CleanupStack::Pop(); // availabilityField - - attributeFields.AddOrReplaceFieldL(infoField ); - - CleanupStack::Pop(); // infoField - - myPresence->SetPersonPresenceL(PersonPresence); - CleanupStack::Pop(1); // PersonPresence - - req = publisher.PublishOwnPresenceL( *myPresence ); - - // wait completion - eventObserver->WaitOpToCompleteL( req ); - CleanupStack::PopAndDestroy(1); // myPresence - - req = presecenCtx->UnbindL(); - eventObserver->WaitOpToCompleteL( req ); - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::WaitOpToCompleteL() end" ) ); - - CleanupStack::PopAndDestroy ( 4 ); //presenceFeatures,presecenCtx,eventObserver,ximpClient - TOssAdapMtLogger::Log ( _L ( "Cossadapmt::SetAvtarL() End" ) ); - return KErrNone; - - } -// [End of File] - Do not remove diff -r 085f765766a0 -r 860cd8a5168c imservices/ossprotocoladaptation/tsrc/ossadapmt/src/uscontextobserver.cpp --- a/imservices/ossprotocoladaptation/tsrc/ossadapmt/src/uscontextobserver.cpp Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,753 +0,0 @@ -/* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: uscontextobserver.cpp -* -*/ - -#include "uscontextobserver.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "ossadapmt.h" -#include -#include -#include "ximpcontextstate.h" -#include -#include -#include -#include -#include -#include -#include -#include - -#include "imconversationevent.h" -#include - -#include "imconversationinfo.h" -#include -#include -#include - -#include -#include -#include -// ============================ MEMBER FUNCTIONS =============================== - -// CONSTRUCTION -CUSContextObserver* CUSContextObserver::NewLC() - { - CUSContextObserver* self = new ( ELeave ) CUSContextObserver(); - CleanupStack::PushL ( self ); - return self; - } - - -CUSContextObserver::~CUSContextObserver() - { - } - - -CUSContextObserver::CUSContextObserver() - { - } - - - -// =========================================================================== -// PUBLIC FUNCTIONS -// =========================================================================== -// -void CUSContextObserver::WaitOpToCompleteL ( const TXIMPRequestId& aOpToWait ) - { - iReqToWait = aOpToWait; - - iWait.Start(); - - } - -/*void CUSContextObserver::WaitCompleteL() - { - iWait.AsyncStop(); - }*/ - -// =========================================================================== -// FROM MXIMPContextObserver -// =========================================================================== -// -void CUSContextObserver::HandlePresenceContextEvent ( - const MXIMPContext& /*aContext*/, - const MXIMPBase& aEvent ) - { - - TOssAdapMtLogger::Log ( _L ( "HandlePresenceContextEvent called" ) ); - - TInt32 eventId = aEvent.GetInterfaceId(); - - switch ( aEvent.GetInterfaceId() ) - { - _LIT ( KDir, "EVENT_LOG" ); // here we hv to write a folder name in wch we want to create log file - _LIT ( KFile, "event.txt" ); //here we hv to write a file name in wch we want to log default path is " c:/Logs/" - - case MXIMPRequestCompleteEvent::KInterfaceId: - { - TOssAdapMtLogger::Log ( _L ( "CUSContextObserver::MXIMPRequestCompleteEvent() start" ) ); - - const MXIMPRequestCompleteEvent* complEvent = - TXIMPGetInterface< const MXIMPRequestCompleteEvent >::From ( aEvent, - MXIMPBase::EPanicIfUnknown ); - - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "*************BEGIN******************" ) ); - _LIT ( KMsg, "Recvd RequestCompleteEvent " ); // here we hv to write message or text wch we want to write in log file - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, KMsg ); - - if ( iWait.IsStarted() && ( complEvent->RequestId() == iReqToWait ) ) - { - iReqResult = complEvent->CompletionResult().ResultCode(); - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "Error code for the request is %d " ), iReqResult ); - iWait.AsyncStop(); - } - - TOssAdapMtLogger::Log ( _L ( "CUSContextObserver::MXIMPRequestCompleteEvent() end" ) ); - - break; - } - - case MXIMPContextStateEvent::KInterfaceId: - { - const MXIMPContextStateEvent* ctxtStateEvent = - TXIMPGetInterface< const MXIMPContextStateEvent >::From ( aEvent, - MXIMPBase::EPanicIfUnknown ); - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "*************BEGIN******************" ) ); - _LIT ( KMsg, "Recvd PresenceContextStateEvent " ); // here we hv to write message or text wch we want to write in log file - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, KMsg ); - const MXIMPStatus* fwStatus = ctxtStateEvent->StateChangeReason(); - const MXIMPContextState& cState = ctxtStateEvent->ContextState(); - MXIMPContextState::TState state = cState.ContextState(); - break; - } - - case MPresentityGroupListEvent::KInterfaceId: - { - const MPresentityGroupListEvent* groupListEvent = - TXIMPGetInterface< const MPresentityGroupListEvent >::From ( aEvent, - MXIMPBase::EPanicIfUnknown ); - - TBuf<100> sdstate; - TBuf<100> ssstate; - _LIT ( Kna, " Susbcription state is unavailable" ); - _LIT ( Kava, " Susbcription state is available" ); - _LIT ( KDef, " Susbcription state is ERROR" ); - - const MXIMPDataSubscriptionState& dstate = groupListEvent->DataSubscriptionState(); - - switch ( dstate.SubscriptionState() ) - { - - case 0: - ssstate.Copy ( Kna ); - break; - - case 1: - ssstate.Copy ( Kava ); - break; - - default: - ssstate.Copy ( KDef ); - break; - } - - _LIT ( Kdna, " Data state is unavailable" ); - - _LIT ( Kdava, " Data state is available" ); - _LIT ( KdDef, " Data state is ERROR" ); - - - switch ( dstate.SubscriptionState() ) - { - - case 0: - sdstate.Copy ( Kdna ); - break; - - case 1: - sdstate.Copy ( Kdava ); - break; - - default: - sdstate.Copy ( KdDef ); - break; - } - - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "*************BEGIN******************" ) ); - - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "Recvd PresentityGroupListEvent New:%d, Updt:%d, Disappeared:%d, Current:%d, SubscrState:%d, DataState:%d" ), groupListEvent->NewGroupsCount(), groupListEvent->UpdatedGroupsCount(), groupListEvent->DisappearedGroupsCount(), groupListEvent->CurrentGroupsCount(), dstate.SubscriptionState(), dstate.DataState() );//KMsg); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, sdstate ); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, ssstate ); - break; - } - - - case MPresentityGroupContentEvent::KInterfaceId: - { - const MPresentityGroupContentEvent* groupContentEvent = - TXIMPGetInterface< const MPresentityGroupContentEvent >::From ( aEvent, - MXIMPBase::EPanicIfUnknown ); - TBuf<100> sdstate; - TBuf<100> ssstate; - _LIT ( Kna, " Susbcription state is unavailable" ); - _LIT ( Kava, " Susbcription state is available" ); - _LIT ( KDef, " Susbcription state is ERROR" ); - - const MXIMPDataSubscriptionState& dstate = groupContentEvent->DataSubscriptionState(); - - switch ( dstate.SubscriptionState() ) - { - - case 0: - ssstate.Copy ( Kna ); - break; - - case 1: - ssstate.Copy ( Kava ); - break; - - default: - ssstate.Copy ( KDef ); - break; - } - - _LIT ( Kdna, " Data state is unavailable" ); - - _LIT ( Kdava, " Data state is available" ); - _LIT ( KdDef, " Data state is ERROR" ); - - - switch ( dstate.SubscriptionState() ) - { - - case 0: - sdstate.Copy ( Kdna ); - break; - - case 1: - sdstate.Copy ( Kdava ); - break; - - default: - sdstate.Copy ( KdDef ); - break; - } - - - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "*************BEGIN******************" ) ); - - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "Recvd PresentityGroupContentEvent New:%d, Updt:%d, Disappeared:%d, Current:%d, SubscrState:%d, DataState:%d" ), groupContentEvent->NewMembersCount(), groupContentEvent->UpdatedMembersCount(), groupContentEvent->DisappearedMembersCount(), groupContentEvent->CurrentMembersCount(), dstate.SubscriptionState(), dstate.DataState() ); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, sdstate ); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, ssstate ); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, groupContentEvent->GroupId().Identity() ); - // print the list contents - - for ( TInt i = 0; i < groupContentEvent->CurrentMembersCount(); i++ ) - { - const MPresentityGroupMemberInfo& gi = groupContentEvent->CurrentMember ( i ); - - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "Id and displayname for cur group member %d X" ), i ); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, gi.GroupMemberId().Identity() ); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, gi.GroupMemberDisplayName() ); -// EUNIT_ASSERT_EQUALS_DESC( gi.GroupMemberId().Identity(), iContactid[i], "contact id's does'nt match"); -// EUNIT_ASSERT_EQUALS_DESC( gi.GroupMemberDisplayName(), iNickname[i], "contact nickname does'nt match"); - - } - - // print the list contents - for ( TInt i = 0; i < groupContentEvent->NewMembersCount(); i++ ) - { - const MPresentityGroupMemberInfo& gi = groupContentEvent->NewMember ( i ); - - - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "Id and displayname for new group member %d X" ), i ); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, gi.GroupMemberId().Identity() ); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, gi.GroupMemberDisplayName() ); -// EUNIT_ASSERT_EQUALS_DESC( gi.GroupMemberId().Identity(), iContactid[i], "contact id's does'nt match"); -// EUNIT_ASSERT_EQUALS_DESC( gi.GroupMemberDisplayName(), iNickname[i], "contact nickname does'nt match"); - } - - - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "*************END*******************" ) ); - - break; - } - - case MPresenceGrantRequestListEvent::KInterfaceId: - { - const MPresenceGrantRequestListEvent* grantreqEvent = - TXIMPGetInterface< const MPresenceGrantRequestListEvent >::From ( aEvent, - MXIMPBase::EPanicIfUnknown ); - TBuf<100> sdstate; - TBuf<100> ssstate; - _LIT ( Kna, " Susbcription state is unavailable" ); - _LIT ( Kava, " Susbcription state is available" ); - _LIT ( KDef, " Susbcription state is ERROR" ); - - const MXIMPDataSubscriptionState& dstate = grantreqEvent->DataSubscriptionState(); - - switch ( dstate.SubscriptionState() ) - { - - case 0: - ssstate.Copy ( Kna ); - break; - - case 1: - ssstate.Copy ( Kava ); - break; - - default: - ssstate.Copy ( KDef ); - break; - } - - _LIT ( Kdna, " Data state is unavailable" ); - - _LIT ( Kdava, " Data state is available" ); - _LIT ( KdDef, " Data state is ERROR" ); - - - switch ( dstate.SubscriptionState() ) - { - - case 0: - sdstate.Copy ( Kdna ); - break; - - case 1: - sdstate.Copy ( Kdava ); - break; - - default: - sdstate.Copy ( KdDef ); - break; - } - - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "*************BEGIN******************" ) ); - - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "Recvd Presentity Grant event" ) ); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, sdstate ); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, ssstate ); - - TInt index = grantreqEvent->NewRequestsCount(); - - for ( TInt i = 0; i < index; i++ ) - { - const MPresenceGrantRequestInfo& grantinfo = grantreqEvent->NewRequest ( i ); - - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, grantinfo.RequestorId().Identity() ); - const TDesC16 dispname = grantinfo.RequestorDisplayName(); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, dispname ); - } - - index = grantreqEvent->CurrentRequestsCount(); - - for ( TInt i = 0; i < index; i++ ) - { - const MPresenceGrantRequestInfo& grantinfo = grantreqEvent->CurrentRequest ( i ); - - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, grantinfo.RequestorId().Identity() ); - const TDesC16 dispname = grantinfo.RequestorDisplayName(); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, dispname ); - } - - break; - } - - case MPresenceBlockListEvent::KInterfaceId: - { - const MPresenceBlockListEvent* blockListEvent = - TXIMPGetInterface< const MPresenceBlockListEvent >::From ( aEvent, - MXIMPBase::EPanicIfUnknown ); - TBuf<100> sdstate; - TBuf<100> ssstate; - _LIT ( Kna, " Susbcription state is unavailable" ); - _LIT ( Kava, " Susbcription state is available" ); - _LIT ( KDef, " Susbcription state is ERROR" ); - - const MXIMPDataSubscriptionState& dstate = blockListEvent->DataSubscriptionState(); - - switch ( dstate.SubscriptionState() ) - { - - case 0: - ssstate.Copy ( Kna ); - break; - - case 1: - ssstate.Copy ( Kava ); - break; - - default: - ssstate.Copy ( KDef ); - break; - } - - _LIT ( Kdna, " Data state is unavailable" ); - - _LIT ( Kdava, " Data state is available" ); - _LIT ( KdDef, " Data state is ERROR" ); - - - switch ( dstate.SubscriptionState() ) - { - - case 0: - sdstate.Copy ( Kdna ); - break; - - case 1: - sdstate.Copy ( Kdava ); - break; - - default: - sdstate.Copy ( KdDef ); - break; - } - - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "*************BEGIN******************" ) ); - - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "Recvd Presentity Grant event" ) ); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, sdstate ); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, ssstate ); - - TInt index = blockListEvent->NewBlocksCount(); - - for ( TInt i = 0; i < index; i++ ) - { - const MPresenceBlockInfo& blockinfo = blockListEvent->NewBlock ( i ); - - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, blockinfo.BlockedEntityId().Identity() ); - const TDesC16& dispname = blockinfo.BlockedEntityDisplayName(); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, dispname ); - } - - index = blockListEvent->CurrentBlocksCount(); - - for ( TInt i = 0; i < index; i++ ) - { - const MPresenceBlockInfo& blockinfo = blockListEvent->CurrentBlock ( i ); - - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, blockinfo.BlockedEntityId().Identity() ); - const TDesC16& dispname = blockinfo.BlockedEntityDisplayName(); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, dispname ); - } - - break; - } - - case MPresentityPresenceEvent::KInterfaceId: - { - const MPresentityPresenceEvent* PresentityPresenceEvent = - TXIMPGetInterface< const MPresentityPresenceEvent >::From ( aEvent, - MXIMPBase::EPanicIfUnknown ); - TBuf<100> sdstate; - TBuf<100> ssstate; - _LIT ( Kna, " Susbcription state is unavailable" ); - _LIT ( Kava, " Susbcription state is available" ); - _LIT ( KDef, " Susbcription state is ERROR" ); - - const MXIMPDataSubscriptionState& dstate = PresentityPresenceEvent->DataSubscriptionState(); - - switch ( dstate.SubscriptionState() ) - { - - case 0: - ssstate.Copy ( Kna ); - break; - - case 1: - ssstate.Copy ( Kava ); - break; - - default: - ssstate.Copy ( KDef ); - break; - } - - _LIT ( Kdna, " Data state is unavailable" ); - - _LIT ( Kdava, " Data state is available" ); - _LIT ( KdDef, " Data state is ERROR" ); - - - switch ( dstate.SubscriptionState() ) - { - - case 0: - sdstate.Copy ( Kdna ); - break; - - case 1: - sdstate.Copy ( Kdava ); - break; - - default: - sdstate.Copy ( KdDef ); - break; - } - - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "*************BEGIN******************" ) ); - - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "Recvd Presentity PresenceEvent" ) ); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, sdstate ); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, ssstate ); - - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, PresentityPresenceEvent->PresentityId().Identity() ); - - const MPresenceInfo& pi = PresentityPresenceEvent->SubscribedPresence(); - const MPersonPresenceInfo* ppi = pi.PersonPresence(); - const MPresenceInfoFieldCollection& presinf = ppi->Fields(); - TInt index = presinf.FieldCount(); - // const MXIMPBase base; - - for ( TInt i = 0; i < index; i++ ) - { - const MPresenceInfoField& infofield = presinf.FieldAt ( i ); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, infofield.FieldType() ); - const MPresenceInfoFieldValueText* PresentityPresencestatus = - TXIMPGetInterface< const MPresenceInfoFieldValueText >::From ( infofield.FieldValue(), - MXIMPBase::EPanicIfUnknown ); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, PresentityPresencestatus->TextValue() ); - // EUNIT_ASSERT_EQUALS_DESC(PresentityPresencestatus->TextValue(), iPersonpresattributes[i], "statustext does'nt match"); - } - - index = pi.ServicePresenceCount(); - - for ( TInt i = 0; i < index; i++ ) - { - const MServicePresenceInfo& servicePresinfo = pi.ServicePresenceAt ( i ); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, servicePresinfo.ServiceType() ); -// EUNIT_ASSERT_EQUALS_DESC(servicePresinfo.ServiceType(), servctype, "service does'nt match"); - const MPresenceInfoFieldCollection& fields = servicePresinfo.Fields(); - - for ( TInt j = 0; j < fields.FieldCount(); j++ ) - { - const MPresenceInfoField& infofield = fields.FieldAt ( j ); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, infofield.FieldType() ); - const MPresenceInfoFieldValueText* Presenceavailability = - TXIMPGetInterface< const MPresenceInfoFieldValueText >::From ( infofield.FieldValue(), - MXIMPBase::EPanicIfUnknown ); - -// EUNIT_ASSERT_EQUALS_DESC(Presenceavailability->TextValue(), _L("OPEN") , "Comm capability does'nt match"); - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, Presenceavailability->TextValue() ); - } - } - - index = pi.DevicePresenceCount(); - - for ( TInt i = 0; i < index; i++ ) - { - const MDevicePresenceInfo& DevicePresinfo = pi.DevicePresenceAt ( i ); - const TPtrC8 devicename = DevicePresinfo.DeviceName(); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, DevicePresinfo.DeviceName() ); - const MPresenceInfoFieldCollection& fields = DevicePresinfo.Fields(); - TInt fieldcount = fields.FieldCount(); - - for ( TInt j = 0; j < fieldcount; j++ ) - { - const MPresenceInfoField& infofield = fields.FieldAt ( j ); - const TDesC8* fieldtype = & ( infofield.FieldType() ); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, *fieldtype ); - const MXIMPBase& base = infofield.FieldValue(); - const MPresenceInfoFieldValueText* Presentityvalue = - TXIMPGetInterface< const MPresenceInfoFieldValueText >::From ( infofield.FieldValue(), - MXIMPBase::EPanicIfUnknown ); - - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, Presentityvalue->TextValue() ); -// EUNIT_ASSERT_EQUALS_DESC(Presentityvalue->TextValue(), clienttype, "Clienttype does'nt match"); - } - - - } - - _LIT ( KMsg, " presentity presence event is getting " ); // here we hv to write message or text wch we want to write in log file - - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, KMsg ); - break; - } - - case MPresenceWatcherListEvent::KInterfaceId: - { - const MPresenceWatcherListEvent* watcherListEvent = - TXIMPGetInterface< const MPresenceWatcherListEvent >::From ( aEvent, - MXIMPBase::EPanicIfUnknown ); - TBuf<100> sdstate; - TBuf<100> ssstate; - - const MXIMPDataSubscriptionState& dstate = watcherListEvent->DataSubscriptionState(); - - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "Recvd watcher event" ) ); - // print the list contents - - for ( TInt i = 0; i < watcherListEvent->CurrentWatchersCount(); i++ ) - { - const MPresenceWatcherInfo& gi = watcherListEvent->CurrentWatcher ( i ); - - gid[i].Copy ( gi.WatcherId().Identity() ); - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "Id and displayname for cur watcher group %d X" ), i ); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, gi.WatcherId().Identity() ); -// EUNIT_ASSERT_EQUALS_DESC(gi.WatcherId().Identity(), KContact1, "watcher does'nt match"); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, gi.WatcherDisplayName() ); - // EUNIT_ASSERT_EQUALS_DESC(gi.WatcherDisplayName(), KNickname1, "Devicename does'nt match"); - } - - gidcount = watcherListEvent->CurrentWatchersCount(); - - // print the list contents - - for ( TInt i = 0; i < watcherListEvent->NewWatchersCount(); i++ ) - { - const MPresenceWatcherInfo& gi = watcherListEvent->NewWatcher ( i ); - gid[i].Copy ( gi.WatcherId().Identity() ); - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "Id and displayname for new group %d X" ), i ); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, gi.WatcherId().Identity() ); -// EUNIT_ASSERT_EQUALS_DESC(gi.WatcherId().Identity(), KContact1, "watcher does'nt match"); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, gi.WatcherDisplayName() ); - // EUNIT_ASSERT_EQUALS_DESC(gi.WatcherDisplayName(), KNickname1, "Devicename does'nt match"); - } - - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "*************END*******************" ) ); - - gidcount = watcherListEvent->NewWatchersCount(); - - break; - } - - case MImConversationEvent::KInterfaceId: - { - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "Recvd conversation event" ) ); - - const MImConversationEvent* convEvent = - TXIMPGetInterface< const MImConversationEvent >::From - ( aEvent, MXIMPBase::EPanicIfUnknown ); - TInt count = convEvent->NewTextMessageCount(); - const MImConversationInfo& convInfo = convEvent->NewTextMessage ( 0 ); - const MXIMPIdentity& identity = convInfo.MessageId(); - const TDesC16& msg = convInfo.TextMessage(); - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "message is" ) ); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, convInfo.TextMessage() ); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, convInfo.MessageId().Identity() ); - - /* const MDesCArray& array= convInfo.RecipientL(); - TPtrC sender=array.MdcaPoint(0);*/ - break; - } - case MSearchEvent::KInterfaceId: - { - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "search event")); - const MSearchEvent* srchEvent = - TXIMPGetInterface< const MSearchEvent >::From - (aEvent, MXIMPBase::EPanicIfUnknown); - TInt count= srchEvent->SearchResultCount(); - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend,_L("result count :%d "),count); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, srchEvent->SearchId().Identity() ); - - TInt64 radn; - TInt random = Math::Rand( radn ); - - for(TInt i=0;iSearchResult(i); - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend,_L("Result No:%d "),i); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, info.GetFieldInfo(EFirstName) ); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, info.GetFieldInfo(ELastName) ); - RFileLogger::Write ( KDir, KFile, EFileLoggingModeAppend, info.GetFieldInfo(EEmailAddress) ); - //take a random contact - if ( i == random % count ) - { - - RFs fs; - RFile file; - TBuf8<100> buf; - User::LeaveIfError( fs.Connect() ); - User::LeaveIfError( file.Replace( fs, - KAddContactFileName, EFileWrite ) ); - - CnvUtfConverter::ConvertFromUnicodeToUtf8( buf, - info.GetFieldInfo(EEmailAddress) ); - file.Write( buf ); - file.Close(); - fs.Close(); - - } - } - RFileLogger::WriteFormat ( KDir, KFile, EFileLoggingModeAppend, _L ( "search event processed")); - break; - } - - case MSearchKeysEvent::KInterfaceId: - { - const MSearchKeysEvent* srchEvent = - TXIMPGetInterface< const MSearchKeysEvent >::From - (aEvent, MXIMPBase::EPanicIfUnknown); - TInt count= srchEvent->InfoCount(); - - for(TInt a=0; a < count; a++) - { - const MSearchKeyInfo& keyInfo=srchEvent->SearchKeyInfo( a); - switch(keyInfo.Type()) - { - case EKey: - { - TInt key= keyInfo.Key(); - } - break; - - case ELabel: - { - TPtrC label = keyInfo.Label(); - break; - } - } - } - - break; - } - - default: - { - break; - } - } - } - - -// end of file - - - - - - diff -r 085f765766a0 -r 860cd8a5168c imservices/xmppsettingsapi/eabi/xmppsettingsapiu.def --- a/imservices/xmppsettingsapi/eabi/xmppsettingsapiu.def Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -EXPORTS - _ZN16CXmppSettingsApi12RemoveParamLEmRK7TDesC16 @ 1 NONAME - _ZN16CXmppSettingsApi17GetRepositoryKeyLEmRK7TDesC16iRm @ 2 NONAME - _ZN16CXmppSettingsApi21CreateSettingsRecordLERm @ 3 NONAME - _ZN16CXmppSettingsApi21RemoveSettingsRecordLEm @ 4 NONAME - _ZN16CXmppSettingsApi22DefaultSettingsRecordLERm @ 5 NONAME - _ZN16CXmppSettingsApi25GetSettingsRecordIdArrayLER6RArrayImE @ 6 NONAME - _ZN16CXmppSettingsApi4NewLEv @ 7 NONAME - _ZN16CXmppSettingsApi5NewLCEv @ 8 NONAME - _ZN16CXmppSettingsApi9GetParamLEmRK7TDesC16R6TDes16 @ 9 NONAME - _ZN16CXmppSettingsApi9GetParamLEmRK7TDesC16Ri @ 10 NONAME - _ZN16CXmppSettingsApi9SetParamLEmRK7TDesC16S2_ @ 11 NONAME - _ZN16CXmppSettingsApi9SetParamLEmRK7TDesC16i @ 12 NONAME - _ZN16CXmppSettingsApiD0Ev @ 13 NONAME - _ZN16CXmppSettingsApiD1Ev @ 14 NONAME - _ZN16CXmppSettingsApiD2Ev @ 15 NONAME - _ZTI16CXmppSettingsApi @ 16 NONAME ; ## - _ZTI19CXmppSettingsColumn @ 17 NONAME ; ## - _ZTI19CXmppSettingsRecord @ 18 NONAME ; ## - _ZTV16CXmppSettingsApi @ 19 NONAME ; ## - _ZTV19CXmppSettingsColumn @ 20 NONAME ; ## - _ZTV19CXmppSettingsRecord @ 21 NONAME ; ## - diff -r 085f765766a0 -r 860cd8a5168c imservices/xmppsettingsapi/tsrc/bmarm/xmppsettings_apiU.DEF --- a/imservices/xmppsettingsapi/tsrc/bmarm/xmppsettings_apiU.DEF Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) - diff -r 085f765766a0 -r 860cd8a5168c imservices/xmppsettingsapi/tsrc/bwins/xmppsettings_apiu.def --- a/imservices/xmppsettingsapi/tsrc/bwins/xmppsettings_apiu.def Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) - diff -r 085f765766a0 -r 860cd8a5168c imservices/xmppsettingsapi/tsrc/conf/xmppsettings_api.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imservices/xmppsettingsapi/tsrc/conf/xmppsettings_api.cfg Fri Sep 17 19:56:13 2010 +0530 @@ -0,0 +1,64 @@ +[Test] +title Test_CreateSettingsRecordL +create xmppsettings_api xmppsettings_apiObj +xmppsettings_apiObj Test_CreateSettingsRecordL +delete xmppsettings_apiObj +[Endtest] + +[Test] +title Test_DefaultSettingsRecord +create xmppsettings_api xmppsettings_apiObj +xmppsettings_apiObj Test_DefaultSettingsRecord +delete xmppsettings_apiObj +[Endtest] + +[Test] +title Test_GetSettingsRecordIdArray +create xmppsettings_api xmppsettings_apiObj +xmppsettings_apiObj Test_GetSettingsRecordIdArray +delete xmppsettings_apiObj +[Endtest] + +[Test] +title Test_SetParamInt +create xmppsettings_api xmppsettings_apiObj +xmppsettings_apiObj Test_SetParamInt +delete xmppsettings_apiObj +[Endtest] + +[Test] +title Test_SetParamLDes +create xmppsettings_api xmppsettings_apiObj +xmppsettings_apiObj Test_SetParamLDes +delete xmppsettings_apiObj +[Endtest] + +[Test] +title Test_GetParamInt +create xmppsettings_api xmppsettings_apiObj +xmppsettings_apiObj Test_GetParamInt +delete xmppsettings_apiObj +[Endtest] + +[Test] +title Test_GetParamLDes +create xmppsettings_api xmppsettings_apiObj +xmppsettings_apiObj Test_GetParamLDes +delete xmppsettings_apiObj +[Endtest] + +[Test] +title Test_RemoveSettingsRecord +create xmppsettings_api xmppsettings_apiObj +xmppsettings_apiObj Test_RemoveSettingsRecord +delete xmppsettings_apiObj +[Endtest] + +[Test] +title Test_RemoveParam +create xmppsettings_api xmppsettings_apiObj +xmppsettings_apiObj Test_RemoveParam +delete xmppsettings_apiObj +[Endtest] + + diff -r 085f765766a0 -r 860cd8a5168c imservices/xmppsettingsapi/tsrc/eabi/xmppsettings_apiu.def --- a/imservices/xmppsettingsapi/tsrc/eabi/xmppsettings_apiu.def Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - _Z9LibEntryLR13CTestModuleIf @ 1 NONAME - diff -r 085f765766a0 -r 860cd8a5168c imservices/xmppsettingsapi/tsrc/group/bld.inf --- a/imservices/xmppsettingsapi/tsrc/group/bld.inf Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -PRJ_PLATFORMS -// specify the platforms your component needs to be built for here -// defaults to WINS MARM so you can ignore this if you just build these - - DEFAULT - -PRJ_TESTEXPORTS -// NOTE: If using ARS requirements all export operations should be done under this. -// 'abld test export' - -PRJ_EXPORTS -// Specify the source file followed by its destination here -// copy will be used to copy the source file to its destination -// If there's no destination then the source file will be copied -// -// Example: -/* - -*/ -../init/TestFramework.ini /epoc32/winscw/c/TestFramework/TestFramework.ini -../conf/xmppsettings_api.cfg /epoc32/winscw/c/TestFramework/xmppsettings_api.cfg -PRJ_TESTMMPFILES - - xmppsettings_api.mmp - - -// Specify the .mmp files required for building the important component -// releasables. -// -// Specify "tidy" if the component you need to build doesn't need to be -// released. Specify "ignore" if the MMP file exists but should be -// ignored. -// Example: -// - - -// End of File diff -r 085f765766a0 -r 860cd8a5168c imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/bmarm/xmppsettingsfetchermtu.def --- a/imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/bmarm/xmppsettingsfetchermtu.def Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -EXPORTS - LibEntryL__Fv @ 1 NONAME R3UNUSED ; LibEntryL(void) - SetRequirements__FRP16CTestModuleParamRUl @ 2 NONAME R3UNUSED ; SetRequirements(CTestModuleParam *&, unsigned long &) - diff -r 085f765766a0 -r 860cd8a5168c imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/bwins/xmppsettingsfetchermtu.def --- a/imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/bwins/xmppsettingsfetchermtu.def Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -EXPORTS - ?LibEntryL@@YAPAVCTestModuleBase@@XZ @ 1 NONAME ; class CTestModuleBase * __cdecl LibEntryL(void) - ?SetRequirements@@YAHAAPAVCTestModuleParam@@AAK@Z @ 2 NONAME ; int __cdecl SetRequirements(class CTestModuleParam * &,unsigned long &) - diff -r 085f765766a0 -r 860cd8a5168c imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/eabi/xmppsettingsfetchermtu.def --- a/imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/eabi/xmppsettingsfetchermtu.def Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -EXPORTS - _Z9LibEntryLv @ 1 NONAME - _Z15SetRequirementsRP16CTestModuleParamRm @ 2 NONAME - diff -r 085f765766a0 -r 860cd8a5168c imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/group/bld.inf --- a/imservices/xmppsettingsfetcher/tsrc/xmppsettingsfetchermt/group/bld.inf Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: bld.inf -* -*/ - - - -PRJ_PLATFORMS -// specify the platforms your component needs to be built for here -// defaults to WINS MARM so you can ignore this if you just build these -DEFAULT - -PRJ_TESTEXPORTS -// NOTE: If using ARS requirements all export operations should be done under this. -// 'abld test export' - -PRJ_EXPORTS -// Specify the source file followed by its destination here -// copy will be used to copy the source file to its destination -// If there's no destination then the source file will be copied -// to the same name in /epoc32/include - -../init/TestFramework.ini /epoc32/winscw/c/TestFramework/TestFramework.ini - -PRJ_TESTMMPFILES -// NOTE: If using ARS requirements .mmp file operation should be done under this. -// 'abld test build' -xmppsettingsfetchermt.mmp -PRJ_MMPFILES -// Specify the .mmp files required for building the important component -// releasables. -// -// Specify "tidy" if the component you need to build doesn't need to be -// released. Specify "ignore" if the MMP file exists but should be -// ignored. -// Example: -/* -/agnmodel/group/agnmodel.mmp -#if defined(MARM) -/agnmodel/group/agsvexe.mmp -#endif -*/ - - -// End of File \ No newline at end of file diff -r 085f765766a0 -r 860cd8a5168c imsrv_plat/ximp_core_feature_plugin_api/inc/ximpfeaturepluginifids.hrh --- a/imsrv_plat/ximp_core_feature_plugin_api/inc/ximpfeaturepluginifids.hrh Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: feature plugin if ids -* -*/ - -#ifndef XIMPFEATUREPLUGINIFIDS_HRH -#define XIMPFEATUREPLUGINIFIDS_HRH - -// datmodel -#define XIMP_ECOM_IF_UID_PROTOCOL_DATAMODEL_CODEC_INTERFACE 0x2000B5E9 - -// operations -#define XIMP_ECOM_IF_UID_OPERATIONS_INTERFACE 0x20015A0D - -//processor -#define XIMP_ECOM_IF_UID_PROTOCOL_DATA_HOST_INTERFACE 0x20015A0E - -#endif //XIMPFEATUREPLUGINIFIDS_HRH - diff -r 085f765766a0 -r 860cd8a5168c imsrv_plat/xmpp_settings_api/tsrc/bmarm/xmppsettings_apiu.def --- a/imsrv_plat/xmpp_settings_api/tsrc/bmarm/xmppsettings_apiu.def Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) - diff -r 085f765766a0 -r 860cd8a5168c imsrv_plat/xmpp_settings_api/tsrc/bwins/xmppsettings_apiu.def --- a/imsrv_plat/xmpp_settings_api/tsrc/bwins/xmppsettings_apiu.def Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) - diff -r 085f765766a0 -r 860cd8a5168c imsrv_plat/xmpp_settings_api/tsrc/eabi/xmppsettings_apiU.def --- a/imsrv_plat/xmpp_settings_api/tsrc/eabi/xmppsettings_apiU.def Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - _Z9LibEntryLR13CTestModuleIf @ 1 NONAME - diff -r 085f765766a0 -r 860cd8a5168c imsrv_plat/xmpp_settings_api/tsrc/group/bld.inf --- a/imsrv_plat/xmpp_settings_api/tsrc/group/bld.inf Fri May 28 18:27:27 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -PRJ_PLATFORMS -// specify the platforms your component needs to be built for here -// defaults to WINS MARM so you can ignore this if you just build these - - DEFAULT - -PRJ_TESTEXPORTS -// NOTE: If using ARS requirements all export operations should be done under this. -// 'abld test export' - -PRJ_EXPORTS -// Specify the source file followed by its destination here -// copy will be used to copy the source file to its destination -// If there's no destination then the source file will be copied -// -// Example: -/* - -*/ -../init/TestFramework.ini /epoc32/winscw/c/TestFramework/TestFramework.ini -../conf/xmppsettings_api.cfg /epoc32/winscw/c/TestFramework/xmppsettings_api.cfg -PRJ_TESTMMPFILES - - xmppsettings_api.mmp - - -// Specify the .mmp files required for building the important component -// releasables. -// -// Specify "tidy" if the component you need to build doesn't need to be -// released. Specify "ignore" if the MMP file exists but should be -// ignored. -// Example: -// - - -// End of File diff -r 085f765766a0 -r 860cd8a5168c package_definition.xml --- a/package_definition.xml Fri May 28 18:27:27 2010 +0530 +++ b/package_definition.xml Fri Sep 17 19:56:13 2010 +0530 @@ -1,111 +1,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + diff -r 085f765766a0 -r 860cd8a5168c package_map.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_map.xml Fri Sep 17 19:56:13 2010 +0530 @@ -0,0 +1,1 @@ +