messagingapp/msgnotifications/msgnotifier/src/msgstorehandler.cpp
branchRCL_3
changeset 57 ebe688cedc25
equal deleted inserted replaced
54:fa1df4b99609 57:ebe688cedc25
       
     1 /*
       
     2  * Copyright (c) 2008 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:  Message Store Handling for Indications
       
    15  *
       
    16  */
       
    17 
       
    18 #include "msgstorehandler.h"
       
    19 #include <xqconversions.h>
       
    20 #include "msgnotifier_p.h"
       
    21 #include <ccsrequesthandler.h>
       
    22 #include <ccsconversationentry.h>
       
    23 #include <ccsclientconversation.h>
       
    24 #include "msgcontacthandler.h"
       
    25 #include <msvids.h>
       
    26 #include <mmsconst.h>
       
    27 #include <smuthdr.h>
       
    28 #include <SendUiConsts.h>
       
    29 #include <msvsearchsortquery.h>
       
    30 #include <msvsearchsortoperation.h>
       
    31 #include <tmsvsmsentry.h>
       
    32 #include <txtrich.h>
       
    33 #include <ssm/ssmdomaindefs.h>
       
    34 #include "debugtraces.h"
       
    35 
       
    36 // CONSTANTS
       
    37 _LIT(KUnixEpoch, "19700000:000000.000000");
       
    38 
       
    39 // ================= MEMBER FUNCTIONS =======================
       
    40 
       
    41 // ---------------------------------------------------------
       
    42 // Default constructor.
       
    43 // ---------------------------------------------------------
       
    44 //
       
    45 MsgStoreHandler::MsgStoreHandler(MsgNotifierPrivate* notifier, CCSRequestHandler* aCvServer) :
       
    46     CActive(EPriorityStandard), iMsvSession(NULL), iNotifier(notifier), iRequestHandler(aCvServer)
       
    47 {
       
    48     InitL();
       
    49 }
       
    50 
       
    51 // ---------------------------------------------------------
       
    52 // Destructor.
       
    53 // ---------------------------------------------------------
       
    54 //
       
    55 MsgStoreHandler::~MsgStoreHandler()
       
    56 {
       
    57 	Cancel();
       
    58     iStateAwareSession.Close();
       
    59     
       
    60     if (iMsvEntry) {
       
    61         delete iMsvEntry;
       
    62         iMsvEntry = NULL;
       
    63     }
       
    64 
       
    65     if (iMsvSession) {
       
    66         delete iMsvSession;
       
    67         iMsvSession = NULL;
       
    68     }
       
    69 
       
    70     if (iFailedMessages) {
       
    71         delete iFailedMessages;
       
    72         iFailedMessages = NULL;
       
    73     }
       
    74 
       
    75 }
       
    76 
       
    77 // ---------------------------------------------------------
       
    78 // InitL( )
       
    79 // Initialize the Store handler.
       
    80 // ---------------------------------------------------------
       
    81 void MsgStoreHandler::InitL()
       
    82 {
       
    83     iMsvSession = CMsvSession::OpenSyncL(*this);
       
    84     iMsvEntry = iMsvSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
       
    85     iMsvEntry->AddObserverL(*this);
       
    86 
       
    87     iFailedMessages = new (ELeave) CMsvEntrySelection;
       
    88     
       
    89     User::LeaveIfError(iStateAwareSession.Connect(KSM2GenMiddlewareDomain3));
       
    90     CActiveScheduler::Add(this);
       
    91     
       
    92     TSsmState ssmState = iStateAwareSession.State();
       
    93     
       
    94     if (ssmState.MainState() != ESsmNormal) 
       
    95     {
       
    96         iStateAwareSession.RequestStateNotification(iStatus);
       
    97         SetActive();
       
    98     }
       
    99     else
       
   100     {  
       
   101         RunL();
       
   102     }
       
   103 
       
   104 }
       
   105 
       
   106 void MsgStoreHandler::RunL()
       
   107 {
       
   108     TSsmState ssmState = iStateAwareSession.State();
       
   109     if (ssmState.MainState() != ESsmNormal) 
       
   110     {        
       
   111         iStateAwareSession.RequestStateNotification(iStatus);
       
   112         SetActive();
       
   113     }
       
   114     else 
       
   115     {
       
   116         //Create  the query/operation object
       
   117         CMsvSearchSortOperation *operation = CMsvSearchSortOperation::NewL(*iMsvSession);
       
   118         CleanupStack::PushL(operation);
       
   119         CMsvSearchSortQuery *query = CMsvSearchSortQuery::NewL();
       
   120         CleanupStack::PushL(query);
       
   121 
       
   122         //set the query options
       
   123         query->SetParentId(KMsvGlobalInBoxIndexEntryId);
       
   124         query->SetResultType(EMsvResultAsTMsvId);
       
   125         query->AddSearchOptionL(EMsvMtmTypeUID, KSenduiMtmSmsUidValue, EMsvEqual);
       
   126         query->AddSearchOptionL(EMsvUnreadMessages, ETrue);
       
   127         CleanupStack::Pop(query);
       
   128 
       
   129         CMsvOperationActiveSchedulerWait* wait = CMsvOperationActiveSchedulerWait::NewLC();
       
   130         //ownership of Query transferred to Operation  
       
   131         operation->RequestL(query, EFalse, wait->iStatus);
       
   132         wait->Start();
       
   133 
       
   134         //Get No of entries
       
   135         RArray<TMsvId> messageArray;
       
   136         operation->GetResultsL(messageArray);
       
   137 
       
   138         CMsvEntry* entry = NULL;
       
   139         for (TInt i = 0; i < messageArray.Count(); ++i) 
       
   140         {
       
   141             entry = iMsvSession->GetEntryL(messageArray[i]);
       
   142             TMsvSmsEntry smsEntry = entry->Entry();
       
   143             TSmsDataCodingScheme::TSmsClass classType(TSmsDataCodingScheme::ESmsClass0);
       
   144             if (smsEntry.Class(classType)) 
       
   145             {
       
   146                 HandleClass0SmsL(entry, smsEntry.Id());
       
   147             }
       
   148             else
       
   149             {
       
   150                 delete entry;
       
   151                 entry = NULL;
       
   152             }
       
   153         }
       
   154         messageArray.Close();
       
   155         CleanupStack::PopAndDestroy(2, operation);
       
   156     }
       
   157 
       
   158 }
       
   159 
       
   160 void MsgStoreHandler::DoCancel()
       
   161 {
       
   162     iStateAwareSession.RequestStateNotificationCancel();
       
   163 }
       
   164 // ---------------------------------------------------------
       
   165 // MsgStoreHandler::HandleSessionEventL()
       
   166 // ---------------------------------------------------------
       
   167 //
       
   168 void MsgStoreHandler::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* /*aArg3*/)
       
   169 {
       
   170     CMsvEntrySelection* selection = NULL;
       
   171     TMsvId parent;
       
   172 
       
   173     //args
       
   174     if (aArg1 == NULL || aArg2 == NULL) {
       
   175         return;
       
   176     }
       
   177 
       
   178     //start, processing the event
       
   179     selection = (CMsvEntrySelection*) aArg1;
       
   180     parent = *(TMsvId*) aArg2;
       
   181 
       
   182     // Return when not (outbox or inbox) and  event not EMsvEntriesChanged
       
   183     if (!(parent == KMsvGlobalOutBoxIndexEntryIdValue || parent == KMsvGlobalInBoxIndexEntryIdValue)
       
   184         && aEvent != EMsvEntriesChanged) {
       
   185         return;
       
   186     }
       
   187 
       
   188     // check for incoming class 0 sms 
       
   189     if (parent == KMsvGlobalInBoxIndexEntryIdValue && aEvent == EMsvEntriesChanged) {
       
   190         CMsvEntry* inboxEntry = iMsvSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
       
   191         for (TInt i = 0; i < selection->Count(); ++i) {
       
   192             TMsvEntry entry = inboxEntry->ChildDataL(selection->At(i));
       
   193             if (KSenduiMtmSmsUidValue == entry.iMtm.iUid) {
       
   194                 CMsvEntry* msgEntry = iMsvSession->GetEntryL(entry.Id());
       
   195                 TMsvSmsEntry smsEntry = msgEntry->Entry();
       
   196                 TSmsDataCodingScheme::TSmsClass classType(TSmsDataCodingScheme::ESmsClass0);
       
   197 
       
   198                 if (smsEntry.Class(classType) && smsEntry.Unread()) 
       
   199                 {
       
   200                     HandleClass0SmsL(msgEntry, smsEntry.Id());
       
   201                 }
       
   202                 else 
       
   203                 {
       
   204                     delete msgEntry;
       
   205                     msgEntry = NULL;
       
   206                 }
       
   207             }
       
   208 
       
   209         } // for (TInt i = 0; i < selection->Count(); ++i)
       
   210         delete inboxEntry;
       
   211     }
       
   212     //Handling for outbox entries
       
   213     else if (parent == KMsvGlobalOutBoxIndexEntryIdValue) {
       
   214         CMsvEntry* rootEntry = iMsvSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
       
   215 
       
   216         for (TInt i = 0; i < selection->Count(); ++i) {
       
   217             TMsvEntry entry = rootEntry->ChildDataL(selection->At(i));
       
   218 
       
   219             if ((entry.iMtm == KSenduiMtmSmsUid) || (entry.iMtm == KSenduiMtmMmsUid)) {
       
   220                 TUint sendingState = entry.SendingState();
       
   221                 TInt index = iFailedMessages->Find(entry.Id());
       
   222 
       
   223                 if (sendingState == KMsvSendStateFailed && KErrNotFound == index) {
       
   224 
       
   225                     iFailedMessages->AppendL(entry.Id());
       
   226                     MsgInfo aInfo;
       
   227                     ProcessIndicatorDataL(entry.Id(), aInfo);
       
   228                     iNotifier->displayFailedNote(aInfo);
       
   229                 }
       
   230                 else if (sendingState != KMsvSendStateFailed && KErrNotFound != index) {
       
   231                     iFailedMessages->Delete(index);
       
   232                     iFailedMessages->Compress();
       
   233                 }
       
   234 
       
   235             }
       
   236         }//end for
       
   237     }
       
   238     else {
       
   239         TMsvEntry entry;
       
   240         TMsvId service;
       
   241         TInt error = KErrNone;
       
   242         for (TInt i = 0; i < selection->Count(); ++i) {
       
   243             error = iMsvSession->GetEntry(selection->At(i), service, entry);
       
   244 
       
   245             if (error == KErrNone && entry.iMtm == KUidMsgMMSNotification && 
       
   246                 MmsNotificationStatus(entry) == EMsgStatusFailed) {
       
   247 
       
   248                 TInt index = iFailedMessages->Find(entry.Id());
       
   249 
       
   250                 if (KErrNotFound == index) {
       
   251                     iFailedMessages->AppendL(entry.Id());
       
   252                     MsgInfo aInfo;
       
   253                     //Fill aInfo with appropriate data
       
   254                     aInfo.mMessageType = ECsMmsNotification;
       
   255                     ProcessIndicatorDataL(entry.Id(), aInfo);
       
   256                     iNotifier->displayFailedNote(aInfo);
       
   257 
       
   258                 }// end of if
       
   259             }
       
   260             else if (error == KErrNone && entry.iMtm == KUidMsgMMSNotification
       
   261                 && MmsNotificationStatus(entry) == EMsgStatusRetrieving) {
       
   262                 
       
   263                 TInt index = iFailedMessages->Find(entry.Id());
       
   264                 if (KErrNotFound != index) {
       
   265                     iFailedMessages->Delete(index);
       
   266                     iFailedMessages->Compress();
       
   267                 }// end of KErrNotFound != index if block
       
   268 
       
   269             } // end of 2nd if  
       
   270         } // for loop
       
   271     }
       
   272 
       
   273 }
       
   274 
       
   275 // ---------------------------------------------------------
       
   276 // MsgStoreHandler::HandleClass0SmsL()
       
   277 // ---------------------------------------------------------
       
   278 //
       
   279 void MsgStoreHandler::HandleClass0SmsL(CMsvEntry* aMsgEntry, TMsvId aMsgId)
       
   280 {
       
   281     CleanupStack::PushL(aMsgEntry);
       
   282 
       
   283     CMsvStore* store = aMsgEntry->ReadStoreL();
       
   284     CleanupStack::PushL(store);
       
   285 
       
   286     CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL();
       
   287     CleanupStack::PushL(paraFormatLayer);
       
   288 
       
   289     CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL();
       
   290     CleanupStack::PushL(charFormatLayer);
       
   291 
       
   292     CRichText* richText = CRichText::NewL(paraFormatLayer, charFormatLayer);
       
   293     CleanupStack::PushL(richText);
       
   294 
       
   295     store->RestoreBodyTextL(*richText);
       
   296 
       
   297     TInt len = richText->DocumentLength();
       
   298     HBufC* bufBody = HBufC::NewLC(len * 2);
       
   299 
       
   300     // Get Body content of SMS message
       
   301     TPtr bufBodyPtr = bufBody->Des();
       
   302     richText->Extract(bufBodyPtr, 0, len);
       
   303 
       
   304     //convert bufbody to qstring..
       
   305     QString body = XQConversions::s60DescToQString(*bufBody);
       
   306 
       
   307     Class0Info class0Info;
       
   308 
       
   309     class0Info.body = body;
       
   310     CleanupStack::PopAndDestroy(bufBody);
       
   311 
       
   312     // Get From address of SMS message
       
   313     CPlainText* nullString = CPlainText::NewL();
       
   314     CleanupStack::PushL(nullString);
       
   315 
       
   316     CSmsHeader* smsheader = CSmsHeader::NewL(CSmsPDU::ESmsDeliver, *nullString);
       
   317     CleanupStack::PushL(smsheader);
       
   318     smsheader->RestoreL(*store);
       
   319 
       
   320     QString address = XQConversions::s60DescToQString(smsheader->FromAddress());
       
   321     class0Info.address = address;
       
   322 
       
   323     // Get alias of SMS message
       
   324     QString alias;
       
   325     int count;
       
   326     MsgContactHandler::resolveContactDisplayName(address, alias, count);
       
   327     class0Info.alias = alias;
       
   328 
       
   329     // Get timestamp of SMS message
       
   330     QDateTime timeStamp;
       
   331     TTime time = aMsgEntry->Entry().iDate;
       
   332     TTime unixEpoch(KUnixEpoch);
       
   333     TTimeIntervalSeconds seconds;
       
   334     time.SecondsFrom(unixEpoch, seconds);
       
   335     timeStamp.setTime_t(seconds.Int());
       
   336 
       
   337     const QString times = timeStamp.toString("dd/MM/yy hh:mm ap");
       
   338     class0Info.time = times;
       
   339 
       
   340     class0Info.messageId = aMsgId;
       
   341     CleanupStack::PopAndDestroy(7);
       
   342     aMsgEntry = NULL;
       
   343 
       
   344     // Show the SMS message..  
       
   345     iNotifier->ShowClass0Message(class0Info);
       
   346 }
       
   347 
       
   348 // ---------------------------------------------------------
       
   349 // MsgStoreHandler::HandleEntryEventL()
       
   350 // ---------------------------------------------------------
       
   351 
       
   352 void MsgStoreHandler::HandleEntryEventL(TMsvEntryEvent aEvent, TAny* /*aArg1*/, TAny* /*aArg2*/,
       
   353     TAny* /*aArg3*/)
       
   354 {
       
   355     switch (aEvent) {
       
   356     case EMsvChildrenChanged:
       
   357     case EMsvDeletedChildren:
       
   358     {
       
   359         UpdateOutboxIndications();
       
   360         break;
       
   361     }
       
   362     default:
       
   363         break;
       
   364 
       
   365     }
       
   366 }
       
   367 
       
   368 // ---------------------------------------------------------
       
   369 // UpdateOutboxIndications()
       
   370 // Outgoing Pending message/messages
       
   371 // ---------------------------------------------------------
       
   372 void MsgStoreHandler::UpdateOutboxIndications()
       
   373 {
       
   374     MsgInfo failedIndicatorData;
       
   375     MsgInfo pendingIndicatorData;
       
   376 
       
   377     TInt err = KErrNone;
       
   378 
       
   379     TRAP(err, GetOutboxEntriesL(failedIndicatorData, pendingIndicatorData));
       
   380 
       
   381     if (err == KErrNone) {
       
   382         iNotifier->displayOutboxIndications(failedIndicatorData);
       
   383         iNotifier->displayOutboxIndications(pendingIndicatorData);
       
   384     }
       
   385 }
       
   386 
       
   387 // ---------------------------------------------------------
       
   388 // GetOutboxEntries()
       
   389 // Outgoing Pending message/messages
       
   390 // ---------------------------------------------------------
       
   391 TInt MsgStoreHandler::GetOutboxEntriesL(MsgInfo& aFailedIndicatorData,
       
   392     MsgInfo& aPendingIndicatorData)
       
   393 {
       
   394     CMsvEntry* rootEntry = iMsvSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
       
   395     CMsvEntrySelection* messages = rootEntry->ChildrenL();
       
   396 
       
   397     TInt failedMessageCount = 0;
       
   398     TInt pendingMessageCount = 0;
       
   399 
       
   400     for (TInt i = 0; i < messages->Count(); ++i) {
       
   401         TMsvEntry entry = rootEntry->ChildDataL(messages->At(i));
       
   402         if ((entry.iMtm != KSenduiMtmSmsUid) && (entry.iMtm != KSenduiMtmMmsUid)) {
       
   403             continue;
       
   404         }
       
   405 
       
   406         if (entry.SendingState() == KMsvSendStateFailed) {
       
   407             ++failedMessageCount;
       
   408         }
       
   409         else {
       
   410             ++pendingMessageCount;
       
   411         }
       
   412 
       
   413         if (entry.SendingState() == KMsvSendStateFailed) {
       
   414             ProcessIndicatorDataL(entry.Id(), aFailedIndicatorData);
       
   415         }
       
   416         else {
       
   417             ProcessIndicatorDataL(entry.Id(), aPendingIndicatorData);
       
   418         }
       
   419        
       
   420     }
       
   421 
       
   422     aFailedIndicatorData.mFromSingle = (failedMessageCount > 1) ? false : true;
       
   423     aPendingIndicatorData.mFromSingle = (pendingMessageCount > 1) ? false : true;
       
   424     aFailedIndicatorData.mIndicatorType = FailedIndicatorPlugin;
       
   425     aPendingIndicatorData.mIndicatorType = PendingIndicatorPlugin;
       
   426     aFailedIndicatorData.mMsgCount = failedMessageCount;
       
   427     aPendingIndicatorData.mMsgCount = pendingMessageCount;
       
   428 
       
   429     return KErrNone;
       
   430 }
       
   431 
       
   432 // ---------------------------------------------------------
       
   433 // ProcessIndicatorData()
       
   434 // Process the data in the MsgInfo object. 
       
   435 // ---------------------------------------------------------
       
   436 
       
   437 void MsgStoreHandler::ProcessIndicatorDataL(TMsvId msgId, MsgInfo& indicatorData)
       
   438 {
       
   439     CCsClientConversation* conversation = iRequestHandler->GetConversationFromMessageIdL(msgId);
       
   440     if (conversation == NULL)
       
   441         return;
       
   442 
       
   443     indicatorData.mConversationId = conversation->GetConversationEntryId();
       
   444     CCsConversationEntry* convEntry = conversation->GetConversationEntry();
       
   445 
       
   446     //check for valid data
       
   447     if ((indicatorData.mConversationId == -1) || (convEntry == NULL)) {
       
   448         delete conversation;
       
   449         return;
       
   450     }
       
   451     
       
   452     //set indicator data
       
   453     HBufC* displayName = conversation->GetDisplayName();
       
   454 
       
   455     if (displayName) {
       
   456         indicatorData.mDisplayName.append(XQConversions::s60DescToQString(*displayName));
       
   457     }
       
   458     else {
       
   459         HBufC* number = convEntry->Contact();
       
   460         if (number)
       
   461             indicatorData.mDisplayName.append(XQConversions::s60DescToQString(*number));
       
   462     }
       
   463     delete conversation;
       
   464 }
       
   465 
       
   466 // ---------------------------------------------------------
       
   467 // GetUnreadMessageCountL()
       
   468 // Get Unread message count.
       
   469 // ---------------------------------------------------------
       
   470 
       
   471 int MsgStoreHandler::GetUnreadMessageCountL()
       
   472 {
       
   473     //Create  the query/operation object
       
   474     CMsvSearchSortOperation *operation = CMsvSearchSortOperation::NewL(*iMsvSession);
       
   475     CleanupStack::PushL(operation);
       
   476     CMsvSearchSortQuery *query = CMsvSearchSortQuery::NewL();
       
   477     CleanupStack::PushL(query);
       
   478 
       
   479     //set the query options
       
   480     query->SetParentId(KMsvGlobalInBoxIndexEntryId);
       
   481     query->SetResultType(EMsvResultAsTMsvEntry);
       
   482     query->AddSearchOptionL(EMsvUnreadMessages, ETrue);
       
   483     CleanupStack::Pop(query);
       
   484 
       
   485     CMsvOperationWait* wait = CMsvOperationWait::NewLC();
       
   486     //ownership of Query transferred to Operation  
       
   487     operation->RequestL(query, EFalse, wait->iStatus);
       
   488     wait->Start();
       
   489     CActiveScheduler::Start();
       
   490 
       
   491     //Get No of entries
       
   492     int count = operation->GetResultCountL();
       
   493     CleanupStack::PopAndDestroy(2, operation);
       
   494 
       
   495     return count;
       
   496 }
       
   497 
       
   498 // ---------------------------------------------------------
       
   499 // MsgStoreHandler::MmsNotificationStatus
       
   500 // ---------------------------------------------------------
       
   501 //
       
   502 TCsMmsNotificationMsgState MsgStoreHandler::
       
   503 MmsNotificationStatus( TMsvEntry entry )
       
   504     {   
       
   505     TCsMmsNotificationMsgState status = EMsgStatusNull;
       
   506 
       
   507     // operationMask includes operation type. It is not bitmap but ordinal number. 
       
   508     // It does not include operation status and result
       
   509     TInt operationMask = (entry.iMtmData2 & KMmsOperationIdentifier) ;
       
   510 
       
   511     // Note! Ongoing operation resets every bit of operation type, operation status
       
   512     // and result. E.g. If message has been forwarded and then fetching starts, 
       
   513     // information about forwarding is lost
       
   514 
       
   515     if( ( entry.iMtmData1 & KMmsMessageTypeMask ) == KMmsMessageMNotificationInd )
       
   516         {
       
   517         if(     operationMask == KMmsOperationFetch 
       
   518                 &&  OperationOngoing( entry ) )
       
   519             { 
       
   520             // It's in retrieving state
       
   521             status = EMsgStatusRetrieving;
       
   522             }
       
   523         else if(    operationMask == KMmsOperationForward
       
   524                 &&  OperationOngoing( entry ) )
       
   525             { 
       
   526             // It's in forwarding state
       
   527             status = EMsgStatusForwarding;
       
   528             }
       
   529         else if(    operationMask == KMmsOperationForward
       
   530                 &&  OperationFinished( entry )
       
   531                 &&  !( entry.iMtmData2 & KMmsOperationResult ) )
       
   532             { 
       
   533             // It's been forwarded succesfully
       
   534             status = EMsgStatusForwarded;
       
   535             }
       
   536         else if(    operationMask == KMmsOperationFetch 
       
   537                 &&  OperationFinished( entry )
       
   538                 &&   (  entry.iMtmData2 & KMmsOperationResult 
       
   539                 ||  entry.iError ) )
       
   540             { 
       
   541             // Fetch has been failed
       
   542             status = EMsgStatusFailed;
       
   543             }
       
   544         else if(    operationMask == KMmsOperationDelete
       
   545                 &&  OperationFinished( entry )
       
   546                 &&  !( entry.iMtmData2 & KMmsOperationResult ) )
       
   547             { 
       
   548             // It's been deleted succesfully
       
   549             status = EMsgStatusDeleted;
       
   550             }
       
   551         else 
       
   552             {   // Normal waiting state
       
   553             status = EMsgStatusReadyForFetching;
       
   554             }
       
   555         }
       
   556 
       
   557     return status;
       
   558     }
       
   559 
       
   560 // ---------------------------------------------------------
       
   561 // MsgStoreHandler::OperationOngoing
       
   562 // ---------------------------------------------------------
       
   563 //
       
   564 TBool MsgStoreHandler::OperationOngoing( const TMsvEntry& aEntry ) const
       
   565     {
       
   566     return (    aEntry.iMtmData2 & KMmsOperationOngoing 
       
   567             &&  !( aEntry.iMtmData2 & KMmsOperationFinished ) );
       
   568     }
       
   569 
       
   570 // ---------------------------------------------------------
       
   571 // ConversationMsgStoreHandler::OperationFinished
       
   572 // ---------------------------------------------------------
       
   573 //
       
   574 TBool MsgStoreHandler::OperationFinished( 
       
   575     const TMsvEntry& aEntry ) const
       
   576     {
       
   577     return (    aEntry.iMtmData2 & KMmsOperationFinished
       
   578             &&  !( aEntry.iMtmData2 & KMmsOperationOngoing ) );
       
   579     }
       
   580 
       
   581 // End of file