messagingfw/msgsrvnstore/server/src/MCLIENT.CPP
changeset 40 320ec5cd0227
parent 0 8e480a14352b
equal deleted inserted replaced
33:61f466445ae5 40:320ec5cd0227
   455 	TestSlotAvailableL();
   455 	TestSlotAvailableL();
   456 	SendEntryDataL(aOperationId, aEntry);
   456 	SendEntryDataL(aOperationId, aEntry);
   457 	User::LeaveIfError(SendReceive(EMsvChangeEntry, TIpcArgs(aOperationId, aOwnerId)));
   457 	User::LeaveIfError(SendReceive(EMsvChangeEntry, TIpcArgs(aOperationId, aOwnerId)));
   458 	}
   458 	}
   459 
   459 
       
   460 /**
       
   461 Update the specified Changes to selection of TMsvId (asynchronously).
       
   462 
       
   463 @param aSelection The IDs of the entry to Change. 
       
   464 @param aMark The read/Unread value.  
       
   465 @param aOperationId Operation identifier
       
   466 @param aOwnerId The ID of the owning process
       
   467 @param aRequestStatus Asynchronous request status
       
   468 
       
   469 */
       
   470 
       
   471 void RMsvServerSession::ChangeEntriesL(const CMsvEntrySelection& aSelection, TBool aMark ,TMsvOp aOperationId, TSecureId aOwnerId, TRequestStatus& aRequestStatus)
       
   472     {
       
   473      TestSlotAvailableL();
       
   474      TInt markvalue = (TInt)aMark;
       
   475      SendOperationDataL(aOperationId, aSelection, markvalue);
       
   476      aRequestStatus=KRequestPending;
       
   477      SendReceive(EMsvChangeEntries, TIpcArgs(aOperationId, aOwnerId), aRequestStatus);
       
   478     }
   460 
   479 
   461 /**
   480 /**
   462 Gets the index entry with the specified unique id.
   481 Gets the index entry with the specified unique id.
   463 @param aId ID of the entry to get
   482 @param aId ID of the entry to get
   464 @param aService On return, the ID of the service to which the entry belongs
   483 @param aService On return, the ID of the service to which the entry belongs
   470 @capability ReadUserData This is required to access any entry where the condition 
   489 @capability ReadUserData This is required to access any entry where the condition 
   471 described for no capabilities does not apply.
   490 described for no capabilities does not apply.
   472 */
   491 */
   473 EXPORT_C TInt RMsvServerSession::GetEntry(TMsvId aId, TMsvId& aService, TMsvEntry& aEntry)
   492 EXPORT_C TInt RMsvServerSession::GetEntry(TMsvId aId, TMsvId& aService, TMsvEntry& aEntry)
   474 	{
   493 	{
   475 	TRAPD(error, DoGetEntryL(aId, aService, aEntry));
   494     // pass the buffer and its max length to receive the data through
   476 	return error;
   495     TPtr8 ptr=iBuffer->Des();
   477 	}
   496     TInt maxLength = iBuffer->Des().MaxLength();
   478 
   497     
   479 void RMsvServerSession::DoGetEntryL(TMsvId aId, TMsvId& aService, TMsvEntry& aEntry)
       
   480 	{
       
   481 	// pass the buffer to receive the data through
       
   482 	TPtr8 ptr=iBuffer->Des();
       
   483 	// get the service the entry i sunder
       
   484 	TPckg<TMsvId> service(aService);
       
   485 	// signal the server
   498 	// signal the server
   486 	TInt error = SendReceive(EMsvGetEntry,TIpcArgs(aId,&ptr,&service));
   499     TInt error = SendReceive(EMsvGetEntry,TIpcArgs(aId, &ptr, maxLength));
   487 	while(error == KErrOverflow)
   500     while(error == KErrOverflow)
   488 		{
   501         {
   489 		// increase the size of the buffer and try again
   502         // increase the size of the buffer and try again
   490 		iBuffer->Des().SetLength(0);
   503         iBuffer->Des().SetLength(0);
   491 		iBuffer = iBuffer->ReAllocL(iBuffer->Des().MaxSize() + KMsvSessionBufferLength);
   504         // TRAP here and return if leaving with error
   492 		// pass the buffer to receive the data through
   505         TRAP(error, iBuffer = iBuffer->ReAllocL(iBuffer->Des().MaxSize() + KMsvSessionBufferLength));
   493 		TPtr8 ptr=iBuffer->Des();
   506         if( error != KErrNone)
   494 		error = SendReceive(EMsvGetEntry,TIpcArgs(aId,&ptr,&service));
   507 			{
   495 		}
   508             break;
   496 	User::LeaveIfError(error);
   509 			}
   497 	TMsvPackedEntry packedEntry(iBuffer);
   510         // pass the buffer to receive the data through
   498 	packedEntry.UnpackEntry(aEntry);
   511         TPtr8 ptr=iBuffer->Des();
       
   512         maxLength = iBuffer->Des().MaxLength();
       
   513         error = SendReceive(EMsvGetEntry,TIpcArgs(aId,&ptr,maxLength));
       
   514         }
       
   515 
       
   516     if( error == KErrNone)
       
   517         {
       
   518         TMsvPackedEntry packedEntry(iBuffer);
       
   519         // Unpack the entry and servie id from same buffer
       
   520         packedEntry.UnpackEntryAndService(aEntry, aService);
       
   521         }
       
   522 
       
   523     return error;
   499 	}
   524 	}
   500 
   525 
   501 /**
   526 /**
   502 Gets the children of the index entry with the specified unique id.
   527 Gets the children of the index entry with the specified unique id.
   503 
   528