NotificationManager::~NotificationManager(){ if(mListener != NULL){ isSokcetInited = false; stopListener(); delete mListener; mListener = NULL; } }
/* * This method sets the pointer to this instance's listener to the * passed-in value. The memory management of this listener will then * fall to this instance and it will be cleaned up when the time is * right. */ void CKIRCProtocol::setListener( CKIRCProtocolListener *aListener ) { // first, see if we have any current listener if (mListener != NULL) { /* * We need to nicely kill this current listener */ stopListener(); // now let's delete it as it's no longer needed delete mListener; mListener = NULL; } // now we can set the value if it's not NULL if (aListener != NULL) { mListener = aListener; } }
/* * This method will log out any logged in user and break the * established connection to the IRC host. This is useful * when "shutting down" as it takes care of all the * possibilities in one fell swoop. */ void CKIRCProtocol::disconnect() { // first, stop the listener stopListener(); // now handle the connection to the IRC server itself. if (isConnected()) { if (isLoggedIn()) { doQUIT("bye"); setIsLoggedIn(false); } { CKStackLocker lockem(&mCommPortMutex); mCommPort.disconnect(); } // clear out all the channels we joined clearChannelList(); } }
void UDP::restartListener() { stopListener(); startListener(false); }