messagingfw/msgsrvnstore/server/src/MCLIENT.CPP
author hgs
Wed, 03 Nov 2010 22:41:46 +0530
changeset 62 db3f5fa34ec7
permissions -rw-r--r--
201044_02
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
62
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
     1
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
     2
// All rights reserved.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
     3
// This component and the accompanying materials are made available
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
     5
// which accompanies this distribution, and is available
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
     7
//
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
     8
// Initial Contributors:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    10
//
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    11
// Contributors:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    12
//
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    13
// Description:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    14
//
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    15
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    16
#include <s32std.h>
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    17
#include <s32mem.h>
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    18
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    19
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    20
#include "MSVIPC.H"
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    21
#include "MSERVER.H"
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    22
#include "MSVREGIP.H"
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    23
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    24
#include "MCLIENT.H"
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    25
#include "MCLENTRY.H"
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    26
#include "MSVPANIC.H"
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    27
#include "MSVAPI.H"
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    28
#include "MsvSecurityCapabilitySet.h"
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    29
#include <mmsvstoremanager.h>
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    30
#include <tmsvsystemprogress.h>
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    31
#include <tnonoperationmtmdata.h>
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    32
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    33
_LIT(KMsvServerExe, "msexe.exe");
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    34
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    35
#if defined _UNICODE
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    36
const TUid KMsvMsexExeUid={0x1000484B};
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    37
#else
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    38
const TUid KMsvMsexExeUid={0x1000484A};
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    39
#endif
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    40
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    41
const TInt KMsvRetryTimeout=100000;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    42
const TInt KMsvRetryCount=10;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    43
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    44
static TInt StartServer()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    45
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    46
	const TUidType serverUid(KNullUid, KNullUid, KMsvMsexExeUid);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    47
	RProcess server;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    48
	TInt r = server.Create(KMsvServerExe, KNullDesC, serverUid);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    49
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    50
	if( r != KErrNone )
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    51
		return r;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    52
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    53
	TRequestStatus status;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    54
	server.Rendezvous(status);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    55
	if( status != KRequestPending )
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    56
		server.Kill(0); // abort start-up
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    57
	else
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    58
		server.Resume();	// wait for server start-up.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    59
	User::WaitForRequest(status);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    60
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    61
	// If the server panics on start-up, then exit reason may still be zero,
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    62
	// which is not distinguishable from KErrNone.		
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    63
	r = (server.ExitType() == EExitPanic ) ? KErrGeneral : status.Int();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    64
	server.Close();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    65
	return r;	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    66
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    67
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    68
//********************************
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    69
//RMsvServerSession
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    70
//**********************************
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    71
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    72
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    73
Constructor.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    74
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    75
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    76
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    77
EXPORT_C RMsvServerSession::RMsvServerSession()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    78
: iBuffer(NULL)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    79
	{}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    80
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    81
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    82
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    83
Destructor.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    84
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    85
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    86
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    87
EXPORT_C RMsvServerSession::~RMsvServerSession()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    88
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    89
	delete iBuffer;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    90
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    91
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    92
#if defined (__EPOC32__)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    93
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    94
Connect to the messaging server, and starts it if is not already running.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    95
 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    96
The default number of message slots is 14.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    97
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    98
@param aFs File server handle
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
    99
