Msrp/MsrpHeader/src/CMsrpMessage.cpp
author shivsood
Sat, 12 Jun 2010 14:30:11 +0530
branchMSRP_FrameWork
changeset 25 505ad3f0ce5c
child 58 cdb720e67852
permissions -rw-r--r--
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia. MSRP Implementation as per RFC 4975 and RCS specifications that supports 1. Multiple one to one chat data sessions as per RCS/RFC 4975 specifications. 2. Multiple file Sharing sessions as per RCS. 3. Data Chunking requirements as per 4975. 3. MSRP Connection sharing requirements as per RFC 4975
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
     1
/*
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
     2
* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
     3
* All rights reserved.
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
     4
* This component and the accompanying materials are made available
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
     6
* which accompanies this distribution, and is available
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html."
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
     8
* Initial Contributors:
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
     9
* Nokia Corporation - initial contribution.
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    10
* Contributors:
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    11
*
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    12
* Description:
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    13
* MSRP Implementation
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    14
*
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    15
*/
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    16
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    17
// CLASS HEADER
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    18
#include "CMsrpMessage.h"
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    19
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    20
// EXTERNAL INCLUDES
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    21
#include <MsrpStrConsts.h>
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    22
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    23
// INTERNAL INCLUDES
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    24
#include "MsrpCommon.h"
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    25
#include "CMSRPFromPathHeader.h"
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    26
#include "CMSRPToPathHeader.h"
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    27
#include "CMSRPMessageIdHeader.h"
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    28
#include "CMSRPByteRangeHeader.h"
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    29
#include "CMSRPContentTypeHeader.h"
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    30
#include "CMSRPFailureReportHeader.h"
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    31
#include "CMSRPSuccessReportHeader.h"
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    32
#include "TMSRPHeaderUtil.h"
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    33
// -----------------------------------------------------------------------------
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    34
// CMSRPMessage::CMSRPMessage
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    35
// -----------------------------------------------------------------------------
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    36
//
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    37
EXPORT_C CMSRPMessage::CMSRPMessage()
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    38
	{
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    39
	}
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    40
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    41
// -----------------------------------------------------------------------------
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    42
// CMSRPMessage::~CMSRPMessage
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    43
// -----------------------------------------------------------------------------
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    44
//
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    45
EXPORT_C CMSRPMessage::~CMSRPMessage()
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    46
	{
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    47
	delete iContentBuffer;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    48
	}
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    49
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    50
// -----------------------------------------------------------------------------
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    51
// CMSRPMessage::SetContentL
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    52
// -----------------------------------------------------------------------------
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    53
//
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    54
EXPORT_C void CMSRPMessage::SetContent( HBufC8* aContent )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    55
	{
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    56
    if( iContentBuffer )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    57
        {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    58
        delete iContentBuffer;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    59
        iContentBuffer = NULL;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    60
        }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    61
	iContentBuffer = aContent;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    62
	}
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    63
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    64
// -----------------------------------------------------------------------------
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    65
// CMSRPMessage::Content
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    66
// -----------------------------------------------------------------------------
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    67
//
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    68
EXPORT_C const TDesC8& CMSRPMessage::Content( )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    69
	{
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    70
    if( iContentBuffer )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    71
        {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    72
        return *iContentBuffer;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    73
        }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    74
	return KNullDesC8();
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    75
	}
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    76
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    77
// -----------------------------------------------------------------------------
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    78
// CMSRPMessage::IsContent
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    79
// -----------------------------------------------------------------------------
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    80
//
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    81
EXPORT_C TBool CMSRPMessage::IsContent( ) const
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    82
	{
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    83
	if ( iContentBuffer )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    84
		{
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    85
		return ETrue;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    86
		}
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    87
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    88
	return EFalse;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    89
	}
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    90
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    91
// -----------------------------------------------------------------------------
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    92
// CMSRPMessage::SetFileName
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    93
// -----------------------------------------------------------------------------
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    94
//
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    95
EXPORT_C void CMSRPMessage::SetFileName( const TFileName& aFileName )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    96
    {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    97
    iFileName = aFileName;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    98
    }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
    99
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   100
// -----------------------------------------------------------------------------
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   101
// CMSRPMessage::GetFileName
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   102
// -----------------------------------------------------------------------------
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   103
//
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   104
EXPORT_C TFileName& CMSRPMessage::GetFileName( )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   105
    {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   106
    return iFileName;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   107
    }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   108
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   109
// -----------------------------------------------------------------------------
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   110
// CMSRPMessage::SetFileSize
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   111
// -----------------------------------------------------------------------------
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   112
//
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   113
EXPORT_C void CMSRPMessage::SetFileSize( const TInt aFileSize )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   114
    {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   115
    iFileSize = aFileSize;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   116
    }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   117
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   118
// -----------------------------------------------------------------------------
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   119
// CMSRPMessage::GetFileSize
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   120
// -----------------------------------------------------------------------------
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   121
//
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   122
EXPORT_C TInt CMSRPMessage::GetFileSize( )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   123
    {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   124
    return iFileSize;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   125
    }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   126
