16 * |
16 * |
17 */ |
17 */ |
18 |
18 |
19 #include "ipssosaopluginheaders.h" |
19 #include "ipssosaopluginheaders.h" |
20 |
20 |
21 //const TInt KAOSmtpStartDelaySeconds = 310; |
|
22 const TInt KIpsSosAOImapPopLogicDefGra = 1; |
21 const TInt KIpsSosAOImapPopLogicDefGra = 1; |
23 //const TInt KIpsSosAoImapPopLogicEventGra = 2; |
22 const TInt KMailboxCreatedTimeout = 500000; // 0.5 sec |
24 |
23 |
25 // ---------------------------------------------------------------------------- |
24 // ---------------------------------------------------------------------------- |
26 // class CIpsSosAOImapPopLogic |
25 // class CIpsSosAOImapPopLogic |
27 // ---------------------------------------------------------------------------- |
26 // ---------------------------------------------------------------------------- |
28 // |
27 // |
214 { |
213 { |
215 FUNC_LOG; |
214 FUNC_LOG; |
216 switch( aEvent ) |
215 switch( aEvent ) |
217 { |
216 { |
218 case MMsvSessionObserver::EMsvEntriesCreated: |
217 case MMsvSessionObserver::EMsvEntriesCreated: |
|
218 handleEntriesCreatedL(aArg1); |
219 break; |
219 break; |
220 case MMsvSessionObserver::EMsvEntriesChanged: |
220 case MMsvSessionObserver::EMsvEntriesChanged: |
221 { |
221 { |
222 TMsvId parent = (*(TMsvId*) (aArg2)); |
222 TMsvId parent = (*(TMsvId*) (aArg2)); |
223 //we check that parent is the root. if not, it cannot be an |
223 //we check that parent is the root. if not, it cannot be an |
509 } |
509 } |
510 } |
510 } |
511 |
511 |
512 CleanupStack::PopAndDestroy( 3, cEntry ); |
512 CleanupStack::PopAndDestroy( 3, cEntry ); |
513 } |
513 } |
|
514 |
|
515 // ---------------------------------------------------------------------------- |
|
516 // ---------------------------------------------------------------------------- |
|
517 void CIpsSosAOImapPopLogic::handleEntriesCreatedL(const TAny* aArg1) |
|
518 { |
|
519 FUNC_LOG; |
|
520 TMsvEntry entry; |
|
521 getFirstEntryFromSelectionL(static_cast<const CMsvEntrySelection*>(aArg1), entry); |
|
522 |
|
523 if( entry.iMtm==KSenduiMtmImap4Uid || entry.iMtm==KSenduiMtmPop3Uid) |
|
524 { |
|
525 // handling imap4 or pop3 entry |
|
526 if(entry.iType.iUid==KUidMsvServiceEntryValue) |
|
527 { |
|
528 // new mailbox has been created, starting sync for it |
|
529 User::After(KMailboxCreatedTimeout); // sleep for 0.5 sec; guarantees that mailbox is fully set up, and message server ready to serve it |
|
530 RefreshMailboxListL(); |
|
531 SendCommandToSpecificMailboxL( entry.Id(), CIpsSosAOMBoxLogic::ECommandStart ); |
|
532 SendCommandToSpecificMailboxL( entry.Id(), CIpsSosAOMBoxLogic::ECommandStartSync ); |
|
533 } |
|
534 } |
|
535 } |
|
536 |
|
537 // ---------------------------------------------------------------------------- |
|
538 // ---------------------------------------------------------------------------- |
|
539 void CIpsSosAOImapPopLogic::getFirstEntryFromSelectionL(const CMsvEntrySelection* aSelection, TMsvEntry& aEntry) |
|
540 { |
|
541 FUNC_LOG; |
|
542 if ( aSelection->Count() == 0) |
|
543 { |
|
544 User::Leave( KErrArgument ); |
|
545 } |
|
546 |
|
547 TMsvId dummy( KMsvNullIndexEntryIdValue ); |
|
548 User::LeaveIfError( iSession.GetEntry( aSelection->At(0), dummy, aEntry ) ); |
|
549 } |
|
550 |
514 // End of file |
551 // End of file |
515 |
552 |