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.

First, we will need to add a new member to this class that will represent theBuddyList service. To accomplish this, we add the following line to the classmember definition:BLService* m_pBuddyListservice;The AwarenessList class will also need to receive events from the BuddyListservice so it will inherit the BLServiceListener class:class AwarenessList : public CDialog,public BLServiceListenerFor initializing the m_pBuddyListService member, we will add the lines inExample 7-2 at the end of the AwarenessList constructor.Example 7-2 initial the m_pBuddyListService memberAwarenessList::AwarenessList(STSession* pSTSession, CRect windowRect,CWnd* pParent /* = NULL */): CDialog(AwarenessList::IDD, pParent),m_pAwarenessService(NULL),m_pWatchList(NULL),m_pAwarenessServiceListener(NULL),m_pAwarenessStatusListener(NULL),m_windowRect(windowRect),m_bEnableRemoving(TRUE),m_pChatUI(NULL){...if (pSTSession)m_pBuddyListService = (BLService*)pSTSession->getComponent(BUDDY_LIST_COMP_NAME);if (!m_pBuddyListService)return;}m_pBuddyListService->addBLServiceListener(this);Finally, when the awareness list gets destroyed, it needs to stop listening to theBuddyList service event. To enable this, we will add the following lines in theOnDestroy method:if (m_pBuddyListService){m_pBuddyListService->removeBLServiceListener(this);m_pBuddyListService = NULL;}Chapter 7. BuddyList service 173

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

Saved successfully!

Ooh no, something went wrong!