// -----------------------------------------------------------------------------
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   127
// CMSRPMessage::InternalizeL
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   128
// -----------------------------------------------------------------------------
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   129
//
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   130
EXPORT_C CMSRPMessage* CMSRPMessage::InternalizeL( RReadStream& aReadStream )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   131
	{
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   132
	CMSRPMessage* self = new (ELeave) CMSRPMessage();
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   133
	CleanupStack::PushL( self );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   134
    self->DoInternalizeL( aReadStream );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   135
	CleanupStack::Pop( self );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   136
    return self;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   137
	}
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   138
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   139
// -----------------------------------------------------------------------------
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   140
// CMSRPMessage::DoInternalizeL
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   141
// -----------------------------------------------------------------------------
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   142
//
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   143
void CMSRPMessage::DoInternalizeL( RReadStream& aReadStream )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   144
    {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   145
    TUint8 dataType( 0 );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   146
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   147
    // read the identifier
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   148
    if ( aReadStream.ReadUint8L() != 100 )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   149
        {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   150
        User::Leave( KErrArgument );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   151
        }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   152
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   153
    do
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   154
        {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   155
        dataType = aReadStream.ReadUint8L();
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   156
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   157
        switch( dataType )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   158
            {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   159
            case 1: // from path
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   160
                {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   161
                iFromPath = CMSRPFromPathHeader::InternalizeValueL( aReadStream );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   162
                break;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   163
                }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   164
            case 2: // to path
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   165
                {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   166
                iToPath = CMSRPToPathHeader::InternalizeValueL( aReadStream );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   167
                break;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   168
                }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   169
            case 3: // message id
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   170
                {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   171
                iMessageId = CMSRPMessageIdHeader::InternalizeValueL( aReadStream );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   172
                break;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   173
                }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   174
            case 4: // byte range
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   175
                {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   176
                iByteRange = CMSRPByteRangeHeader::InternalizeValueL( aReadStream );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   177
                break;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   178
                }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   179
            case 5: // content type
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   180
                {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   181
                iContentType = CMSRPContentTypeHeader::InternalizeValueL( aReadStream );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   182
                break;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   183
                }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   184
            case 6: // failure report
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   185
                {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   186
                iFailureReport = CMSRPFailureReportHeader::InternalizeValueL( aReadStream );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   187
                break;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   188
                }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   189
            case 7: // success report
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   190
                {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   191
                iSuccessReport = CMSRPSuccessReportHeader::InternalizeValueL( aReadStream );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   192
                break;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   193
                }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   194
            case 10: // content buffer
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   195
                {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   196
                TUint32 contentLength = aReadStream.ReadUint32L();
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   197
                iContentBuffer = HBufC8::NewL( contentLength );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   198
                TPtr8 bufferPtr = iContentBuffer->Des();
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   199
                aReadStream.ReadL( bufferPtr, contentLength );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   200
                break;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   201
                }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   202
            case 11: //filename
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   203
                {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   204
                 TUint32 nameLength = aReadStream.ReadUint32L();
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   205
                 aReadStream.ReadL( iFileName, nameLength );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   206
                 break;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   207
                }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   208
            case 12: //filesize
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   209
                 {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   210
                  TUint32 val = aReadStream.ReadUint32L();
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   211
                  if( val > 0 )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   212
                    {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   213
                    HBufC8* tempString = HBufC8::NewLC( val );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   214
                    TPtr8 tempValue( tempString->Des() );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   215
                    aReadStream.ReadL( tempValue, val );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   216
                    iFileSize = TMSRPHeaderUtil::ConvertToNumber( tempString->Des() );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   217
                    CleanupStack::PopAndDestroy( tempString );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   218
                    }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   219
                   break;              
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   220
                  }         
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   221
            case 13: //granularity
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   222
                  {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   223
                 TUint32 val = aReadStream.ReadUint32L();
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   224
                 if( val > 0 )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   225
                    {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   226
                     HBufC8* tempString = HBufC8::NewLC( val );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   227
                     TPtr8 tempValue( tempString->Des() );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   228
                     aReadStream.ReadL( tempValue, val );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   229
                     iNotifyProgress = TMSRPHeaderUtil::ConvertToNumber( tempString->Des() );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   230
                     CleanupStack::PopAndDestroy( tempString );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   231
                     }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   232
                 break;              
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   233
                  }                 
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   234
            default:
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   235
                {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   236
                // nothing to do
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   237
                break;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   238
                }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   239
            }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   240
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   241
        } while( dataType );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   242
    }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   243
