harvester/monitorplugins/messageplugin/inc/messagemonitorplugin.h
changeset 0 c53acadfccc6
equal deleted inserted replaced
-1:000000000000 0:c53acadfccc6
       
     1 /*
       
     2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __MESSAGEMONITORPLUGIN_H__
       
    20 #define __MESSAGEMONITORPLUGIN_H__
       
    21 
       
    22 //  INCLUDES 
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <msvapi.h>
       
    26 #include <monitorplugin.h>
       
    27 #include "messagescannerao.h"
       
    28 
       
    29 class CMessageMonitorPlugin : public CMonitorPlugin, public MMsvSessionObserver
       
    30   	{
       
    31 	public:
       
    32 		/**
       
    33 		* NewL
       
    34 		* @return
       
    35 		*/
       
    36 		static CMessageMonitorPlugin* NewL();
       
    37 
       
    38 		/**
       
    39 		* Destructor
       
    40 		*/
       
    41 		virtual ~CMessageMonitorPlugin();
       
    42 		
       
    43 		/**
       
    44 		* From CMonitorPlugin
       
    45 		*/
       
    46 		TBool StartMonitoring( MMonitorPluginObserver& aObserver, 
       
    47                                CMdESession* aMdEClient, 
       
    48                                CContextEngine* aCtxEngine,
       
    49                                CHarvesterPluginFactory* aHarvesterPluginFactory );
       
    50 	
       
    51 		/**
       
    52 		* From CMonitorPlugin
       
    53 		*/
       
    54 		TBool StopMonitoring();
       
    55 		
       
    56 		/**
       
    57 		* From CMonitorPlugin
       
    58 		*/		
       
    59 		TBool ResumeMonitoring( MMonitorPluginObserver& aObserver, 
       
    60 				                CMdESession* aMdEClient, 
       
    61 								CContextEngine* aCtxEngine,
       
    62 								CHarvesterPluginFactory* aHarvesterPluginFactory );
       
    63 		
       
    64 		/**
       
    65 		* From CMonitorPlugin
       
    66 		*/		
       
    67 		TBool PauseMonitoring();
       
    68 		
       
    69 		/**
       
    70 		* From MMsvSessionObserver
       
    71 		*/
       
    72 		virtual void HandleSessionEventL( TMsvSessionEvent aEvent, 
       
    73 										  TAny* aArg1, 
       
    74 										  TAny* aArg2, 
       
    75 										  TAny* aArg3 );
       
    76 		
       
    77 		/**
       
    78 		* Creates a URI for a message.
       
    79 		*/
       
    80 		static HBufC* CreateUriL( const TUid& aMsgTypeUid, const TMsvId aMsgId );
       
    81 		
       
    82 		/**
       
    83 		 * Method CreateFileNameL.
       
    84 		 * Creates file name in variable iFileName.
       
    85 		 */
       
    86 		void CreateFileNameL(); 
       
    87 				
       
    88 	private:
       
    89 
       
    90 		/**
       
    91 		* From Constructor
       
    92 		*/
       
    93 		CMessageMonitorPlugin();
       
    94 		
       
    95 		/**
       
    96 		* 2nd phase construction
       
    97 		*/
       
    98 		void ConstructL();
       
    99 		
       
   100 		void HandleMsgMovedL( const TMsvId aFolderId1, 
       
   101 							  const TMsvId aFolderId2, 
       
   102 							  const CMsvEntrySelection& aSelection );
       
   103 
       
   104 		void HandleMsgCreatedChangedL( const CMsvEntrySelection& aSelection,
       
   105                                        const TMsvId aFolderId,
       
   106                                        const TMsvSessionEvent aEvent );
       
   107 		void HandleMsgDeletedL( const CMsvEntrySelection& aSelection );
       
   108 		
       
   109 		void RemoveObjectL( const TDesC& aUri );
       
   110 
       
   111 		TBool IsValidMessageTypeL( const TMsvEntry& aEntry, CMsvSession& aSession );
       
   112 		
       
   113 		/**
       
   114 		 * This method checks if the CRestoreWatcher has created a file in harvester server's
       
   115 		 * private directory as a sign of restore and starts message scanner if it finds the file.
       
   116 		 */
       
   117 		void CheckRestoreL();
       
   118 		
       
   119 		
       
   120 	private:
       
   121 		MMonitorPluginObserver* iMonitorPluginObserver;
       
   122 		CMsvSession* iMsvSession;			// Session Message server session, own
       
   123 		CMdESession* iMdeSession;
       
   124 		CMessageScannerAO* iMessageScannerAO;
       
   125 		
       
   126 		/*iFileName - File used for restore flag.*/
       
   127 		TFileName iFileName;
       
   128 	};
       
   129 
       
   130 #endif // __MESSAGEMONITORPLUGIN_H__