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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

}System.err.println("Error: cannot login to Sametime server");return -1;resolve();}return m_shUserStatus;The login() method and its helper, the isLoggedIn() method (Example 4-5),attempt to log the application in to the Sametime server. The application waitsuntil login is successful or the number of login attempts is exceeded. If the loginattempt is unsuccessful, the Sametime session is stopped and unloaded. If theattempt is successful, the loggedIn() method is called.Example 4-5 UserStatus login() and isloggedIn() methodsprivate void login(){m_communityService.addLoginListener(this);m_communityService.loginByPassword("", "","");int loginAttempts = 0;boolean loginExpired = false;do{if (++loginAttempts > 1000){loginExpired = true;}try{Thread.sleep(5);}catch (InterruptedException ie){ie.printStackTrace();}}while (isLoggedIn() == false && loginExpired == false);if(isLoggedIn() == false){m_session.stop();m_session.unloadSession();m_bSetup = true;90 <strong>Lotus</strong> <strong>Instant</strong> <strong>Messaging</strong>/<strong>Web</strong> <strong>Conferencing</strong> (Sametime): Building Sametime-Enabled Applications

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

Saved successfully!

Ooh no, something went wrong!