harvesterplugins/tsrc/harvesterplugintester/inc/cmessagesessionobserver.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 11 Jun 2010 13:39:26 +0300
changeset 7 51d10d255e92
parent 0 ccd0fd43f247
child 9 4a2987baf8f7
permissions -rw-r--r--
Revision: 201021 Kit: 2010123

/*
* Copyright (c) 2010 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: 
*
*/

#ifndef CMESSAGESESSIONOBSERVER_H_
#define CMESSAGESESSIONOBSERVER_H_

#include <msvapi.h>

class CMessageSessionObserver : public MMsvSessionObserver 
{
public:
    static CMessageSessionObserver* NewL();
    static CMessageSessionObserver* NewLC();
    virtual ~CMessageSessionObserver();
private:
    void ConstructL();
    CMessageSessionObserver();
    /**
     * callback from MMsvSessionObserver
     */
    virtual void HandleSessionEventL(TMsvSessionEvent aEvent, 
                                         TAny* aArg1, 
                                         TAny* aArg2, 
                                         TAny* aArg3);
};

class MessagingUtils
{
public:
    static TInt CreateMessageL(CMsvSession* aMsgSession, 
                               const TDesC& aMsgFrom,
                               const TDesC& aMsgTo,
                               const TDesC& aMsgBody
                               );
    static TInt RemoveEntryL(CMsvSession* aMsgSession,TMsvId aMsgId);
    
    static TInt CreateMmsMessageL(CMsvSession* aMsgSession, 
                                  const TDesC& aMsgFrom,
                                  const TDesC& aMsgTo,
                                  const TDesC& aMsgBody);
    
    static TInt RemoveMmsEntryL(CMsvSession* aMsgSession,TMsvId aMsgId);
    
    static TInt CreateEmailEntryL(CMsvSession* aMsgSession );
};

class CMessAsyncWaiter: public CActive
{
public:    
     static CMessAsyncWaiter* NewL();
     virtual ~CMessAsyncWaiter();
     void StartAndWait();
     TInt Result() const;
     void DoCancel();
     
private:
     CMessAsyncWaiter();
     void RunL();
     TInt iError;
};
 
#endif /* CMESSAGESESSIONOBSERVER_H_ */