phoneengine/loghandling/src/cpelogevent.cpp
branchRCL_3
changeset 10 ba54057fe027
parent 3 8871b09be73b
child 24 41a7f70b3818
equal deleted inserted replaced
9:91c2fb4b78df 10:ba54057fe027
   656 void CPELogEvent::SetRemoteParty( CLogEvent& aEvent, 
   656 void CPELogEvent::SetRemoteParty( CLogEvent& aEvent, 
   657         const CPELogInfo& aLogInfo )
   657         const CPELogInfo& aLogInfo )
   658     {
   658     {
   659     if ( KNullDesC() != aLogInfo.Name() )
   659     if ( KNullDesC() != aLogInfo.Name() )
   660         {
   660         {
   661         aEvent.SetRemoteParty( aLogInfo.Name() );
   661         // This if clause fixes ou1cimx1#320365 Wrong address shown in received log entry
       
   662         if ( aLogInfo.EventType() != CPELogInfo::EPEVoIPEvent ||
       
   663              KNullDesC() == aEvent.RemoteParty() )
       
   664             {
       
   665             aEvent.SetRemoteParty( aLogInfo.Name() );
       
   666             }
   662         }
   667         }
   663     }
   668     }
   664 
   669 
   665 
   670 
   666 // -----------------------------------------------------------------------------
   671 // -----------------------------------------------------------------------------
   668 // -----------------------------------------------------------------------------
   673 // -----------------------------------------------------------------------------
   669 //
   674 //
   670 void CPELogEvent::SetRemoteContact( CLogEvent& aEvent, 
   675 void CPELogEvent::SetRemoteContact( CLogEvent& aEvent, 
   671         const CPELogInfo& aLogInfo )
   676         const CPELogInfo& aLogInfo )
   672     {
   677     {
   673     if ( KNullDesC() != aLogInfo.PhoneNumber() )
   678     if ( KNullDesC() != aLogInfo.PhoneNumber() )      
   674         {
   679         {
   675         aEvent.SetNumber( aLogInfo.PhoneNumber() );
   680         if ( aLogInfo.EventType() != CPELogInfo::EPEVoIPEvent ||
   676        
   681              ( KNullDesC() == aEvent.Number() &&
   677         if ( CPELogInfo::EPEVoIPEvent == aLogInfo.EventType() )
   682                KErrNotFound == iEvent->Data().Find( KLogsDataFldTag_URL ) ) )
   678             {
   683             {
   679             TRAPD( error, RemoveTagFromDataFieldL( KLogsDataFldTag_URL ) );
   684             aEvent.SetNumber( aLogInfo.PhoneNumber() );
   680             if( error )
   685             }
   681                 {
   686         }
   682                 TEFLOGSTRING2( KTAERROR, 
   687     
   683                     "LOG CPELogEvent::SetRemoteContact()>RemoveTagFromDataFieldL(), error=%d", error )
   688     else if ( KNullDesC() != aLogInfo.VoipAddress() &&
   684                 }
   689               KNullDesC() == aEvent.Number())
   685             }
       
   686         }
       
   687     
       
   688     if ( KNullDesC() != aLogInfo.VoipAddress() )
       
   689         {
   690         {
   690         TRAPD( error, SetDataFieldL( KLogsDataFldTag_URL, aLogInfo.VoipAddress() ) );
   691         TRAPD( error, SetDataFieldL( KLogsDataFldTag_URL, aLogInfo.VoipAddress() ) );
   691         if ( error )
   692         if ( error )
   692             {
   693             {
   693             TEFLOGSTRING2( KTAERROR, 
   694             TEFLOGSTRING2( KTAERROR, 
   694                 "LOG CPELogEvent::SetRemoteContact()>SetDataFieldL(), error=%d", error )
   695                 "LOG CPELogEvent::SetRemoteContact()>SetDataFieldL(), error=%d", error )
   695             }
   696             }
   696         aEvent.SetNumber( KNullDesC() );
       
   697         }
       
   698     }
       
   699 
       
   700 // -----------------------------------------------------------------------------
       
   701 // CPELogEvent::RemoveTagFromDataFieldL
       
   702 // -----------------------------------------------------------------------------
       
   703 //
       
   704 void CPELogEvent::RemoveTagFromDataFieldL( const TDesC8& aTag )
       
   705     {
       
   706     __ASSERT_ALWAYS( aTag.Length() != 0 ,
       
   707         User::Leave( KErrArgument ) );
       
   708 
       
   709     TInt index = iEvent->Data().Find( aTag );
       
   710     if ( KErrNotFound != index  )
       
   711         {
       
   712         HBufC8* eventData = iEvent->Data().AllocLC();
       
   713         TPtrC8 urlData = eventData->Mid( index );
       
   714         TInt otherTag = urlData.Find( KLogsDataFldNameDelimiter );
       
   715        
       
   716         const TInt dlLen = KLogsDataFldNameDelimiter().Length();
       
   717         if ( KErrNotFound == otherTag )
       
   718             {
       
   719             eventData->Des().Delete( index - dlLen, urlData.Length() + dlLen );
       
   720             }
       
   721         else
       
   722             {
       
   723             eventData->Des().Delete( index - dlLen, otherTag );
       
   724             }
       
   725         iEvent->SetDataL( *eventData );
       
   726 
       
   727         CleanupStack::PopAndDestroy( eventData );
       
   728         }
   697         }
   729     }
   698     }
   730 
   699 
   731 
   700 
   732 // ================= OTHER EXPORTED FUNCTIONS ===============================
   701 // ================= OTHER EXPORTED FUNCTIONS ===============================