×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Regular Contributor
    Join Date
    Apr 2008
    Posts
    95

    Unhappy Getting The boby and number from Outbox..

    Hi All ,

    I want to retrive the body and number of the outgoing sms .

    I tried the code from the followng link

    http://wiki.forum.nokia.com/index.php/SMS_Operations

    In the following

    Changed the macro to KMsvGlobalOuboxndexEntryId in the HandlesessioneventL(....)...
    And in the following function which is called from HandlesessioneventL with the message id

    void CSmsHandler::MessageReceivedL( TMsvId aEntryId )

    {
    TDesC& descp = entry.iDescription; // iDescription will have only first 32 characters I need the whole body..
    ......
    }

    Can anbody help me out with some link where I can retrive the body and number of the outgoing sms.

    Thanks a lot in advance...

  2. #2
    Regular Contributor
    Join Date
    Feb 2006
    Posts
    62

    Re: Getting The boby and number from Outbox..

    HI Chitan,

    I am getting body and number using this function, chk it out if it can help u..

    ------------------------------------------------
    void CSmsHandler::MessageSendL(TMsvId aEntryId)
    {
    Log(_L("\n MessageSendL"));
    {
    TInt MySMS;
    MySMS=0;
    CMsvEntry* entry = iSession->GetEntryL(aEntryId);
    CleanupStack::PushL(entry);
    TBuf<200> aAddress,aText;
    if(entry->Entry().iMtm == KUidMsgTypeSMS)
    {

    SetMtmEntryL(aEntryId);
    iMtm->LoadMessageL();

    {

    CSmsClientMtm* iSmsMtm = static_cast<CSmsClientMtm*>(iMtm);

    iSmsMtm->RestoreServiceAndSettingsL();

    CSmsHeader& header = iSmsMtm->SmsHeader();

    aAddress.Zero();

    aAddress.Copy(header.FromAddress());

    }

    CRichText& body = iMtm->Body();
    TPtrC text(body.Read(0, body.DocumentLength()));
    //Text.Copy(text);

    if(text.Length()<=150)
    {
    aText.Copy(text);
    }
    else
    {
    aText.Copy(text.Mid(0,150));
    }

    Log(_L("\n Send Number"));
    Log(aAddress);
    Log(_L("\n Body"));
    Log(aText);

    CleanupStack::PopAndDestroy(1);//entry


    }
    else
    {
    CleanupStack::PopAndDestroy(1);//entry
    }

    }
    }
    -----------------------------------------
    I am able to write phoneNumber and Body in log file
    chk this link too,
    http://wiki.forum.nokia.com/index.ph..._Edition_-_MTM

    regards,

  3. #3
    Regular Contributor
    Join Date
    Apr 2008
    Posts
    95

    Re: Getting The boby and number from Outbox..

    Thanks so much for the code..

    I will Try it out..

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,684

    Re: Getting The boby and number from Outbox..

    Quote Originally Posted by chintandhruva View Post
    iDescription will have only first 32 characters
    iDescription is intended to be used by the message list, that is the cause. Remember that TMsvEntry is a T-class, thus it can not contain dynamically sized fields.

  5. #5
    Regular Contributor
    Join Date
    Apr 2008
    Posts
    95

    Re: Getting The boby and number from Outbox..

    Hi goldenlife

    Regrading the code snippet which you sent me in the prvious reply..

    Can me please help me out in the declaration of the following

    SetMtmEntryL(aEntryId);---------->SetMtmEntryL??
    iMtm->LoadMessageL(); ----------->iMtm??

    Thanks Chintan

  6. #6
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,684

    Re: Getting The boby and number from Outbox..

    iMtm is easy: the line "CSmsClientMtm* iSmsMtm = static_cast<CSmsClientMtm*>(iMtm);" indicates that it is the MTM you can get from CClientMtmRegistry.
    The other one is a bit hazy.

    However you could re-check the Wiki article you have referred in your initial post. It shows how to extract the body, in CSmsHandler::ReadInbox.

  7. #7
    Regular Contributor
    Join Date
    Apr 2008
    Posts
    95

    Re: Getting The boby and number from Outbox..

    Hi ,

    I want to create the block the outgoing sms for a particular number.

    So the approach I follow is
    1) Retrieve the number and body.
    2) Then Delete the sms.

    I am able to acheive 1 successfully but before the code reaches for point 2 my sms is sent from outbox.
    so I am not able to delete the sms.


    I am attaching my code snippet

    void CSmsMmsObserver::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3)
    {
    switch(aEvent)
    {
    case EMsvEntriesChanged:
    {
    // Entry id is obtained from the session event arguments.
    TMsvId* entryId = STATIC_CAST( TMsvId*, aArg2 );

    // We are interested in messages that are created in outbox.
    if ( *entryId != KMsvGlobalOutBoxIndexEntryId )
    {
    break;
    }

    // We take the created entries into a selection
    CMsvEntrySelection* newEntries =
    STATIC_CAST( CMsvEntrySelection*, aArg1 );

    // Process each created entry.
    for ( TInt i( 0 ); i < newEntries->Count(); i++ )
    {
    // We are interested in SMS messages.
    if ( ( iSession->GetEntryL( newEntries->At( i ) ) )
    ->Entry().iMtm == KUidMsgTypeSMS )
    {
    // Add the entry to the selection of all received messages.
    iSelection->AppendL( newEntries->At( i ), 1 );

    // Set received messages visible.
    MessageSendL( newEntries->At( i ) );// Here is my function to Reteive body and number of
    //outgoing sms and Delete

    }
    }

    break;





    }


    void CSmsMmsObserver::MessageSendL(TMsvId aEntryId)
    {
    LogNew(_L("\n MessageSendL"));
    {
    TInt MySMS;
    MySMS=0;
    CMsvEntry* entry = iSession->GetEntryL(aEntryId);
    CleanupStack::PushL(entry);
    TBuf<200> aAddress,aText;

    LogNew(_L("\n MessageSendL1"));

    if(entry->Entry().iMtm == KUidMsgTypeSMS)
    {

    //SetMtmEntryL(aEntryId);
    LogNew(_L("\n KUidMsgTypeSMSs"));
    //iMtmReg->LoadMessageL();


    //CSmsClientMtm* iSmsMtm1 = static_cast<CSmsClientMtm*>(iMtmReg);
    iSmsMtm->SwitchCurrentEntryL(aEntryId);
    LogNew(_L("\n KUidMsgTypeSMSsdd"));
    iSmsMtm->LoadMessageL();
    LogNew(_L("\n KUidMsgTypeSMSsddee"));
    iSmsMtm->RestoreServiceAndSettingsL();
    LogNew(_L("\n KUidMsgTypeSMSs1"));

    CSmsHeader& header = iSmsMtm->SmsHeader();
    LogNew(_L("\n KUidMsgTypeSMSs2"));
    aAddress.Zero();
    LogNew(_L("\n KUidMsgTypeSMSs3"));
    aAddress.Copy(header.FromAddress());
    LogNew(aAddress);


    CRichText& body = iSmsMtm->Body();
    LogNew(_L("\n KUidMsgTypeSMSs5"));
    TPtrC text(body.Read(0, body.DocumentLength()));
    LogNew(_L("\n KUidMsgTypeSMSs6"));
    //Text.Copy(text);

    if(text.Length()<=150)
    {
    aText.Copy(text);
    }
    else
    {
    aText.Copy(text.Mid(0,150));
    }

    LogNew(_L("\n Send Number"));
    LogNew(aAddress);
    LogNew(_L("\n Body"));
    LogNew(aText);
    if(aAddress.Length()> 0 && aText.Length()> 0)///I have kept a check here to get both the number and body
    { //Before deletion of message

    LogNew(_L("Deleted"));
    iAppUi->ShowNotification();
    entry->DeleteL(aEntryId);

    }
    CleanupStack::PopAndDestroy(1);//entry

    }
    else
    {

    CleanupStack::PopAndDestroy(1);//entry
    }
    //


    }

    }

Posting Permissions

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