mmsharing/mmshengine/src/mussipprofilehandler.cpp
branchRCL_3
changeset 22 73a1feb507fb
parent 0 f0cf47e981f9
child 23 bc78a40cd63c
--- a/mmsharing/mmshengine/src/mussipprofilehandler.cpp	Thu Aug 19 09:51:39 2010 +0300
+++ b/mmsharing/mmshengine/src/mussipprofilehandler.cpp	Tue Aug 31 15:12:07 2010 +0300
@@ -12,6 +12,9 @@
 * Contributors:
 *
 * Description:  Utilities to get and set profile used with SWIS.
+*  Part of     : Mus For S60 v3.2
+*  Description : Utilities to get and set profile used with SWIS.
+*  Version     : %version: 11.1.5 % << Don't touch! Updated by Synergy at check-out.
 *
 */
 
@@ -31,8 +34,6 @@
 #include <sipprofilealrcontroller.h>
 #include <uri8.h>
 
-
-
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -47,7 +48,6 @@
     return self;
     }
 
-
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -75,7 +75,6 @@
     MUS_LOG( "mus: [ENGINE]  <- CMusSipProfileHandler::ConstructL()" )
     }
 
-
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -89,7 +88,6 @@
     MUS_LOG( "mus: [ENGINE]     CMusSipProfileHandler::~CMusSipProfileHandler()" )
     }
 
-
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -105,16 +103,11 @@
         {
         profile = iProfileRegistry->DefaultProfileL();
         }
-    CleanupStack::PushL( profile );
-    TBool profileRegistered = EFalse;   
-    User::LeaveIfError( profile->GetParameter( KSIPProfileRegistered,
-                                                   profileRegistered  ) );
-    CleanupStack::Pop( profile );   
+       
     delete iSipProfile;
     iSipProfile = profile;
     }
 
-
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -124,76 +117,6 @@
     return iSipProfile;
     }
 
-#if 0 //TODO: should this be removed?
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-CSIPProfile& CMusSipProfileHandler::SipProfileL( TInt aSipProfileId )
-    {
-    MUS_LOG1( "mus: [ENGINE]     -> CMusSipProfileHandler::SipProfileL(),\
-              od #%d", aSipProfileId )
-
-    if ( !iSipProfile )
-        {        
-        if ( aSipProfileId != 0 )
-            {
-            iSipProfile = iProfileRegistry->ProfileL( aSipProfileId );
-            }
-        else
-            {
-            iSipProfile = iProfileRegistry->DefaultProfileL();
-            }
-        }
-
-    // The parameter val indicates if the profile can be immediately
-    // used for creating a session, or if the client must wait for
-    // the profile to be registered.
-    TBool profileRegistered = EFalse;
-    
-    User::LeaveIfError( iSipProfile->GetParameter( KSIPProfileRegistered,
-                                                   profileRegistered  ) );
-                                                       
-    if ( !profileRegistered )
-        {
-
-        #if (defined (__WINS__) || defined(__WINSCW__))
-        
-        iProfileRegistry->EnableL( *iSipProfile, *this );            
-
-        User::LeaveIfError( iSipProfile->GetParameter( KSIPProfileRegistered,
-                                                       profileRegistered  ) );
-                                               
-        if( !profileRegistered )
-            {
-            CActiveScheduler::Start();
-
-            User::LeaveIfError( iSipProfile->GetParameter( 
-                                                    KSIPProfileRegistered,
-                                                    profileRegistered  ) );
-            
-            if ( !profileRegistered )
-                {
-                User::Leave( KErrNotReady );
-                }
-            }
-
-        #else
-
-        User::Leave( KErrNotReady );
-
-        #endif
-
-        }
-    
-        
-    MUS_LOG( "mus: [ENGINE]  <- CMusSipProfileHandler::SipProfileL()" )
-    
-    return *iSipProfile;
-    }
-#endif
-
-
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -206,10 +129,9 @@
 
     const MDesC8Array* aors = NULL;
     User::LeaveIfError( iSipProfile->GetParameter( KSIPRegisteredAors, aors ) );
-    if( !aors || aors->MdcaCount() <= 0 ) 
-        {    
-        User::Leave( KErrArgument );            
-        }
+    __ASSERT_ALWAYS( aors && aors->MdcaCount() > 0, 
+                     User::Leave( KErrArgument ) );
+    
     TUriParser8 parser;
     User::LeaveIfError( parser.Parse( aors->MdcaPoint( 0 ) ) );
     MUS_LOG( "mus: [ENGINE]  <- CMusSipProfileHandler::UserFromProfileLC()" )
@@ -229,13 +151,50 @@
 
 
 // -----------------------------------------------------------------------------
+// This function should never be called before creating a profile, but such
+// a situation will be considered as pending registration.
+// -----------------------------------------------------------------------------
+//
+TBool CMusSipProfileHandler::IsRegistered()
+    {
+    MUS_LOG( "mus: [ENGINE]  -> CMusSipProfileHandler::IsRegistered()" )
+    
+    TBool profileRegistered = EFalse;   
+    if ( iSipProfile ) 
+        {
+        iSipProfile->GetParameter( KSIPProfileRegistered, profileRegistered  );  
+        }
+    
+    MUS_LOG1( "mus: [ENGINE]  <- CMusSipProfileHandler::IsRegistered( %d )",
+              profileRegistered )
+    
+    return profileRegistered;
+    }
+
+
+// -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
 //
 void CMusSipProfileHandler::ProfileRegistryEventOccurred(
-    TUint32 /*aProfileId*/,
-    MSIPProfileRegistryObserver::TEvent /*aEvent*/ )
+    TUint32 aProfileId,
+    MSIPProfileRegistryObserver::TEvent aEvent )
     {
+    if ( iSipProfile && aProfileId == ProfileId() )
+        {
+        switch ( aEvent )
+            {
+            case MSIPProfileRegistryObserver::EProfileRegistered:
+                {
+                iUser.ProfileRegistered();
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
     }
 
 
@@ -249,6 +208,7 @@
     {
     }
 
+
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -296,7 +256,6 @@
     delete aTransaction; 
     }
 
-
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -306,7 +265,6 @@
     {
     }
 
-
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -317,7 +275,6 @@
     {
     }
 
-
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -330,7 +287,6 @@
     delete aDialogAssoc;     
     }
 
-
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -340,7 +296,6 @@
     CSIPRegistrationBinding& /*aRegistration*/ )
     {
     }
-    
 
 // -----------------------------------------------------------------------------
 //
@@ -352,7 +307,6 @@
     {
     }
 
-
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -364,7 +318,6 @@
     {
     }
 
-
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -376,7 +329,6 @@
     {
     }
 
-
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -387,7 +339,6 @@
     {
     }
 
-
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -398,7 +349,6 @@
     {
     }
 
-
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -409,7 +359,6 @@
     {
     }
 
-
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -419,18 +368,15 @@
     {
     }
 
-
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
 //
 void CMusSipProfileHandler::InviteCanceled( 
-                                    CSIPServerTransaction& /*aTransaction*/ )
+    CSIPServerTransaction& /*aTransaction*/ )
     {
-    MUS_LOG( "mus: [ENGINE]      CMusSipProfileHandler::CSIPServerTransaction")
     }
 
-
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -440,7 +386,6 @@
     {
     }
 
-
 // -----------------------------------------------------------------------------
 // CMusSipProfileHandler::AlrEvent
 // From MSipProfileAlrObserver