10.07.2015 Views

Lotus Instant Messaging/ Web Conferencing ... - IBM Redbooks

Lotus Instant Messaging/ Web Conferencing ... - IBM Redbooks

Lotus Instant Messaging/ Web Conferencing ... - IBM Redbooks

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

When the service is down, we set the m_BLServiceIsOn value to FALSE so thatthe application will know how to handle the case when the user tries to updatehis list (add/remove people) (see Example 7-4).Example 7-4 Handling serviceUnavailable eventvoid AwarenessList::serviceUnavailable(BLEvent event){m_BLServiceIsOn = FALSE;}7.4.3 Loading the user buddylistNow that we are all set, we can load the user buddylist after successfully loggingin. The class MainAppDlg is responsible for receiving the logged in event. Youcan see in the original sample code that the application calls the AwarnessListAddUser method with the current logged in user information. We would like tochange this and instead call a new method: LoadBuddyList. We will modify theoriginal sample code by including this line:m_pAwarenessList->LoadBuddyList(&myUserInstance);instead of the original line:m_pAwarenessList->AddUser(&myUserInstance);We will add the new LoadBuddyList method to the AwarenessList class, as inExample 7-5.Example 7-5 LoadBuddyList methodvoid AwarenessList::LoadBuddyList(STUser* user){m_pMyUser<strong>Instant</strong> = new STUser(*user);if ( (!m_BLServiceIsOn) && (m_pBuddyListService))m_pBuddyListService->getBuddyList();}As you can see in Example 7-5, there is a new class member calledm_pMyUser<strong>Instant</strong>. This member contains the current logged in userinformation. We will need this member later in case of a load failure.Note that we are loading the BuddyList service only if the service is up. If theservice is not currently available, we will load it later on once the servicebecomes available. See the HandlingServiceEvent example (Example 7-3 onpage 174) for reference.Chapter 7. BuddyList service 175

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!