// -----------------------------------------------------------------------------
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   244
// CMSRPMessage::ExternalizeL
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   245
// -----------------------------------------------------------------------------
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   246
//
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   247
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   248
EXPORT_C void CMSRPMessage::ExternalizeL( RWriteStream& aWriteStream )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   249
        {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   250
        // first add the MSRP Message identifier
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   251
        aWriteStream.WriteUint8L( 100 ); // MSRP Message identifier
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   252
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   253
        if( iFromPath )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   254
            {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   255
            aWriteStream.WriteUint8L(1); // more headers in the stream flag
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   256
            iFromPath->ExternalizeValueL( aWriteStream );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   257
            }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   258
        if( iToPath )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   259
            {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   260
            aWriteStream.WriteUint8L(2); // more headers in the stream flag
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   261
            iToPath->ExternalizeValueL( aWriteStream );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   262
            }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   263
        if ( iMessageId )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   264
            {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   265
            aWriteStream.WriteUint8L(3); // more headers in the stream flag
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   266
            iMessageId->ExternalizeValueL( aWriteStream );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   267
            }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   268
        if( iByteRange )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   269
            {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   270
            aWriteStream.WriteUint8L(4); // more headers in the stream flag
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   271
            iByteRange->ExternalizeValueL( aWriteStream );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   272
            }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   273
        if( iContentType )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   274
            {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   275
            aWriteStream.WriteUint8L(5); // more headers in the stream flag
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   276
            iContentType->ExternalizeValueL( aWriteStream );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   277
            }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   278
        if( iFailureReport )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   279
            {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   280
            aWriteStream.WriteUint8L(6); // more headers in the stream flag
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   281
            iFailureReport->ExternalizeValueL( aWriteStream );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   282
            }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   283
        if( iSuccessReport )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   284
            {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   285
            aWriteStream.WriteUint8L(7); // more headers in the stream flag
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   286
            iSuccessReport->ExternalizeValueL( aWriteStream );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   287
            }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   288
        if ( IsContent() )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   289
            {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   290
            aWriteStream.WriteUint8L( 10 ); 
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   291
            aWriteStream.WriteInt32L( iContentBuffer->Length()  );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   292
            aWriteStream.WriteL( *iContentBuffer, iContentBuffer->Length() );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   293
            }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   294
        if ( IsFile() )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   295
            {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   296
            aWriteStream.WriteUint8L( 11 ); // 2 = file ID
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   297
            aWriteStream.WriteInt32L( iFileName.Length() );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   298
            aWriteStream.WriteL( iFileName );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   299
            }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   300
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   301
        if( iFileSize > 0 )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   302
            {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   303
            aWriteStream.WriteUint8L( 12 );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   304
            TBuf8< 50 > val;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   305
            val.AppendNum( iFileSize );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   306
            aWriteStream.WriteInt32L( val.Length() );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   307
            aWriteStream.WriteL( val );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   308
             }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   309
        if( iNotifyProgress > 0 )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   310
            {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   311
            aWriteStream.WriteUint8L( 13 );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   312
            TBuf8< 50 > val;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   313
            val.AppendNum( iNotifyProgress );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   314
            aWriteStream.WriteInt32L( val.Length() );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   315
            aWriteStream.WriteL( val );
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   316
             }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   317
        aWriteStream.WriteUint8L(0); // no more headers in the stream flag
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   318
        }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   319
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   320
// -----------------------------------------------------------------------------
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   321
// CMSRPMessage::IsMessage
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   322
// -----------------------------------------------------------------------------
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   323
//
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   324
EXPORT_C TBool CMSRPMessage::IsMessage( const TDesC8& aBuffer )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   325
	{
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   326
	if ( aBuffer.Length() )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   327
		{
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   328
		if ( aBuffer[ 0 ] == 100 )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   329
			{
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   330
			return ETrue;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   331
			}
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   332
		}
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   333
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   334
	return EFalse;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   335
	}
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   336
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   337
EXPORT_C TBool CMSRPMessage::IsFile()
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   338
    {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   339
   if ( iFileName.Length() )
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   340
        {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   341
        return ETrue;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   342
        }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   343
    return EFalse;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   344
      
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   345
}
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   346
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   347
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   348
EXPORT_C void CMSRPMessage::SetNotifyProgress(TBool aNotify)
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   349
      {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   350
      iNotifyProgress = aNotify;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   351
      }
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   352
    
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   353
EXPORT_C TBool CMSRPMessage::GetNotifyProgress()
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   354
      {
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   355
      return iNotifyProgress;
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   356
      } 
505ad3f0ce5c MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff changeset
   357
// End of File