imservices/instantmessagingcache/imcacheserver/src/cimcachemessagebase.cpp
changeset 0 e6b17d312c8b
equal deleted inserted replaced
-1:000000000000 0:e6b17d312c8b
       
     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:  a message class implementation 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "cimcachemessagebase.h"
       
    20  //logs
       
    21 #include "imcachedebugtrace.h"
       
    22 
       
    23 	
       
    24 //-----------------------------------------------------------------------------
       
    25 // CIMCacheMessageBase::NewL
       
    26 // ( Other items commented in header )
       
    27 //-----------------------------------------------------------------------------
       
    28 CIMCacheMessageBase* CIMCacheMessageBase::NewL( 
       
    29                                         const TDesC& aData )
       
    30 	{
       
    31 	TRACE( T_LIT( "CIMCacheMessageBase::NewL begin") );
       
    32 	CIMCacheMessageBase* self = new ( ELeave ) CIMCacheMessageBase();
       
    33 	CleanupStack::PushL( self );
       
    34 	self->ConstructL(aData );
       
    35 	CleanupStack::Pop( self );
       
    36 	TRACE( T_LIT( "CIMCacheMessageBase::NewL end") );
       
    37 	return self;
       
    38 	}
       
    39 //-----------------------------------------------------------------------------
       
    40 // CIMCacheMessageBase::CIMCacheMessageBase
       
    41 // ( Other items commented in header )
       
    42 //-----------------------------------------------------------------------------
       
    43 CIMCacheMessageBase::CIMCacheMessageBase()
       
    44 	{
       
    45 	TRACE( T_LIT( "CIMCacheMessageBase::CIMCacheMessageBase") );
       
    46 	}
       
    47 	
       
    48 	
       
    49 //-----------------------------------------------------------------------------
       
    50 // CIMCacheMessageBase::ConstructL
       
    51 // ( Other items commented in header )
       
    52 //-----------------------------------------------------------------------------
       
    53 void CIMCacheMessageBase::ConstructL(const TDesC& aData  )
       
    54     {
       
    55     TRACE( T_LIT( "CIMCacheMessageBase::NewL start") );
       
    56     iText =  aData.AllocL(); 
       
    57     iMessagerType = EIMCMessageOther;
       
    58     iTime.HomeTime();
       
    59     iMessageType = EIMCMessagePTOP;
       
    60     iUnread = ETrue;
       
    61     TRACE( T_LIT( "CIMCacheMessageBase::NewL end") );
       
    62     }
       
    63 
       
    64 //-----------------------------------------------------------------------------
       
    65 // CIMCacheMessageBase::~CIMCacheMessageBase
       
    66 // ( Other items commented in header )
       
    67 //-----------------------------------------------------------------------------
       
    68 CIMCacheMessageBase::~CIMCacheMessageBase()
       
    69 	{
       
    70 	TRACE( T_LIT( "CIMCacheMessageBase::~CIMCacheMessageBase start") );
       
    71 	delete iText;	
       
    72 	TRACE( T_LIT( "CIMCacheMessageBase::~CIMCacheMessageBase end") );
       
    73 	}
       
    74 	
       
    75 //-----------------------------------------------------------------------------
       
    76 // CIMCacheMessageBase::TimeStamp
       
    77 // ( Other items commented in header )
       
    78 //-----------------------------------------------------------------------------
       
    79 const TTime& CIMCacheMessageBase::TimeStamp() const
       
    80 	{
       
    81 	return iTime;
       
    82 	}
       
    83 
       
    84 //-----------------------------------------------------------------------------
       
    85 // CIMCacheMessageBase::MessageType
       
    86 // ( Other items commented in header )
       
    87 //-----------------------------------------------------------------------------	
       
    88 TIMCacheMessageType CIMCacheMessageBase::MessageType() const
       
    89 	{
       
    90 	return iMessageType;
       
    91 	}
       
    92 
       
    93 //-----------------------------------------------------------------------------
       
    94 // CIMCacheMessageBase::MessagerType
       
    95 // ( Other items commented in header )
       
    96 //-----------------------------------------------------------------------------	
       
    97 TIMCacheMessagerType CIMCacheMessageBase::MessagerType() const
       
    98 	{
       
    99 	return iMessagerType;
       
   100 	}
       
   101 
       
   102 
       
   103 //-----------------------------------------------------------------------------
       
   104 // CIMCacheMessageBase::Text
       
   105 // ( Other items commented in header )
       
   106 //-----------------------------------------------------------------------------	
       
   107 const TDesC& CIMCacheMessageBase::Text() const
       
   108     {
       
   109     TRACE( T_LIT( "CIMCacheMessageBase::Text start") );
       
   110     if( iText )
       
   111         {
       
   112         return *iText;
       
   113         }
       
   114     TRACE( T_LIT( "CIMCacheMessageBase::Text end") );
       
   115     return KNullDesC;
       
   116     }
       
   117       
       
   118 //-----------------------------------------------------------------------------
       
   119 // CIMCacheMessageBase::SetRead
       
   120 // ( Other items commented in header )
       
   121 //-----------------------------------------------------------------------------	
       
   122 void CIMCacheMessageBase::SetRead() 
       
   123     {
       
   124     TRACE( T_LIT( "CIMCacheMessageBase::SetUnread start") );
       
   125     iUnread = EFalse;
       
   126     TRACE( T_LIT( "CIMCacheMessageBase::SetUnread end") );
       
   127     
       
   128     }
       
   129 
       
   130 //-----------------------------------------------------------------------------
       
   131 // CIMCacheMessageBase::IsUnread
       
   132 // ( Other items commented in header )
       
   133 //-----------------------------------------------------------------------------	
       
   134 TBool CIMCacheMessageBase::IsUnread() const
       
   135     {
       
   136     TRACE( T_LIT( "CIMCacheMessageBase::IsUnread ") );
       
   137     return iUnread;
       
   138    
       
   139     }     
       
   140 // -----------------------------------------------------------------------------
       
   141 // CIMCacheMessageBase::SetMessageType
       
   142 // -----------------------------------------------------------------------------
       
   143 //
       
   144 void CIMCacheMessageBase::SetMessageType( TIMCacheMessageType aNewType )
       
   145     {
       
   146     TRACE( T_LIT( "CIMCacheMessageBase::SetMessageType start") );
       
   147     iMessageType = aNewType;
       
   148     TRACE( T_LIT( "CIMCacheMessageBase::SetMessageType end") );
       
   149     }
       
   150 
       
   151 // -----------------------------------------------------------------------------
       
   152 // CIMCacheMessageBase::SetMessagerType
       
   153 // -----------------------------------------------------------------------------
       
   154 //
       
   155 void CIMCacheMessageBase::SetMessagerType( TIMCacheMessagerType aNewType )
       
   156     {
       
   157     TRACE( T_LIT( "CIMCacheMessageBase::SetMessagerType start") );
       
   158     iMessagerType = aNewType;
       
   159     TRACE( T_LIT( "CIMCacheMessageBase::SetMessagerType end") );
       
   160     }
       
   161 
       
   162  //-----------------------------------------------------------------------------
       
   163 // CIMCacheMessageBase::ContentType
       
   164 // ( Other items commented in header )
       
   165 //-----------------------------------------------------------------------------	
       
   166 TIMCacheContentType CIMCacheMessageBase::ContentType() const
       
   167 	{
       
   168 	return EIMCContentText;
       
   169 	}   
       
   170 
       
   171     
       
   172 // end of file