wvuing/wvuiada/Src/CCAImpsGroupClient.cpp
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2005 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:  Implements group services interface.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include    "CCAImpsGroupClient.h"
       
    22 #include	"TCAInterfaceSignaller.h"
       
    23 
       
    24 // ============================ MEMBER FUNCTIONS ===============================
       
    25 
       
    26 // -----------------------------------------------------------------------------
       
    27 // CCAImpsGroupClient::CCAImpsGroupClient
       
    28 // C++ default constructor can NOT contain any code, that
       
    29 // might leave.
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 CCAImpsGroupClient::CCAImpsGroupClient( RImpsEng& aImpsEng )
       
    33         : iImpsEng( aImpsEng )
       
    34     {
       
    35     }
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // CCAImpsGroupClient::NewL
       
    39 // Two-phased constructor.
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 CCAImpsGroupClient* CCAImpsGroupClient::NewL( RImpsEng& aImpsEng )
       
    43     {
       
    44     CCAImpsGroupClient* self = new ( ELeave ) CCAImpsGroupClient( aImpsEng );
       
    45     return self;
       
    46     }
       
    47 
       
    48 
       
    49 // Destructor
       
    50 CCAImpsGroupClient::~CCAImpsGroupClient()
       
    51     {
       
    52     }
       
    53 
       
    54 // -----------------------------------------------------------------------------
       
    55 // CCAImpsGroupClient::InterfaceL
       
    56 // Returns registered WV Engine interface. Implements lazy initialization.
       
    57 // (other items were commented in a header).
       
    58 // -----------------------------------------------------------------------------
       
    59 //
       
    60 RImpsGroupClient2* CCAImpsGroupClient::InterfaceL()
       
    61     {
       
    62     if ( iLazyInitialization )
       
    63         {
       
    64         // Connect to IMPS engine (server)
       
    65         TCAInterfaceSignaller::ConnectL();
       
    66 
       
    67         iClient.RegisterL( iImpsEng, iGroupHandler, KNullDesC, ETrue,
       
    68                            iPriority );
       
    69         iLazyInitialization = EFalse;
       
    70         iRegistered = ETrue;
       
    71         if ( iErrorHandler )
       
    72             {
       
    73             iClient.RegisterErrorObserverL( *iErrorHandler );
       
    74             }
       
    75         if ( iStatusHandler )
       
    76             {
       
    77             iClient.RegisterStatusObserverL( iStatusHandler );
       
    78             }
       
    79         }
       
    80     return &iClient;
       
    81     }
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // CCAImpsGroupClient::RegisterL
       
    85 // Stores values for later registration. Implements lazy initialization.
       
    86 // (other items were commented in a header).
       
    87 // -----------------------------------------------------------------------------
       
    88 //
       
    89 void CCAImpsGroupClient::RegisterL( MImpsGroupHandler2* aObserver,
       
    90                                     TUid aApplicationId, TInt aPriority /* = 0  */ )
       
    91     {
       
    92     iPriority = aPriority;
       
    93     iApplicationId = aApplicationId;
       
    94     iGroupHandler = aObserver;
       
    95     iLazyInitialization = ETrue;
       
    96     }
       
    97 
       
    98 // -----------------------------------------------------------------------------
       
    99 // CCAImpsGroupClient::Unregister
       
   100 // Unregisters if registered. Clears member variables.
       
   101 // (other items were commented in a header).
       
   102 // -----------------------------------------------------------------------------
       
   103 //
       
   104 void CCAImpsGroupClient::Unregister()
       
   105     {
       
   106     if ( iRegistered )
       
   107         {
       
   108         iClient.Unregister();
       
   109         }
       
   110     iLazyInitialization = ETrue;
       
   111     iRegistered = EFalse;
       
   112     }
       
   113 
       
   114 // -----------------------------------------------------------------------------
       
   115 // CCAImpsGroupClient::AddMembersL
       
   116 // Forwards the call to WV Engine.
       
   117 // (other items were commented in a header).
       
   118 // -----------------------------------------------------------------------------
       
   119 //
       
   120 TInt CCAImpsGroupClient::AddMembersL( const TDesC& aGroupId,
       
   121                                       const MDesCArray& aUserList, const MDesCArray& aScreenNameList )
       
   122     {
       
   123     return InterfaceL()->AddMembersL( aGroupId, aUserList, aScreenNameList );
       
   124     }
       
   125 
       
   126 // -----------------------------------------------------------------------------
       
   127 // CCAImpsGroupClient::CheckSubscriptionL
       
   128 // Forwards the call to WV Engine.
       
   129 // (other items were commented in a header).
       
   130 // -----------------------------------------------------------------------------
       
   131 //
       
   132 TInt CCAImpsGroupClient::CheckSubscriptionL( const TDesC& aGroupId )
       
   133     {
       
   134     return InterfaceL()->CheckSubscriptionL( aGroupId );
       
   135     }
       
   136 
       
   137 // -----------------------------------------------------------------------------
       
   138 // CCAImpsGroupClient::CreateGroupL
       
   139 // Forwards the call to WV Engine.
       
   140 // (other items were commented in a header).
       
   141 // -----------------------------------------------------------------------------
       
   142 //
       
   143 TInt CCAImpsGroupClient::CreateGroupL( const TDesC& aGroupId,
       
   144                                        const CImpsCommonGroupProps* aProperties, const TDesC& aScreenName,
       
   145                                        TBool aJoinGroup, TBool aSubscribeNotification /* = EFalse  */ )
       
   146     {
       
   147     return InterfaceL()->CreateGroupL( aGroupId, aProperties, aScreenName,
       
   148                                        aJoinGroup, aSubscribeNotification /* = EFalse  */ );
       
   149     }
       
   150 
       
   151 // -----------------------------------------------------------------------------
       
   152 // CCAImpsGroupClient::DeleteGroupL
       
   153 // Forwards the call to WV Engine.
       
   154 // (other items were commented in a header).
       
   155 // -----------------------------------------------------------------------------
       
   156 //
       
   157 TInt CCAImpsGroupClient::DeleteGroupL( const TDesC& aGroupId )
       
   158     {
       
   159     return InterfaceL()->DeleteGroupL( aGroupId );
       
   160     }
       
   161 
       
   162 // -----------------------------------------------------------------------------
       
   163 // CCAImpsGroupClient::GroupMembersL
       
   164 // Forwards the call to WV Engine.
       
   165 // (other items were commented in a header).
       
   166 // -----------------------------------------------------------------------------
       
   167 //
       
   168 TInt CCAImpsGroupClient::GroupMembersL( const TDesC& aGroupId )
       
   169     {
       
   170     return InterfaceL()->GroupMembersL( aGroupId );
       
   171     }
       
   172 
       
   173 // -----------------------------------------------------------------------------
       
   174 // CCAImpsGroupClient::GroupPropertiesL
       
   175 // Forwards the call to WV Engine.
       
   176 // (other items were commented in a header).
       
   177 // -----------------------------------------------------------------------------
       
   178 //
       
   179 TInt CCAImpsGroupClient::GroupPropertiesL( const TDesC& aGroupId )
       
   180     {
       
   181     return InterfaceL()->GroupPropertiesL( aGroupId );
       
   182     }
       
   183 
       
   184 // -----------------------------------------------------------------------------
       
   185 // CCAImpsGroupClient::JoinGroupL
       
   186 // Forwards the call to WV Engine.
       
   187 // (other items were commented in a header).
       
   188 // -----------------------------------------------------------------------------
       
   189 //
       
   190 TInt CCAImpsGroupClient::JoinGroupL(
       
   191     const TDesC& aGroupId,
       
   192     const TDesC& aScreenName,
       
   193     TBool aUsers,
       
   194     TBool aSubscribeNotification /* = EFalse  */ )
       
   195     {
       
   196     return InterfaceL()->JoinGroupL( aGroupId, aScreenName, aUsers,
       
   197                                      aSubscribeNotification /* = EFalse  */ );
       
   198     }
       
   199 
       
   200 // -----------------------------------------------------------------------------
       
   201 // CCAImpsGroupClient::LeaveGroupL
       
   202 // Forwards the call to WV Engine.
       
   203 // (other items were commented in a header).
       
   204 // -----------------------------------------------------------------------------
       
   205 //
       
   206 TInt CCAImpsGroupClient::LeaveGroupL( const TDesC& aGroupId )
       
   207     {
       
   208     return InterfaceL()->LeaveGroupL( aGroupId );
       
   209     }
       
   210 
       
   211 // -----------------------------------------------------------------------------
       
   212 // CCAImpsGroupClient::ModifyMembersAccessL
       
   213 // Forwards the call to WV Engine.
       
   214 // (other items were commented in a header).
       
   215 // -----------------------------------------------------------------------------
       
   216 //
       
   217 TInt CCAImpsGroupClient::ModifyMembersAccessL( const TDesC& aGroupId,
       
   218                                                const MDesCArray* aAdminList, const MDesCArray* aModerList,
       
   219                                                const MDesCArray* aOrdinaryList )
       
   220     {
       
   221     return InterfaceL()->ModifyMembersAccessL( aGroupId, aAdminList, aModerList,
       
   222                                                aOrdinaryList );
       
   223     }
       
   224 
       
   225 // -----------------------------------------------------------------------------
       
   226 // CCAImpsGroupClient::RemoveMembersL
       
   227 // Forwards the call to WV Engine.
       
   228 // (other items were commented in a header).
       
   229 // -----------------------------------------------------------------------------
       
   230 //
       
   231 TInt CCAImpsGroupClient::RemoveMembersL( const TDesC& aGroupId,
       
   232                                          const MDesCArray& aUserList )
       
   233     {
       
   234     return InterfaceL()->RemoveMembersL( aGroupId, aUserList );
       
   235     }
       
   236 
       
   237 // -----------------------------------------------------------------------------
       
   238 // CCAImpsGroupClient::SetGroupPropertiesL
       
   239 // Forwards the call to WV Engine.
       
   240 // (other items were commented in a header).
       
   241 // -----------------------------------------------------------------------------
       
   242 //
       
   243 TInt CCAImpsGroupClient::SetGroupPropertiesL( const TDesC& aGroupId,
       
   244                                               const CImpsCommonGroupProps* aGroupProps,
       
   245                                               const CImpsPrivateGroupProps* aOwnProps )
       
   246     {
       
   247     return InterfaceL()->SetGroupPropertiesL( aGroupId, aGroupProps, aOwnProps );
       
   248     }
       
   249 
       
   250 // -----------------------------------------------------------------------------
       
   251 // CCAImpsGroupClient::SetRejectListL
       
   252 // Forwards the call to WV Engine.
       
   253 // (other items were commented in a header).
       
   254 // -----------------------------------------------------------------------------
       
   255 //
       
   256 TInt CCAImpsGroupClient::SetRejectListL( const TDesC& aGroupId,
       
   257                                          const MDesCArray* aRejectedList, const MDesCArray* aEnabledList )
       
   258     {
       
   259     return InterfaceL()->SetRejectListL( aGroupId, aRejectedList, aEnabledList );
       
   260     }
       
   261 
       
   262 // -----------------------------------------------------------------------------
       
   263 // CCAImpsGroupClient::SubscribeL
       
   264 // Forwards the call to WV Engine.
       
   265 // (other items were commented in a header).
       
   266 // -----------------------------------------------------------------------------
       
   267 //
       
   268 TInt CCAImpsGroupClient::SubscribeL( const TDesC& aGroupId )
       
   269     {
       
   270     return InterfaceL()->SubscribeL( aGroupId );
       
   271     }
       
   272 
       
   273 // -----------------------------------------------------------------------------
       
   274 // CCAImpsGroupClient::UnsubscribeL
       
   275 // Forwards the call to WV Engine.
       
   276 // (other items were commented in a header).
       
   277 // -----------------------------------------------------------------------------
       
   278 //
       
   279 TInt CCAImpsGroupClient::UnsubscribeL( const TDesC& aGroupId )
       
   280     {
       
   281     return InterfaceL()->UnsubscribeL( aGroupId );
       
   282     }
       
   283 
       
   284 // -----------------------------------------------------------------------------
       
   285 // CCAImpsGroupClient::GetServicesL
       
   286 // Forwards the call to WV Engine.
       
   287 // (other items were commented in a header).
       
   288 // -----------------------------------------------------------------------------
       
   289 //
       
   290 void CCAImpsGroupClient::GetServicesL( TImpsServices& aServices )
       
   291     {
       
   292     InterfaceL()->GetServicesL( aServices );
       
   293     }
       
   294 
       
   295 // -----------------------------------------------------------------------------
       
   296 // CCAImpsGroupClient::RegisterErrorObserverL
       
   297 // Calls WV Engine if registered.
       
   298 // (other items were commented in a header).
       
   299 // -----------------------------------------------------------------------------
       
   300 //
       
   301 void CCAImpsGroupClient::RegisterErrorObserverL( MImpsErrorHandler2 &aObs )
       
   302     {
       
   303     iErrorHandler = &aObs;
       
   304     if ( iRegistered )
       
   305         {
       
   306         InterfaceL()->RegisterErrorObserverL( *iErrorHandler );
       
   307         }
       
   308     }
       
   309 
       
   310 // -----------------------------------------------------------------------------
       
   311 // CCAImpsGroupClient::UnregisterErrorObserverL
       
   312 // Calls WV Engine always.
       
   313 // (other items were commented in a header).
       
   314 // -----------------------------------------------------------------------------
       
   315 //
       
   316 void CCAImpsGroupClient::UnregisterErrorObserverL()
       
   317     {
       
   318     iClient.UnregisterErrorObserverL();
       
   319     }
       
   320 
       
   321 // -----------------------------------------------------------------------------
       
   322 // CCAImpsGroupClient::RegisterStatusObserverL
       
   323 // Calls WV Engine if registered.
       
   324 // (other items were commented in a header).
       
   325 // -----------------------------------------------------------------------------
       
   326 //
       
   327 void CCAImpsGroupClient::RegisterStatusObserverL( MImpsStatusHandler2 *aObs )
       
   328     {
       
   329     iStatusHandler = aObs;
       
   330     if ( iRegistered )
       
   331         {
       
   332         InterfaceL()->RegisterStatusObserverL( iStatusHandler );
       
   333         }
       
   334     }
       
   335 
       
   336 // -----------------------------------------------------------------------------
       
   337 // CCAImpsGroupClient::UnregisterStatusObserverL
       
   338 // Calls WV Engine always.
       
   339 // (other items were commented in a header).
       
   340 // -----------------------------------------------------------------------------
       
   341 //
       
   342 void CCAImpsGroupClient::UnregisterStatusObserverL()
       
   343     {
       
   344     iClient.UnregisterStatusObserverL();
       
   345     }
       
   346 
       
   347 // -----------------------------------------------------------------------------
       
   348 // CCAImpsGroupClient::StatusHandler
       
   349 // Returns current status handler pointer.
       
   350 // (other items were commented in a header).
       
   351 // -----------------------------------------------------------------------------
       
   352 //
       
   353 MImpsStatusHandler2* CCAImpsGroupClient::StatusHandler() const
       
   354     {
       
   355     return iStatusHandler;
       
   356     }
       
   357 
       
   358 // -----------------------------------------------------------------------------
       
   359 // CCAImpsGroupClient::ErrorHandler
       
   360 // Returns current error handler pointer.
       
   361 // (other items were commented in a header).
       
   362 // -----------------------------------------------------------------------------
       
   363 //
       
   364 MImpsErrorHandler2* CCAImpsGroupClient::ErrorHandler() const
       
   365     {
       
   366     return iErrorHandler;
       
   367     }
       
   368 
       
   369 //  End of File