@return System wide error codes
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   100
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   101
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   102
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   103
EXPORT_C TInt RMsvServerSession::Connect(RFs& aFs)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   104
#else
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   105
EXPORT_C TInt RMsvServerSession::Connect(RFs& /*aFs*/)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   106
#endif
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   107
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   108
	if (iBuffer==NULL)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   109
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   110
		iBuffer = HBufC8::New(KMsvSessionBufferLength);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   111
		if (iBuffer==NULL)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   112
			return KErrNoMemory;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   113
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   114
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   115
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   116
	TInt retry = KMsvRetryCount;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   117
	FOREVER
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   118
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   119
		TInt r = CreateSession(KMsvServerName, Version(), KMsvNumberOfSlots);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   120
	 	if( r != KErrNotFound && r != KErrServerTerminated && r != KErrServerBusy )
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   121
			return r;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   122
		if( --retry == 0 )
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   123
			return r;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   124
		if( r == KErrServerBusy )
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   125
			User::After(KMsvRetryTimeout);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   126
		r = StartServer();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   127
		if( r != KErrNone && r != KErrAlreadyExists )
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   128
			return r;		
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   129
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   130
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   131
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   132
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   133
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   134
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   135
Gets the version number of the server.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   136
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   137
@return Version number
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   138
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   139
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   140
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   141
EXPORT_C TVersion RMsvServerSession::Version(void) const
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   142
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   143
	return(TVersion(KMsvServerMajorVersionNumber,KMsvServerMinorVersionNumber,KMsvServerBuildVersionNumber));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   144
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   145
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   146
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   147
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   148
Makes a request for session event notifications.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   149
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   150
@param aChange Packaged notification information (a TMsvNotifBuffer object)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   151
@param aSequence notification sequence number (a packaged TUint) 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   152
@param aRequestStatus Asynchronous request status
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   153
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   154
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   155
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   156
EXPORT_C void RMsvServerSession::QueueSessionEventRequest(TDes8& aChange, TDes8& aSequence, TRequestStatus& aRequestStatus)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   157
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   158
	SendReceive(EMsvNotifySessionEvent, TIpcArgs(&aChange,&aSequence), aRequestStatus);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   159
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   160
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   161
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   162
Cancels a request for session event notifications.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   163
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   164
@return System wide error codes
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   165
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   166
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   167
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   168
EXPORT_C TInt RMsvServerSession::CancelSessionEventRequest()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   169
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   170
	return SendReceive(EMsvCancelSessionEventNotification);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   171
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   172
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   173
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   174
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   175
Set a session as an observer only.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   176
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   177
@return System wide error codes
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   178
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   179
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   180
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   181
TInt RMsvServerSession::SetSessionAsObserver()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   182
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   183
	return SendReceive(EMsvSetSessionAsObserver);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   184
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   185
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   186
void RMsvServerSession::SendEntryDataL(TMsvOp aOperationId, const TMsvEntry& aEntry)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   187
//
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   188
// Sends the entry data in a synchronous call
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   189
//
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   190
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   191
	// package up the entry into a packed entry
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   192
	TMsvPackedEntry packedEntry(iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   193
	TInt error = packedEntry.PackEntry(aEntry);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   194
	while(error!=KErrNone)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   195
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   196
		// increase the size of the buffer and try again
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   197
		iBuffer->Des().SetLength(0); // to avoid copying contents
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   198
		iBuffer = iBuffer->ReAllocL(iBuffer->Des().MaxSize() + KMsvSessionBufferLength);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   199
		error = packedEntry.PackEntry(aEntry);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   200
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   201
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   202
	// pass data to the server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   203
	User::LeaveIfError(SendReceive(EMsvOperationData, TIpcArgs(aOperationId,iBuffer)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   204
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   205
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   206
void RMsvServerSession::SendOperationDataL(TMsvOp aOperationId, const CMsvEntrySelection& aSelection, TInt aParameter1, TInt aParameter2)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   207
//
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   208
// Sends the operation data in a synchronous call
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   209
//
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   210
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   211
	PackOperationDataL(aSelection, aParameter1, aParameter2);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   212
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   213
	// package up the entry into a packed entry
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   214
	User::LeaveIfError(SendReceive(EMsvOperationData, TIpcArgs(aOperationId,iBuffer)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   215
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   216
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   217
void RMsvServerSession::PackOperationDataL(const CMsvEntrySelection& aSelection, TInt aParameter1, TInt aParameter2)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   218
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   219
	TMsvPackedOperation packedOperation(iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   220
	TInt error = packedOperation.Pack(aSelection, aParameter1, aParameter2);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   221
	while(error!=KErrNone)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   222
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   223
		// increase the size of the buffer and try again
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   224
		iBuffer->Des().SetLength(0); // to avoid copying contents
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   225
		iBuffer = iBuffer->ReAllocL(iBuffer->Des().MaxSize() + KMsvSessionBufferLength); 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   226
		error = packedOperation.Pack(aSelection, aParameter1, aParameter2);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   227
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   228
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   229
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   230
void RMsvServerSession::SendCommandDataL(TMsvOp aOperationId, const CMsvEntrySelection& aSelection, TInt aCommand, const TDesC8& aParameter)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   231
//
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   232
// Sends the operation data in a synchronous call
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   233
//
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   234
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   235
	TMsvPackedOperation packedOperation(iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   236
	TInt error = packedOperation.Pack(aSelection, aCommand);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   237
	while(error!=KErrNone)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   238
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   239
		// increase the size of the buffer and try again
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   240
		iBuffer->Des().SetLength(0); // to avoid copying contents
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   241
		iBuffer = iBuffer->ReAllocL(iBuffer->Des().MaxSize() + KMsvSessionBufferLength); 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   242
		error = packedOperation.Pack(aSelection, aCommand);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   243
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   244
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   245
	// package up the entry into a packed entry
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   246
	User::LeaveIfError(SendReceive(EMsvCommandData, TIpcArgs(aOperationId,iBuffer,&aParameter)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   247
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   248
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   249
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   250
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   251
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   252
Creates an entry in the message server index (asynchronously) with the supplied owner ID.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   253
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   254
@param aEntry Entry to create
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   255
@param aOperationId Operation identifier
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   256
@param aOwnerId The ID of the owning process
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   257
@param aRequestStatus Asynchronous request status
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   258
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   259
@capability None A client with no capabilities can create an entry only if the entry is    
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   260
under a local service, is in an unprotected folder, is not a service entry, and, if part of 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   261
an existing message, if that message is owned by the client.  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   262
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   263
@capability WriteDeviceData Required if the entry is a service. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   264
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   265
@capability ReadUserData Required in some circumstances: see the note below.   
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   266
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   267
@capability WriteUserData Required in some circumstances: see the note below.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   268
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   269
@capability Note The capabilities required to create an entry that is not a service vary depending on the 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   270
following conditions:  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   271
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   272
-# Entry to be created is part of an existing message: 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   273
	-# Entry is under the local service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   274
		-# Entry is in the Outbox and the Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   275
		-# Entry is in the Outbox and the Outbox is unprotected: MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   276
		-# Entry is in a protected folder: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   277
		-# Entry is in an unprotected folder and the existing entry is not owned by the client: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   278
		-# Entry is in an unprotected folder and the existing entry is owned by the client: no capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   279
	-# Entry is under a remote service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   280
		-# The Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   281
		-# The Outbox is unprotected and the existing entry is owned by the client: MTM-specified capabilities (of the MTM for the remote service) 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   282
		-# The Outbox is unprotected and the existing entry is not owned by the client: ReadUserData + WriteUserData + 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   283
		MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   284
-# Entry to be created is not part of an existing message: 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   285
	-# Entry is under the local service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   286
		-# Entry is in the Outbox and the Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   287
		-# Entry is in the Outbox and the Outbox is unprotected: MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   288
		-# Entry is in a protected folder: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   289
		-# Entry is in an unprotected folder: no capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   290
	-# Entry is under a remote service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   291
		-# The Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   292
		-# The Outbox is unprotected: MTM-specified capabilities (of the MTM for the remote service) 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   293
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   294
@internalComponent
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   295
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   296
EXPORT_C void RMsvServerSession::CreateEntryL(const TMsvEntry& aEntry, TMsvOp aOperationId, TSecureId aOwnerId, TRequestStatus& aRequestStatus)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   297
//
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   298
// Creates an entry in the index for aEntry.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   299
//
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   300
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   301
	TestSlotAvailableL();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   302
	SendEntryDataL(aOperationId, aEntry);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   303
	aRequestStatus=KRequestPending;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   304
	SendReceive(EMsvCreateEntry, TIpcArgs(aOperationId, aOwnerId), aRequestStatus);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   305
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   306
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   307
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   308
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   309
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   310
Creates an entry in the message server index (synchronously).
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   311
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   312
@param aEntry Entry to create
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   313
@param aOperationId Operation identifier
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   314
@param aOwnerId The ID of the owning process
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   315
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   316
@capability None A client with no capabilities can create an entry only if the entry is    
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   317
under a local service, is in an unprotected folder, is not a service entry, and, if part of 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   318
an existing message, if that message is owned by the client.  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   319
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   320
@capability WriteDeviceData Required if the entry is a service. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   321
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   322
@capability ReadUserData Required in some circumstances: see the note below.   
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   323
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   324
@capability WriteUserData Required in some circumstances: see the note below.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   325
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   326
@capability Note The capabilities required to create an entry that is not a service vary depending on the 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   327
following conditions:  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   328
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   329
-# Entry to be created is part of an existing message: 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   330
	-# Entry is under the local service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   331
		-# Entry is in the Outbox and the Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   332
		-# Entry is in the Outbox and the Outbox is unprotected: MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   333
		-# Entry is in a protected folder: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   334
		-# Entry is in an unprotected folder and the existing entry is not owned by the client: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   335
		-# Entry is in an unprotected folder and the existing entry is owned by the client: no capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   336
	-# Entry is under a remote service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   337
		-# The Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   338
		-# The Outbox is unprotected and the existing entry is owned by the client: MTM-specified capabilities (of the MTM for the remote service) 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   339
		-# The Outbox is unprotected and the existing entry is not owned by the client: ReadUserData + WriteUserData + 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   340
		MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   341
-# Entry to be created is not part of an existing message: 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   342
	-# Entry is under the local service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   343
		-# Entry is in the Outbox and the Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   344
		-# Entry is in the Outbox and the Outbox is unprotected: MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   345
		-# Entry is in a protected folder: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   346
		-# Entry is in an unprotected folder: no capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   347
	-# Entry is under a remote service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   348
		-# The Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   349
		-# The Outbox is unprotected: MTM-specified capabilities (of the MTM for the remote service) 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   350
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   351
@internalComponent
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   352
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   353
EXPORT_C void RMsvServerSession::CreateEntryL(const TMsvEntry& aEntry, TMsvOp aOperationId, TSecureId aOwnerId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   354
//
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   355
// Creates an entry in the index for aEntry.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   356
//
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   357
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   358
	TestSlotAvailableL();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   359
	SendEntryDataL(aOperationId, aEntry);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   360
	User::LeaveIfError(SendReceive(EMsvCreateEntry,TIpcArgs(aOperationId, aOwnerId)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   361
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   362
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   363
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   364
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   365
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   366
Changes the contents of a message server entry (asynchronously).
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   367
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   368
@param aEntry Entry to change
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   369
@param aOperationId Operation identifier
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   370
@param aOwnerId The ID of the owning process
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   371
@param aRequestStatus Asynchronous request status
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   372
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   373
@capability None A client with no capabilities can access an entry only if the entry is    
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   374
under a local service, is owned by the client, is in an unprotected folder,  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   375
and is not a service entry. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   376
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   377
@capability WriteDeviceData Required if the entry is a service. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   378
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   379
@capability ReadUserData Required in some circumstances: see the note below.   
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   380
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   381
@capability WriteUserData Required in some circumstances: see the note below.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   382
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   383
@capability Note The capabilities required to access an entry that is not a service vary depending on the 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   384
following conditions:  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   385
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   386
- Entry is under the local service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   387
	-# Entry is in the Outbox and the Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   388
	-# Entry is in the Outbox and the Outbox is unprotected: MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   389
	-# Entry is in a protected folder: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   390
	-# Entry is in an unprotected folder and the entry is not owned by the client: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   391
	-# Entry is in an unprotected folder and the entry is owned by the client: no capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   392
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   393
- Entry is under a remote service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   394
	-# The Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   395
	-# The Outbox is unprotected and the entry is owned by the client: MTM-specified capabilities (of the MTM for the remote service) 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   396
	-# The Outbox is unprotected and the entry is not owned by the client: ReadUserData + WriteUserData + 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   397
	MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   398
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   399
@internalComponent
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   400
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   401
EXPORT_C void RMsvServerSession::ChangeEntryL(const TMsvEntry& aEntry, TMsvOp aOperationId, TSecureId aOwnerId, TRequestStatus& aRequestStatus)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   402
//
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   403
// Changes the content of an entry
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   404
//
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   405
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   406
	TestSlotAvailableL();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   407
	SendEntryDataL(aOperationId, aEntry);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   408
	aRequestStatus=KRequestPending;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   409
	SendReceive(EMsvChangeEntry, TIpcArgs(aOperationId, aOwnerId), aRequestStatus);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   410
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   411
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   412
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   413
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   414
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   415
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   416
Changes the contents of a message server entry (synchronously).
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   417
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   418
@param aEntry Entry to create
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   419
@param aOwnerId The ID of the owning process
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   420
@param aOperationId Operation identifier
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   421
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   422
@capability None A client with no capabilities can access an entry only if the entry is    
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   423
under a local service, is owned by the client, is in an unprotected folder,  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   424
and is not a service entry. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   425
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   426
@capability WriteDeviceData Required if the entry is a service. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   427
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   428
@capability ReadUserData Required in some circumstances: see the note below.   
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   429
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   430
@capability WriteUserData Required in some circumstances: see the note below.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   431
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   432
@capability Note The capabilities required to access an entry that is not a service vary depending on the 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   433
following conditions:  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   434
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   435
- Entry is under the local service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   436
	-# Entry is in the Outbox and the Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   437
	-# Entry is in the Outbox and the Outbox is unprotected: MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   438
	-# Entry is in a protected folder: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   439
	-# Entry is in an unprotected folder and the entry is not owned by the client: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   440
	-# Entry is in an unprotected folder and the entry is owned by the client: no capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   441
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   442
- Entry is under a remote service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   443
	-# The Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   444
	-# The Outbox is unprotected and the entry is owned by the client: MTM-specified capabilities (of the MTM for the remote service) 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   445
	-# The Outbox is unprotected and the entry is not owned by the client: ReadUserData + WriteUserData + 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   446
	MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   447
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   448
@internalComponent
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   449
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   450
EXPORT_C void RMsvServerSession::ChangeEntryL(const TMsvEntry& aEntry, TMsvOp aOperationId, TSecureId aOwnerId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   451
//
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   452
// Changes the content of an entry
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   453
//
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   454
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   455
	TestSlotAvailableL();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   456
	SendEntryDataL(aOperationId, aEntry);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   457
	User::LeaveIfError(SendReceive(EMsvChangeEntry, TIpcArgs(aOperationId, aOwnerId)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   458
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   459
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   460
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   461
Update the specified Changes to selection of TMsvId (asynchronously).
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   462
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   463
@param aSelection The IDs of the entry to Change. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   464
@param aMark The read/Unread value.  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   465
@param aOperationId Operation identifier
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   466
@param aOwnerId The ID of the owning process
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   467
@param aRequestStatus Asynchronous request status
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   468
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   469
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   470
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   471
void RMsvServerSession::ChangeEntriesL(const CMsvEntrySelection& aSelection, TBool aMark ,TMsvOp aOperationId, TSecureId aOwnerId, TRequestStatus& aRequestStatus)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   472
    {
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   473
     TestSlotAvailableL();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   474
     TInt markvalue = (TInt)aMark;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   475
     SendOperationDataL(aOperationId, aSelection, markvalue);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   476
     aRequestStatus=KRequestPending;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   477
     SendReceive(EMsvChangeEntries, TIpcArgs(aOperationId, aOwnerId), aRequestStatus);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   478
    }
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   479
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   480
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   481
Gets the index entry with the specified unique id.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   482
@param aId ID of the entry to get
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   483
@param aService On return, the ID of the service to which the entry belongs
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   484
@param aEntry On return, the index entry with the specified ID
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   485
@return System wide error code
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   486
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   487
@capability None A client with no capabilities can access an entry only if owns that entry. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   488
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   489
@capability ReadUserData This is required to access any entry where the condition 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   490
described for no capabilities does not apply.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   491
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   492
EXPORT_C TInt RMsvServerSession::GetEntry(TMsvId aId, TMsvId& aService, TMsvEntry& aEntry)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   493
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   494
    // pass the buffer and its max length to receive the data through
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   495
    TPtr8 ptr=iBuffer->Des();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   496
    TInt maxLength = iBuffer->Des().MaxLength();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   497
    
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   498
	// signal the server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   499
    TInt error = SendReceive(EMsvGetEntry,TIpcArgs(aId, &ptr, maxLength));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   500
    while(error == KErrOverflow)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   501
        {
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   502
        // increase the size of the buffer and try again
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   503
        iBuffer->Des().SetLength(0);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   504
        // TRAP here and return if leaving with error
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   505
        TRAP(error, iBuffer = iBuffer->ReAllocL(iBuffer->Des().MaxSize() + KMsvSessionBufferLength));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   506
        if( error != KErrNone)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   507
			{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   508
            break;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   509
			}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   510
        // pass the buffer to receive the data through
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   511
        TPtr8 ptr=iBuffer->Des();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   512
        maxLength = iBuffer->Des().MaxLength();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   513
        error = SendReceive(EMsvGetEntry,TIpcArgs(aId,&ptr,maxLength));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   514
        }
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   515
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   516
    if( error == KErrNone)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   517
        {
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   518
        TMsvPackedEntry packedEntry(iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   519
        // Unpack the entry and servie id from same buffer
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   520
        packedEntry.UnpackEntryAndService(aEntry, aService);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   521
        }
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   522
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   523
    return error;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   524
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   525
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   526
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   527
Gets the children of the index entry with the specified unique id.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   528
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   529
@param aId ID of the entry to get
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   530
@param aEntries On return, the entry's children. If an error is returned, aEntries is unchanged.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   531
@param aOrdering Sorting and grouping rules for the returned entries
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   532
@return System wide error code
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   533
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   534
@capability None Only children that the client owns are returned. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   535
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   536
@capability ReadUserData All children of the entry are returned
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   537
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   538
EXPORT_C TInt RMsvServerSession::GetChildren(TMsvId aId, CArrayPtrFlat<CMsvClientEntry>& aEntries, const TMsvSelectionOrdering& aOrdering)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   539
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   540
	TInt origCount=aEntries.Count();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   541
	TRAPD(leave, DoGetChildrenL(aId, aEntries, aOrdering));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   542
	if (leave!=KErrNone)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   543
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   544
		TInt count=aEntries.Count();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   545
		while (count>origCount)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   546
			{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   547
			delete aEntries.At(--count);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   548
			aEntries.Delete(count);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   549
			}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   550
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   551
	return leave;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   552
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   553
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   554
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   555
void RMsvServerSession::DoGetChildrenL(TMsvId aId, CArrayPtrFlat<CMsvClientEntry>& aEntries, const TMsvSelectionOrdering& aOrdering)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   556
//
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   557
// Gets the children of the index entry with the Unique id aId.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   558
//
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   559
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   560
	// package up the Id into a children details class
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   561
	TPckgBuf<TMsvChildrenDetails> details;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   562
	details().iParentId = aId;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   563
	// pass the sort order
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   564
	TPckgC<TMsvSelectionOrdering> package2(aOrdering);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   565
	// pass the buffer to receive the data through
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   566
	TPtr8 ptr=iBuffer->Des();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   567
	// signal the server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   568
	TInt error = SendReceive(EMsvGetChildren, TIpcArgs(&details,&package2,&ptr));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   569
		
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   570
	if (error!=KErrNone && error!=KErrOverflow)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   571
		User::Leave(error);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   572
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   573
	// unpack the entries from the buffer
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   574
	TMsvPackedEntryArray packedEntryArray(iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   575
	for (TInt count=0; count<details().iNumberChildrenInArray; count++)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   576
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   577
		TMsvEntry entry;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   578
		User::LeaveIfError(packedEntryArray.UnpackEntry(count, entry));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   579
		CMsvClientEntry* cEntry = CMsvClientEntry::NewLC(entry, EMsvClientChild);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   580
		aEntries.AppendL(cEntry);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   581
		CleanupStack::Pop(); // cEntry
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   582
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   583
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   584
	// if there are more entries - get them
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   585
	if (error==KErrOverflow)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   586
		DoGetRemainingChildrenL(details, aEntries);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   587
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   588
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   589
void RMsvServerSession::DoGetRemainingChildrenL(TPckgBuf<TMsvChildrenDetails>& aDetails, CArrayPtrFlat<CMsvClientEntry>& aEntries)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   590
//
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   591
// Gets the remaining children 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   592
//
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   593
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   594
	TInt error=KErrOverflow;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   595
	while (error==KErrOverflow)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   596
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   597
		// package up the Id into a children details class & pass the buffer to receive the data through
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   598
		TPtr8 ptr=iBuffer->Des();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   599
		// get some more entries
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   600
		error = SendReceive(EMsvGetRemainingChildren,TIpcArgs(&aDetails,NULL,&ptr));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   601
		if (error!=KErrNone && error!=KErrOverflow)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   602
			User::Leave(error);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   603
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   604
		if (aDetails().iNumberChildrenInArray == 0)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   605
			{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   606
			if (error == KErrOverflow)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   607
				{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   608
				// The buffer isn't big enough for the current entry
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   609
				// we must resize the buffer or we're in an infinite loop
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   610
				iBuffer->Des().SetLength(0);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   611
				iBuffer = iBuffer->ReAllocL(iBuffer->Des().MaxSize() + KMsvSessionBufferLength);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   612
				}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   613
			}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   614
		else
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   615
			{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   616
			// unpack the entries from the buffer
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   617
			TMsvPackedEntryArray packedEntryArray(iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   618
			for (TInt count=0; count<aDetails().iNumberChildrenInArray; count++)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   619
				{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   620
				TMsvEntry entry;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   621
				User::LeaveIfError(packedEntryArray.UnpackEntry(count, entry));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   622
				CMsvClientEntry* cEntry = CMsvClientEntry::NewLC(entry, EMsvClientChild);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   623
				aEntries.AppendL(cEntry);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   624
				CleanupStack::Pop(); // cEntry
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   625
				}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   626
			}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   627
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   628
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   629
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   630
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   631
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   632
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   633
Delete the specified message server entries (asynchronously).
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   634
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   635
@param aSelection Entries to delete
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   636
@param aOperationId Operation identifier
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   637
@param aRequestStatus Asynchronous request status
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   638
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   639
@capability None A client with no capabilities can access an entry only if the entry is    
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   640
under a local service, is owned by the client, is in an unprotected folder,  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   641
and is not a service entry. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   642
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   643
@capability WriteDeviceData Required if the entry is a service. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   644
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   645
@capability ReadUserData Required in some circumstances: see the note below.   
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   646
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   647
@capability WriteUserData Required in some circumstances: see the note below.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   648
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   649
@capability Note The capabilities required to access an entry that is not a service vary depending on the 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   650
following conditions:  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   651
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   652
- Entry is under the local service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   653
	-# Entry is in the Outbox and the Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   654
	-# Entry is in the Outbox and the Outbox is unprotected: MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   655
	-# Entry is in a protected folder: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   656
	-# Entry is in an unprotected folder and the entry is not owned by the client: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   657
	-# Entry is in an unprotected folder and the entry is owned by the client: no capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   658
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   659
- Entry is under a remote service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   660
	-# The Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   661
	-# The Outbox is unprotected and the entry is owned by the client: MTM-specified capabilities (of the MTM for the remote service) 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   662
	-# The Outbox is unprotected and the entry is not owned by the client: ReadUserData + WriteUserData + 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   663
	MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   664
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   665
EXPORT_C void RMsvServerSession::DeleteEntriesL(const CMsvEntrySelection& aSelection, TMsvOp aOperationId, TRequestStatus& aRequestStatus)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   666
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   667
	TestSlotAvailableL();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   668
	// send the data to the server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   669
	SendOperationDataL(aOperationId, aSelection);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   670
	// start the operation
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   671
	aRequestStatus=KRequestPending;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   672
	SendReceive(EMsvDeleteEntries, TIpcArgs(aOperationId), aRequestStatus);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   673
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   674
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   675
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   676
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   677
Delete the specified message server entries (synchronously).
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   678
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   679
@param aSelection Entries to delete
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   680
@param aOperationId Operation identifier
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   681
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   682
@capability None A client with no capabilities can access an entry only if the entry is    
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   683
under a local service, is owned by the client, is in an unprotected folder,  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   684
and is not a service entry. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   685
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   686
@capability WriteDeviceData Required if the entry is a service. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   687
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   688
@capability ReadUserData Required in some circumstances: see the note below.   
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   689
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   690
@capability WriteUserData Required in some circumstances: see the note below.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   691
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   692
@capability Note The capabilities required to access an entry that is not a service vary depending on the 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   693
following conditions:  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   694
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   695
- Entry is under the local service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   696
	-# Entry is in the Outbox and the Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   697
	-# Entry is in the Outbox and the Outbox is unprotected: MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   698
	-# Entry is in a protected folder: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   699
	-# Entry is in an unprotected folder and the entry is not owned by the client: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   700
	-# Entry is in an unprotected folder and the entry is owned by the client: no capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   701
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   702
- Entry is under a remote service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   703
	-# The Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   704
	-# The Outbox is unprotected and the entry is owned by the client: MTM-specified capabilities (of the MTM for the remote service) 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   705
	-# The Outbox is unprotected and the entry is not owned by the client: ReadUserData + WriteUserData + 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   706
	MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   707
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   708
EXPORT_C void RMsvServerSession::DeleteEntriesL(const CMsvEntrySelection& aSelection, TMsvOp aOperationId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   709
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   710
	TestSlotAvailableL();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   711
	// send the data to the server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   712
	SendOperationDataL(aOperationId, aSelection);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   713
	User::LeaveIfError(SendReceive(EMsvDeleteEntries, TIpcArgs(aOperationId)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   714
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   715
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   716
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   717
Locks a message server entry.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   718
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   719
This prevents it from being accessed by other clients. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   720
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   721
This function is intended only for test purposes.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   722
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   723
@param aId ID of the entry to lock
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   724
@return System wide error code
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   725
@see RMsvServerSession::ReleaseEntry
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   726
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   727
@capability Note When the __REMOVE_MESSAGING_API_V1__ macro is defined, the
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   728
function is policed against the capabilities of the message server (Read/Write Device Data, 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   729
Protected Server, Network Control, Network Services, Local Services and Read 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   730
User Data). When the macro is not defined, the function is not policed. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   731
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   732
EXPORT_C TInt RMsvServerSession::LockEntry(TMsvId aId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   733
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   734
	return SendReceive(EMsvLockEntry, TIpcArgs(aId));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   735
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   736
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   737
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   738
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   739
Releases the lock on an entry.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   740
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   741
This function is intended only for test purposes.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   742
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   743
@param aId ID of the locked entry to release
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   744
@return System wide error code
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   745
@see RMsvServerSession::LockEntry
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   746
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   747
@capability Note When the __REMOVE_MESSAGING_API_V1__ macro is defined, the
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   748
function is policed against the capabilities of the message server (Read/Write Device Data, 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   749
Protected Server, Network Control, Network Services, Local Services and Read 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   750
User Data). When the macro is not defined, the function is not policed. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   751
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   752
EXPORT_C TInt RMsvServerSession::ReleaseEntry(TMsvId aId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   753
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   754
	return SendReceive(EMsvReleaseEntry, TIpcArgs(aId));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   755
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   756
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   757
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   758
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   759
Tests if a client can read from a specified message store.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   760
A locked store cannot be read from.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   761
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   762
@param aId ID of the entry that owns the store
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   763
@return KErrNone if the store can be read from; another system wide error code if not.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   764
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   765
@capability None A client with no capabilities can access an entry only if owns that entry. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   766
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   767
@capability ReadUserData This is required to access any entry where the condition 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   768
described for no capabilities does not apply.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   769
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   770
EXPORT_C TInt RMsvServerSession::ReadStore(TMsvId aId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   771
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   772
	// package an TInt to get the id back
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   773
	return SendReceive(EMsvReadStore, TIpcArgs(aId));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   774
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   775
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   776
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   777
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   778
Locks a store for writing.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   779
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   780
@param aId ID of the entry that owns the store
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   781
@return System wide error code
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   782
@see RMsvServerSession::ReleaseStore
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   783
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   784
@capability None A client with no capabilities can access an entry only if the entry is    
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   785
under a local service, is owned by the client, is in an unprotected folder,  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   786
and is not a service entry. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   787
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   788
@capability WriteDeviceData Required if the entry is a service. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   789
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   790
@capability ReadUserData Required in some circumstances: see the note below.   
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   791
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   792
@capability WriteUserData Required in some circumstances: see the note below.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   793
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   794
@capability Note The capabilities required to access an entry that is not a service vary depending on the 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   795
following conditions:  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   796
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   797
- Entry is under the local service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   798
	-# Entry is in the Outbox and the Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   799
	-# Entry is in the Outbox and the Outbox is unprotected: MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   800
	-# Entry is in a protected folder: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   801
	-# Entry is in an unprotected folder and the entry is not owned by the client: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   802
	-# Entry is in an unprotected folder and the entry is owned by the client: no capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   803
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   804
- Entry is under a remote service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   805
	-# The Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   806
	-# The Outbox is unprotected and the entry is owned by the client: MTM-specified capabilities (of the MTM for the remote service) 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   807
	-# The Outbox is unprotected and the entry is not owned by the client: ReadUserData + WriteUserData + 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   808
	MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   809
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   810
EXPORT_C TInt RMsvServerSession::LockStore(TMsvId aId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   811
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   812
	// package an TInt to get the id back
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   813
	return SendReceive(EMsvLockStore, TIpcArgs(aId));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   814
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   815
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   816
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   817
Releases the lock on a store.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   818
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   819
@param aId ID of the entry that owns the store
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   820
@return System wide error code
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   821
@see RMsvServerSession::LockStore
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   822
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   823
@capability None A client with no capabilities can access an entry only if the entry is    
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   824
under a local service, is owned by the client, is in an unprotected folder,  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   825
and is not a service entry. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   826
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   827
@capability WriteDeviceData Required if the entry is a service. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   828
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   829
@capability ReadUserData Required in some circumstances: see the note below.   
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   830
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   831
@capability WriteUserData Required in some circumstances: see the note below.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   832
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   833
@capability Note The capabilities required to access an entry that is not a service vary depending on the 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   834
following conditions:  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   835
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   836
- Entry is under the local service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   837
	-# Entry is in the Outbox and the Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   838
	-# Entry is in the Outbox and the Outbox is unprotected: MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   839
	-# Entry is in a protected folder: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   840
	-# Entry is in an unprotected folder and the entry is not owned by the client: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   841
	-# Entry is in an unprotected folder and the entry is owned by the client: no capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   842
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   843
- Entry is under a remote service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   844
	-# The Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   845
	-# The Outbox is unprotected and the entry is owned by the client: MTM-specified capabilities (of the MTM for the remote service) 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   846
	-# The Outbox is unprotected and the entry is not owned by the client: ReadUserData + WriteUserData + 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   847
	MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   848
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   849
EXPORT_C TInt RMsvServerSession::ReleaseStore(TMsvId aId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   850
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   851
	return SendReceive(EMsvReleaseStore, TIpcArgs(aId));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   852
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   853
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   854
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   855
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   856
Decrements the number of readers on a store.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   857
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   858
@param aId ID of the entry that owns the store
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   859
@return System wide error code
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   860
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   861
@capability None A client with no capabilities can access an entry only if owns that entry. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   862
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   863
@capability ReadUserData This is required to access any entry where the condition 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   864
described for no capabilities does not apply.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   865
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   866
TInt RMsvServerSession::DecStoreReaderCount(TMsvId aId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   867
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   868
	return SendReceive(EMsvDecStoreReaderCount,TIpcArgs(aId));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   869
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   870
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   871
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   872
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   873
Closes the message server.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   874
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   875
The function results in the session sending a shutdown session notification 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   876
(TMsvSessionEvent::EMsvCloseSession) to all current sessions. The Message 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   877
Server closes when all sessions have been closed.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   878
 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   879
@capability WriteDeviceData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   880
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   881
EXPORT_C void RMsvServerSession::CloseMessageServer()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   882
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   883
	SendReceive(EMsvCloseServer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   884
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   885
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   886
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   887
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   888
Gets registry information for the MTMs for a specified MTM DLL type (client, server, UI, UI data).  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   889
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   890
@param aMtmDllTypeUid UID of the MTM DLL type
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   891
@param aRegisteredMtmDllArray On return, an array of registry information for the MTMs of the specified type.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   892
@param aTimeoutMicroSeconds32 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   893
@return System wide error code
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   894
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   895
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   896
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   897
EXPORT_C TInt RMsvServerSession::FillRegisteredMtmDllArray(TUid aMtmDllTypeUid,CRegisteredMtmDllArray& aRegisteredMtmDllArray,TTimeIntervalMicroSeconds32 aTimeoutMicroSeconds32)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   898
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   899
	// pass the buffer to receive the data through
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   900
	TPtr8 ptr=iBuffer->Des();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   901
	// signal the server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   902
	TInt error = SendReceive(EMsvFillRegisteredMtmDllArray,TIpcArgs(aMtmDllTypeUid.iUid, &ptr));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   903
	if (error==KErrNone)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   904
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   905
		RDesReadStream readStream(*iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   906
		TRAP(error, TMsvPackedRegisteredMtmDllArray::UnpackRegisteredMtmDllArrayL(readStream, aRegisteredMtmDllArray, aTimeoutMicroSeconds32, *this));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   907
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   908
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   909
	return error;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   910
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   911
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   912
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   913
Installs a new MTM group.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   914
 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   915
@param aFullName The full path name of the MTM group file
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   916
@return System wide error code
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   917
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   918
@capability WriteDeviceData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   919
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   920
EXPORT_C TInt RMsvServerSession::InstallMtmGroup(const TDesC& aFullName)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   921
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   922
	return SendReceive(EMsvInstallMtmGroup,TIpcArgs(&aFullName));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   923
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   924
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   925
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   926
Uninstalls an MTM group.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   927
 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   928
@param aFullName The full path name of the MTM group file
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   929
@return System wide error code
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   930
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   931
@capability WriteDeviceData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   932
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   933
EXPORT_C TInt RMsvServerSession::DeInstallMtmGroup(const TDesC& aFullName)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   934
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   935
	return SendReceive(EMsvDeInstallMtmGroup,TIpcArgs(&aFullName));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   936
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   937
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   938
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   939
Increments the usage reference count for a specified MTM group. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   940
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   941
@param aMtmTypeUid MTM group UID
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   942
@return System wide error code
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   943
@see RMsvServerSession::ReleaseMtmGroup
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   944
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   945
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   946
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   947
EXPORT_C TInt RMsvServerSession::UseMtmGroup(TUid aMtmTypeUid)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   948
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   949
	// package up the Id of the entry required
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   950
	return SendReceive(EMsvUseMtmGroup,TIpcArgs(aMtmTypeUid.iUid));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   951
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   952
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   953
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   954
Decrements the usage reference count for a specified MTM group.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   955
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   956
@param aMtmTypeUid MTM group UID
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   957
@return System wide error code
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   958
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   959
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   960
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   961
EXPORT_C TInt RMsvServerSession::ReleaseMtmGroup(TUid aMtmTypeUid)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   962
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   963
	// package up the Id of the entry required
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   964
	return SendReceive(EMsvReleaseMtmGroup,TIpcArgs(aMtmTypeUid.iUid));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   965
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   966
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   967
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   968
Gets the registration data for an MTM group.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   969
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   970
@param aMtmTypeUid MTM group UID
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   971
@return Registration data for the specified MTM group
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   972
@leave System wide error code
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   973
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   974
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   975
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   976
EXPORT_C CMtmGroupData* RMsvServerSession::GetMtmGroupDataL(TUid aMtmTypeUid)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   977
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   978
	TPtr8 ptr=iBuffer->Des();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   979
	// package up the Id of the entry required and pass the buffer to receive the data through
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   980
	User::LeaveIfError(SendReceive(EMsvGetMtmGroupData,TIpcArgs(aMtmTypeUid.iUid,&ptr)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   981
	RDesReadStream readStream(*iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   982
	return CMtmGroupData::NewL(readStream);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   983
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   984
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   985
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   986
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   987
Gets capabilities required to use the specified MTM.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   988
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   989
@param aMtmTypeUid MTM UID
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   990
@param aCapSet On return, capabilities required to use the specified MTM.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   991
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   992
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   993
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   994
void RMsvServerSession::GetMtmRequiredCapabilitiesL(TUid aMtmTypeUid, TCapabilitySet& aCapSet) const
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   995
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   996
	TPtr8 ptr=iBuffer->Des();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   997
	User::LeaveIfError(SendReceive(EMsvGetMtmRequiredCapabilities, TIpcArgs(aMtmTypeUid.iUid, &ptr)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   998
	RDesReadStream readStream(*iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
   999
	MsvSecurityCapabilitySetUtils::InternalizeL(readStream,aCapSet);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1000
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1001
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1002
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1003
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1004
Cancels a specified operation.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1005
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1006
@param aId Operation identifier
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1007
@param aProgress On return, progress information for the operation
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1008
@return System wide error code
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1009
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1010
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1011
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1012
EXPORT_C TInt RMsvServerSession::CancelOperation(TMsvOp aId, TDes8& aProgress)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1013
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1014
	TInt ret = SendReceive(EMsvCancelOperation, TIpcArgs(aId,&aProgress));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1015
	if (ret>0)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1016
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1017
		aProgress.SetLength(ret);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1018
		ret=KErrNone;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1019
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1020
	else
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1021
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1022
		aProgress.SetLength(0);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1023
		if (ret==KErrNotReady)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1024
			ret=KErrNone;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1025
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1026
	return ret;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1027
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1028
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1029
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1030
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1031
Gets progress information for an operation.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1032
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1033
@param aId Operation identifier
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1034
@param aProgress On return, progress information for the operation
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1035
@return System wide error code
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1036
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1037
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1038
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1039
EXPORT_C TInt RMsvServerSession::OperationProgress(TMsvOp aId, TDes8& aProgress)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1040
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1041
	TInt ret = SendReceive(EMsvOperationProgress, TIpcArgs(aId,&aProgress));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1042
	if (ret>0)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1043
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1044
		aProgress.SetLength(ret);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1045
		ret=KErrNone;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1046
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1047
	else
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1048
		aProgress.SetLength(0);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1049
	return ret;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1050
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1051
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1052
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1053
Obtains the progress information that is defined by and understood by the system as well as client MTM's
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1054
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1055
@param aId Operation identifier
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1056
@param aProgress On return, progress information for the operation
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1057
@return System wide error code
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1058
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1059
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1060
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1061
EXPORT_C TInt RMsvServerSession::OperationSystemProgress(TMsvOp aId, TMsvSystemProgress& aProgress)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1062
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1063
	TPckg<TMsvSystemProgress> sysProgressPkg(aProgress);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1064
	return SendReceive(EMsvOperationSystemProgress, TIpcArgs(aId,&sysProgressPkg));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1065
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1066
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1067
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1068
Obtains the final progress information for an operation.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1069
The associated server side objects are then deleted.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1070
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1071
@param aId Operation identifier
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1072
@param aProgress On return, progress information for the operation
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1073
@return System wide error code
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1074
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1075
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1076
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1077
EXPORT_C TInt RMsvServerSession::OperationCompletion(TMsvOp aId, TDes8& aProgress)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1078
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1079
	TInt ret = SendReceive(EMsvOperationCompletion, TIpcArgs(aId,&aProgress));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1080
	if (ret>0)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1081
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1082
		aProgress.SetLength(ret);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1083
		ret=KErrNone;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1084
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1085
	else
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1086
		aProgress.SetLength(0);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1087
	return ret;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1088
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1089
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1090
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1091
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1092
Moves the specified message server entries (asynchronously).
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1093
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1094
@param aSelection The IDs of the entry to move. On return, contains the children that could not be fully moved. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1095
@param aTarget The ID of the new parent 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1096
@param aOperationId Operation identifier
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1097
@param aRequestStatus Asynchronous request status
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1098
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1099
@capability None A client with no capabilities can move an entry only if both source and target entries
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1100
are under a local service, are owned by the client, and are in an unprotected folder.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1101
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1102
@capability ReadUserData Required in some circumstances: see the note below.   
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1103
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1104
@capability WriteUserData Required in some circumstances: see the note below.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1105
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1106
@capability Note The function tests that the caller has capabilities to modify the 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1107
the source entry (see RMsvServerSession::ChangeEntryL) and to create under the target
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1108
entry (see RMsvServerSession::CreateEntryL).
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1109
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1110
EXPORT_C void RMsvServerSession::MoveEntriesL(const CMsvEntrySelection& aSelection, TMsvId aTarget, TMsvOp aOperationId, TRequestStatus& aRequestStatus)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1111
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1112
	TestSlotAvailableL();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1113
	// send the data to the server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1114
	SendOperationDataL(aOperationId, aSelection, aTarget);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1115
	// start the operation
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1116
	aRequestStatus=KRequestPending;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1117
	SendReceive(EMsvMoveEntries, TIpcArgs(aOperationId), aRequestStatus);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1118
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1119
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1120
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1121
Moves the specified message server entries (synchronously).
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1122
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1123
@param aSelection The IDs of the entry to move. On return, contains the children that could not be fully moved. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1124
@param aTarget The ID of the new parent entry
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1125
@param aOperationId Operation identifier
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1126
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1127
@capability None A client with no capabilities can move an entry only if both source and target entries
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1128
are under a local service, are owned by the client, and are in an unprotected folder.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1129
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1130
@capability ReadUserData Required in some circumstances: see the note below.   
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1131
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1132
@capability WriteUserData Required in some circumstances: see the note below.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1133
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1134
@capability Note The function tests that the caller has capabilities to modify the 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1135
the source entry (see RMsvServerSession::ChangeEntryL) and to create under the target
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1136
entry (see RMsvServerSession::CreateEntryL).
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1137
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1138
EXPORT_C void RMsvServerSession::MoveEntriesL(const CMsvEntrySelection& aSelection, TMsvId aTarget, TMsvOp aOperationId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1139
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1140
	TestSlotAvailableL();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1141
	// send the data to the server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1142
	SendOperationDataL(aOperationId, aSelection, aTarget);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1143
	// start the operation
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1144
	User::LeaveIfError(SendReceive(EMsvMoveEntries, TIpcArgs(aOperationId)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1145
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1146
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1147
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1148
Copies the specified message server entries (synchronously).
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1149
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1150
@param aSelection The IDs of the source entries to copy. On return, contains the children that could not be fully copied. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1151
@param aTarget The ID of the destination parent entry
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1152
@param aOperationId Operation identifier
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1153
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1154
@capability None A client with no capabilities can copy an entry only if both source and target entries
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1155
are under a local service, are owned by the client, and are in an unprotected folder.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1156
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1157
@capability ReadUserData Required in some circumstances: see the note below.   
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1158
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1159
@capability WriteUserData Required in some circumstances: see the note below.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1160
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1161
@capability Note The function tests that the caller has capabilities to create under the 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1162
target entry (see RMsvServerSession::CreateEntryL).
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1163
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1164
EXPORT_C void RMsvServerSession::CopyEntriesL(const CMsvEntrySelection& aSelection, TMsvId aTarget, TMsvOp aOperationId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1165
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1166
	TestSlotAvailableL();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1167
	// send the data to the server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1168
	SendOperationDataL(aOperationId, aSelection, aTarget);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1169
	// start the operation
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1170
	User::LeaveIfError(SendReceive(EMsvCopyEntries, TIpcArgs(aOperationId)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1171
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1172
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1173
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1174
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1175
Copies the specified message server entries (asynchronously).
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1176
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1177
@param aSelection The IDs of the source entries to copy. On return, contains the children that could not be fully copied. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1178
@param aTarget The ID of the destination parent entry
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1179
@param aOperationId Operation identifier
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1180
@param aRequestStatus Asynchronous request status
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1181
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1182
@capability None A client with no capabilities can copy an entry only if both source and target entries
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1183
are under a local service, are owned by the client, and are in an unprotected folder.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1184
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1185
@capability ReadUserData Required in some circumstances: see the note below.   
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1186
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1187
@capability WriteUserData Required in some circumstances: see the note below.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1188
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1189
@capability Note The function tests that the caller has capabilities to create under the 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1190
target entry (see RMsvServerSession::CreateEntryL).
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1191
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1192
EXPORT_C void RMsvServerSession::CopyEntriesL(const CMsvEntrySelection& aSelection, TMsvId aTarget, TMsvOp aOperationId, TRequestStatus& aRequestStatus)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1193
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1194
	TestSlotAvailableL();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1195
	// send the data to the server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1196
	SendOperationDataL(aOperationId, aSelection, aTarget);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1197
	// start the operation
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1198
	aRequestStatus=KRequestPending;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1199
	SendReceive(EMsvCopyEntries, TIpcArgs(aOperationId), aRequestStatus);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1200
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1201
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1202
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1203
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1204
Passes an MTM-specific operation to the associated server-side MTM by means of the Message Server (asynchronously). 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1205
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1206
@param aSelection A selection of entries that may be relevant to the operation 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1207
@param aCommandId The command ID. The interpretation of the command is MTM-specific. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1208
@param aParameter A descriptor containing operation-specific parameters 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1209
@param aOperationId Operation identifier
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1210
@param aRequestStatus Asynchronous request status
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1211
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1212
@capability ReadUserData    
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1213
@capability WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1214
@capability Note A client application needs to have any additional capabilities that are specified by 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1215
the MTM for the message type, as well as ReadUserData and WriteUserData. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1216
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1217
@see RMsvServerSession::GetMTMRequiredCapabilitiesL
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1218
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1219
EXPORT_C void RMsvServerSession::TransferCommandL(const CMsvEntrySelection& aSelection, TInt aCommandId, const TDesC8& aParameter, TMsvOp aOperationId, TRequestStatus& aRequestStatus)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1220
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1221
	TestSlotAvailableL();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1222
	// send the operation data to the server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1223
	SendCommandDataL(aOperationId, aSelection, aCommandId, aParameter);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1224
	// start the operation
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1225
	aRequestStatus=KRequestPending;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1226
	SendReceive(EMsvMtmCommand, TIpcArgs(aOperationId), aRequestStatus);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1227
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1228
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1229
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1230
Passes an MTM-specific operation to the associated server-side MTM by means of the Message Server (synchronously). 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1231
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1232
@param aSelection A selection of entries that may be relevant to the operation 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1233
@param aCommandId The command ID. The interpretation of the command is MTM-specific. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1234
@param aParameter A descriptor containing operation-specific parameters 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1235
@param aOperationId Operation identifier
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1236
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1237
@capability ReadUserData    
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1238
@capability WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1239
@capability Note A client application needs to have any additional capabilities that are specified by 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1240
the MTM for the message type, as well as ReadUserData and WriteUserData. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1241
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1242
@see RMsvServerSession::GetMTMRequiredCapabilitiesL
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1243
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1244
EXPORT_C TInt RMsvServerSession::TransferCommandL(const CMsvEntrySelection& aSelection, TInt aCommandId, const TDesC8& aParameter, TMsvOp aOperationId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1245
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1246
	TestSlotAvailableL();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1247
	// send the operation data to the server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1248
	SendCommandDataL(aOperationId, aSelection, aCommandId, aParameter);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1249
	// start the operation
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1250
	return SendReceive(EMsvMtmCommand, TIpcArgs(aOperationId));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1251
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1252
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1253
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1254
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1255
Gets the MTM that would perform an operation using two specified entries.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1256
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1257
@param aId1 ID of first entry
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1258
@param aId2 ID of second entry
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1259
@param aMtm On return, the UID of the MTM that would be used 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1260
@param aService On return, the ID of the service that would be used 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1261
@return System wide error code
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1262
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1263
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1264
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1265
EXPORT_C TInt RMsvServerSession::OperationMtmL(TMsvId aId1, TMsvId aId2, TUid& aMtm, TMsvId& aService)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1266
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1267
	TPckg<TUid> uid(aMtm);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1268
	TPckg<TMsvId> service(aService);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1269
	return SendReceive(EMsvOperationMtm, TIpcArgs(aId1,aId2,&uid,&service));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1270
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1271
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1272
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1273
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1274
Stops any operations that a Server-side MTM for the specified service is running, 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1275
and then unloads the Server-side MTM.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1276
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1277
The current operation and any queued operations are cancelled.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1278
 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1279
@param aServiceId ID of the service
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1280
@return System wide error code
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1281
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1282
@capability Note A client application needs to have any capabilities that are specified by 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1283
the MTM.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1284
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1285
@see RMsvServerSession::GetMTMRequiredCapabilitiesL
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1286
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1287
EXPORT_C TInt RMsvServerSession::StopService(TMsvId aServiceId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1288
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1289
	return SendReceive(EMsvStopService, TIpcArgs(aServiceId));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1290
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1291
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1292
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1293
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1294
Tests if a Server-side MTM for a particular service is loaded by the Message 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1295
Server.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1296
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1297
The Server-side MTM does not have to be executing a command: it may be 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1298
waiting for another command.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1299
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1300
@param aServiceId The ID of the relevant service 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1301
@return ETrue if the Server-side MTM for the service is loaded, otherwise EFalse 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1302
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1303
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1304
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1305
EXPORT_C TBool RMsvServerSession::ServiceActive(TMsvId aServiceId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1306
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1307
	return SendReceive(EMsvServiceActive, TIpcArgs(aServiceId)); 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1308
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1309
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1310
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1311
Gets the current progress information from the Server-side MTM for the specified 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1312
service.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1313
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1314
It is typically used by User Interface MTMs. The format of the progress information 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1315
returned in the aProgress buffer is MTM-specific.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1316
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1317
Calling this function results in the Message Server calling CBaseServerMtm::Progress() 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1318
on the relevant Server-side MTM. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1319
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1320
Note that the progress information is independent of which message client 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1321
application started the current operation. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1322
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1323
@param aServiceId The ID of the service from which to get the progress information 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1324
@param aProgress On return, a descriptor holding progress information. It is 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1325
the caller's responsibility to ensure the descriptor is large enough for this information. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1326
@return KErrNone: success; KErrNotFound: The service is not active (the relevant Server-side MTM is not loaded 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1327
by the Message Server); KErrOverflow: The descriptor was too small for the progress information
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1328
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1329
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1330
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1331
EXPORT_C TInt RMsvServerSession::ServiceProgress(TMsvId aServiceId, TDes8& aProgress)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1332
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1333
	TInt ret = SendReceive(EMsvServiceProgress, TIpcArgs(aServiceId,&aProgress));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1334
	if (ret>0)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1335
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1336
		aProgress.SetLength(ret);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1337
		ret=KErrNone;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1338
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1339
	else
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1340
		aProgress.SetLength(0);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1341
	return ret;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1342
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1343
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1344
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1345
Deletes the specified entry from the Message Server. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1346
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1347
The call is guaranteed not to fail. If the entry cannot be deleted immediately, 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1348
it will be deleted later.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1349
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1350
@param aId The ID of the entry to remove 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1351
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1352
@capability None A client with no capabilities can access an entry only if the entry is    
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1353
under a local service, is owned by the client, is in an unprotected folder,  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1354
and is not a service entry. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1355
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1356
@capability WriteDeviceData Required if the entry is a service. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1357
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1358
@capability ReadUserData Required in some circumstances: see the note below.   
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1359
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1360
@capability WriteUserData Required in some circumstances: see the note below.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1361
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1362
@capability Note The capabilities required to access an entry that is not a service vary depending on the 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1363
following conditions:  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1364
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1365
- Entry is under the local service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1366
	-# Entry is in the Outbox and the Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1367
	-# Entry is in the Outbox and the Outbox is unprotected: MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1368
	-# Entry is in a protected folder: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1369
	-# Entry is in an unprotected folder and the entry is not owned by the client: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1370
	-# Entry is in an unprotected folder and the entry is owned by the client: no capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1371
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1372
- Entry is under a remote service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1373
	-# The Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1374
	-# The Outbox is unprotected and the entry is owned by the client: MTM-specified capabilities (of the MTM for the remote service) 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1375
	-# The Outbox is unprotected and the entry is not owned by the client: ReadUserData + WriteUserData + 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1376
	MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1377
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1378
EXPORT_C void RMsvServerSession::RemoveEntry(TMsvId aId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1379
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1380
	SendReceive(EMsvRemoveEntry, TIpcArgs(aId));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1381
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1382
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1383
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1384
Gets the path of the folder in which the Message Server data is stored.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1385
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1386
@param aDirectory Descriptor to hold returned path 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1387
@return System wide error code
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1388
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1389
EXPORT_C TInt RMsvServerSession::GetMessageDirectory(TDes& aDirectory)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1390
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1391
	return SendReceive(EMsvGetMessageDirectory, TIpcArgs(&aDirectory));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1392
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1393
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1394
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1395
Gets the drive on which the Message Server data is stored.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1396
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1397
@return Drive, as a TDriveNumber value
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1398
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1399
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1400
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1401
TInt RMsvServerSession::GetMessageDrive()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1402
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1403
	return SendReceive(EMsvGetMessageDrive);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1404
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1405
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1406
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1407
void RMsvServerSession::TestSlotAvailableL()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1408
//
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1409
//
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1410
//
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1411
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1412
	User::LeaveIfError(SendReceive(EMsvSlotAvailable));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1413
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1414
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1415
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1416
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1417
Set failure condition to simulate (for test purposes).
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1418
@param aType 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1419
@param aArg1 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1420
@param aArg2 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1421
@param aArg3 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1422
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1423
@capability Note When the __REMOVE_MESSAGING_API_V1__ macro is defined, the
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1424
function is policed against the capabilities of the message server (Read/Write Device Data, 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1425
Protected Server, Network Control, Network Services, Local Services and Read 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1426
User Data). When the macro is not defined, the function is not policed. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1427
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1428
EXPORT_C void RMsvServerSession::SetFailure(TInt aType, TInt aArg1, TInt aArg2, TInt aArg3)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1429
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1430
	SendReceive(EMsvSetFailure,TIpcArgs(aType,aArg1,aArg2,aArg3));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1431
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1432
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1433
/** Sets or clears multiple fields in a selection of entries.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1434
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1435
Fields to change are specified using a bitmask of TMsvAttribute values. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1436
@param aSelection The entries to change
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1437
@param aSetAttributes A bitmask of the fields to set
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1438
@param aClearAttributes A bitmask of the fields to clear
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1439
@see TMsvAttribute 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1440
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1441
@capability WriteUserData 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1442
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1443
@capability Note Clients with no capabilities that own entries in an unprotected folder cannot use this IPC call. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1444
Instead, they must change attributes by using ChangeEntryL on each entry.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1445
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1446
EXPORT_C void RMsvServerSession::ChangeAttributesL(const CMsvEntrySelection& aSelection, TUint aSetAttributes, TUint aClearAttributes)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1447
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1448
	PackOperationDataL(aSelection, aSetAttributes, aClearAttributes);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1449
	User::LeaveIfError(SendReceive(EMsvChangeAttributes,TIpcArgs(iBuffer)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1450
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1451
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1452
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1453
Gets a filtered list of children of a specified message entry.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1454
@param aId Message entry of which to get children
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1455
@param aFilter Filter by which various message entries can be excluded
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1456
@param aSelection On return, a list of message entry IDs
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1457
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1458
@capability None Only children that the client owns are returned. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1459
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1460
@capability ReadUserData All children of the entry are returned
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1461
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1462
EXPORT_C void RMsvServerSession::GetChildIdsL(TMsvId aId, const CMsvEntryFilter& aFilter, CMsvEntrySelection& aSelection)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1463
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1464
	TMsvPackedEntryFilter package(iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1465
	User::LeaveIfError(package.PackFilter(aFilter));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1466
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1467
	TPtr8 ptr=iBuffer->Des();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1468
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1469
	TInt error = SendReceive(EMsvGetChildIds,TIpcArgs(&ptr,aId));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1470
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1471
	while(error == KErrOverflow)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1472
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1473
		// increase the size of the buffer and try again
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1474
		iBuffer->Des().SetLength(0); // to avoid copying contents
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1475
		iBuffer = iBuffer->ReAllocL(iBuffer->Des().MaxSize() + KMsvSessionBufferLength);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1476
		TMsvPackedEntryFilter package1(iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1477
		User::LeaveIfError(package1.PackFilter(aFilter));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1478
		TPtr8 ptr2=iBuffer->Des();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1479
		error = SendReceive(EMsvGetChildIds,TIpcArgs(&ptr2,aId));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1480
		}	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1481
	User::LeaveIfError(error);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1482
	TInt temp1(0); 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1483
	TInt temp2(0);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1484
	TMsvPackedOperation op(iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1485
	op.UnpackL(aSelection, temp1, temp2);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1486
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1487
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1488
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1489
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1490
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1491
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1492
Load the Message Server index from the specified drive.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1493
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1494
Progress information is provided by a TMsvIndexLoadProgress object.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1495
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1496
If an error occurs, the index is unchanged.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1497
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1498
@param aDrive The drive holding the Message Server index, specified 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1499
by a TDriveNumber value
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1500
@param aOperationId Operation identifier
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1501
@param aRequestStatus Asynchronous completion status 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1502
@leave KErrServerBusy Cannot change drive because there are outstanding Message 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1503
Server operations.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1504
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1505
@capability WriteDeviceData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1506
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1507
void RMsvServerSession::ChangeDriveL(TInt aDrive, TMsvOp aOperationId, TRequestStatus& aRequestStatus)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1508
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1509
	__ASSERT_ALWAYS(RFs::IsValidDrive(aDrive), PanicServer(EMsvInvalidDrive));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1510
	TestSlotAvailableL();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1511
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1512
	// start the operation
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1513
	aRequestStatus = KRequestPending;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1514
	SendReceive(EMsvChangeDrive, TIpcArgs(aOperationId,TInt(aDrive)), aRequestStatus);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1515
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1516
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1517
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1518
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1519
Copy the Message Store to the specified drive.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1520
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1521
Progress information is provided by a TMsvCopyProgress object.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1522
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1523
If an error occurs, copying is stopped.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1524
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1525
@param aDrive The drive holding the Message Server index, specified 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1526
by a TDriveUnit value
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1527
@param aOperationId Operation identifier
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1528
@param aStatus Asynchronous completion status 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1529
@leave KErrServerBusy Cannot copy store because there are outstanding Message 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1530
Server operations.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1531
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1532
@capability WriteDeviceData*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1533
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1534
void RMsvServerSession::CopyStoreL(const TDriveUnit& aDrive, TMsvOp aOperationId, TRequestStatus& aStatus)                     
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1535
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1536
	__ASSERT_ALWAYS(RFs::IsValidDrive(aDrive), PanicServer(EMsvInvalidDrive));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1537
	TestSlotAvailableL();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1538
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1539
	// start the operation
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1540
	SendReceive(EMsvCopyStore, TIpcArgs(aOperationId,TInt(aDrive)), aStatus);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1541
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1542
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1543
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1544
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1545
Delete the Message Store to the specified drive.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1546
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1547
Progress information is provided by a TMsvDeleteProgress object.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1548
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1549
If an error occurs, deleting is stopped.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1550
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1551
@param aDrive The drive holding the Message Server index, specified 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1552
by a TDriveUnit value
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1553
@param aOperationId Operation identifier
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1554
@param aStatus Asynchronous completion status 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1555
@leave KErrServerBusy Cannot delete store because there are outstanding Message 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1556
Server operations.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1557
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1558
@capability WriteDeviceData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1559
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1560
void RMsvServerSession::DeleteStoreL(const TDriveUnit& aDrive, TMsvOp aOperationId, TRequestStatus& aStatus)                     
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1561
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1562
	__ASSERT_ALWAYS(RFs::IsValidDrive(aDrive), PanicServer(EMsvInvalidDrive));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1563
	TestSlotAvailableL();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1564
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1565
	// start the operation
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1566
	SendReceive(EMsvDeleteStore, TIpcArgs(aOperationId,TInt(aDrive)), aStatus);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1567
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1568
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1569
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1570
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1571
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1572
Gets the number of outstanding operations.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1573
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1574
@return The number of outstanding operations 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1575
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1576
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1577
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1578
TInt RMsvServerSession::OutstandingOperationsL()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1579
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1580
	TInt count;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1581
	TPckg<TBool> package(count);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1582
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1583
	User::LeaveIfError(SendReceive(EMsvOutstandingOperations, TIpcArgs(&package)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1584
	return count;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1585
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1586
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1587
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1588
Get the notification sequence number.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1589
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1590
@return Notification sequence number
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1591
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1592
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1593
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1594
TUint32 RMsvServerSession::NotifySequenceL()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1595
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1596
	TUint32 sequence;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1597
	TPckg<TUint32> package(sequence);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1598
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1599
	User::LeaveIfError(SendReceive(EMsvGetNotifySequence, TIpcArgs(&package)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1600
	return sequence;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1601
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1602
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1603
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1604
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1605
Sets whether the session's observer should be notified of events related to 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1606
changes in message server entries.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1607
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1608
If the flag is set to true, the session observer will be notified of all events types. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1609
If it is set to false, the observer will not be notified of events of types EMsvEntriesCreated, 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1610
EMsvEntriesChanged, EMsvEntriesDeleted, or EMsvEntriesMoved. (Event types are enumerated in  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1611
MMsvSessionObserver::TMsvSessionEvent.) 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1612
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1613
@param aReceive Event request flag
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1614
@return System wide error code
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1615
@see MMsvSessionObserver::TMsvSessionEvent
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1616
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1617
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1618
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1619
EXPORT_C TInt RMsvServerSession::SetReceiveEntryEvents(TBool aReceive)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1620
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1621
	// Send the uid type in message and Make request
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1622
	return SendReceive(EMsvSetReceiveEntyEvents, TIpcArgs(aReceive));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1623
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1624
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1625
// from MMsvStoreManager
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1626
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1627
Creates a new attachment file in the message store for the message entry specified.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1628
This function allows clients to create a new empty file and stream data to it. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1629
The empty attachment file is passed back to the client using an opened file handle 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1630
to the file in the message store.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1631
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1632
@param aEntryId Entry to create the attachment for
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1633
@param aFileName The attachment filename
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1634
@param aFile On return, open file handle to the new attachment file . Ownership is transferred. The caller must close the file handle .
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1635
@return True if the file created was named as specified, otherwise false 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1636
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1637
@capability None A client with no capabilities can access an entry only if the entry is    
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1638
under a local service, is owned by the client, is in an unprotected folder,  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1639
and is not a service entry. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1640
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1641
@capability WriteDeviceData Required if the entry is a service. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1642
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1643
@capability ReadUserData Required in some circumstances: see the note below.   
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1644
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1645
@capability WriteUserData Required in some circumstances: see the note below.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1646
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1647
@capability Note The capabilities required to access an entry that is not a service vary depending on the 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1648
following conditions:  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1649
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1650
- Entry is under the local service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1651
	-# Entry is in the Outbox and the Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1652
	-# Entry is in the Outbox and the Outbox is unprotected: MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1653
	-# Entry is in a protected folder: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1654
	-# Entry is in an unprotected folder and the entry is not owned by the client: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1655
	-# Entry is in an unprotected folder and the entry is owned by the client: no capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1656
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1657
- Entry is under a remote service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1658
	-# The Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1659
	-# The Outbox is unprotected and the entry is owned by the client: MTM-specified capabilities (of the MTM for the remote service) 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1660
	-# The Outbox is unprotected and the entry is not owned by the client: ReadUserData + WriteUserData + 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1661
	MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1662
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1663
EXPORT_C TBool RMsvServerSession::CreateAttachmentForWriteL(TMsvId aEntryId, TDes& aFileName, RFile& aFile)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1664
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1665
	TPckg<TInt> pckgSubSessionHandle(0);  // intitialise
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1666
	TPckg<TBool> pckgFileNameChanged(EFalse);  // intitialise
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1667
	// session handle (RFs)received from TransferToClient() in server			
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1668
	TInt sessionHandle = User::LeaveIfError(SendReceive(EMsvCreateAttachmentForWrite,TIpcArgs(aEntryId,&aFileName,&pckgSubSessionHandle,&pckgFileNameChanged)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1669
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1670
	// Adopt the file handle from server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1671
	User::LeaveIfError(aFile.AdoptFromServer(sessionHandle,pckgSubSessionHandle()));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1672
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1673
	return pckgFileNameChanged();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1674
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1675
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1676
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1677
Allows clients to replace an existing attachment file and allows clients to stream data to it.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1678
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1679
Replaces an existing attachment file in the message store for the message entry specified by the aEntryId 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1680
parameter. The attachment filename is set to the filename indicated by the aFilename parameter. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1681
If an attachment with the supplied name does not exist, a new file is created. The empty attachment
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1682
file is passed back to the client using an opened file handle to the file in the message store.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1683
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1684
@param aEntryId The entry for which an attachment needs to be created in the message store
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1685
@param aFilename The name of the attachment file to be created
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1686
@param aFile On return, The created file handle for the attachment file.Ownership is transferred . The caller must close the file handle .
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1687
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1688
@capability None A client with no capabilities can access an entry only if the entry is    
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1689
under a local service, is owned by the client, is in an unprotected folder,  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1690
and is not a service entry. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1691
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1692
@capability WriteDeviceData Required if the entry is a service. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1693
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1694
@capability ReadUserData Required in some circumstances: see the note below.   
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1695
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1696
@capability WriteUserData Required in some circumstances: see the note below.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1697
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1698
@capability Note The capabilities required to access an entry that is not a service vary depending on the 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1699
following conditions:  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1700
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1701
- Entry is under the local service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1702
	-# Entry is in the Outbox and the Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1703
	-# Entry is in the Outbox and the Outbox is unprotected: MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1704
	-# Entry is in a protected folder: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1705
	-# Entry is in an unprotected folder and the entry is not owned by the client: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1706
	-# Entry is in an unprotected folder and the entry is owned by the client: no capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1707
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1708
- Entry is under a remote service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1709
	-# The Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1710
	-# The Outbox is unprotected and the entry is owned by the client: MTM-specified capabilities (of the MTM for the remote service) 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1711
	-# The Outbox is unprotected and the entry is not owned by the client: ReadUserData + WriteUserData + 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1712
	MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1713
*/	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1714
EXPORT_C void RMsvServerSession::ReplaceAttachmentForWriteL(TMsvId aEntryId, TDes& aFileName, RFile& aFile)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1715
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1716
	TPckg<TInt> pckgSubSessionHandle(0);  // intitialise
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1717
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1718
	// session handle (RFs)received from TransferToClient() in server			
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1719
	TInt sessionHandle = User::LeaveIfError(SendReceive(EMsvReplaceAttachmentForWrite,TIpcArgs(aEntryId,&aFileName,&pckgSubSessionHandle)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1720
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1721
	// Adopt the file handle from server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1722
	User::LeaveIfError(aFile.AdoptFromServer(sessionHandle,pckgSubSessionHandle()));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1723
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1724
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1725
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1726
Opens an existing attachment file in the message store for the message entry specified.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1727
This function allows clients to view attachment files.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1728
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1729
@param aEntryId Entry that has the attachment
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1730
@param aFilePath The attachment filename
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1731
@param aFile On return, open file handle to the attachment file. Ownership is transferred . The caller must close the file handle .
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1732
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1733
@capability None A client with no capabilities can access an entry only if owns that entry. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1734
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1735
@capability ReadUserData This is required to access any entry where the condition 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1736
described for no capabilities does not apply.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1737
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1738
EXPORT_C void RMsvServerSession::OpenAttachmentL(TMsvId aEntryId, const TDesC& aFilePath, RFile& aFile)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1739
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1740
	TPckg<TInt> pckgSubSessionHandle(0);   // initialise
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1741
	// session handle (RFs)received from TransferToClient() in server			
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1742
	TInt sessionHandle = SendReceive(EMsvOpenAttachment,TIpcArgs(aEntryId,&aFilePath,&pckgSubSessionHandle));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1743
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1744
	// Adopt the file handle from server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1745
	User::LeaveIfError(aFile.AdoptFromServer(sessionHandle,pckgSubSessionHandle()));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1746
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1747
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1748
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1749
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1750
Opens an existing attachment file in the message store for the message entry specified.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1751
This function allows clients to edit attachment files.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1752
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1753
@param aEntryId Entry that has the attachment
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1754
@param aFilePath The attachment filename
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1755
@param aFile On return, open file handle to the attachment file .Ownership is transferred . The caller must close the file handle .
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1756
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1757
@capability None A client with no capabilities can access an entry only if the entry is    
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1758
under a local service, is owned by the client, is in an unprotected folder,  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1759
and is not a service entry.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1760
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1761
@capability ReadUserData Required in some circumstances: see the note below.   
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1762
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1763
@capability WriteUserData Required in some circumstances: see the note below.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1764
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1765
@capability Note The capabilities required to access an entry that is not a service vary depending on the 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1766
following conditions:  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1767
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1768
- Entry is under the local service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1769
	-# Entry is in the Outbox and the Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1770
	-# Entry is in the Outbox and the Outbox is unprotected: MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1771
	-# Entry is in a protected folder: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1772
	-# Entry is in an unprotected folder and the entry is not owned by the client: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1773
	-# Entry is in an unprotected folder and the entry is owned by the client: no capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1774
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1775
- Entry is under a remote service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1776
	-# The Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1777
	-# The Outbox is unprotected and the entry is owned by the client: MTM-specified capabilities (of the MTM for the remote service) 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1778
	-# The Outbox is unprotected and the entry is not owned by the client: ReadUserData + WriteUserData + 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1779
	MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1780
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1781
EXPORT_C void RMsvServerSession::OpenAttachmentForWriteL(TMsvId aEntryId, const TDesC& aFilePath, RFile& aFile)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1782
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1783
	TPckg<TInt> pckgSubSessionHandle(0);   // initialise
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1784
	// session handle (RFs)received from TransferToClient() in server			
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1785
	TInt sessionHandle = SendReceive(EMsvOpenAttachmentForWrite,TIpcArgs(aEntryId,&aFilePath,&pckgSubSessionHandle));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1786
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1787
	// Adopt the file handle from server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1788
	User::LeaveIfError(aFile.AdoptFromServer(sessionHandle,pckgSubSessionHandle()));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1789
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1790
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1791
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1792
Deletes an existing attachment file in the message store.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1793
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1794
@param aEntryId Entry that has the attachment
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1795
@param aFilePath The attachment filename
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1796
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1797
@return System wide error code 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1798
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1799
@capability None A client with no capabilities can access an entry only if the entry is    
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1800
under a local service, is owned by the client, is in an unprotected folder,  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1801
and is not a service entry. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1802
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1803
@capability WriteDeviceData Required if the entry is a service. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1804
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1805
@capability ReadUserData Required in some circumstances: see the note below.   
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1806
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1807
@capability WriteUserData Required in some circumstances: see the note below.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1808
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1809
@capability Note The capabilities required to access an entry that is not a service vary depending on the 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1810
following conditions:  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1811
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1812
- Entry is under the local service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1813
	-# Entry is in the Outbox and the Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1814
	-# Entry is in the Outbox and the Outbox is unprotected: MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1815
	-# Entry is in a protected folder: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1816
	-# Entry is in an unprotected folder and the entry is not owned by the client: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1817
	-# Entry is in an unprotected folder and the entry is owned by the client: no capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1818
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1819
- Entry is under a remote service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1820
	-# The Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1821
	-# The Outbox is unprotected and the entry is owned by the client: MTM-specified capabilities (of the MTM for the remote service) 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1822
	-# The Outbox is unprotected and the entry is not owned by the client: ReadUserData + WriteUserData + 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1823
	MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1824
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1825
EXPORT_C TInt RMsvServerSession::DeleteAttachment(TMsvId aEntryId, const TDesC& aFilePath)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1826
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1827
	return SendReceive(EMsvDeleteAttachment,TIpcArgs(aEntryId,&aFilePath));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1828
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1829
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1830
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1831
Renames an existing attachment file.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1832
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1833
Renames an existing attachment file in the message store associated with the
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1834
message entry specified by the aEntryId parameter. The attachment is 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1835
identified by the file path specified by the aOldFilePath parameter and renamed to
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1836
the name supplied in the aNewName paramter.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1837
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1838
@param aEntryId The entry whose attachment needs to be renamed from the message store
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1839
@param aOldFilePath The name and path of the attachment file to be renamed.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1840
@param aNewName The new name of the attachment file.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1841
@return KErrNone if successful, otherwise any of the system wide error codes.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1842
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1843
@capability None A client with no capabilities can access an entry only if the entry is    
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1844
under a local service, is owned by the client, is in an unprotected folder,  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1845
and is not a service entry. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1846
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1847
@capability WriteDeviceData Required if the entry is a service. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1848
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1849
@capability ReadUserData Required in some circumstances: see the note below.   
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1850
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1851
@capability WriteUserData Required in some circumstances: see the note below.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1852
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1853
@capability Note The capabilities required to access an entry that is not a service vary depending on the 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1854
following conditions:  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1855
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1856
- Entry is under the local service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1857
	-# Entry is in the Outbox and the Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1858
	-# Entry is in the Outbox and the Outbox is unprotected: MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1859
	-# Entry is in a protected folder: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1860
	-# Entry is in an unprotected folder and the entry is not owned by the client: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1861
	-# Entry is in an unprotected folder and the entry is owned by the client: no capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1862
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1863
- Entry is under a remote service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1864
	-# The Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1865
	-# The Outbox is unprotected and the entry is owned by the client: MTM-specified capabilities (of the MTM for the remote service) 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1866
	-# The Outbox is unprotected and the entry is not owned by the client: ReadUserData + WriteUserData + 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1867
	MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1868
*/	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1869
EXPORT_C TInt RMsvServerSession::RenameAttachment(TMsvId aEntryId, const TDesC& aOldFilePath, const TDesC& aNewName)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1870
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1871
	return SendReceive(EMsvRenameAttachment,TIpcArgs(aEntryId, &aOldFilePath, &aNewName));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1872
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1873
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1874
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1875
Checks if the attachment filename specified exists in the store.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1876
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1877
@param aFilePath The complete attachment file path specification
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1878
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1879
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1880
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1881
@return ETrue if the attachment exists, otherwise EFalse
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1882
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1883
EXPORT_C TBool RMsvServerSession::FileExistsL(const TDesC& aFilePath)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1884
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1885
	TInt err = SendReceive(EMsvFileExists, TIpcArgs(&aFilePath));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1886
	if( err == KErrNotFound )
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1887
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1888
		return EFalse;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1889
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1890
		
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1891
	User::LeaveIfError(err);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1892
	return ETrue;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1893
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1894
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1895
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1896
Get the file path where the attachments for a particular entry are stored.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1897
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1898
@param aEntryId The message entry Id.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1899
@param aFilePath On return this will contain the filepath for the attachments.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1900
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1901
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1902
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1903
EXPORT_C void RMsvServerSession::AttachmentFilePathL(TMsvId aEntryId, TDes& aFilePath)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1904
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1905
	User::LeaveIfError(SendReceive(EMsvGetAttachmentFilePath, TIpcArgs(aEntryId, &aFilePath)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1906
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1907
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1908
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1909
Opens for reading a message store file for the message entry specified.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1910
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1911
@param aEntryId Entry that has the store
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1912
@param aFile On return, open file handle to the store.Ownership is transferred . The caller must close the file handle .
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1913
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1914
@capability None A client with no capabilities can access an entry only if owns that entry. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1915
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1916
@capability ReadUserData This is required to access any entry where the condition 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1917
described for no capabilities does not apply.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1918
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1919
EXPORT_C TInt RMsvServerSession::OpenFileStoreForRead(TMsvId aEntryId, RFile& aFile)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1920
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1921
	TPckg<TInt> pckgSubSessionHandle(0);  // initialise
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1922
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1923
	// session handle (RFs) received from TransferToClient() in server	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1924
	TInt sessionHandle = SendReceive(EMsvOpenFileStoreForRead,TIpcArgs(aEntryId,&pckgSubSessionHandle));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1925
	if( sessionHandle < KErrNone )
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1926
		return sessionHandle;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1927
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1928
	// Adopt the file handle from server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1929
	return aFile.AdoptFromServer(sessionHandle ,pckgSubSessionHandle());
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1930
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1931
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1932
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1933
Opens a temporary store file for the message entry specified.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1934
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1935
The function returns an open read-write file handle with an exclusive share to the temporary store file. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1936
This method, along with ReplaceFileStoreL, allows the message store classes to write data to the store 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1937
file for a particular message entry.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1938
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1939
@param aEntryId Entry with which to associate the store
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1940
@param aFile On return, open file handle to the store. Ownership is transferred . The caller must close the file handle .
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1941
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1942
@capability None A client with no capabilities can access an entry only if the entry is    
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1943
under a local service, is owned by the client, is in an unprotected folder,  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1944
and is not a service entry. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1945
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1946
@capability WriteDeviceData Required if the entry is a service. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1947
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1948
@capability ReadUserData Required in some circumstances: see the note below.   
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1949
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1950
@capability WriteUserData Required in some circumstances: see the note below.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1951
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1952
@capability Note The capabilities required to access an entry that is not a service vary depending on the 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1953
following conditions:  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1954
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1955
- Entry is under the local service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1956
	-# Entry is in the Outbox and the Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1957
	-# Entry is in the Outbox and the Outbox is unprotected: MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1958
	-# Entry is in a protected folder: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1959
	-# Entry is in an unprotected folder and the entry is not owned by the client: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1960
	-# Entry is in an unprotected folder and the entry is owned by the client: no capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1961
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1962
- Entry is under a remote service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1963
	-# The Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1964
	-# The Outbox is unprotected and the entry is owned by the client: MTM-specified capabilities (of the MTM for the remote service) 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1965
	-# The Outbox is unprotected and the entry is not owned by the client: ReadUserData + WriteUserData + 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1966
	MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1967
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1968
EXPORT_C void RMsvServerSession::OpenTempStoreFileL(TMsvId aEntryId, RFile& aFile)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1969
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1970
	TPckg<TInt> pckgSubSessionHandle(0);  // intitialise
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1971
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1972
	// session handle (RFs) received from TransferToClient() in server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1973
	TInt sessionHandle = SendReceive(EMsvOpenTempStoreFile,TIpcArgs(aEntryId,&pckgSubSessionHandle));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1974
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1975
	// Adopt the file handle from server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1976
	User::LeaveIfError(aFile.AdoptFromServer(sessionHandle ,pckgSubSessionHandle()));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1977
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1978
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1979
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1980
Replaces the current store file with the temporary store file, created from OpenTempStoreFileL, for the specified message entry.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1981
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1982
@param aEntryId Entry associated with the store
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1983
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1984
@capability None A client with no capabilities can access an entry only if the entry is    
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1985
under a local service, is owned by the client, is in an unprotected folder,  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1986
and is not a service entry. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1987
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1988
@capability WriteDeviceData Required if the entry is a service. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1989
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1990
@capability ReadUserData Required in some circumstances: see the note below.   
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1991
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1992
@capability WriteUserData Required in some circumstances: see the note below.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1993
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1994
@capability Note The capabilities required to access an entry that is not a service vary depending on the 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1995
following conditions:  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1996
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1997
- Entry is under the local service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1998
	-# Entry is in the Outbox and the Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  1999
	-# Entry is in the Outbox and the Outbox is unprotected: MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2000
	-# Entry is in a protected folder: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2001
	-# Entry is in an unprotected folder and the entry is not owned by the client: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2002
	-# Entry is in an unprotected folder and the entry is owned by the client: no capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2003
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2004
- Entry is under a remote service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2005
	-# The Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2006
	-# The Outbox is unprotected and the entry is owned by the client: MTM-specified capabilities (of the MTM for the remote service) 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2007
	-# The Outbox is unprotected and the entry is not owned by the client: ReadUserData + WriteUserData + 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2008
	MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2009
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2010
EXPORT_C void RMsvServerSession::ReplaceFileStoreL(TMsvId aEntryId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2011
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2012
	User::LeaveIfError(SendReceive(EMsvReplaceFileStore,TIpcArgs(aEntryId)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2013
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2014
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2015
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2016
Deletes the store file associated with the specified message entry.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2017
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2018
@capability None A client with no capabilities can access an entry only if the entry is    
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2019
under a local service, is owned by the client, is in an unprotected folder,  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2020
and is not a service entry. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2021
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2022
@capability WriteDeviceData Required if the entry is a service. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2023
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2024
@capability ReadUserData Required in some circumstances: see the note below.   
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2025
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2026
@capability WriteUserData Required in some circumstances: see the note below.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2027
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2028
@capability Note The capabilities required to access an entry that is not a service vary depending on the 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2029
following conditions:  
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2030
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2031
- Entry is under the local service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2032
	-# Entry is in the Outbox and the Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2033
	-# Entry is in the Outbox and the Outbox is unprotected: MTM-specified capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2034
	-# Entry is in a protected folder: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2035
	-# Entry is in an unprotected folder and the entry is not owned by the client: ReadUserData + WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2036
	-# Entry is in an unprotected folder and the entry is owned by the client: no capabilities
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2037
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2038
- Entry is under a remote service:
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2039
	-# The Outbox is protected: ReadUserData + WriteUserData + MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2040
	-# The Outbox is unprotected and the entry is owned by the client: MTM-specified capabilities (of the MTM for the remote service) 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2041
	-# The Outbox is unprotected and the entry is not owned by the client: ReadUserData + WriteUserData + 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2042
	MTM-specified capabilities (of the MTM for the remote service)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2043
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2044
EXPORT_C void RMsvServerSession::DeleteFileStoreL(TMsvId aEntryId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2045
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2046
	User::LeaveIfError(SendReceive(EMsvDeleteFileStore,TIpcArgs(aEntryId)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2047
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2048
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2049
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2050
Tests if a store file exists for the specified message entry.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2051
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2052
@param aEntryId Entry associated with the store
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2053
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2054
@return ETrue if the store file exists, otherwise EFalse.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2055
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2056
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2057
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2058
EXPORT_C TBool RMsvServerSession::FileStoreExistsL(TMsvId aEntryId) const
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2059
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2060
	return SendReceive(EMsvFileStoreExists,TIpcArgs(aEntryId));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2061
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2062
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2063
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2064
Checks a flag in the message server that is set when the server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2065
deletes a corrupt index file. Then clears the flag.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2066
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2067
It is intended to allow the message centre UI to check whether
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2068
a corrupt index has been deleted on startup. If it has the UI
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2069
may inform the user about the loss of their messages.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2070
    
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2071
@return ETrue if a corrupt index flag was present indicating that
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2072
a corrupt index file has been deleted since the last time this
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2073
function was called.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2074
 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2075
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2076
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2077
TBool RMsvServerSession::GetAndClearIndexCorruptFlagL()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2078
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2079
	TInt result=User::LeaveIfError(SendReceive(EMsvGetAndClearIndexCorruptFlag));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2080
	return result==0 ? EFalse : ETrue;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2081
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2082
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2083
/** Checks if the specified drive has a Message Server index on it.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2084
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2085
@param aDrive Drive to check
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2086
@return True if aDrive has a Message Server index, otherwise false
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2087
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2088
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2089
TBool RMsvServerSession::DriveContainsStoreL(TDriveUnit aDrive)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2090
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2091
	TInt result=User::LeaveIfError(SendReceive(EMsvDriveContainsStore,TIpcArgs(aDrive)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2092
	return result==0 ? EFalse : ETrue;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2093
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2094
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2095
/** Checks to see if the currently selected drive contains the correct mail store.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2096
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2097
If the message store is present on an external drive, we have to check if the same drive is 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2098
mounted or not before storing the mail.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2099
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2100
@return ETrue if the same drive is mounted. otherwise returns EFalse
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2101
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2102
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2103
EXPORT_C TBool RMsvServerSession::MessageStoreDrivePresentL()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2104
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2105
	TInt result = User::LeaveIfError(SendReceive(EMsvMessageStoreDrivePresent));	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2106
	return result== 0 ? EFalse : ETrue;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2107
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2108
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2109
EXPORT_C TBool RMsvServerSession::CreateShareProtectedAttachmentForWriteL(TMsvId /*aEntryId*/, TDes& /*aFilename*/, RFile& /*aFile*/)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2110
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2111
	User::Leave(KErrNotSupported);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2112
	//Avoid complier errors and warnings...
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2113
	return EFalse;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2114
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2115
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2116
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2117
Get the file path where the plain body text for a particular entry will be stored.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2118
@param aBodyTextId 	The TMsvId of the body text entry.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2119
@param aFilePath 	On return this will contain the filepath for the plainbody text.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2120
@capability None
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2121
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2122
EXPORT_C void RMsvServerSession::BodyTextFilePathL(TMsvId aBodyTextId, TDes& aFilePath)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2123
 	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2124
 	User::LeaveIfError(SendReceive(EMsvGetBodyTextFilePath, TIpcArgs(aBodyTextId, &aFilePath)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2125
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2126
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2127
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2128
Open the bodytext file whose path is given in aFileName.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2129
@param aFile	 	 The RFile reference that is to be opened.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2130
@param aBodyTextId	 The TMsvId of the body text entry.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2131
@capability ReadUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2132
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2133
EXPORT_C void RMsvServerSession::OpenBodyTextFileForReadL(RFile& aFile, TMsvId aBodyTextId, const TDesC& aFilePath)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2134
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2135
	TPckg<TInt> pckgSubSessionHandle(0);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2136
	TInt sessionHandle = User::LeaveIfError(SendReceive(EMsvOpenTextFileForRead, TIpcArgs(aBodyTextId,  &aFilePath, &pckgSubSessionHandle)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2137
	User::LeaveIfError(aFile.AdoptFromServer(sessionHandle,pckgSubSessionHandle()));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2138
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2139
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2140
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2141
Create a plainbody text file whose path is given in aFilePath.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2142
@param aFile 	  	The RFile reference that is to be opened.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2143
@param aBodyTextId  The TMsvId of the body text entry.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2144
@capability WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2145
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2146
EXPORT_C void RMsvServerSession::CreatePlainTextFileL(RFile& aFile, TMsvId aBodyTextId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2147
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2148
	TPckg<TInt> pckgSubSessionHandle(0);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2149
	TInt sessionHandle = User::LeaveIfError(SendReceive(EMsvCreatePlainTextFile, TIpcArgs(aBodyTextId, &pckgSubSessionHandle)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2150
	User::LeaveIfError(aFile.AdoptFromServer(sessionHandle,pckgSubSessionHandle()));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2151
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2152
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2153
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2154
Deletes  a plainbody text file whose path is given in aFilePath.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2155
@param aBodyTextId	 The TMsvId of the body text entry.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2156
@capability WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2157
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2158
EXPORT_C void RMsvServerSession::DeletePlainTextFileL(TMsvId aBodyTextId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2159
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2160
	User::LeaveIfError(SendReceive(EMsvDeletePlainTextFile, TIpcArgs(aBodyTextId)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2161
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2162
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2163
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2164
Replaces  a plainbody text file whose Id is given in aBodyTextId.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2165
@param aBodyTextId 	  The TMsvId of the body text entry.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2166
@capability WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2167
*/	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2168
EXPORT_C void RMsvServerSession::ReplacePlainTextFileL(TMsvId aBodyTextId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2169
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2170
	User::LeaveIfError(SendReceive(EMsvReplacePlainTextFile,TIpcArgs(aBodyTextId)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2171
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2172
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2173
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2174
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2175
#if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2176
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2177
 * GetChildrenAll()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2178
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2179
 * @param TMsvId:                ID of the parent entry.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2180
 * @param TMsvSelectionOrdering: Sorting and grouping rules for the returned entries.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2181
 * @param CArrayPtrFlat<CMsvClientEntry>: On return, the entry's children. If an error is returned, aEntries is unchanged.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2182
 * @return TInt:                 System wide error code
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2183
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2184
 * @capability None Only children that the client owns are returned. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2185
 * @capability ReadUserData All children of the entry are returned
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2186
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2187
 * Gets the children of a parent entry specified as first argument.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2188
 * If the passed parent is a standard folder the function will fetch 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2189
 * entries from all drives currently present in the preferred drive list.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2190
 */
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2191
EXPORT_C TInt RMsvServerSession::GetChildrenAll(TMsvId aId, CArrayPtrFlat<CMsvClientEntry>& aEntries, const TMsvSelectionOrdering& aOrdering)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2192
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2193
	TInt origCount = aEntries.Count();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2194
	TInt leave = KErrNone;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2195
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2196
	TRAP(leave, DoGetChildrenAllL(aId, aEntries, aOrdering));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2197
	if(KErrNone != leave)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2198
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2199
		TInt count=aEntries.Count();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2200
		while(count > origCount)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2201
			{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2202
			delete aEntries.At(--count);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2203
			aEntries.Delete(count);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2204
			}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2205
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2206
	return leave;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2207
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2208
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2209
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2210
void RMsvServerSession::DoGetChildrenAllL(TMsvId aId, CArrayPtrFlat<CMsvClientEntry>& aEntries, const TMsvSelectionOrdering& aOrdering)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2211
//
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2212
// Gets the children of the index entry with the Unique id aId.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2213
//
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2214
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2215
	// package up the Id into a children details class
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2216
	TPckgBuf<TMsvChildrenDetails> details;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2217
	details().iParentId = aId;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2218
	// pass the sort order
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2219
	TPckgC<TMsvSelectionOrdering> package2(aOrdering);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2220
	// pass the buffer to receive the data through
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2221
	TPtr8 ptr=iBuffer->Des();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2222
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2223
	// signal the server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2224
	TInt error = SendReceive(EMsvGetChildrenALL, TIpcArgs(&details,&package2,&ptr));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2225
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2226
	if (error!=KErrNone && error!=KErrOverflow)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2227
		User::Leave(error);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2228
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2229
	// unpack the entries from the buffer
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2230
	TMsvPackedEntryArray packedEntryArray(iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2231
	for (TInt count=0; count<details().iNumberChildrenInArray; count++)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2232
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2233
		TMsvEntry entry;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2234
		User::LeaveIfError(packedEntryArray.UnpackEntry(count, entry));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2235
		CMsvClientEntry* cEntry = CMsvClientEntry::NewLC(entry, EMsvClientChild);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2236
		aEntries.AppendL(cEntry);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2237
		CleanupStack::Pop(); // cEntry
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2238
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2239
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2240
	// if there are more entries - get them
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2241
	if (error==KErrOverflow)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2242
		DoGetRemainingChildrenL(details, aEntries);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2243
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2244
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2245
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2246
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2247
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2248
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2249
 * GetChildIdsAllL()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2250
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2251
 * @param TMsvId:          ID of the parent entry.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2252
 * @param CMsvEntryFilter: Filter by which various message entries can be excluded.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2253
 * @return aSelection:     A list of message entry IDs
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2254
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2255
 * @capability None Only children that the client owns are returned. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2256
 * @capability ReadUserData All children of the entry are returned
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2257
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2258
 * Gets the children of a parent entry specified as first argument.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2259
 * If the passed parent is a standard folder the function will fetch 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2260
 * entries from all drives currently present in the preferred drive list.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2261
 */
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2262
EXPORT_C void RMsvServerSession::GetChildIdsAllL(TMsvId aId, const CMsvEntryFilter& aFilter, CMsvEntrySelection& aSelection)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2263
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2264
	TMsvPackedEntryFilter package(iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2265
	User::LeaveIfError(package.PackFilter(aFilter));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2266
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2267
	TPtr8 ptr=iBuffer->Des();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2268
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2269
	TInt error = SendReceive(EMsvGetChildIdsALL, TIpcArgs(&ptr, aId));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2270
	while(error == KErrOverflow)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2271
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2272
		// increase the size of the buffer and try again
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2273
		iBuffer->Des().SetLength(0); // to avoid copying contents
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2274
		iBuffer = iBuffer->ReAllocL(iBuffer->Des().MaxSize() + KMsvSessionBufferLength);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2275
		TMsvPackedEntryFilter package1(iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2276
		User::LeaveIfError(package1.PackFilter(aFilter));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2277
		TPtr8 ptr2=iBuffer->Des();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2278
		error = SendReceive(EMsvGetChildIdsALL,TIpcArgs(&ptr2,aId));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2279
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2280
		
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2281
	User::LeaveIfError(error);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2282
	TInt temp1(0); 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2283
	TInt temp2(0);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2284
	TMsvPackedOperation op(iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2285
	op.UnpackL(aSelection, temp1, temp2);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2286
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2287
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2288
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2289
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2290
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2291
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2292
 * CurrentDriveInfo()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2293
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2294
 * @return TDriveNumber: Drive number of the current drive
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2295
 *						 in the preferred drive list.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2296
 * @return TUint	   : Priority of the drive.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2297
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2298
 * Code changes for PREQ 557.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2299
 * The function returns the current drive of message server.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2300
 */ 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2301
EXPORT_C void RMsvServerSession::CurrentDriveInfoL(TDriveNumber& aDriveNumber, TUint& aPriority)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2302
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2303
	TPckg<TDriveNumber> driveNum(aDriveNumber);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2304
	TPckg<TUint> priority(aPriority);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2305
		
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2306
	User::LeaveIfError(SendReceive(EMsvGetCurrentDriveInfo, TIpcArgs(&driveNum, &priority)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2307
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2308
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2309
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2310
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2311
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2312
 * DriveList()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2313
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2314
 * @return RArray<TDriveNumber>: List of drive number present in 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2315
 *         the preferred drive list arranged in decrementing order
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2316
 *         of their priority.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2317
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2318
 * Code changes for PREQ 557.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2319
 */
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2320
EXPORT_C void RMsvServerSession::DriveListL(RArray<TDriveNumber>& aDriveList)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2321
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2322
	TPtr8 ptr = iBuffer->Des();	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2323
	User::LeaveIfError(SendReceive(EMsvGetDriveList, TIpcArgs(&ptr)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2324
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2325
	// Unpack the entries from the buffer.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2326
	TMsvPackedDriveIdOperation packedDriveIdOperation(iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2327
	packedDriveIdOperation.UnpackL(aDriveList);	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2328
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2329
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2330
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2331
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2332
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2333
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2334
 * AvailableDriveListL()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2335
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2336
 * @return RArray<TDriveNumber>: List of drive number of available
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2337
 *         drives present in the preferred drive list arranged in 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2338
 *         decrementing order of their priority.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2339
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2340
 * Code changes for PREQ 557.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2341
 * NOTE: A drive number is available only if it has a valid 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2342
 * (readable and of correct version) message store in it.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2343
 */
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2344
EXPORT_C void RMsvServerSession::AvailableDriveListL(RArray<TDriveNumber>& aDriveList)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2345
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2346
	TPtr8 ptr = iBuffer->Des();	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2347
	User::LeaveIfError(SendReceive(EMsvGetAvailableDriveList, TIpcArgs(&ptr)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2348
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2349
	// Unpack the entries from the buffer.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2350
	TMsvPackedDriveIdOperation packedDriveIdOperation(iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2351
	packedDriveIdOperation.UnpackL(aDriveList);	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2352
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2353
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2354
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2355
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2356
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2357
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2358
 * AddDriveL()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2359
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2360
 * @param  TDriveNumber: Drive number of the drive
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2361
 *						 to be added.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2362
 * @param TUint        : Priority of the drive.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2363
 * @return TUint       : New priority of the added drive.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2364
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2365
 * Code changes for PREQ 557.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2366
 * The function adds the passed drive in the preferred drive list.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2367
 * The location of the drive in the list is specified by the priority 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2368
 * of the drive as specified in the second argument. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2369
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2370
 * - If the priority value of the drive is more than the number of 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2371
 * elements in the preferred drive list, the function appends the drive 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2372
 * at the end of the list. The new priority of the drive is returned as 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2373
 * the second argument.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2374
 * - If the priority of the new drive is higher than the current drive 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2375
 * of message server, and if the new drive has a media in it, the message 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2376
 * server will perform implicit changeDrive and sends a notification to 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2377
 * all registered client processes about the change.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2378
 * - If the drive does not contain a valid version of message store the 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2379
 * function updates the drive status to EMsvMessageStoreNotSupported and 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2380
 * sends appropriate notification to the client process. The drive's content 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2381
 * will not be visible to any of the client processes.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2382
 * - If the message store/message index database in the media is corrupt, 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2383
 * the server will delete the message store and create a fresh message store
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2384
 * and related files in the media.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2385
 * - If the number of drive already present in the preferred list is eight,
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2386
 * the function will return appropriate error message. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2387
 * - In all cases mentioned above, if the drive is successfully added to the 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2388
 * preferred drive list the function will also update the central repository 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2389
 * with the new preferred drive list.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2390
 */ 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2391
EXPORT_C void RMsvServerSession::AddDriveL(TDriveNumber aDriveNumber, TUint& aPriority)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2392
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2393
	TUint newPriority = aPriority;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2394
	TPckg<TUint> priorityPkg(newPriority);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2395
	if(!RFs::IsValidDrive(aDriveNumber))
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2396
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2397
		User::Leave(KErrArgument);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2398
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2399
	User::LeaveIfError(SendReceive(EMsvAddDriveToDriveList, TIpcArgs(aDriveNumber, aPriority, &priorityPkg)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2400
	aPriority = newPriority;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2401
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2402
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2403
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2404
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2405
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2406
 * RemoveDriveL()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2407
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2408
 * @param  TDriveNumber: Drive number of the drive
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2409
 *						 to be removed.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2410
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2411
 * Code changes for PREQ 557.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2412
 * The function removes the drive from the preferred
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2413
 * drive list. If the current drive is being removed, 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2414
 * the next available drive in the preferred drive list 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2415
 * becomes the current drive. The device internal drive 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2416
 * cannot be removed from the preferred drive list. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2417
 * Appropriate notification will be sent to the client 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2418
 * process if there is a change in the current drive. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2419
 * The function will also update the central repository 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2420
 * accordingly.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2421
 */ 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2422
 EXPORT_C void RMsvServerSession::RemoveDriveL(TDriveNumber aDriveNumber)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2423
 	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2424
	if(!RFs::IsValidDrive(aDriveNumber))
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2425
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2426
		User::Leave(KErrArgument);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2427
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2428
	User::LeaveIfError(SendReceive(EMsvRemoveDriveFromDriveList, TIpcArgs(aDriveNumber)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2429
 	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2430
 	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2431
 	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2432
 	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2433
 /**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2434
 * UpdateDrivePriorityL()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2435
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2436
 * @param  TDriveNumber: Drive number of the drive
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2437
 *						 to be updated.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2438
 * @param  TUint       : Priority of the drive.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2439
 * @return TUint       : New priority of the drive.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2440
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2441
 * Code changes for PREQ 557.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2442
 * The function updates the priority of the drive 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2443
 * already present in the preferred drive list. If 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2444
 * the priority being mentioned is greater than the 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2445
 * number of drive present in the list, the drive 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2446
 * will be added at the end of the preferred drive list. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2447
 * The function will then return the new priority of 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2448
 * the drive. If updating a priority makes a non-current 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2449
 * drive the current drive or vice-versa, the function 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2450
 * will implicitly perform changeDrive() and send the 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2451
 * notification to all registered client. It will return
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2452
 * error if the said drive is not already present in the 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2453
 * preferred drive list.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2454
 */ 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2455
EXPORT_C void RMsvServerSession::UpdateDrivePriorityL(TDriveNumber aDriveNumber, TUint& aPriority)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2456
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2457
	TUint newPriority = aPriority;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2458
	TPckg<TUint> priorityPkg(newPriority);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2459
	if(!RFs::IsValidDrive(aDriveNumber))
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2460
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2461
		User::Leave(KErrArgument);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2462
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2463
	User::LeaveIfError(SendReceive(EMsvUpdateDrivePriority, TIpcArgs(aDriveNumber, aPriority, &priorityPkg)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2464
	aPriority = newPriority;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2465
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2466
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2467
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2468
#if (defined SYMBIAN_MESSAGESTORE_UNIT_TESTCODE)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2469
void RMsvServerSession::ResetRepositoryL()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2470
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2471
	User::LeaveIfError(SendReceive(EMsvResetRepository));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2472
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2473
#endif 	// #if (defined SYMBIAN_MESSAGESTORE_UNIT_TESTCODE)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2474
#endif  // #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT)	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2475
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2476
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2477
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2478
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2479
Gets data from a server MTM that is not related to any operation being performed on
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2480
that MTM.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2481
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2482
@param aServiceId The ID of the service from which to get the data
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2483
@param aType The type of MTM data to get.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2484
@param aMtmData A packaged buffer to store the data
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2485
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2486
@return KErrNone if successful or one of the system wide error codes
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2487
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2488
TInt RMsvServerSession::GetNonOperationMtmData(TMsvId aServiceId, const TNonOperationMtmDataType& aMtmDataType, TDes8& aMtmData)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2489
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2490
	return SendReceive(EMsvGetNonOperationMtmData, TIpcArgs(aServiceId, aMtmDataType, &aMtmData));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2491
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2492
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2493
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2494
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2495
SearchSort Request on Header and/or Body part
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2496
@param aQuery SearchSortQuery object
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2497
@param aOperationId Opertion Id
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2498
@param aMarkQuery TBool for QueryId, whether needs to mark at server side or not
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2499
@param aRequestStatus TRequestStatus status
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2500
@capability WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2501
*/	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2502
void RMsvServerSession::SearchSortRequestOnHeaderBodyL(const CMsvSearchSortQuery* aQuery, TMsvOp aOperationId, TBool aMarkQuery, TRequestStatus& aRequestStatus)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2503
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2504
	TestSlotAvailableL();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2505
	TMsvPackQuery packedQuery(iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2506
	TInt error = packedQuery.PackQuery(aQuery);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2507
	while(error!=KErrNone)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2508
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2509
		// increase the size of the buffer and try again
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2510
		iBuffer->Des().SetLength(0); // to avoid copying contents
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2511
		iBuffer = iBuffer->ReAllocL(iBuffer->Des().MaxSize() + KMsvSessionBufferLength);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2512
		error = packedQuery.PackQuery(aQuery);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2513
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2514
	// pass data to the server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2515
	SendReceive(EMsvSearchSortOperation, TIpcArgs(aOperationId, iBuffer, aMarkQuery), aRequestStatus);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2516
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2517
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2518
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2519
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2520
Get results for given QueryId
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2521
@param aQueryId queryId from client
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2522
@param aOperationId Opertion Id
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2523
@param aIterator Whether results should be send in iterator
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2524
@param aRequestStatus TRequestStatus status
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2525
@capability ReadUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2526
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2527
void RMsvServerSession::GetResultsForQueryId(TInt& aQueryId, TMsvOp aOperationId, TInt aIterator, TRequestStatus& aRequestStatus)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2528
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2529
	SendReceive(EMsvSearchSortQueryId, TIpcArgs(aOperationId, aQueryId, aIterator), aRequestStatus);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2530
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2531
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2532
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2533
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2534
Search Sort Request on TMsvEntry
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2535
@param aQuery SearchSortQuery object
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2536
@param aOperationId Opertion Id
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2537
@param aMarkQuery TBool for QueryId, whether needs to mark at server side or not
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2538
@param aIterator Whether results should be send in iterator
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2539
@param aRequestStatus TRequestStatus status
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2540
@capability ReadUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2541
*/	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2542
void RMsvServerSession::SearchSortRequestOnEntryL(const CMsvSearchSortQuery* aQuery, TMsvOp aOperationId, TBool aMarkQuery, TInt aIterator, TRequestStatus& aRequestStatus)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2543
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2544
	TestSlotAvailableL();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2545
	// package up the query into a query entry
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2546
	TMsvPackQuery packedQuery(iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2547
	TInt error = packedQuery.PackQuery(aQuery);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2548
	while(error!=KErrNone)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2549
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2550
		// increase the size of the buffer and try again
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2551
		iBuffer->Des().SetLength(0); // to avoid copying contents
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2552
		iBuffer = iBuffer->ReAllocL(iBuffer->Des().MaxSize() + KMsvSessionBufferLength);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2553
		error = packedQuery.PackQuery(aQuery);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2554
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2555
	SendReceive(EMsvSearchSortOnIndexEntry, TIpcArgs(aOperationId, iBuffer, aMarkQuery, aIterator), aRequestStatus);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2556
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2557
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2558
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2559
Get search sort results as TMsvId
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2560
@param aId RArray of TMsvId's sent by server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2561
@capability ReadUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2562
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2563
void RMsvServerSession::GetResultAsIdL(RArray<TMsvId>& aId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2564
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2565
	TBool resultType=ETrue; // result as TMsvId
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2566
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2567
	// pass the buffer to receive the data through
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2568
	TPtr8 ptr=iBuffer->Des();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2569
	// signal the server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2570
	TInt error = SendReceive(EMsvGetResult,TIpcArgs(&resultType, &ptr));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2571
	while(error == KErrOverflow)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2572
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2573
		// increase the size of the buffer and try again
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2574
		iBuffer->Des().SetLength(0);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2575
		iBuffer = iBuffer->ReAllocL(iBuffer->Des().MaxSize() + KMsvSessionBufferLength);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2576
		// pass the buffer to receive the data through
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2577
		TPtr8 ptr=iBuffer->Des();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2578
		error = SendReceive(EMsvGetResult,TIpcArgs(&resultType, &ptr));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2579
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2580
	User::LeaveIfError(error);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2581
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2582
	// unpack the entries from the buffer
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2583
	TMsvPackedIdOperation packedIdOperation(iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2584
	packedIdOperation.UnpackL(aId);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2585
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2586
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2587
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2588
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2589
Get search sort Request QueryId
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2590
@param aQueryId get aQueryId from server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2591
@capability ReadUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2592
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2593
void RMsvServerSession::GetSearchSortRequestQueryIdL(TInt& aQueryId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2594
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2595
	TPckg<TInt> queryId(aQueryId); 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2596
	User::LeaveIfError(SendReceive(EMsvGetQueryId,TIpcArgs(&queryId)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2597
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2598
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2599
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2600
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2601
Unmark the QueryId it was marked at server side
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2602
@param aQueryId Unmark the aQueryId at server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2603
@capability WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2604
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2605
void RMsvServerSession::UnmarkSearchSortRequestQueryIdL(TInt aQueryId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2606
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2607
	User::LeaveIfError(SendReceive(EMsvUnmarQueryId,TIpcArgs(&aQueryId)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2608
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2609
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2610
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2611
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2612
Sending TMsvId along with Sort filed to server, so that it will update the data in search-sort cache. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2613
@param aOperationId Opertion Id
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2614
@param aTMsvIdWithSortField RArray of TMsvId along with Sort filed.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2615
@param aRequestStatus TRequestStatus status
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2616
@capability WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2617
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2618
void RMsvServerSession::SendResultantListL(TMsvOp aOperationId, RArray<TMsvIdWithSortField> aTMsvIdWithSortField, TRequestStatus& aRequestStatus)	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2619
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2620
	TestSlotAvailableL();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2621
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2622
	// need to pack TMsvId and TMessagePart (i.e TMsvId and Sort field)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2623
	TMsvPackedIdAndMessagePart packIdAndMessagePart;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2624
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2625
	// calculate size of the TTMsvIdWithMessagePart
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2626
	TInt bufferSize = packIdAndMessagePart.Size(aTMsvIdWithSortField);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2627
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2628
	// if size lessthan KMsvSessionBufferLength, allocate KMsvSessionBufferLength to sync with iBuffer initial allocation.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2629
	if(bufferSize < KMsvSessionBufferLength)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2630
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2631
		bufferSize = KMsvSessionBufferLength;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2632
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2633
		
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2634
	// allocate the buffer
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2635
	CBufFlat* flat = CBufFlat::NewL(bufferSize);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2636
	CleanupStack::PushL(flat);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2637
	flat->ExpandL(0, bufferSize);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2638
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2639
	RBufWriteStream writeStream(*flat);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2640
	CleanupClosePushL (writeStream);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2641
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2642
	// Externalize the data availbe in TTMsvIdWithMessagePart
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2643
	packIdAndMessagePart.ExternalizeL(writeStream, aTMsvIdWithSortField);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2644
	TPtr8 ptr8 = flat->Ptr(0);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2645
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2646
	// delete memory allocated for iBuffer
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2647
	if(iBuffer != NULL)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2648
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2649
		delete iBuffer;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2650
		iBuffer = NULL;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2651
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2652
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2653
	//Convert CBufFlat into a HBufC8
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2654
	iBuffer = ptr8.AllocL();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2655
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2656
	// send to server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2657
	SendReceive(EMsvIdWithSortFiled, TIpcArgs(aOperationId, iBuffer), aRequestStatus);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2658
	CleanupStack::PopAndDestroy(2, flat);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2659
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2660
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2661
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2662
Sending result to server, this needs be sorted along with existing partial query.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2663
@param aOperationId Opertion Id
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2664
@param aIdArray RArray of TMsvId 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2665
@param aRequestStatus TRequestStatus status
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2666
@capability WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2667
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2668
void RMsvServerSession::SendNewResultsToServerForSortL(TMsvOp aOperationId, RArray<TMsvId>& aIdArray, TRequestStatus& aRequestStatus)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2669
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2670
	TestSlotAvailableL();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2671
	TMsvPackedIdOperation op(iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2672
	TInt error = op.Pack(aIdArray);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2673
	while (error != KErrNone)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2674
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2675
		// increase the size of the buffer and try again
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2676
		iBuffer->Des().SetLength(0); // to avoid copying contents
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2677
		iBuffer = iBuffer->ReAllocL(iBuffer->Des().MaxSize() + KMsvSessionBufferLength);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2678
		error = op.Pack(aIdArray);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2679
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2680
	SendReceive(EMsvUpdateAndSort, TIpcArgs(aOperationId, iBuffer), aRequestStatus);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2681
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2682
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2683
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2684
Get list TMsvId from the server.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2685
The list of TMsvId's may be 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2686
    case i)   Final Result
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2687
    case ii)  Partial Result
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2688
    case iii) New Query, needs search on Header and/or Body
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2689
@param aId RArray of TMsvId's (for case i & ii)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2690
@param aResultStatus Result status, it will tell what kind of result it is..
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2691
@capability ReadUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2692
*/	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2693
void RMsvServerSession::GetResultAsIdL(RArray<TMsvId>& aId, TInt &aResultStatus)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2694
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2695
	// pass the buffer to receive the data through
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2696
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2697
	TPtr8 ptr=iBuffer->Des();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2698
	TPckg<TInt> resultStatus(aResultStatus);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2699
		
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2700
	// signal the server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2701
	TInt error = SendReceive(EMsvGetIdsOrResult,TIpcArgs(&ptr, &resultStatus));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2702
	while(error == KErrOverflow)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2703
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2704
		// increase the size of the buffer and try again
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2705
		iBuffer->Des().SetLength(0);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2706
		iBuffer = iBuffer->ReAllocL(iBuffer->Des().MaxSize() + KMsvSessionBufferLength);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2707
		
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2708
		// pass the buffer to receive the data through
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2709
		TPtr8 ptr=iBuffer->Des();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2710
		error = SendReceive(EMsvGetIdsOrResult,TIpcArgs(&ptr, &resultStatus));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2711
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2712
	User::LeaveIfError(error);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2713
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2714
	// unpack aId from the buffer
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2715
	TMsvPackedIdOperation packedIdOperation(iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2716
	packedIdOperation.UnpackL(aId);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2717
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2718
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2719
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2720
Get next TMsvEntry from server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2721
@param aEntry next result as TMsvEntry
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2722
@capability ReadUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2723
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2724
void RMsvServerSession::GetNextEntryL(TMsvEntry& aEntry, TInt& aCount)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2725
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2726
	TPckg<TInt> count(aCount);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2727
	// pass the buffer to receive the data through
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2728
	TPtr8 ptr=iBuffer->Des();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2729
	// signal the server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2730
	TInt error = SendReceive(EMsvGetNextEntry,TIpcArgs(&ptr, &count));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2731
	while(error == KErrOverflow)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2732
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2733
		// increase the size of the buffer and try again
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2734
		iBuffer->Des().SetLength(0);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2735
		iBuffer = iBuffer->ReAllocL(iBuffer->Des().MaxSize() + KMsvSessionBufferLength);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2736
		// pass the buffer to receive the data through
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2737
		TPtr8 ptr=iBuffer->Des();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2738
		error = SendReceive(EMsvGetNextEntry,TIpcArgs(&ptr, &count));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2739
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2740
	User::LeaveIfError(error);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2741
	TMsvPackedEntry packedEntry(iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2742
	packedEntry.UnpackEntry(aEntry);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2743
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2744
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2745
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2746
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2747
Get next TMsvId from server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2748
@param aId next result as TMsvId
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2749
@capability ReadUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2750
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2751
void RMsvServerSession::GetNextIdL(TMsvId& aId, TInt& aCount)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2752
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2753
	TPckg<TMsvId> tmsvId(aId);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2754
	TPckg<TInt> count(aCount);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2755
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2756
	TInt error = SendReceive(EMsvGetNextId,TIpcArgs(&tmsvId, &count));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2757
	User::LeaveIfError(error);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2758
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2759
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2760
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2761
Get Result count from server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2762
@param aCount Result count
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2763
@capability ReadUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2764
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2765
void RMsvServerSession::GetResultCountL(TInt& aCount)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2766
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2767
	TPckg<TInt> count(aCount);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2768
	// get result count from server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2769
	User::LeaveIfError(SendReceive(EMsvGetResultCount,TIpcArgs(&count)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2770
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2771
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2772
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2773
Get Search sort request from server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2774
This Query is requied in case partial result for the QueryId
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2775
@param aQuery Search Sort Query object
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2776
@param aOpId Opertion Id
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2777
@capability ReadUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2778
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2779
void RMsvServerSession::GetQueryFromServerL(TMsvOp aOperationId, TInt aQueryId, CMsvSearchSortQuery* aQuery)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2780
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2781
	// pass the buffer to receive the query data
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2782
	TPtr8 ptr=iBuffer->Des();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2783
	// signal the server
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2784
	TInt error = SendReceive(EMsvQueryData,TIpcArgs(aOperationId, aQueryId, &ptr));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2785
	while(error == KErrOverflow)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2786
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2787
		// increase the size of the buffer and try again
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2788
		iBuffer->Des().SetLength(0);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2789
		iBuffer = iBuffer->ReAllocL(iBuffer->Des().MaxSize() + KMsvSessionBufferLength);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2790
		// pass the buffer to receive the data through
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2791
		TPtr8 ptr=iBuffer->Des();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2792
		error = SendReceive(EMsvQueryData,TIpcArgs(aOperationId, aQueryId, &ptr));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2793
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2794
	User::LeaveIfError(error);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2795
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2796
	TMsvPackQuery packedQuery(iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2797
	packedQuery.UnpackQuery(aQuery);	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2798
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2799
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2800
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2801
Get Progress information from the server for a given Request.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2802
@param aOperationProgress Operation progress
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2803
@param aOpId Opertion Id
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2804
@capability ReadUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2805
*/	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2806
void RMsvServerSession::SearchSortOperationProgressL(TMsvOp aOperationId, TInt aOperationProgress)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2807
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2808
	TPckg<TInt> progressInfo(aOperationProgress);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2809
	User::LeaveIfError(SendReceive(EMsvGetSearchSortProgress,TIpcArgs(aOperationId, &progressInfo)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2810
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2811
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2812
/** 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2813
Cancel current saerch sort Request.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2814
@param aOpId Opertion Id
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2815
@capability ReadUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2816
*/	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2817
int RMsvServerSession::CancelSearchSortOperation(TMsvOp aOperationId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2818
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2819
	TInt error = SendReceive(EMsvCancelSearchSortOp,TIpcArgs(aOperationId));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2820
	return error;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2821
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2822
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2823
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2824
#if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2825
#if (defined SYMBIAN_MESSAGESTORE_UNIT_TESTCODE)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2826
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2827
Print cache structure in a log file.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2828
*/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2829
EXPORT_C void RMsvServerSession::PrintCache()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2830
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2831
	SendReceive(EMsvPrintCache);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2832
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2833
#endif
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2834
#endif
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2835
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2836
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2837
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2838
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2839
#if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2840
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2841
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2842
 * CreateStoreL()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2843
 * 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2844
 * A headerStore is associated with a mtm type and stores message header
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2845
 * data. Message server creates a separate store for each MTM type. A 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2846
 * header-entry in the headerStore is essentially a list of UID-Data entries.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2847
 * For example an email header-entry can have CImHeader, MIME header and 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2848
 * encoded header stored as a separate UID-Data entry in the header store.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2849
 * By default a UID-Data entry will have a "Default" field which store the
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2850
 * content of 'Data'. Moreover one such UID-Data pair can also specify mutiple
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2851
 * fields such that it can store individual portion of data in such fields 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2852
 * separately. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2853
 * 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2854
 * @param TUid: MtmId of the header store.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2855
 * @param RPointerArray<aFieldDetails>: Structure of the Data fields in a UID-Data pair.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2856
 * The store by default add a 'Details' field to store the content of data.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2857
 * @return None.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2858
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2859
 * @leave: All System wide error code.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2860
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2861
 * @capability WriteDeviceData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2862
 */
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2863
void RMsvServerSession::CreateStoreL(const TUid& aMtmId, const RPointerArray<CFieldPair>& aFieldDetails)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2864
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2865
	TMsvPackedHeaderStructure packedHeaderStruct(iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2866
	TInt error = packedHeaderStruct.Pack(aFieldDetails);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2867
	while(error!=KErrNone)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2868
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2869
		// increase the size of the buffer and try again
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2870
		iBuffer->Des().SetLength(0); // to avoid copying contents
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2871
		iBuffer = iBuffer->ReAllocL(iBuffer->Des().MaxSize() + KMsvSessionBufferLength); 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2872
		error = packedHeaderStruct.Pack(aFieldDetails);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2873
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2874
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2875
	// package up the entry into a packed entry
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2876
	User::LeaveIfError(SendReceive(EMsvCreateStore, TIpcArgs(aMtmId.iUid, iBuffer)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2877
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2878
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2879
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2880
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2881
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2882
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2883
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2884
 * DoesStoreExistsL()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2885
 * 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2886
 * The function checks the existence of a header store
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2887
 * for a given MTM Id. The function can be called to 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2888
 * check if the header store already exist before creating
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2889
 * the store.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2890
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2891
 * @param TUid: Mtm UID of the store.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2892
 * @return TBool: ETrue, if the store exists, else EFalse.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2893
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2894
 * @capability ReadDeviceData 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2895
 */
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2896
TBool RMsvServerSession::DoesStoreExistsL(const TUid& aMtmId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2897
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2898
	TPckg<TBool> isStoreExists = EFalse;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2899
	User::LeaveIfError(SendReceive(EMsvCheckStoreExists, TIpcArgs(aMtmId.iUid, &isStoreExists)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2900
	return isStoreExists();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2901
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2902
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2903
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2904
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2905
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2906
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2907
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2908
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2909
 * LastErrorMessageL()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2910
 * 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2911
 * The function returns the detail error message 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2912
 * received while creating the header store.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2913
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2914
 * @param HBufC*: Error message text.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2915
 * @return None.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2916
 * @leave: All system wide error code.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2917
 */
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2918
void RMsvServerSession::LastErrorMessageL(HBufC*& aErrorMsg)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2919
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2920
	TPtr8 ptr8 = iBuffer->Des();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2921
	User::LeaveIfError(SendReceive(EMsvLastErrorMessage, TIpcArgs(&ptr8)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2922
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2923
	TInt* ptr = (TInt*) CONST_CAST(TUint8*, iBuffer->Ptr());
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2924
	TInt textSize = *ptr++;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2925
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2926
	TPtrC16 ptrBuf;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2927
	const TText* textPtr = (TText*)ptr;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2928
	ptrBuf.Set(textPtr, (textSize/2));	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2929
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2930
	aErrorMsg = ptrBuf.AllocL();
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2931
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2932
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2933
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2934
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2935
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2936
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2937
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2938
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2939
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2940
 * CreateHeaderEntryL()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2941
 * 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2942
 * This function creates a new message header in the header-store. A message header is
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2943
 * essentially a list of UID-Data entry. At most one entry in the list must have 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2944
 * values for all the fields created in the header store. Rest all entries should have
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2945
 * values for only default field 'Details'.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2946
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2947
 * @param TUid: MtmId to identify the header table.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2948
 * @param TMsvId: Metadata Entry Id.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2949
 * @param RPointerArray<CHeaderFields>: Header details.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2950
 * @return None.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2951
 * @leave KErrAlreadyExists, if entry already exists.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2952
 * @leave KErrArgument, if incorrect arguments and system wide leave code.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2953
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2954
 * @capability WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2955
 */	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2956
EXPORT_C void RMsvServerSession::CreateHeaderEntryL(const TUid& aMtmId, TMsvId aEntryId, const RPointerArray<CHeaderFields>& aFieldPairList)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2957
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2958
	TMsvPackedHeaderData packedHeaderData(iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2959
	TInt error = packedHeaderData.Pack(aFieldPairList);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2960
	while(error!=KErrNone)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2961
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2962
		// increase the size of the buffer and try again
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2963
		iBuffer->Des().SetLength(0); // to avoid copying contents
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2964
		iBuffer = iBuffer->ReAllocL(iBuffer->Des().MaxSize() + KMsvSessionBufferLength); 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2965
		error = packedHeaderData.Pack(aFieldPairList);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2966
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2967
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2968
	User::LeaveIfError(SendReceive(EMsvCreateHeaderEntry, TIpcArgs(aMtmId.iUid, aEntryId, iBuffer)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2969
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2970
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2971
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2972
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2973
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2974
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2975
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2976
 * LoadHeaderEntryL()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2977
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2978
 * This function loads the header entry from the header-store
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2979
 * and returns to the client.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2980
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2981
 * @param TUid: MtmId to identify the header table.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2982
 * @param TMsvId: Metadata Entry Id.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2983
 * @param RPointerArray<CHeaderFields>: Header entry details.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2984
 * @return None.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2985
 * @leave KErrNotFound: If entry not found. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2986
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2987
 * @capability ReadUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2988
 */	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2989
 EXPORT_C void RMsvServerSession::LoadHeaderEntryL(const TUid& aMtmId, TMsvId aEntryId, RPointerArray<CHeaderFields>& aFieldPairList)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2990
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2991
	TPtr8 ptr = iBuffer->Des();	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2992
	User::LeaveIfError(SendReceive(EMsvLoadHeaderEntry, TIpcArgs(aMtmId.iUid, aEntryId, &ptr)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2993
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2994
	TMsvPackedHeaderData packedHeaderData(iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2995
	TRAPD(error, packedHeaderData.UnpackL(aFieldPairList));	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2996
	while(error!=KErrNone)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2997
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2998
		// increase the size of the buffer and try again
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  2999
		iBuffer->Des().SetLength(0); // to avoid copying contents
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3000
		iBuffer = iBuffer->ReAllocL(iBuffer->Des().MaxSize() + KMsvSessionBufferLength); 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3001
		TRAP(error, packedHeaderData.UnpackL(aFieldPairList));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3002
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3003
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3004
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3005
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3006
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3007
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3008
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3009
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3010
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3011
 * DeleteHeaderEntryL()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3012
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3013
 * This function deletes the header entry from the header-store.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3014
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3015
 * @param aMtmId: MtmId to identify the header table.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3016
 * @param aEntryId: Entry Id.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3017
 * @return None.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3018
 * @leave KErrNotFound: If entry not found. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3019
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3020
 * @capability WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3021
 */		
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3022
EXPORT_C void RMsvServerSession::DeleteHeaderEntryL(const TUid& aMtmId, TMsvId aEntryId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3023
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3024
	User::LeaveIfError(SendReceive(EMsvDeleteHeaderEntry, TIpcArgs(aMtmId.iUid, aEntryId)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3025
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3026
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3027
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3028
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3029
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3030
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3031
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3032
 * UpdateHeaderEntryL()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3033
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3034
 * This function udpates the header entry in the header-store. A header entry is 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3035
 * essentially a list of UID-String combination which is stored as a separate 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3036
 * element in the passed header structure. 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3037
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3038
 * If the number of UID-String element in the passed header structure is more
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3039
 * than what is present in the DB, the function inserts the new UID-String entry
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3040
 * in the header store. And if the few entries are missing from the passed header 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3041
 * structure the function deletes the extra entry from the header store.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3042
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3043
 * @param TUid: MtmId to identify the header table.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3044
 * @param TMsvId: Entry Id.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3045
 * @param RPointerArray<CHeaderFields>: Header entry details.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3046
 * @return None.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3047
 * @leave KErrNotFound, if entry to be updated not found and all system wide leave code.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3048
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3049
 * @capability WriteUserData
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3050
 */	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3051
EXPORT_C void RMsvServerSession::UpdateHeaderEntryL(const TUid& aMtmId, TMsvId aEntryId, const RPointerArray<CHeaderFields>& aFieldPairList)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3052
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3053
	TMsvPackedHeaderData packedHeaderData(iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3054
	TInt error = packedHeaderData.Pack(aFieldPairList);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3055
	while(error!=KErrNone)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3056
		{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3057
		// increase the size of the buffer and try again
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3058
		iBuffer->Des().SetLength(0); // to avoid copying contents
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3059
		iBuffer = iBuffer->ReAllocL(iBuffer->Des().MaxSize() + KMsvSessionBufferLength); 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3060
		error = packedHeaderData.Pack(aFieldPairList);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3061
		}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3062
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3063
	User::LeaveIfError(SendReceive(EMsvUpdateHeaderEntry, TIpcArgs(aMtmId.iUid, aEntryId, iBuffer)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3064
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3065
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3066
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3067
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3068
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3069
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3070
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3071
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3072
 * DoesAnyStoreExists()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3073
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3074
 * This function checks if the store (header/body) exists 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3075
 * for a given metadata entry.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3076
 */	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3077
EXPORT_C TBool RMsvServerSession::DoesAnyStoreExists(TMsvId aId, TUid aMtmId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3078
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3079
	return SendReceive(EMsvCheckAnyStoreExists, TIpcArgs(aId, aMtmId.iUid));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3080
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3081
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3082
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3083
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3084
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3085
/**
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3086
 * DoesHeaderTableExist()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3087
 *
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3088
 * This function checks if the header table exists
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3089
 * for a given MTM type.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3090
 */	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3091
EXPORT_C TBool RMsvServerSession::DoesHeaderTableExist(const TUid& aMtmId)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3092
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3093
	return SendReceive(EMsvCheckHeaderTableExist, TIpcArgs(aMtmId.iUid));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3094
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3095
	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3096
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3097
/********************************Converter API's***************************/
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3098
/*
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3099
 GetConvertibleDriveListL()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3100
 Fetches a list of unsupported drives. Any drive is rendered unsupported
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3101
 if the message store version is less than current message store version.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3102
 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3103
 @param aDriveList: RArray containing unsupported drive numbers.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3104
 @return None 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3105
 */
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3106
void RMsvServerSession::GetConvertibleDriveListL(RArray<TDriveNumber>& aDriveList)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3107
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3108
	TPtr8 ptr = iBuffer->Des();	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3109
	User::LeaveIfError(SendReceive(EMsvGetConvertibleDriveList, TIpcArgs(&ptr)));	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3110
	// Unpack the entries from the buffer.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3111
	TMsvPackedDriveIdOperation packedDriveIdOperation(iBuffer);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3112
	packedDriveIdOperation.UnpackL(aDriveList);	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3113
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3114
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3115
/*
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3116
 ConvertMessageStore()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3117
 Starts message store conversion on a drive asynchronously.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3118
 The message store to be converted is identified by the drive number
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3119
 Message store conversion is an asynchronous operation and the client gets
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3120
 notified by TRequestStatus variable.Message store conversion starts only when
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3121
 the drive meets different validation criteria.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3122
   
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3123
 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3124
 @param aDrive: Drive number.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3125
 @param aRequestStatus: Indicates the completion status of a request made to a service provider..
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3126
 @return None 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3127
 */
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3128
void RMsvServerSession::ConvertMessageStore(TDriveNumber aDrive,TRequestStatus& aRequestStatus)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3129
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3130
	aRequestStatus=KRequestPending;
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3131
	SendReceive(EMsvConvertMessageStore, TIpcArgs(aDrive), aRequestStatus);
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3132
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3133
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3134
/*
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3135
 GetConversionStatusL()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3136
 Gets the conversion status for the specified drive
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3137
 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3138
 @param aDrive: Drive number.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3139
 @return None 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3140
 */
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3141
void RMsvServerSession::GetConversionStatusL(TDriveNumber aDrive)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3142
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3143
	User::LeaveIfError(SendReceive(EMsvGetConversionStatus, TIpcArgs(aDrive)));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3144
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3145
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3146
/*
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3147
 CancelConversion()
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3148
 Cancels conversion for the specified drive.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3149
 
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3150
 @param aDrive: Drive number.
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3151
 @return TInt: System wide error codes
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3152
 */	
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3153
TInt RMsvServerSession::CancelConversion(TDriveNumber aDrive)
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3154
	{
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3155
	return SendReceive(EMsvCancelConversionRequest, TIpcArgs(aDrive));
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3156
	}
db3f5fa34ec7 201044_02
hgs
parents:
diff changeset
  3157
#endif			// #if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB)