emailservices/emailframework/src/CFSMailClient.cpp
changeset 0 8466d47a6819
child 8 e1b6206813b4
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  email framework user interface
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "emailtrace.h"
       
    20 #include "CFSMailClient.h"
       
    21 #include "CFSFWImplementation.h"
       
    22 #include "CFSMailPluginManager.h"
       
    23 #include "CFSMailRequestObserver.h"
       
    24 #include "CFSMailIterator.h"
       
    25 #include "CFSMailBrandManagerImpl.h"
       
    26 
       
    27 
       
    28 // ================= MEMBER FUNCTIONS ==========================================
       
    29 // -----------------------------------------------------------------------------
       
    30 // CFSMailClient::NewLC
       
    31 // -----------------------------------------------------------------------------
       
    32 EXPORT_C CFSMailClient* CFSMailClient::NewLC(TInt aConfiguration)
       
    33 {
       
    34     FUNC_LOG;
       
    35 
       
    36 	CFSMailClient* client = Instance();
       
    37 	if(!client)
       
    38 	{
       
    39 		client = new (ELeave) CFSMailClient();
       
    40 		CleanupStack:: PushL(client);
       
    41 		client->ConstructL(aConfiguration);
       
    42 		TInt err = Dll::SetTls(static_cast<TAny*>(client));
       
    43 		User::LeaveIfError(err);
       
    44 		}
       
    45 	else
       
    46 		{
       
    47 		CleanupStack:: PushL(client);
       
    48 		}
       
    49 
       
    50 	client->IncReferenceCount();
       
    51 	
       
    52 	return client;
       
    53 
       
    54 } 
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // CFSMailClient::NewL
       
    58 // -----------------------------------------------------------------------------
       
    59 EXPORT_C CFSMailClient* CFSMailClient::NewL()
       
    60 {
       
    61     FUNC_LOG;
       
    62   CFSMailClient* client =  CFSMailClient::NewLC(EFSLoadPlugins);
       
    63   CleanupStack:: Pop(client);
       
    64   return client;
       
    65 }
       
    66 
       
    67 // -----------------------------------------------------------------------------
       
    68 // CFSMailClient::NewL
       
    69 // -----------------------------------------------------------------------------
       
    70 EXPORT_C CFSMailClient* CFSMailClient::NewL(TInt aConfiguration)
       
    71 {
       
    72     FUNC_LOG;
       
    73 
       
    74   CFSMailClient* client =  CFSMailClient::NewLC(aConfiguration);
       
    75   CleanupStack:: Pop(client);
       
    76   return client;
       
    77 }
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // CFSMailClient::ConstructL
       
    81 // -----------------------------------------------------------------------------
       
    82 void CFSMailClient::ConstructL(TInt aConfiguration)
       
    83 {
       
    84     FUNC_LOG;
       
    85 	iFWImplementation = CFSFWImplementation::NewL(aConfiguration);
       
    86 }
       
    87 
       
    88 // -----------------------------------------------------------------------------
       
    89 // CFSMailClient::CFSMailClient
       
    90 // -----------------------------------------------------------------------------
       
    91 CFSMailClient::CFSMailClient()
       
    92 {
       
    93     FUNC_LOG;
       
    94 	// clear pointers
       
    95 	iFWImplementation = NULL;
       
    96 	iBrandManager = NULL;
       
    97 }
       
    98 
       
    99 
       
   100 // -----------------------------------------------------------------------------
       
   101 // CFSMailClient::~CFSMailClient
       
   102 // -----------------------------------------------------------------------------
       
   103 EXPORT_C CFSMailClient::~CFSMailClient()
       
   104 {
       
   105     FUNC_LOG;
       
   106 	if(iBrandManager)
       
   107 		{
       
   108 		delete iBrandManager;
       
   109 		}
       
   110 	Close();
       
   111 }
       
   112 
       
   113 // -----------------------------------------------------------------------------
       
   114 // CFSMailClient::GetMailBoxByUidL
       
   115 // -----------------------------------------------------------------------------
       
   116 EXPORT_C CFSMailBox* CFSMailClient::GetMailBoxByUidL(const TFSMailMsgId aMailBoxId)
       
   117 {
       
   118     FUNC_LOG;
       
   119 	// select plugin
       
   120 	CFSMailBox* mailBox = NULL;
       
   121 	CFSMailPlugin* plugin = iFWImplementation->GetPluginManager().GetPluginByUid(aMailBoxId);
       
   122 	if(plugin)
       
   123 	{
       
   124 		// get mailbox from plugin
       
   125 		mailBox = plugin->GetMailBoxByUidL(aMailBoxId);
       
   126 	}
       
   127 
       
   128 	return mailBox;
       
   129 }
       
   130 
       
   131 // -----------------------------------------------------------------------------
       
   132 // CFSMailClient::GetFolderByUidL
       
   133 // -----------------------------------------------------------------------------
       
   134 EXPORT_C CFSMailFolder* CFSMailClient::GetFolderByUidL( const TFSMailMsgId aMailBoxId,
       
   135 													   const TFSMailMsgId aFolderId )
       
   136 {
       
   137     FUNC_LOG;
       
   138 	CFSMailFolder* folder = NULL;
       
   139 	
       
   140 	// select plugin
       
   141 	CFSMailPlugin* plugin = iFWImplementation->GetPluginManager().GetPluginByUid(aFolderId);
       
   142 	if(plugin)
       
   143 	{
       
   144 		// get folder from plugin
       
   145 		folder = plugin->GetFolderByUidL( aMailBoxId, aFolderId );
       
   146 	}
       
   147 	return folder;
       
   148 }
       
   149 
       
   150 // -----------------------------------------------------------------------------
       
   151 // CFSMailClient::GetMessageByUidL
       
   152 // -----------------------------------------------------------------------------
       
   153 EXPORT_C CFSMailMessage* CFSMailClient::GetMessageByUidL( const TFSMailMsgId aMailBoxId,
       
   154 														 const TFSMailMsgId aFolderId,
       
   155 														 const TFSMailMsgId aMessageId,
       
   156 														 const TFSMailDetails aDetails)
       
   157 {
       
   158     FUNC_LOG;
       
   159 	CFSMailMessage* message = NULL;
       
   160     // select plugin
       
   161     CFSMailPlugin* plugin = iFWImplementation->GetPluginManager().GetPluginByUid(aMessageId);
       
   162 	if(plugin)
       
   163 	{
       
   164 	    // get message from plugin
       
   165     	message = plugin->GetMessageByUidL( aMailBoxId, aFolderId, aMessageId, aDetails );
       
   166 	}
       
   167 
       
   168     return message;
       
   169 }
       
   170 
       
   171 // -----------------------------------------------------------------------------
       
   172 // CFSMailClient::DeleteMessagesByUidL
       
   173 // -----------------------------------------------------------------------------
       
   174 EXPORT_C void CFSMailClient::DeleteMessagesByUidL( const TFSMailMsgId aMailBoxId,
       
   175 												   const TFSMailMsgId aFolderId,
       
   176 											 	   const RArray<TFSMailMsgId>& aMessages )
       
   177 {
       
   178     FUNC_LOG;
       
   179 	CFSMailPlugin* plugin = iFWImplementation->GetPluginManager().GetPluginByUid(aFolderId);
       
   180 	if(plugin)
       
   181 	{
       
   182 		plugin->DeleteMessagesByUidL(aMailBoxId,aFolderId,aMessages);
       
   183 	}
       
   184 }
       
   185 
       
   186 // -----------------------------------------------------------------------------
       
   187 // CFSMailClient::DeleteMailBoxByUidL
       
   188 // -----------------------------------------------------------------------------
       
   189 EXPORT_C TInt CFSMailClient::DeleteMailBoxByUidL( const TFSMailMsgId aMailBoxId,
       
   190  								  MFSMailRequestObserver& aOperationObserver )
       
   191 {
       
   192     FUNC_LOG;
       
   193 	// select plugin
       
   194 	CFSMailPlugin* plugin = iFWImplementation->GetPluginManager().GetPluginByUid(aMailBoxId);
       
   195 	if(plugin)
       
   196 	{
       
   197 		// init asynchronous request
       
   198 		TFSPendingRequest request = iFWImplementation->GetPluginManager().InitAsyncRequestL(  aMailBoxId.PluginId(),
       
   199 																		aOperationObserver );
       
   200 
       
   201 		TRAPD(err, plugin->DeleteMailBoxByUidL(aMailBoxId,*request.iObserver,request.iRequestId));
       
   202 		
       
   203 	    if(err != KErrNone)
       
   204 		{
       
   205 			iFWImplementation->GetPluginManager().CompleteRequest(request.iRequestId);	
       
   206 		}
       
   207 	    return request.iRequestId;
       
   208 	}
       
   209 	return 0;
       
   210 }
       
   211 
       
   212 // -----------------------------------------------------------------------------
       
   213 // CFSMailClient::ListMailBoxes
       
   214 // -----------------------------------------------------------------------------
       
   215 EXPORT_C TInt CFSMailClient::ListMailBoxes(const TFSMailMsgId aPlugin,
       
   216 											 RPointerArray<CFSMailBox>& aMailBoxes)
       
   217 {
       
   218     FUNC_LOG;
       
   219 
       
   220 	RArray<TFSMailMsgId> mailBoxList;
       
   221 	mailBoxList.Reset();
       
   222 	TInt ret = KErrNone;
       
   223 	
       
   224     // <cmail>	
       
   225 	CFSMailBox *mailBox = NULL;	
       
   226     // </cmail>	
       
   227 	
       
   228 	if(aPlugin.IsNullId())
       
   229 	{
       
   230 		for(TInt i=0;i<iFWImplementation->GetPluginManager().GetPluginCount();i++)
       
   231 		{
       
   232 			CFSMailPlugin* plugin = iFWImplementation->GetPluginManager().GetPluginByIndex(i);	
       
   233 			TRAPD(err,plugin->ListMailBoxesL(mailBoxList));
       
   234 			if(err == KErrNone)
       
   235 			{
       
   236 				for(TInt ii=0;ii < mailBoxList.Count(); ii++)
       
   237 				{
       
   238 				// <cmail>
       
   239 				    mailBox = NULL;
       
   240 				    TRAP_IGNORE(
       
   241                         mailBox = plugin->GetMailBoxByUidL(mailBoxList[ii]) );
       
   242 				    if ( mailBox )
       
   243     				    {
       
   244                         aMailBoxes.Append( mailBox );
       
   245                         }
       
   246 				// </cmail>
       
   247 					if(err != KErrNone)
       
   248 					{
       
   249 						ret = err;
       
   250 					}
       
   251 				}
       
   252 			}
       
   253 			else
       
   254 			{
       
   255 				ret = err;
       
   256 			}
       
   257 			mailBoxList.Reset();
       
   258 		}
       
   259 	}
       
   260 	else
       
   261 	{
       
   262 		CFSMailPlugin* plugin = iFWImplementation->GetPluginManager().GetPluginByUid(aPlugin);		
       
   263 		// <cmail>
       
   264 		TInt err(KErrNone);
       
   265 		if ( plugin )
       
   266 		    {
       
   267 	        TRAP(err,plugin->ListMailBoxesL(mailBoxList));		    
       
   268 		    }
       
   269 		else
       
   270 		    {
       
   271 		    err = KErrNotFound;
       
   272 		    }
       
   273         // </cmail>		
       
   274 		if (err == KErrNone)
       
   275 		    {
       
   276 			for(TInt i=0;i < mailBoxList.Count(); i++)
       
   277 			    {			    
       
   278                 // <cmail>
       
   279                     mailBox = NULL;
       
   280 				    TRAP_IGNORE(
       
   281                         mailBox = plugin->GetMailBoxByUidL(mailBoxList[i]) );
       
   282                     if ( mailBox )
       
   283                         {
       
   284                         aMailBoxes.Append( mailBox );
       
   285                         }
       
   286                 // </cmail>				
       
   287 				if(err != KErrNone)
       
   288 				    {
       
   289 					ret = err;
       
   290 				    }
       
   291 			    }
       
   292 		    }
       
   293 		else
       
   294 		    {
       
   295 			ret = err;
       
   296 		    }
       
   297 		mailBoxList.Reset();			
       
   298 	}
       
   299 	
       
   300 	mailBoxList.Reset();
       
   301 	return ret;
       
   302 }
       
   303 
       
   304 // -----------------------------------------------------------------------------
       
   305 // CFSMailClient::ListMessages
       
   306 // -----------------------------------------------------------------------------
       
   307 EXPORT_C MFSMailIterator* CFSMailClient::ListMessages(const TFSMailMsgId aMailBoxId,
       
   308         						const TFSMailMsgId aFolderId, const TFSMailDetails aDetails,
       
   309         						const RArray<TFSMailSortCriteria>& aSorting)
       
   310 {
       
   311     FUNC_LOG;
       
   312 
       
   313 	MFSMailIterator* iterator = NULL;
       
   314 	MFSMailIterator* pluginIterator = NULL;
       
   315 	
       
   316 	// select plugin
       
   317 	if(CFSMailPlugin* plugin = iFWImplementation->GetPluginManager().GetPluginByUid(aFolderId))
       
   318 	{
       
   319 		// get message list iterator from plugin
       
   320 		TRAPD(err, pluginIterator = plugin->ListMessagesL(aMailBoxId,aFolderId,aDetails,aSorting));
       
   321 		if(err == KErrNone && pluginIterator)
       
   322 		{
       
   323 			TRAPD(err,iterator = CFSMailIterator::NewL(*pluginIterator,&iFWImplementation->GetPluginManager()));
       
   324 			if(err == KErrNone)
       
   325 			{
       
   326 				return iterator;				
       
   327 			}
       
   328 		}
       
   329 	}
       
   330 
       
   331 	return iterator;
       
   332 }
       
   333 	
       
   334 // -----------------------------------------------------------------------------
       
   335 // CFSMailClient::GetBrandManagerL
       
   336 // -----------------------------------------------------------------------------
       
   337 EXPORT_C MFSMailBrandManager& CFSMailClient::GetBrandManagerL( void )
       
   338 {
       
   339     FUNC_LOG;
       
   340 
       
   341 	if(iBrandManager == NULL)
       
   342 		{
       
   343 		TRAPD( creationError,
       
   344 		       iBrandManager = CFSMailBrandManagerImpl::NewL( *this ) );
       
   345 		if ( creationError != KErrNone )
       
   346 		    {
       
   347 		    User::Leave( creationError );
       
   348 		    }
       
   349 		}
       
   350 		
       
   351  	return *iBrandManager;
       
   352 
       
   353 }
       
   354 
       
   355 // -----------------------------------------------------------------------------
       
   356 // CFSMailClient::AddObserverL
       
   357 // -----------------------------------------------------------------------------
       
   358 EXPORT_C void CFSMailClient::AddObserverL(MFSMailEventObserver& aObserver)
       
   359 {
       
   360     FUNC_LOG;
       
   361 	for(TInt i=0;i<iFWImplementation->GetPluginManager().GetPluginCount();i++)
       
   362 		{
       
   363 		CFSMailPlugin* plugin = iFWImplementation->GetPluginManager().GetPluginByIndex(i);
       
   364 		if(plugin)
       
   365 			{
       
   366 			plugin->AddObserverL(aObserver);			
       
   367 			}
       
   368 		}
       
   369 }
       
   370 
       
   371 // -----------------------------------------------------------------------------
       
   372 // CFSMailClient::RemoveObserver
       
   373 // -----------------------------------------------------------------------------
       
   374 EXPORT_C void CFSMailClient::RemoveObserver(MFSMailEventObserver& aObserver)
       
   375 {
       
   376     FUNC_LOG;
       
   377 	for(TInt i=0;i<iFWImplementation->GetPluginManager().GetPluginCount();i++)
       
   378 	{
       
   379 		CFSMailPlugin* plugin = iFWImplementation->GetPluginManager().GetPluginByIndex(i);
       
   380 		if(plugin)
       
   381 		{
       
   382 		plugin->RemoveObserver(aObserver);			
       
   383 		}
       
   384 	}
       
   385 }
       
   386 
       
   387 // -----------------------------------------------------------------------------
       
   388 // CFSMailClient::UnregisterRequestObserver
       
   389 // -----------------------------------------------------------------------------
       
   390 EXPORT_C void CFSMailClient::UnregisterRequestObserver(TInt aRequestId)
       
   391 {
       
   392     FUNC_LOG;
       
   393 	for(TInt i=0;i<iFWImplementation->GetPluginManager().GetPluginCount();i++)
       
   394 	{
       
   395 		if(CFSMailPlugin* plugin = iFWImplementation->GetPluginManager().GetPluginByIndex(i))
       
   396 			{
       
   397 			plugin->UnregisterRequestObserver(aRequestId);
       
   398 			iFWImplementation->GetPluginManager().CompleteRequest(aRequestId);
       
   399 			}
       
   400 	}
       
   401 }
       
   402 
       
   403 // -----------------------------------------------------------------------------
       
   404 // CFSMailClient::SubscribeMailboxEventsL
       
   405 // -----------------------------------------------------------------------------
       
   406 EXPORT_C void CFSMailClient::SubscribeMailboxEventsL(TFSMailMsgId aMailBoxId,
       
   407 													 	MFSMailEventObserver& aObserver)
       
   408 	{
       
   409     FUNC_LOG;
       
   410 	// select plugin
       
   411 	if(CFSMailPlugin* plugin = iFWImplementation->GetPluginManager().GetPluginByUid(aMailBoxId))
       
   412 		{
       
   413 		// set observer
       
   414 		plugin->SubscribeMailboxEventsL( aMailBoxId, aObserver );
       
   415 		}
       
   416 	}
       
   417 
       
   418 // -----------------------------------------------------------------------------
       
   419 // CFSMailClient::UnsubscribeMailboxEvents
       
   420 // -----------------------------------------------------------------------------
       
   421 EXPORT_C void CFSMailClient::UnsubscribeMailboxEvents(TFSMailMsgId aMailBoxId,
       
   422 														MFSMailEventObserver& aObserver)
       
   423 	{
       
   424     FUNC_LOG;
       
   425 	// select plugin
       
   426 	if(CFSMailPlugin* plugin = iFWImplementation->GetPluginManager().GetPluginByUid(aMailBoxId))
       
   427 		{
       
   428 		// set observer
       
   429 		plugin->UnsubscribeMailboxEvents( aMailBoxId, aObserver );
       
   430 		}
       
   431 	}
       
   432 
       
   433 // -----------------------------------------------------------------------------
       
   434 // CFSMailClient::WizardDataAvailableL
       
   435 // -----------------------------------------------------------------------------
       
   436 EXPORT_C TInt CFSMailClient::WizardDataAvailableL()
       
   437 	{
       
   438     FUNC_LOG;
       
   439 	
       
   440 	TInt ret = KErrNone;
       
   441 	for(TInt i=0;i<iFWImplementation->GetPluginManager().GetPluginCount();i++)
       
   442 	{
       
   443 		if(CFSMailPlugin* plugin = iFWImplementation->GetPluginManager().GetPluginByIndex(i))
       
   444 			{
       
   445 			TInt rcode = plugin->WizardDataAvailableL( );
       
   446 			if(rcode != KErrNone)		
       
   447 				{
       
   448 				ret = KErrGeneral;			
       
   449 				}
       
   450 			}
       
   451 		else
       
   452 			{
       
   453 			ret = KErrGeneral;
       
   454 			}
       
   455 	}
       
   456 
       
   457 	return ret;
       
   458 	}
       
   459 
       
   460 // -----------------------------------------------------------------------------
       
   461 // CFSMailClient::AuthenticateL
       
   462 // -----------------------------------------------------------------------------
       
   463 EXPORT_C TInt CFSMailClient::AuthenticateL(MFSMailRequestObserver& aOperationObserver)
       
   464 	{
       
   465     FUNC_LOG;
       
   466 
       
   467 	TInt requestId(0);
       
   468 	
       
   469 	for(TInt i=0;i<iFWImplementation->GetPluginManager().GetPluginCount();i++)
       
   470 	{
       
   471 		if(CFSMailPlugin* plugin = iFWImplementation->GetPluginManager().GetPluginByIndex(i))
       
   472 		{
       
   473 		    // get async request id
       
   474 		    TUid id = iFWImplementation->GetPluginManager().GetPluginIdByIndex(i);
       
   475     		TFSPendingRequest request = iFWImplementation->GetPluginManager().InitAsyncRequestL(	id,	aOperationObserver);
       
   476     		
       
   477     		// send authentication requests
       
   478 			requestId = request.iRequestId;
       
   479 			TRAPD(err,plugin->AuthenticateL( *request.iObserver, requestId ));			
       
   480 			if(err != KErrNone)
       
   481 			{
       
   482 				iFWImplementation->GetPluginManager().CompleteRequest(requestId);
       
   483 			}
       
   484 		}
       
   485 	}
       
   486 
       
   487 	return requestId;
       
   488 
       
   489 	}
       
   490 
       
   491 // -----------------------------------------------------------------------------
       
   492 // CFSMailClient::CleanTempDirL
       
   493 // -----------------------------------------------------------------------------
       
   494 EXPORT_C void CFSMailClient::CleanTempDirL( )
       
   495 	{
       
   496     FUNC_LOG;
       
   497     iFWImplementation->GetPluginManager().CleanTempDirL();	
       
   498 	}
       
   499 
       
   500 // -----------------------------------------------------------------------------
       
   501 // CFSMailClient::GetTempDir
       
   502 // -----------------------------------------------------------------------------
       
   503 EXPORT_C TDesC& CFSMailClient::GetTempDirL( )
       
   504 	{
       
   505     FUNC_LOG;
       
   506 	return iFWImplementation->GetPluginManager().GetTempDirL();
       
   507 	}
       
   508 
       
   509 // -----------------------------------------------------------------------------
       
   510 // CFSMailClient::CancelL
       
   511 // -----------------------------------------------------------------------------
       
   512 EXPORT_C void CFSMailClient::CancelL( const TInt aRequestId )
       
   513 	{
       
   514     FUNC_LOG;
       
   515 	iFWImplementation->GetPluginManager().CancelRequestL(aRequestId);
       
   516 	}
       
   517 
       
   518 // -----------------------------------------------------------------------------
       
   519 // CFSMailClient::CancelAllL
       
   520 // -----------------------------------------------------------------------------
       
   521 EXPORT_C void CFSMailClient::CancelAllL( )
       
   522 	{
       
   523     FUNC_LOG;
       
   524 		iFWImplementation->GetPluginManager().CancelAllRequestsL();
       
   525 	}
       
   526 
       
   527 // -----------------------------------------------------------------------------
       
   528 // CFSMailClient::SetMailboxName
       
   529 // -----------------------------------------------------------------------------
       
   530 EXPORT_C void CFSMailClient::SetMailboxName( const TFSMailMsgId aMailboxId, const TDesC& aMailboxName )
       
   531 	{
       
   532     FUNC_LOG;
       
   533 	CFSMailPlugin* plugin = iFWImplementation->GetPluginManager().GetPluginByUid( aMailboxId );
       
   534 	if ( plugin )
       
   535 		{
       
   536 		plugin->SetMailboxName( aMailboxId, aMailboxName );
       
   537 		}
       
   538 	}
       
   539 	
       
   540 // -----------------------------------------------------------------------------
       
   541 // CFSMailClient::Close
       
   542 // -----------------------------------------------------------------------------
       
   543 EXPORT_C void CFSMailClient::Close()
       
   544 {
       
   545     FUNC_LOG;
       
   546 	CFSMailClient* instance = Instance();
       
   547 	if(!instance)
       
   548 	{
       
   549 		return;
       
   550 	}
       
   551 
       
   552 	if(instance->DecReferenceCount() == 0)
       
   553 	{
       
   554 		if(iFWImplementation)
       
   555 		{
       
   556 			delete iFWImplementation;
       
   557 			iFWImplementation = NULL;		
       
   558 		}
       
   559 		Dll::FreeTls();
       
   560   		delete instance;
       
   561 	}
       
   562 }
       
   563 	
       
   564 // -----------------------------------------------------------------------------
       
   565 // CFSMailClient::Instance
       
   566 // -----------------------------------------------------------------------------
       
   567 CFSMailClient* CFSMailClient::Instance()
       
   568 {
       
   569     FUNC_LOG;
       
   570 	return static_cast<CFSMailClient*>(Dll::Tls());
       
   571 }
       
   572 
       
   573 // -----------------------------------------------------------------------------
       
   574 // CFSMailClient::IncReferenceCount
       
   575 // -----------------------------------------------------------------------------
       
   576 TInt CFSMailClient::IncReferenceCount()
       
   577 {
       
   578     FUNC_LOG;
       
   579 	return ++iReferenceCount;
       
   580 }
       
   581 
       
   582 // -----------------------------------------------------------------------------
       
   583 // CFSMailClient::DecReferenceCount
       
   584 // -----------------------------------------------------------------------------
       
   585 TInt CFSMailClient::DecReferenceCount()
       
   586 {
       
   587     FUNC_LOG;
       
   588 	return --iReferenceCount;
       
   589 }
       
   590 
       
   591 // -----------------------------------------------------------------------------
       
   592 // CFSMailClient::ReleaseExtension
       
   593 // -----------------------------------------------------------------------------
       
   594 EXPORT_C void CFSMailClient::ReleaseExtension( CEmailExtension* aExtension )
       
   595     {
       
   596     CExtendableEmail::ReleaseExtension( aExtension );
       
   597     }
       
   598 
       
   599 // -----------------------------------------------------------------------------
       
   600 // CFSMailClient::ExtensionL
       
   601 // -----------------------------------------------------------------------------
       
   602 EXPORT_C CEmailExtension* CFSMailClient::ExtensionL( const TUid& aInterfaceUid )
       
   603     {
       
   604     return CExtendableEmail::ExtensionL( aInterfaceUid );
       
   605     }
       
   606