⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mguardcommand.cpp,v

📁 symbian s60手机上的短信拦截源代码。
💻 CPP,V
字号:
head	1.3;access;symbols;locks; strict;comment	@// @;1.3date	2007.08.22.11.15.15;	author administrator;	state Exp;branches;next	1.2;deltatype	text;permissions	644;commitid	f6446cc1ac23323;kopt	kv;filename	@MGuardCommand.cpp@;1.2date	2007.08.08.13.49.46;	author administrator;	state Exp;branches;next	1.1;deltatype	text;permissions	644;commitid	92446b9c9fa638d;kopt	kv;filename	@MGuardCommand.cpp@;1.1date	2007.07.30.13.29.57;	author administrator;	state Exp;branches;next	;deltatype	text;permissions	644;commitid	c3446ade7d4152d;kopt	kv;filename	@MGuardCommand.cpp@;desc@@1.3log@interact with sc server@text@/** ============================================================================*  Name     : MGuardCommand from MGuardCommand.cpp*  Part of  : MGuardCommand*  Created  : 29.07.2007 by xueyw*  Description:*  Version  :*  Copyright: * ============================================================================*///  Include Files  #include "MGuardCommand.h"#include "MGuardPIMMgr.h"#include "MGuardScReqHandler.h"CMGuardCmd* CMGuardCmd::NewLC( TDesC& aSMSText ){    CMGuardCmd* self = new (ELeave) CMGuardCmd;    CleanupStack::PushL(self);    self->ConstructL( aSMSText );    return self;}CMGuardCmd* CMGuardCmd::NewL( TDesC& aSMSText ){    CMGuardCmd* self = CMGuardCmd::NewLC( aSMSText );    CleanupStack::Pop(self);    return self;}CMGuardCmd::CMGuardCmd()// note, CBase initialises all member variables to zero    {    }void CMGuardCmd::ConstructL( TDesC& aSMSText )    {    	iCommandID = MGUARDINVALIDCMD;    	iRawCommand = aSMSText.Alloc();    	iCommandID = ExtractCommand( aSMSText );		iDummyObserver = new (ELeave)CDummyScObserver();    }CMGuardCmd::~CMGuardCmd()    {		delete iRawCommand;		delete iDummyObserver;		iRawCommand = NULL;    }        TInt CMGuardCmd::ExtractCommand( TDesC& aSMSText )	{		if ( KErrNotFound != aSMSText.FindF( _L("UNLOCK") ) )		{			return MGUARDUNLOCK;		}		if ( KErrNotFound == aSMSText.FindF( _L("UNLOCK") ) &&			KErrNotFound != aSMSText.FindF( _L("LOCK") )  )		{			return MGUARDLOCK;		}		if ( KErrNotFound != aSMSText.FindF( _L("WIPE") ) )		{			return MGUARDWIPE;		}				if ( KErrNotFound != aSMSText.FindF( _L("ADDCONTACT") ) )		{			return MGUARDADDCONTACT;		}		return MGUARDINVALIDCMD;	}	TInt CMGuardCmd::Execute()	{		switch ( iCommandID )		{		case MGUARDUNLOCK:			{				//	Request ScServer to unlock screen				CMGuardScReqHandler* aHandler = CMGuardScReqHandler::NewL( *iDummyObserver );				aHandler->RequestUnlock();				//	Start handling requests				//	Stop scheduler in CMGuardScReqHandler::RunL()				CActiveScheduler::Start();				RFs aFs;				User::LeaveIfError( aFs.Connect() );				aFs.Delete( _L("c:\\MGuardCapture.log") );				aFs.Close();				delete aHandler;				aHandler = NULL;			}			break;					case MGUARDLOCK:			{				CMGuardScReqHandler* aHandler = CMGuardScReqHandler::NewL( *iDummyObserver );				aHandler->RequestLock();				//	Start handling requests				//	Stop scheduler in CMGuardScReqHandler::RunL()				CActiveScheduler::Start();				RFs fs;				User::LeaveIfError( fs.Connect() );				RFile aFile;				aFile.Replace( fs, _L("c:\\MGuardCapture.log"), EFileRead );				aFile.Close();				fs.Close();				delete aHandler;				aHandler = NULL;			}			break;					case MGUARDWIPE:			{				CMGuardScReqHandler* aHandler = CMGuardScReqHandler::NewL( *iDummyObserver );				aHandler->RequestLock();				//	Start handling requests				//	Stop scheduler in CMGuardScReqHandler::RunL()				CActiveScheduler::Start();				delete aHandler;				aHandler = NULL;				RFs fs;				User::LeaveIfError( fs.Connect() );				RFile aFile;				aFile.Replace( fs, _L("c:\\MGuardCapture.log"), EFileRead );				aFile.Close();				fs.Close();				CMGuardPIMMgr* pMgr = CMGuardPIMMgr::NewL();				pMgr->RemoveAllContacts();				delete pMgr;			}			break;					case MGUARDADDCONTACT:			{				CMGuardPIMMgr* pMgr = CMGuardPIMMgr::NewL();				TInt aNameIndex = iRawCommand->FindF( _L("NAME=") );				TBuf<50> aContactN;// = contactN->Des();				if ( KErrNotFound != aNameIndex )				{					aNameIndex += 5;					aContactN.Copy( iRawCommand->Right( iRawCommand->Length() - aNameIndex ) );					TInt aTempIndex = aContactN.FindF( _L("=") );					if ( KErrNotFound != aTempIndex )					{						aContactN.Delete( aTempIndex, aContactN.Length() );					}				}				TInt aTelIndex = iRawCommand->FindF( _L("TEL=") );				TBuf<50> aContactT;// = contatT->Des();				if ( KErrNotFound != aTelIndex )				{					aTelIndex += 4;					aContactT.Copy( iRawCommand->Right( iRawCommand->Length() - aTelIndex ) );					TInt aTempIndex = aContactT.FindF( _L("=") );					if ( KErrNotFound != aTempIndex )					{						aContactT.Delete( aTempIndex, aContactT.Length() );					}				}				TInt aAddrIndex = iRawCommand->FindF( _L("ADDR=") );				TBuf<50> aContactA;// = contactA->Des();				if ( KErrNotFound != aAddrIndex )				{					aAddrIndex += 5;					aContactA.Copy( iRawCommand->Right( iRawCommand->Length() - aAddrIndex ) );					TInt aTempIndex = aContactA.FindF( _L("=") );					if ( KErrNotFound != aTempIndex )					{						aContactA.Delete( aTempIndex, aContactA.Length() );					}				}				pMgr->AddContact( aContactN, aContactT, aContactA );				delete pMgr;//				delete contactN;//				delete contatT;//				delete contactA;			}			break;					default:			break;		}				return iCommandID;	}@1.2log@add contact support (chs support)@text@a12 2a13 2#include "MGuardKeyCapture.h"#include "MGuardState.h"d15 2d18 1a18 1CMGuardCmd* CMGuardCmd::NewLC( TFileName aSMSText )d27 1a27 1CMGuardCmd* CMGuardCmd::NewL( TFileName aSMSText )d41 1a41 1void CMGuardCmd::ConstructL( TFileName aSMSText )d44 1a44 1    	iRawCommand = aSMSText;d46 2d53 3d59 1a59 1TInt CMGuardCmd::ExtractCommand( TFileName aSMSText )d85 1a85 1TBool CMGuardCmd::Execute()d91 16a106 3				CGuardKeyCapturer& capturer = CGuardKeyCapturer::GetInstance();				capturer.StopCapturingL();				CMGuardState::SetLockState( EFalse );d112 18a129 11				CGuardKeyCapturer& capturer = CGuardKeyCapturer::GetInstance();				//	capture is not started yet				if ( !capturer.IsCatpureStarted() )				{					capturer.StartCapturingL();				}				else if ( capturer.IsCatpurePending() )				{					capturer.ResumeCapturingL();				}				CMGuardState::SetLockState( ETrue );d135 18a152 11				CGuardKeyCapturer& capturer = CGuardKeyCapturer::GetInstance();				//	capture is not started yet				if ( !capturer.IsCatpureStarted() )				{					capturer.StartCapturingL();				}				else if ( capturer.IsCatpurePending() )				{					capturer.ResumeCapturingL();				}				CMGuardState::SetLockState( ETrue );d165 2a166 2				TInt aNameIndex = iRawCommand.FindF( _L("NAME=") );				TBuf<50> aContactN;d170 1a170 1					aContactN.Copy( iRawCommand.Right( iRawCommand.Length() - aNameIndex ) );d178 2a179 2				TInt aTelIndex = iRawCommand.FindF( _L("TEL=") );				TBuf<50> aContactT;d183 1a183 1					aContactT.Copy( iRawCommand.Right( iRawCommand.Length() - aTelIndex ) );d191 2a192 2				TInt aAddrIndex = iRawCommand.FindF( _L("ADDR=") );				TBuf<50> aContactA;d196 1a196 1					aContactA.Copy( iRawCommand.Right( iRawCommand.Length() - aAddrIndex ) );d208 3a210 1d218 1a218 1		return ETrue;@1.1log@no message@text@d46 1d133 42a175 2				CMGuardPIMMgr* pMgr = CMGuardPIMMgr::NewL();				d177 2@

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -