imstutils/imconversationview/imcvuiengine/src/cimcvenginemessagebase.cpp
changeset 0 5e5d6b214f4f
equal deleted inserted replaced
-1:000000000000 0:5e5d6b214f4f
       
     1 /*
       
     2 * Copyright (c) 2007-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:  Base class for message
       
    15 *
       
    16 */
       
    17 
       
    18 #include "cimcvenginemessagebase.h"
       
    19 #include "mimcvenginemessagecontainerinfo.h"
       
    20 #include "imcvuiliterals.h"
       
    21 #include <StringLoader.h>
       
    22 #include <avkon.rsg>
       
    23 #include <txtetext.h>                    
       
    24 #include "imcvlogger.h"                  
       
    25 
       
    26 //-----------------------------------------------------------------------------
       
    27 // CIMCVEngineMessageBase::CIMCVEngineMessageBase
       
    28 // ( Other items commented in header )
       
    29 //-----------------------------------------------------------------------------
       
    30 CIMCVEngineMessageBase::CIMCVEngineMessageBase()
       
    31 	{
       
    32 	}
       
    33 	
       
    34 	
       
    35 //-----------------------------------------------------------------------------
       
    36 // CIMCVEngineMessageBase::ConstructL
       
    37 // ( Other items commented in header )
       
    38 //-----------------------------------------------------------------------------
       
    39 void CIMCVEngineMessageBase::ConstructL(const TDesC& aSender, 
       
    40                                  const TDesC& aRecipient )
       
    41     {
       
    42     IM_CV_LOGS(TXT("CIMCVEngineMessageBase::ConstructL() start") );
       
    43        
       
    44     iSender = aSender.AllocL();
       
    45     iRecipient = aRecipient.AllocL();
       
    46     
       
    47            
       
    48     iMessagerType = EMessageOther;
       
    49     iSystemMessageType = ESystemMessageNone;
       
    50     iTime.HomeTime();
       
    51     iMessageVersion = KVersionNum;
       
    52     iMessageType = EMessagePTOP;
       
    53     
       
    54     IM_CV_LOGS(TXT("CIMCVEngineMessageBase::ConstructL() end") );
       
    55     }
       
    56 
       
    57 //-----------------------------------------------------------------------------
       
    58 // CIMCVEngineMessageBase::~CIMCVEngineMessageBase
       
    59 // ( Other items commented in header )
       
    60 //-----------------------------------------------------------------------------
       
    61 CIMCVEngineMessageBase::~CIMCVEngineMessageBase()
       
    62 	{
       
    63 	//__CHAT_ASSERT_DEBUG( iOwnerCount == 0 );
       
    64 	delete iSender;
       
    65 	delete iRecipient;
       
    66 	delete iText;	
       
    67 	}
       
    68 	
       
    69 //-----------------------------------------------------------------------------
       
    70 // CIMCVEngineMessageBase::TimeStamp
       
    71 // ( Other items commented in header )
       
    72 //-----------------------------------------------------------------------------
       
    73 const TTime& CIMCVEngineMessageBase::TimeStamp() const
       
    74 	{
       
    75 	return iTime;
       
    76 	}
       
    77 
       
    78 //-----------------------------------------------------------------------------
       
    79 // CIMCVEngineMessageBase::SetTimeStamp
       
    80 // ( Other items commented in header )
       
    81 //-----------------------------------------------------------------------------
       
    82 void CIMCVEngineMessageBase::SetTimeStamp(TTime aTime ) 
       
    83 	{
       
    84 	 iTime = aTime ;
       
    85 	}
       
    86 //-----------------------------------------------------------------------------
       
    87 // CIMCVEngineMessageBase::MessageType
       
    88 // ( Other items commented in header )
       
    89 //-----------------------------------------------------------------------------	
       
    90 MIMCVEngineMessage::TMessageType CIMCVEngineMessageBase::MessageType() const
       
    91 	{
       
    92 	return iMessageType;
       
    93 	}
       
    94 
       
    95 //-----------------------------------------------------------------------------
       
    96 // CIMCVEngineMessageBase::MessagerType
       
    97 // ( Other items commented in header )
       
    98 //-----------------------------------------------------------------------------	
       
    99 MIMCVEngineMessage::TMessagerType CIMCVEngineMessageBase::MessagerType() const
       
   100 	{
       
   101 	return iMessagerType;
       
   102 	}
       
   103 
       
   104 //-----------------------------------------------------------------------------
       
   105 // CIMCVEngineMessageBase::OperationCode
       
   106 // ( Other items commented in header )
       
   107 //-----------------------------------------------------------------------------	
       
   108 TXIMPRequestId CIMCVEngineMessageBase::OperationCode() const
       
   109     {
       
   110     return iOperationCode;
       
   111     }
       
   112 
       
   113 //-----------------------------------------------------------------------------
       
   114 // CIMCVEngineMessageBase::Recipient
       
   115 // ( Other items commented in header )
       
   116 //-----------------------------------------------------------------------------	
       
   117 void CIMCVEngineMessageBase::SetOperationCode(TXIMPRequestId aOperationId )
       
   118     {
       
   119     iOperationCode = aOperationId;
       
   120     }
       
   121 
       
   122 //-----------------------------------------------------------------------------
       
   123 // CIMCVEngineMessageBase::Recipient
       
   124 // ( Other items commented in header )
       
   125 //-----------------------------------------------------------------------------	
       
   126 const TDesC& CIMCVEngineMessageBase::Recipient() const
       
   127     {
       
   128     IM_CV_LOGS(TXT("CIMCVEngineMessageBase::Recipient() start") );
       
   129     if( iRecipient )
       
   130         {
       
   131         return *iRecipient;
       
   132         }
       
   133     IM_CV_LOGS(TXT("CIMCVEngineMessageBase::Recipient() end") );
       
   134     return KNullDesC;
       
   135     }
       
   136 
       
   137    
       
   138 //-----------------------------------------------------------------------------
       
   139 // CIMCVEngineMessageBase::SetMessageContainerInfo
       
   140 // ( Other items commented in header )
       
   141 //-----------------------------------------------------------------------------	
       
   142 void CIMCVEngineMessageBase::SetContainerInfo( MIMCVEngineMessageContainerInfo* aInfo )
       
   143     {
       
   144     IM_CV_LOGS(TXT("CIMCVEngineMessageBase::SetContainerInfo() start") );
       
   145     iInfo = aInfo;
       
   146     IM_CV_LOGS(TXT("CIMCVEngineMessageBase::SetContainerInfo() end") );
       
   147     }
       
   148  
       
   149 //-----------------------------------------------------------------------------
       
   150 // CIMCVEngineMessageBase::Text
       
   151 // ( Other items commented in header )
       
   152 //-----------------------------------------------------------------------------	
       
   153 const TDesC& CIMCVEngineMessageBase::Text() const
       
   154     {
       
   155     IM_CV_LOGS(TXT("CIMCVEngineMessageBase::Text() start") );
       
   156     if( iText )
       
   157         {
       
   158         return *iText;
       
   159         }
       
   160     IM_CV_LOGS(TXT("CIMCVEngineMessageBase::Text() end") );
       
   161     return KNullDesC;
       
   162     }
       
   163     
       
   164 //-----------------------------------------------------------------------------
       
   165 // CIMCVEngineMessageBase::Sender
       
   166 // ( Other items commented in header )
       
   167 //-----------------------------------------------------------------------------	
       
   168 const TDesC& CIMCVEngineMessageBase::Sender() const
       
   169     {
       
   170     IM_CV_LOGS(TXT("CIMCVEngineMessageBase::Sender() start") );
       
   171     if( iSender )
       
   172         {
       
   173         return *iSender;
       
   174         }
       
   175     IM_CV_LOGS(TXT("CIMCVEngineMessageBase::Sender() end") );
       
   176     return KNullDesC;
       
   177     }    
       
   178         
       
   179 //-----------------------------------------------------------------------------
       
   180 // CIMCVEngineMessageBase::SizeInBytes
       
   181 // ( Other items commented in header )
       
   182 //-----------------------------------------------------------------------------	
       
   183 TInt CIMCVEngineMessageBase::SizeInBytes() const
       
   184     {
       
   185     return  iSender->Size() + 
       
   186             iRecipient->Size();
       
   187     }    
       
   188     
       
   189 // ---------------------------------------------------------
       
   190 // CIMCVEngineMessageBase::FailedMessage()
       
   191 // ---------------------------------------------------------
       
   192 //
       
   193 TBool CIMCVEngineMessageBase::FailedMessage() const
       
   194     {
       
   195     return iFailed;
       
   196     }
       
   197     
       
   198 // ---------------------------------------------------------
       
   199 // CIMCVEngineMessageBase::FailedMessage()
       
   200 // ---------------------------------------------------------
       
   201 //
       
   202 void CIMCVEngineMessageBase::SetFailed( TBool aFailed /* = ETrue */  ) 
       
   203     {
       
   204     IM_CV_LOGS(TXT("CIMCVEngineMessageBase::SetFailed() start") );
       
   205     iFailed = aFailed;
       
   206     IM_CV_LOGS(TXT("CIMCVEngineMessageBase::SetFailed() end") );
       
   207     }
       
   208     
       
   209 
       
   210 // -----------------------------------------------------------------------------
       
   211 // CIMCVEngineMessageBase::SetMessageType
       
   212 // -----------------------------------------------------------------------------
       
   213 //
       
   214 void CIMCVEngineMessageBase::SetMessageType( TMessageType aNewType )
       
   215     {
       
   216     IM_CV_LOGS(TXT("CIMCVEngineMessageBase::SetMessageType() start") );
       
   217     iMessageType = aNewType;
       
   218     IM_CV_LOGS(TXT("CIMCVEngineMessageBase::SetMessageType() end") );
       
   219     }
       
   220 
       
   221 // -----------------------------------------------------------------------------
       
   222 // CIMCVEngineMessageBase::SetMessagerType
       
   223 // -----------------------------------------------------------------------------
       
   224 //
       
   225 void CIMCVEngineMessageBase::SetMessagerType( TMessagerType aNewType )
       
   226     {
       
   227     IM_CV_LOGS(TXT("CIMCVEngineMessageBase::SetMessagerType() start") );
       
   228     iMessagerType = aNewType;
       
   229     IM_CV_LOGS(TXT("CIMCVEngineMessageBase::SetMessagerType() end") );
       
   230     }
       
   231     
       
   232 
       
   233 // -----------------------------------------------------------------------------
       
   234 // CIMCVEngineMessageBase::SetSystem
       
   235 // -----------------------------------------------------------------------------
       
   236 //
       
   237 void CIMCVEngineMessageBase::SetSystem( TSystemMessage aType )
       
   238     {
       
   239     IM_CV_LOGS(TXT("CIMCVEngineMessageBase::SetSystem() start") );
       
   240     iSystemMessageType = aType;
       
   241     iMessagerType = EMessageSent;
       
   242     iMessageType = EMessageSystem;
       
   243     IM_CV_LOGS(TXT("CIMCVEngineMessageBase::SetSystem() end") );
       
   244     }
       
   245 
       
   246 // -----------------------------------------------------------------------------
       
   247 // CIMCVEngineMessageBase::SystemMessageType
       
   248 // -----------------------------------------------------------------------------
       
   249 //
       
   250 MIMCVEngineMessage::TSystemMessage CIMCVEngineMessageBase::SystemMessageType()
       
   251     {
       
   252     IM_CV_LOGS(TXT("CIMCVEngineMessageBase::SystemMessageType() start") );
       
   253     if( iMessageType != EMessageSystem )
       
   254         {
       
   255         // not a system message
       
   256         return ESystemMessageNone;
       
   257         }
       
   258     IM_CV_LOGS(TXT("CIMCVEngineMessageBase::SystemMessageType() end") );
       
   259     return iSystemMessageType;
       
   260     }
       
   261 
       
   262 
       
   263 //-----------------------------------------------------------------------------
       
   264 // CIMCVEngineMessageBase::IncreaseOwnerCount
       
   265 // ( Other items commented in header )
       
   266 //-----------------------------------------------------------------------------	
       
   267 void CIMCVEngineMessageBase::IncreaseOwnerCount()
       
   268     {
       
   269     ++iOwnerCount;
       
   270     }
       
   271 
       
   272 //-----------------------------------------------------------------------------
       
   273 // CCAMessageBase::DecreaseOwnerCount
       
   274 // ( Other items commented in header )
       
   275 //-----------------------------------------------------------------------------	
       
   276 TBool CIMCVEngineMessageBase::DecreaseOwnerCount()
       
   277     {
       
   278     return ( --iOwnerCount <= 0 );
       
   279     }
       
   280     
       
   281     
       
   282 // end of file