messagingfw/wappushfw/SISLPushMsgUtils/src/SISLPushMsgUtils.cpp
changeset 0 8e480a14352b
child 58 6c34d0baa0b1
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     1 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <smut.h>
       
    17 #include <msvstd.h>
       
    18 #include <msventry.h>
       
    19 #include <msvids.h>
       
    20 #include <msvuids.h>
       
    21 #include <watcher.h>
       
    22 #include <push/pushlog.h>
       
    23 #include <pushentry.h>
       
    24 
       
    25 #include  <push/sislpushmsgutils.h>
       
    26 #include <push/csipushmsgentry.h>
       
    27 #include <push/cslpushmsgentry.h>
       
    28 
       
    29 
       
    30 /**
       
    31 Allocates and constructs a new SISL Push Message Utility object.
       
    32 
       
    33 @return 
       
    34 New SISL Push Message Utility object.
       
    35 */
       
    36 EXPORT_C CSISLPushMsgUtils* CSISLPushMsgUtils::NewL()
       
    37 	{
       
    38 	CSISLPushMsgUtils* self = new (ELeave) CSISLPushMsgUtils();
       
    39 	CleanupStack::PushL(self);
       
    40 	self->ConstructL();
       
    41 	CleanupStack::Pop();
       
    42 	return self;
       
    43 	}
       
    44 
       
    45 
       
    46 /**
       
    47 Constructor.  
       
    48 */
       
    49 CSISLPushMsgUtils::CSISLPushMsgUtils() : CWapPushMsgUtils()
       
    50 	{
       
    51 	}
       
    52 
       
    53 
       
    54 /**
       
    55 Constructor. Creates CMsvSession and CMsvEntry.   
       
    56 */
       
    57 void CSISLPushMsgUtils::ConstructL()
       
    58 	{
       
    59 	CWapPushMsgUtils::ConstructL();
       
    60 	}
       
    61 
       
    62 
       
    63 /**
       
    64 Destructor.
       
    65 */
       
    66 EXPORT_C CSISLPushMsgUtils::~CSISLPushMsgUtils()
       
    67 	{
       
    68 	}
       
    69 
       
    70 
       
    71 /**
       
    72 Locates a selection of SI entries with the specified ID. 
       
    73 
       
    74 Assumes that all SI entries are saved as children of the Push Service Message Folder. 
       
    75 If the id of the Push Message Folder happens to be Null, it gets the Id of the folder.
       
    76 
       
    77 The return value CMsvEntrySelection is on the Cleanup Stack.
       
    78 
       
    79 @param aSiId 
       
    80 Id of SI message to locate
       
    81 
       
    82 @return 
       
    83 Id of the message entries if it exists, or KMsvNullIndexEntryId if it doesn't.
       
    84 */
       
    85 EXPORT_C CMsvEntrySelection* CSISLPushMsgUtils::FindSiIdLC(const TDesC& aSiId)
       
    86 	{
       
    87 	CMsvEntrySelection* matching = new (ELeave) CMsvEntrySelection;
       
    88 	CleanupStack::PushL(matching);
       
    89 	
       
    90 	CSIPushMsgEntry* siEntry = CSIPushMsgEntry::NewL();
       
    91 	CleanupStack::PushL(siEntry);
       
    92 
       
    93 	if (iPushFolderId == KMsvNullIndexEntryId)
       
    94 		GetPushMsgFolderIdL(iPushFolderId);
       
    95 	iMsvEntry->SetEntryL(iPushFolderId);
       
    96 
       
    97 	CMsvEntrySelection* children;
       
    98 	children = GetChildrenWithMtmLC(KUidMtmWapPush);//leave children on CleanupStack 
       
    99 	
       
   100 	TInt numEntries= children->Count();
       
   101 	TMsvEntry currentEntry;
       
   102 
       
   103 	// loop until we find a match or reach the end of the SI entries
       
   104 	for (TInt count=0; count<numEntries; count++)
       
   105 		{
       
   106 		iMsvEntry->SetEntryL(children->At(count));
       
   107 		currentEntry = iMsvEntry->Entry();
       
   108 		// Hard coded check for the Message Push Type
       
   109 		if (currentEntry.iBioType == KUidWapPushMsgSI.iUid) //It's an SI message!
       
   110 			{
       
   111 			siEntry->SetEntry(currentEntry);
       
   112 			siEntry->RetrieveL(*iMsvSession, currentEntry.Id());
       
   113 			if (aSiId.CompareF( siEntry->Id()) ==0)// Found a match
       
   114 				matching->AppendL( currentEntry.Id());       // get the Id to return
       
   115 			}
       
   116 		}
       
   117 	CleanupStack::PopAndDestroy(2); // children, siEntry
       
   118 
       
   119 	return matching; //Still on CleanupStack
       
   120 	}
       
   121 
       
   122 
       
   123 /**
       
   124 Finds any entry with the specified Url and Push Message Type Uid.
       
   125 
       
   126 The function assumes that the entries are stored under the Push Message Folder Entry. 
       
   127  
       
   128 @param aUrl 
       
   129 URL to find
       
   130 
       
   131 @param aPushType 
       
   132 Push Message type to filter entries.
       
   133 
       
   134 @return 
       
   135 Message entry for the specified Url and message type, 
       
   136 or KMsvNullIndexEntryId if a match is not found.
       
   137 
       
   138 @leave KErrNotFound Could not locate a SISL Push message with the specified URL and push type.
       
   139 @leave CSISLPushMsgUtils::GetPushMsgFolderIdL
       
   140 @leave CMsvEntry::SetEntryL
       
   141 @leave CMsvEntry::HasStoreL
       
   142 @leave CMsvEntry::ReadStoreL
       
   143 @leave CMsvStore::IsPresentL
       
   144 @leave CMsvEntry::EntryId
       
   145 @leave CMsvStore::RetrieveL
       
   146 */
       
   147 EXPORT_C TMsvId CSISLPushMsgUtils::FindUrlL(const TDesC& aUrl, TUid aPushType)
       
   148 	{
       
   149 	//Finds all of the entries with the Push Mtm type, 
       
   150 	//and then checks if each that has the correct Push Message Type, until either a match is 
       
   151 	//found or there are no more entries.
       
   152 
       
   153 	TMsvId pushID = KMsvNullIndexEntryId;
       
   154 
       
   155 	if (iPushFolderId == KMsvNullIndexEntryId)
       
   156 		GetPushMsgFolderIdL(iPushFolderId);
       
   157 	iMsvEntry->SetEntryL(iPushFolderId);
       
   158 
       
   159 	CMsvEntrySelection* children;
       
   160 	children = GetChildrenWithMtmLC(KUidMtmWapPush);//leave children on CleanupStack
       
   161 
       
   162 	TInt numEntries= children->Count();
       
   163 	TMsvEntry currentEntry;
       
   164 
       
   165 	// loop until we find a match or reach the end of the SI entries
       
   166 	for (TInt count=0; count<numEntries  && pushID == KMsvNullIndexEntryId; count++)
       
   167 		{
       
   168 		iMsvEntry->SetEntryL(children->At(count));
       
   169 		currentEntry = iMsvEntry->Entry();
       
   170 		if (currentEntry.iBioType == aPushType.iUid && iMsvEntry->HasStoreL()) 
       
   171 			//It's the right type of message!
       
   172 			{
       
   173 			CPushMsgEntryBase* pushEntry = GetPushMsgEntryL(aPushType);
       
   174 			if (pushEntry)
       
   175 				{
       
   176 				TPtrC url;
       
   177 				if (aPushType == KUidWapPushMsgSI)
       
   178 					{
       
   179 					url.Set(static_cast<CSIPushMsgEntry*>(pushEntry)->Url());
       
   180 					}
       
   181 				else
       
   182 					{
       
   183 					url.Set(static_cast<CSLPushMsgEntry*>(pushEntry)->Url());
       
   184 					}
       
   185 				CleanupStack::PushL(pushEntry);
       
   186 				pushEntry->RetrieveL(*iMsvSession, currentEntry.Id());
       
   187 				if (aUrl.CompareF(url) == 0) 
       
   188 					pushID = currentEntry.Id();
       
   189 				CleanupStack::PopAndDestroy(pushEntry);
       
   190 				}
       
   191 			}
       
   192 		}
       
   193 	CleanupStack::PopAndDestroy(); // children
       
   194 	return pushID;
       
   195 	}
       
   196 
       
   197 
       
   198 /**
       
   199 Gets the action value for the specified message. 
       
   200  
       
   201 @param aId 
       
   202 Message entry of interest.
       
   203 
       
   204 @return 
       
   205 Action level for the message, or KErrNotFound if action level not found.
       
   206 */
       
   207 EXPORT_C TInt CSISLPushMsgUtils::GetActionL(TMsvId aId)
       
   208 	{
       
   209 	//Creates an instance of the correct message entry type which is used to 
       
   210 	//get the action value. This ensures that the decoding routine of the 
       
   211 	//PushEntry class is used, maintaining encapsulation.
       
   212 
       
   213 	TInt action = KErrNotFound;  // -1 to indicate we haven't found the action level
       
   214 	TMsvEntry myEntry;
       
   215 	iMsvEntry->SetEntryL(aId);
       
   216 	myEntry = iMsvEntry->Entry();
       
   217 
       
   218 	if  (myEntry.iBioType == KUidWapPushMsgSI.iUid)
       
   219 		{
       
   220 		CSIPushMsgEntry* siMsg = CSIPushMsgEntry::NewL();
       
   221 		siMsg->SetEntry(myEntry);
       
   222 		action = siMsg->Action();
       
   223 		delete siMsg;
       
   224 		}
       
   225 	else if (myEntry.iBioType == KUidWapPushMsgSL.iUid)
       
   226 		{
       
   227 		CSLPushMsgEntry* slMsg = CSLPushMsgEntry::NewL();
       
   228 		slMsg->SetEntry(myEntry);
       
   229 		action = slMsg->Action();
       
   230 		delete slMsg;
       
   231 		}
       
   232 	return action;
       
   233 	}
       
   234 
       
   235 
       
   236 /**
       
   237 Gets SI or SL Push Message (CSIPushMsgEntry or CSLPushMsgEntry) object from the message 
       
   238 store for the specified message type.
       
   239   
       
   240 @param aPushType 
       
   241 Push Message type.
       
   242 
       
   243 @return 
       
   244 SI or SL Push Message object for the specified message type.
       
   245 
       
   246 @leave CMsvEntry::HasStoreL
       
   247 @leave CMsvEntry::ReadStoreL
       
   248 @leave CMsvStore::IsPresentL
       
   249 @leave CMsvEntry::EntryId
       
   250 @leave CMsvStore::RetrieveL
       
   251 */
       
   252 CPushMsgEntryBase* CSISLPushMsgUtils::GetPushMsgEntryL(const TUid aPushType)
       
   253 	{
       
   254 	TBool streamExists=EFalse;
       
   255 
       
   256 	if (iMsvEntry->HasStoreL())
       
   257 		{
       
   258 		CMsvStore* store = iMsvEntry->ReadStoreL();
       
   259 		CleanupStack::PushL(store);
       
   260 		if (store->IsPresentL(aPushType) )
       
   261 			streamExists = ETrue;
       
   262 		CleanupStack::PopAndDestroy(store);
       
   263 		}
       
   264 
       
   265 	if (!streamExists)
       
   266 		return NULL;
       
   267 
       
   268 	CPushMsgEntryBase* pushMsg = NULL;
       
   269 	if (aPushType == KUidWapPushMsgSI)
       
   270 		{
       
   271 		pushMsg = CSIPushMsgEntry::NewL();
       
   272 		}
       
   273 	else if (aPushType == KUidWapPushMsgSL)
       
   274 		{
       
   275 		pushMsg = CSLPushMsgEntry::NewL();
       
   276 		}
       
   277 
       
   278 	CleanupStack::PushL(pushMsg);
       
   279 	pushMsg->RetrieveL(Session(), iMsvEntry->EntryId());
       
   280 	CleanupStack::Pop(pushMsg);
       
   281 
       
   282 	return pushMsg;
       
   283 	}
       
   284 
       
   285 
       
   286 /**
       
   287 Gets the expiry date for the message with the specified Id.
       
   288 
       
   289 The function assumes that the Id passed as a parameter is for an SI message, 
       
   290 and cannot currently handle any other type of message. 
       
   291  
       
   292 @param aId 
       
   293 Id of message to find expiry date. 
       
   294 
       
   295 @return 
       
   296 Expiry date/time of SI message.
       
   297 */
       
   298 EXPORT_C const TTime  CSISLPushMsgUtils::GetExpiryL(TMsvId aId)
       
   299 	{
       
   300 	TInt64 nullTime = 0;
       
   301 	TTime siExpires = nullTime;
       
   302 	
       
   303 	iMsvEntry->SetEntryL(aId);
       
   304 
       
   305 	// Ensures we only have an SI Msg - otherwise cannot get an expiry date
       
   306 	__ASSERT_ALWAYS(iMsvEntry->Entry().iBioType == KUidWapPushMsgSI.iUid, 
       
   307 				User::Panic(KSISLPushMsgUtilsPanicTitle,ESISLPushMsgUtilsNotSiMsg));
       
   308 
       
   309 	CSIPushMsgEntry* siEntry = CSIPushMsgEntry::NewL();
       
   310 	CleanupStack::PushL(siEntry);
       
   311 	siEntry->RetrieveL(*iMsvSession, aId);
       
   312 	siExpires = siEntry->Expires();
       
   313 	CleanupStack::PopAndDestroy(siEntry);
       
   314 	return siExpires;
       
   315 	}
       
   316 
       
   317 
       
   318 /**
       
   319 Finds the message of a specified Push type with the highest action level.
       
   320  
       
   321 @param	aPushType 
       
   322 Uid for the type of WAP Push Message
       
   323 
       
   324 @return 
       
   325 Id of the message entry with the highest action
       
   326 
       
   327 @leave	KErrNotSupported
       
   328 If aPushType is not a SI or SL push message type. 
       
   329 @leave  CMsvEntry::SetEntryL
       
   330 @leave	CSIPushMsgEntry::NewL
       
   331 @leave	CMsvEntry::ChildrenWithMtmL
       
   332 @leave	CArrayFixFlat::AppendL
       
   333 */
       
   334 EXPORT_C TMsvId CSISLPushMsgUtils::GetHighestActionL(TUid aPushType)
       
   335 	{
       
   336 	//Action only applies to the SI and SL messages - both stored under the Service Entry
       
   337 	CMsvEntrySelection* sel;
       
   338 
       
   339 	if (iPushFolderId ==KMsvNullIndexEntryId)
       
   340 		GetPushMsgFolderIdL(iPushFolderId);
       
   341 	iMsvEntry->SetEntryL(iPushFolderId);
       
   342 
       
   343 	sel=GetChildrenWithMtmLC(KUidMtmWapPush);
       
   344 
       
   345 	CPushMsgEntryBase* pushMsg=NULL;
       
   346 	
       
   347 	if (aPushType ==  KUidWapPushMsgSI)
       
   348 		pushMsg = CSIPushMsgEntry::NewL();
       
   349 	else if(aPushType == KUidWapPushMsgSL)
       
   350 		pushMsg = CSLPushMsgEntry::NewL();
       
   351 	else
       
   352 		User::Leave(KErrNotSupported);
       
   353 	
       
   354 	CleanupStack::PushL(pushMsg);
       
   355 
       
   356 	TMsvId maxId =KMsvNullIndexEntryId ;
       
   357 	TInt maxAction=-1;
       
   358 	TInt currentAction=-1;
       
   359 	TInt entries = sel->Count();
       
   360 
       
   361 	for (TInt count = 0; count < entries; count++)
       
   362 		{
       
   363 		iMsvEntry->SetEntryL(sel->At(count));
       
   364 		pushMsg->SetEntry(iMsvEntry->Entry());
       
   365 		if (iMsvEntry->Entry().iBioType == aPushType.iUid)
       
   366 			{
       
   367 			if (aPushType == KUidWapPushMsgSI )
       
   368 				currentAction = STATIC_CAST(CSIPushMsgEntry*, pushMsg) ->Action();
       
   369 			else if ((aPushType == KUidWapPushMsgSL))
       
   370 				currentAction = STATIC_CAST(CSLPushMsgEntry*, pushMsg) ->Action();
       
   371 			else continue;
       
   372 
       
   373 			if (currentAction>maxAction)  // Found a new highest action - store the details
       
   374 				{
       
   375 				maxAction = currentAction;
       
   376 				maxId = sel->At(count);
       
   377 				}
       
   378 			currentAction = -1;
       
   379 			}
       
   380 		}
       
   381 	CleanupStack::PopAndDestroy(2); //sel,  pushMsg
       
   382 	return maxId;
       
   383 	}
       
   384 
       
   385 
       
   386 /**
       
   387 Gets the earliest expiry date of all the SI Messages that are not flagged for deletion. 
       
   388  
       
   389 @return 
       
   390 Id of the message with the earliest expiry date
       
   391 */
       
   392 EXPORT_C TMsvId CSISLPushMsgUtils::GetNextExpiryL()
       
   393 	{
       
   394 	//Function searches through the SI Messages and keeps hold of the earliest expiry up 
       
   395 	//to that point. Because the function just compares each message with the preceding 
       
   396 	//ones it is possible for it to return a date before the current date and time. 
       
   397 	//This just means that the message has expired but has not been either removed from 
       
   398 	//the system or flagged for deletion. 
       
   399 
       
   400 	CMsvEntrySelection* sel;
       
   401 	
       
   402 	if (iPushFolderId ==KMsvNullIndexEntryId)
       
   403 		GetPushMsgFolderIdL(iPushFolderId);
       
   404 	iMsvEntry->SetEntryL(iPushFolderId);
       
   405 
       
   406 	sel=GetChildrenWithMtmLC(KUidMtmWapPush);
       
   407 
       
   408 	TInt count = sel->Count();
       
   409 	// Ensure that we start with Max time, everything ought to be less than this
       
   410 	TTime earliestTime = Time::MaxTTime(); 
       
   411 	TMsvId siExpiring = KMsvNullIndexEntryId;
       
   412 
       
   413 	CSIPushMsgEntry* siEntry = CSIPushMsgEntry::NewL();
       
   414 	CleanupStack::PushL(siEntry);
       
   415 			
       
   416 	for (TInt current = 0; current< count;current++)
       
   417 		{
       
   418 	
       
   419 		iMsvEntry->SetEntryL(sel->At(current));
       
   420 		if (iMsvEntry->Entry().iBioType == KUidWapPushMsgSI.iUid)
       
   421 			{	
       
   422 
       
   423 			siEntry->RetrieveL(*iMsvSession, iMsvEntry->Entry().Id());
       
   424 
       
   425 			// Ignore null expiry times and entries flagged for deletion
       
   426 			if ( (siEntry->Expires() == Time::NullTTime() )
       
   427 			  || (siEntry->Status() == CPushMsgEntryBase::EPushMsgStatusDeleted) )
       
   428 				continue;
       
   429 			else if ( (siEntry->Expires() < earliestTime ))
       
   430 				{
       
   431 				earliestTime = siEntry->Expires().Int64();
       
   432 				siExpiring = iMsvEntry->Entry().Id();
       
   433 				}
       
   434 			}
       
   435 		
       
   436 		}
       
   437 	CleanupStack::PopAndDestroy(); //siEntry
       
   438 	CleanupStack::PopAndDestroy(); // sel
       
   439 	return siExpiring;
       
   440 	}
       
   441 
       
   442 
       
   443 /**
       
   444 Gets the Id of the Push Message Folder under which all Push Messages are stored. 
       
   445 
       
   446 If the folder does not exist, it is created.
       
   447 
       
   448 @param aFolderId 
       
   449 On return, Id of the Push Message Folder.
       
   450 @leave	CMsvEntry::ChildrenWithTypeL
       
   451 @leave	CMsvEntry::SetEntryL
       
   452 @leave	CArrayFixFlat::AppendL
       
   453 */
       
   454 EXPORT_C void CSISLPushMsgUtils::GetPushMsgFolderIdL(TMsvId& aFolderId)
       
   455 	{
       
   456 	//Returns the Service IDs of MTM aMtm
       
   457 	if (iPushFolderId != KMsvNullIndexEntryId)
       
   458 		{ 
       
   459 		aFolderId = iPushFolderId;
       
   460 		return;
       
   461 		}
       
   462 
       
   463 	aFolderId = KMsvNullIndexEntryId;
       
   464 
       
   465 	iMsvEntry->SetEntryL(KMsvLocalServiceIndexEntryId);
       
   466 
       
   467 	//Get the children on the Root Index Entry
       
   468 	CMsvEntrySelection* selection = iMsvEntry->ChildrenWithTypeL(KUidMsvFolderEntry);
       
   469 	CleanupStack::PushL(selection);
       
   470 
       
   471 	CMsvEntrySelection* pushFolders = new (ELeave) CMsvEntrySelection;
       
   472 	CleanupStack::PushL(pushFolders);
       
   473 
       
   474 	TInt count = selection->Count();
       
   475 
       
   476 	//Find an entry for MTM aMtm
       
   477 	for (TInt curChild = 0; curChild < count; curChild++)
       
   478 		{
       
   479 		iMsvEntry->SetEntryL(selection->At(curChild));
       
   480 
       
   481 		if (iMsvEntry->Entry().iMtm == KUidMtmWapPush)
       
   482 			{
       
   483 			pushFolders->AppendL( iMsvEntry->Entry().Id());
       
   484 			}
       
   485 		}
       
   486 	iMsvEntry->SetEntryL(KMsvRootIndexEntryId);//Point our entry to something safe
       
   487 
       
   488 	if (pushFolders->Count() >0)
       
   489 		aFolderId = pushFolders->At(0); // grab the first, should only be one!
       
   490 	else if (pushFolders->Count() ==0)
       
   491 		{
       
   492 		aFolderId = CreatePushMsgFolderL();
       
   493 		}
       
   494 
       
   495 	if (aFolderId!= KMsvNullIndexEntryId && (&iPushFolderId != &aFolderId) ) //service Id & not self assignment
       
   496 		iPushFolderId = aFolderId;  // Keep this - may save effort in forthcoming fn calls
       
   497 	CleanupStack::PopAndDestroy(2); //selection
       
   498 	}
       
   499 
       
   500 
       
   501 /**
       
   502 Gets the date field from the message with the specified Id.
       
   503 
       
   504 Creation Date is stored in iMsgDate for SI messages, whilst the field holds the date
       
   505 and time of transmission for SL messages. This function is called by GetCreationDate 
       
   506 and GetTransmissionDate
       
   507 
       
   508 @param aId 
       
   509 Id of the message entry with the required date field.
       
   510 
       
   511 @param aPushType 
       
   512 Uid for the type of WAP Push Message
       
   513 
       
   514 @return 
       
   515 Value of the date field.
       
   516 @leave CMsvEntry::SetEntryL
       
   517 @leave CMsvEntry::HasStoreL
       
   518 @leave CMsvEntry::ReadStoreL
       
   519 @leave CMsvStore::IsPresentL
       
   520 @leave CMsvEntry::EntryId
       
   521 @leave CMsvStore::RetrieveL
       
   522 */
       
   523 TTime CSISLPushMsgUtils::GetDateL(TMsvId aId, const TUid aPushType)
       
   524 	{
       
   525 	TTime date = Time::NullTTime();
       
   526 
       
   527 	iMsvEntry->SetEntryL(aId);
       
   528 
       
   529 	CPushMsgEntryBase* pushEntry = GetPushMsgEntryL(aPushType);
       
   530 
       
   531 	if (aPushType == KUidWapPushMsgSI)
       
   532 		{
       
   533 		date = STATIC_CAST(CSIPushMsgEntry*, pushEntry) ->Created();
       
   534 		}
       
   535 	else if (aPushType == KUidWapPushMsgSL)
       
   536 		{
       
   537 		date = STATIC_CAST(CSLPushMsgEntry*, pushEntry) ->TimeSent();
       
   538 		}
       
   539 	delete pushEntry;
       
   540 	return date;
       
   541 	}
       
   542 
       
   543 
       
   544 /**
       
   545 Creates a new Push Service folder under the local service. 
       
   546 
       
   547 Called when GetPushMsgFolderL fails to find a folder entry. 
       
   548 
       
   549 @return 
       
   550 Id of the newly created folder entry
       
   551 */ 
       
   552 TMsvId CSISLPushMsgUtils::CreatePushMsgFolderL()
       
   553 	{
       
   554 	TMsvId id = 0;
       
   555 	TMsvEntry entry;
       
   556 	entry.iServiceId = KMsvLocalServiceIndexEntryId;
       
   557 	entry.iMtm = KUidMtmWapPush;
       
   558 	entry.iType = KUidMsvFolderEntry;
       
   559 	entry.SetReadOnly(ETrue);
       
   560 	entry.SetVisible(EFalse);
       
   561 	entry.iDetails.Set(KPushFolderDescription);
       
   562 	
       
   563 	iMsvEntry->SetEntryL(KMsvLocalServiceIndexEntryId);
       
   564 	iMsvEntry->CreateL(entry);
       
   565 	id = entry.Id();
       
   566 	return id;
       
   567 	}
       
   568 
       
   569 
       
   570 /**
       
   571 Sets the status of the specified Push message to be deleted. 
       
   572 
       
   573 Any messages marked as deleted in the Push Message Folder under the Local Service will be 
       
   574 deleted by the UI later. Sets the value of the first 4 bits of the TMsvEntry field 
       
   575 iMtmData1 to EPushMsgStatusDeleted.
       
   576  
       
   577 @param aId 
       
   578 Id of the entry to be set to Deleted
       
   579 */
       
   580 EXPORT_C void CSISLPushMsgUtils::DeleteEntryL(TMsvId aId)
       
   581 	{
       
   582 	iMsvEntry->SetEntryL(aId);
       
   583 
       
   584 	TMsvEntry entry = iMsvEntry->Entry();
       
   585 	entry.SetMtmData1( (entry.MtmData1() & (~KPushMaskOnlyStatus)) 
       
   586 								+ CPushMsgEntryBase::EPushMsgStatusDeleted );
       
   587 	iMsvEntry->ChangeL(entry);
       
   588 	}
       
   589 
       
   590 /**
       
   591 Deletes the specified Push Message. 
       
   592 
       
   593 This function deletes the item immediately.
       
   594  
       
   595 @param aId 
       
   596 Id of the entry to be Deleted
       
   597 */
       
   598 EXPORT_C void CSISLPushMsgUtils::DeleteEntryNowL(TMsvId aId)
       
   599 	{
       
   600 	iMsvEntry->DeleteL(aId);
       
   601 	}
       
   602 
       
   603 /**
       
   604 Gets all the children of the current message context which have the specified Mtm Uid.  
       
   605 
       
   606 Assumes that the calling function has set the iMsvEntry member to the correct context, prior 
       
   607 to the function call.
       
   608 
       
   609 @param aMtm 
       
   610 Mtm Uid to filter children with
       
   611 
       
   612 @return 
       
   613 Pointer to an array of TMsvId's for entries which match the Mtm Uid
       
   614 @leave CMsvEntry::ChildrenWithMtmL
       
   615 */
       
   616 CMsvEntrySelection* CSISLPushMsgUtils::GetChildrenWithMtmLC(TUid aMtm)
       
   617 	{
       
   618 	CMsvEntrySelection* children;
       
   619 	children = iMsvEntry->ChildrenWithMtmL(aMtm);
       
   620 	CleanupStack::PushL(children);
       
   621 	return children;
       
   622 	}
       
   623 
       
   624 
       
   625 #ifndef EKA2
       
   626 GLDEF_C TInt E32Dll(TDllReason/* aReason*/)	
       
   627 	{
       
   628 	return (KErrNone);
       
   629 	}
       
   630 #endif
       
   631 
       
   632