×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Apr 2009
    Posts
    90

    Delete message from sent items

    Hi

    I am sending the messages in 3rd Edition using the RSendAs. I want delete the message from the sent items as soon as it gets sent. I am sending 5 to six messages in a loop. Each time I call the method to send the message, each message gets sent one by one. But the same should happen with their deletion also. Each message should get deleted from the sent items as soon as it is sent. But the issue I am facing is that some of the messages get deleted but a few of them do not.Here is the code that I am using for sending the messages.

    void CSMSEngine::SendSmsL(const TDesC& aAddr, const TDesC& aMsg)
    {
    iObserver = new(ELeave) CDummyObserver;
    iSession = CMsvSession::OpenSyncL(*iObserver);
    User::LeaveIfError(iSendAs.Connect());
    RSendAsMessage message;
    message.CreateL(iSendAs, KUidMsgTypeSMS);
    CleanupClosePushL(message); // Prepare the message
    message.AddRecipientL(aAddr, RSendAsMessage::ESendAsRecipientTo);
    message.SetBodyTextL(aMsg); // Send the message
    TRequestStatus status;
    message.SendMessage(status);
    User::WaitForRequest(status);
    if (status == KErrNone)
    {
    TSendAsProgress progress;
    progress.iProgress=0;
    progress.iProgressMax=0;
    message.ProgressL( progress );
    if ( progress.iState == CMsvSendOperation::ESendStateDone )
    {

    }
    if ( progress.iState == CMsvSendOperation::ESendStateFailed )
    {
    TMsvId aFolderId = KMsvSentEntryId;
    CMsvEntry* entrie=iSession->GetEntryL(aFolderId);
    CleanupStack::PushL(entrie);
    if(entrie->Count() > 0)
    {
    // sorting
    TMsvSelectionOrdering MySortType;
    // sort type defined
    MySortType.SetSorting(EMsvSortByDate);
    entrie->SetSortTypeL(MySortType);
    CMsvEntrySelection* entries = entrie->ChildrenL();
    CleanupStack::PushL(entries);
    CMsvEntry* entry= (iSession->GetEntryL((*entries)[entrie->Count()-1]));
    CleanupStack::PushL(entry);
    if (entry->Entry().iMtm == KUidMsgTypeSMS)
    {
    entry->DeleteL(entries->At(entrie->Count()-1));

    }
    }
    CleanupStack::PopAndDestroy(2);
    }
    CleanupStack::PopAndDestroy();
    }
    CleanupStack::Pop(); // message
    }


    The header class for the same is :
    /*
    ============================================================================
    Name : SMSEngine.h
    Author : Monika Parvanda
    Version : 1.0
    Copyright : Your copyright notice
    Description : CSMSEngine declaration
    ============================================================================
    */

    #ifndef SMSENGINE_H
    #define SMSENGINE_H

    // This Class send the sms using the RSendAs API Provided in the Third Edition

    #include <e32std.h>
    #include <e32base.h>
    #include <rsendas.h> // RSendAs
    #include <rsendasmessage.h> // RSendAsMessage
    #include <smut.h> // KUidMsgTypeSMS
    #include "Console.H"

    // CLASS DECLARATION

    /**
    * CSMSEngine
    *
    */
    class CDummyObserver;
    class CSMSEngine : public CBase
    {
    public:
    // Constructors and destructor

    /**
    * Destructor.
    */
    ~CSMSEngine();

    /**
    * Two-phased constructor.
    */
    static CSMSEngine* NewL();

    /**
    * Two-phased constructor.
    */
    static CSMSEngine* NewLC();

    private:

    /**
    * Constructor for performing 1st stage construction
    */
    CSMSEngine();

    /**
    * EPOC default constructor for performing 2nd stage construction
    */
    void ConstructL();

    public:
    void SendSmsL(const TDesC& aAddr, const TDesC& aMsg);

    private:
    RSendAs iSendAs;
    CDummyObserver* iObserver;
    /** Pointer to the channel of communication between a client thread and the Message Server */
    CMsvSession* iSession;
    /** Pointer to a particular Message Server entry */
    CMsvEntry* iEntry;
    /** Pointer to the array of entry IDs */
    CMsvEntrySelection* iSelection;
    void Log(TDesC8& m);
    void Log(TDes8& m);
    TBool iFlag;
    };
    class CDummyObserver : public CBase, public MMsvSessionObserver
    {
    public:
    void HandleSessionEventL(TMsvSessionEvent, TAny*, TAny*, TAny*) {};
    };
    #endif // SMSENGINE_H



    Please help me!!!!

    Thanks and Regards
    Monika Parvanda

  2. #2
    Registered User
    Join Date
    May 2012
    Posts
    7

    Re: Delete message from sent items

    Hi monika

    Did you get solution for delete of sms from sent items
    if so plz help me ...


    thanks
    ayyappa

Similar Threads

  1. RSendAsMessage & Delete Sent Items
    By ronald29 in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2011-12-19, 08:32
  2. .sis creation error
    By fuzz63 in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 4
    Last Post: 2010-04-07, 09:17
  3. Delete all items from listbox
    By ssabestian in forum Symbian
    Replies: 5
    Last Post: 2009-03-12, 07:50
  4. calling delete on RPointerArray items leaks memory??
    By krishnaramram in forum Symbian
    Replies: 12
    Last Post: 2008-10-12, 16:12
  5. Delete Sent Items in exe app
    By polaris_1985 in forum Symbian Networking & Messaging (Closed)
    Replies: 3
    Last Post: 2006-07-18, 13:11

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×