QtChatHistoryWidget::~QtChatHistoryWidget() { /*QWebSettings *defaultSettings = QWebSettings::globalSettings(); defaultSettings->clearIconDatabase(); */ OWSAFE_DELETE(_copy); OWSAFE_DELETE(_theme); }
QtConferenceCallWidget::~QtConferenceCallWidget() { OWSAFE_DELETE(_ui); OWSAFE_DELETE(_qtVoxOxCallBarFrame1); OWSAFE_DELETE(_qtVoxOxCallBarFrame2); }
WengoPhone::~WengoPhone() { //Deleting created objects OWSAFE_DELETE(_userProfileHandler); OWSAFE_DELETE(_dtmfThemeManager); //// saveConfiguration(); }
UserProfileHandler::~UserProfileHandler() { uninitEventHandlers(); //VOXOX - JRT - 2009.10.07 // RecursiveMutex::ScopedLock lock(_mutex); //VOXOX - JRT - 2009.09.22 OWSAFE_DELETE(_desiredUserProfile); { _saveTimerRunning = false; _saveTimer.stop(); } if (_currentUserProfile) { _currentUserProfile->lock(); //VOXOX - JRT - 2009.09.21 - Fix COE saveUserProfile(*_currentUserProfile); _currentUserProfile->unlock(); //VOXOX - JRT - 2009.09.21 - Fix COE WsUrl::setWengoAccount(NULL); OWSAFE_DELETE(_currentUserProfile); uninitExtLibraries(); } }
//VOXOX CHANGE by Rolando - 2009.09.10 void UserProfileHandler::sipAccountConnectionFailedEventHandlerThreadSafe(EnumSipLoginState::SipLoginState error, std::string loginErrorMessage) { RecursiveMutex::ScopedLock lock(_mutex); //VOXOX - JRT - 2009.09.22 - Prevent COE LOG_ERROR("error: %d", error); SipAccount * sipaccount = _currentUserProfile->getSipAccount()->clone(); OWSAFE_DELETE(_currentUserProfile); uninitExtLibraries(); sipAccountConnectionFailedEvent(*sipaccount, error, loginErrorMessage);//VOXOX CHANGE by Rolando - 2009.09.10 OWSAFE_DELETE(sipaccount); }
void IMContactListHandler::contactMovedEventHandler(IMContactList & sender, std::string groupName, std::string contactId) { IMAccount * imAccount = _userProfile.getIMAccountManager().getIMAccount(sender.getIMAccountId()); if (imAccount) { IMContact imContact(*imAccount, contactId); bool inList = _imContactList.contains( imContact ); if ( inList ) { LOG_DEBUG("an IMContact has moved:" + contactId + ". New Group: " + groupName ); imContactMovedEvent(*this, groupName, imContact); } else { LOG_DEBUG("this IMContact(" + contactId + ") from group " + groupName + " has not been added yet. Adding it as new IMContact."); newContactAddedEventHandler(sender, groupName, contactId); } OWSAFE_DELETE(imAccount); } }
void QtVoxWindowManager::closeWindow(QString id){ ActiveWindowList::iterator imIter = _activeWindowList.find(id); if (imIter != _activeWindowList.end()) { OWSAFE_DELETE(imIter->second); _activeWindowList.erase(imIter); } }
QtVoxOxLoadingLogin::~QtVoxOxLoadingLogin() { OWSAFE_DELETE(_ui); /*if(_timer){ _timer->stop(); OWSAFE_DELETE(_timer); }*/ }
void ConnectHandler::connect(const std::string & imAccountId) { RecursiveMutex::ScopedLock lock(_mutex); Connect * connect = NULL; IMAccount * imAccount = _userProfile->getIMAccountManager().getIMAccount(imAccountId); if (imAccount) { ConnectMap::iterator it = _connectMap.find(imAccountId); if (it == _connectMap.end()) { connect = new Connect(*imAccount, *_userProfile); connect->connectedEvent += boost::bind(&ConnectHandler::connectedEventHandler, this, _1); connect->disconnectedEvent += boost::bind(&ConnectHandler::disconnectedEventHandler, this, _1, _2, _3, _4); //VOXOX - JRT - 2009.07.13 connect->connectionProgressEvent += boost::bind(&ConnectHandler::connectionProgressEventHandler, this, _1, _2, _3, _4); _connectMap.insert(std::pair<std::string, Connect*>(imAccountId, connect)); } else { connect = (*it).second; } if (!(imAccount->isConnected())) { connect->connect(); } OWSAFE_DELETE(imAccount); } else { LOG_ERROR("IMAccount " + imAccountId + " not found!"); } }
void IMContactListHandler::imAccountAddedEventHandler(IMAccountManager & sender, std::string imAccountId) { IMAccount * imAccount = _userProfile.getIMAccountManager().getIMAccount(imAccountId); if (imAccount) { IMContactListMap::iterator it = _imContactListMap.find(imAccountId); if (it == _imContactListMap.end()) { IMContactList * imContactList = IMWrapperFactory::getFactory().createIMContactList(*imAccount); if (imContactList) { imContactList->newContactAddedEvent += boost::bind(&IMContactListHandler::newContactAddedEventHandler, this, _1, _2, _3); imContactList->contactRemovedEvent += boost::bind(&IMContactListHandler::contactRemovedEventHandler, this, _1, _2, _3); imContactList->contactMovedEvent += boost::bind(&IMContactListHandler::contactMovedEventHandler, this, _1, _2, _3); imContactList->newContactGroupAddedEvent += boost::bind(&IMContactListHandler::newContactGroupAddedEventHandler, this, _1, _2); imContactList->contactGroupRemovedEvent += boost::bind(&IMContactListHandler::contactGroupRemovedEventHandler, this, _1, _2); imContactList->setInitialLoadEvent += boost::bind(&IMContactListHandler::setInitialLoadEventHandler, this, _1, _2); _imContactListMap.insert(std::pair<std::string, IMContactList *>(imAccountId, imContactList)); } else { LOG_DEBUG("cannot create an IMContactList"); } } else { LOG_ERROR("this IMAccount has already been added " + imAccount->getLogin()); } OWSAFE_DELETE(imAccount); } }
void QtFileTransferWidget::clean(bool cleanButton) { if (_ui->tabWidget->currentIndex() == DOWNLOAD_TAB_INDEX) { int count = _ui->downloadTransferListWidget->count(); for (int i = count - 1; i >= 0; i--) { QListWidgetItem * item = _ui->downloadTransferListWidget->item(i); QtFileTransferDownloadItem * widgetItem = (QtFileTransferDownloadItem*)_ui->downloadTransferListWidget->itemWidget(item); if (cleanButton) { if (!widgetItem->isRunning()) { _ui->downloadTransferListWidget->takeItem(i); OWSAFE_DELETE(widgetItem); } } else { if ((widgetItem->removeHasBeenClicked()) && (!widgetItem->isRunning())) { _ui->downloadTransferListWidget->takeItem(i); OWSAFE_DELETE(widgetItem); } } } } else { int count = _ui->uploadTransferListWidget->count(); for (int i = count - 1; i >= 0; i--) { QListWidgetItem * item = _ui->uploadTransferListWidget->item(i); QtFileTransferUploadItem * widgetItem = (QtFileTransferUploadItem*)_ui->uploadTransferListWidget->itemWidget(item); if (cleanButton) { if (!widgetItem->isRunning()) { _ui->uploadTransferListWidget->takeItem(i); OWSAFE_DELETE(widgetItem); } } else { if ((widgetItem->removeHasBeenClicked()) && (!widgetItem->isRunning())) { _ui->uploadTransferListWidget->takeItem(i); OWSAFE_DELETE(widgetItem); } } } } }
void QtVoxOxCallBarFrame::fillComboBox() { QStringList tobeinserted = QStringList(); clearComboBox(); //CUserProfile * cUserProfile = // _qtWengoPhone->getCWengoPhone().getCUserProfileHandler().getCUserProfile(); if (!_cUserProfile) { return; } //completion of history //if _qtHistoryWidget is set it means that History has been created bool isWengoAccountConnected = _cUserProfile->getUserProfile().hasWengoAccount(); CHistory* chistory = _cUserProfile->getCHistory(); if (chistory) { HistoryMementoCollection * mementos = chistory->getMementos(HistoryMemento::OutgoingCall, 10); Config & config = ConfigManager::getInstance().getCurrentConfig(); QString wengoSuffix = "@" + QString::fromStdString( config.getWengoRealm() ); for (HistoryMap::iterator it = mementos->begin(); it != mementos->end(); it++) { HistoryMemento * memento = (*it).second; SipAddress sipAddress(memento->getPeer()); QString username(sipAddress.getSipAddress().c_str()); if (isWengoAccountConnected) { username.remove(wengoSuffix); } username.remove("sip:"); if( !username.isEmpty() && (memento->getState()==HistoryMemento::OutgoingCall) && !tobeinserted.contains(username) ) { tobeinserted << username; } } OWSAFE_DELETE(mementos); } //// tobeinserted.sort(); QStringList::const_iterator constIterator; for (constIterator = tobeinserted.constBegin(); constIterator != tobeinserted.constEnd();++constIterator){ addComboBoxItem(*constIterator); } if(tobeinserted.count() > 0){ if(_ui->callBarComboBox->findText(CLEAR_RECENT_CALLS_MESSAGE) == -1){ _ui->callBarComboBox->insertItem (_ui->callBarComboBox->count(), CLEAR_RECENT_CALLS_MESSAGE ); } } clearComboBoxEditText(); }
UserProfile * UserProfileHandler::getUserProfile(const std::string & name) { UserProfile * result = new UserProfile(); UserProfileFileStorage userProfileStorage(*result); userProfileStorage.profileLoadedFromBackupsEvent += profileLoadedFromBackupsEvent; userProfileStorage.profileCannotBeLoadedEvent += profileCannotBeLoadedEvent; if (!userProfileStorage.load(name)) { OWSAFE_DELETE(result); } return result; }
void QtVoxWindowManager::closeAllWindows(){ ActiveWindowList::iterator iter = _activeWindowList.begin(); ActiveWindowList::iterator iterEnd = _activeWindowList.end(); while (iter != iterEnd) { OWSAFE_DELETE(iter->second); _activeWindowList.erase(iter); iter = _activeWindowList.begin(); } }
CUserProfile::~CUserProfile() { OWSAFE_DELETE(_pUserProfile); OWSAFE_DELETE(_cHistory); OWSAFE_DELETE(_cSms); OWSAFE_DELETE(_cSoftUpdate); OWSAFE_DELETE(_cPhoneLine); OWSAFE_DELETE(_cWsContactProfile); //VOXOX - JRT - 2009.08.03 }
void QtAddIMContact::addIMContact() { QString contactId = _ui->contactIdLineEdit->text().trimmed(); if (contactId.isEmpty()) { return; } QString protocolName = _ui->protocolComboBox->currentText(); EnumIMProtocol::IMProtocol imProtocol = EnumIMProtocol::toIMProtocol(protocolName.toStdString()); // sip contact should know their domain Config & config = ConfigManager::getInstance().getCurrentConfig(); QString wengoSuffix = "@" + QString::fromStdString( config.getWengoRealm() ); if (imProtocol == EnumIMProtocol::IMProtocolWengo) { contactId += wengoSuffix; } else if (imProtocol == EnumIMProtocol::IMProtocolSIP) { if (!contactId.contains("@")) { SipAccount * sipaccount = _cUserProfile.getUserProfile().getSipAccount(); if (sipaccount) { contactId += QString("@") + QString::fromStdString(sipaccount->getRealm()); } } } //// IMContact imContact(imProtocol, contactId.toStdString()); IMAccountList imAccounts = getSelectedIMAccounts(imProtocol); if (imAccounts.empty()) { _contactProfile.addIMContact(imContact); } for (IMAccountList::const_iterator it = imAccounts.begin(); it != imAccounts.end(); ++it) { IMAccount * imAccount = // _cUserProfile.getUserProfile().getIMAccountManager().getIMAccount((*it).getUUID()); //VOXOX - JRT - 2009.04.09 // _cUserProfile.getUserProfile().getIMAccountManager().getIMAccount( it->second.getUUID()); _cUserProfile.getUserProfile().getIMAccountManager().getIMAccount( it->second ); //VOXOX - JRT - 2009.04.24 imContact.setIMAccount(imAccount); _contactProfile.addIMContact(imContact); OWSAFE_DELETE(imAccount); } }
void IMContactListHandler::newContactAddedEventHandler(IMContactList & sender, std::string groupName, std::string contactId) { IMAccount * imAccount = _userProfile.getIMAccountManager().getIMAccount(sender.getIMAccountId()); if (imAccount) { IMContact imContact(*imAccount, contactId); IMContact* pAcct = _imContactList.Add( imContact ); if ( pAcct ) { newIMContactAddedEvent(*this, groupName, *pAcct); } OWSAFE_DELETE(imAccount); } }
void ConnectHandler::connectionIsDownEventHandlerThreadSafe() { RecursiveMutex::ScopedLock lock(_mutex); for (ConnectMap::const_iterator it = _connectMap.begin(); it != _connectMap.end(); ++it) { IMAccount * imAccount = _userProfile->getIMAccountManager().getIMAccount((*it).first); if (imAccount) { if (imAccount->isConnected()) { (*it).second->disconnect(true); } OWSAFE_DELETE(imAccount); } else { LOG_ERROR("IMAccount " + (*it).first + " not found!"); } } }
void IMContactListHandler::imAccountRemovedEventHandler(IMAccountManager & sender, std::string imAccountId) { IMAccount * imAccount = _userProfile.getIMAccountManager().getIMAccount(imAccountId); if (imAccount) { IMContactListMap::iterator it = _imContactListMap.find(imAccount->getKey()); if (it != _imContactListMap.end()) { delete (*it).second; _imContactListMap.erase(it); } else { LOG_ERROR("this IMAccount has not been added " + imAccount->getLogin()); } OWSAFE_DELETE(imAccount); } }
void IMContactListHandler::addIMContact(const std::string & groupName, const IMContact & imContact) { //VOXOX - JRT - 2009.09.21 - We have two CRs here that indicate imContact::imAccount is NULL. They both occurred // for same user on same date. Let's just keep an eye on it. IMAccount * imAccount = _userProfile.getIMAccountManager().getIMAccount(*(const_cast<IMContact&>(imContact).getIMAccount())); if (imAccount) { IMContactListMap::iterator it = _imContactListMap.find(imAccount->getKey()); if (it != _imContactListMap.end()) { (*it).second->addContact(groupName, imContact.getContactId()); } else { LOG_DEBUG("this IMAccount is not registered: " + imAccount->getLogin()); } OWSAFE_DELETE(imAccount); } }
void IMContactListHandler::moveContactToGroup(const std::string & newGroupName, const std::string & oldGroupName, const IMContact & imContact) { IMAccount * imAccount = _userProfile.getIMAccountManager().getIMAccount(imContact.getIMAccountId()); if (imAccount) { IMContactListMap::iterator it = _imContactListMap.find(imAccount->getKey()); if (it != _imContactListMap.end()) { //Update servers via PurpleIMContactList::moveContactToGroup() (*it).second->moveContactToGroup(newGroupName, oldGroupName, imContact.getContactId()); } else { LOG_DEBUG("this IMAccount is not registered: " + imAccount->getLogin()); } OWSAFE_DELETE(imAccount); } }
void IMContactListHandler::contactRemovedEventHandler(IMContactList & sender, std::string groupName, std::string contactId) { IMAccount * imAccount = _userProfile.getIMAccountManager().getIMAccount(sender.getIMAccountId()); if (imAccount) { IMContact imContact(*imAccount, contactId); IMContact* pContact = _imContactList.findByIMContact( imContact ); if ( pContact ) { imContactRemovedEvent(*this, groupName, *pContact ); _imContactList.Delete( *pContact ); } else { LOG_ERROR("contact not found"); } OWSAFE_DELETE(imAccount); } }
void IMContactListHandler::removeIMContact(const std::string & groupName, const IMContact & imContact) { IMAccount * imAccount = _userProfile.getIMAccountManager().getIMAccount( *(const_cast<IMContact&>(imContact).getIMAccount()) ); if (imAccount) { IMContactListMap::iterator it = _imContactListMap.find(imAccount->getKey()); if (it != _imContactListMap.end()) { //VOXOX - JRT - 2009.08.09 - In libpurple, this just removes the IMContact from the Group. // If there are no more groups for this IMContact, then the contact is removed from buddy list. (*it).second->removeContact(groupName, imContact.getContactId()); } else { LOG_DEBUG("this IMAccount is not registered: " + imAccount->getLogin()); } OWSAFE_DELETE(imAccount); } }
void ConnectHandler::connectionIsUpEventHandlerThreadSafe() { RecursiveMutex::ScopedLock lock(_mutex); for (ConnectMap::const_iterator it = _connectMap.begin(); it != _connectMap.end(); ++it) { IMAccount * imAccount = _userProfile->getIMAccountManager().getIMAccount((*it).first); if (imAccount) { if (!imAccount->isConnected()) { (*it).second->connect(); } OWSAFE_DELETE(imAccount); } else { LOG_ERROR("IMAccount " + (*it).first + " not found!"); } } //VOXOX CHANGE CJC CONNECT IM ACCOUNTS< AFTER CONNECTIONS IS RESTORED< THIS IS NOT HAPPENING _userProfile->connect(); }
void ConnectHandler::disconnectedEventHandlerThreadSafe(std::string imAccountId, bool connectionError, std::string reason, bool fatal) //VOXOX - JRT - 2009.07.13 { if (_userProfile && !_freeze) //VOXOX - JRT - 2009.07.11 - potential crash fix. { IMAccount * imAccount = _userProfile->getIMAccountManager().getIMAccount(imAccountId); if (imAccount) { LOG_INFO( "Disconnect Reason: " + reason + ", " + imAccountId ); imAccount->setConnected(false); //Some reasons indicate we should not automatically retry. //VOXOX - JRT - 2009.07.05 // bool retry = QtEnumIMProtocolMap::shouldRetryConnect( imAccount->getQtProtocol(), reason ); imAccount->setAutoReconnect( !fatal ); _userProfile->updateIMAccount(*imAccount); OWSAFE_DELETE(imAccount); disconnectedEvent(*this, imAccountId, connectionError, reason); } } }
void UserProfileHandler::currentUserProfileReleased() { // RecursiveMutex::ScopedLock lock(_mutex); //VOXOX - JRT - 2009.09.22 - Prevent COE if (_currentUserProfile) { saveUserProfile(*_currentUserProfile); WsUrl::setWengoAccount(NULL); OWSAFE_DELETE(_currentUserProfile); uninitExtLibraries(); } if (_desiredUserProfile) { // If we want to change the UserProfile LOG_DEBUG("Old UserProfile killed. Setting the new one"); _currentUserProfile = _desiredUserProfile; _desiredUserProfile = NULL; initializeCurrentUserProfile(); } }
void ConnectHandler::connectedEventHandlerThreadSafe(std::string imAccountId, EnumPresenceState::PresenceState initialPresenceState ) { if (_userProfile && !_freeze) { IMAccount * imAccount = _userProfile->getIMAccountManager().getIMAccount(imAccountId); if (imAccount) { imAccount->setConnected(true); imAccount->setPresenceState( initialPresenceState ); //VOXOX - JRT - 2009.09.10 //VOXOX - JRT - 2009.09.14 - We now set the initialPresence before we try to connect. ////TODO: VOXOX CHANGE by Rolando - 2009.05.22 - FIX this: check if each network associated supports invisible presence //if(_userProfile->mustLoginInvisible() && imAccount->getProtocol() != EnumIMProtocol::IMProtocolWengo && imAccount->getProtocol() != EnumIMProtocol::IMProtocolSIP) //{ // //VOXOX CHANGE by Rolando - 2009.05.22 - because user can login as invisible presence we have to change here the presence to be able to do change it // //TODO: Find a way to be able to change the presence to invisible before set connected the imaccount to "true" // //this is provocating that others users can realize that user logged in and later "logged off" // imAccount->setPresenceState(EnumPresenceState::PresenceStateInvisible); // _userProfile->setPresenceState(EnumPresenceState::PresenceStateInvisible, imAccountId);//VOXOX CHANGE by Rolando - 2009.05.15 //} EnumPresenceState::PresenceState presenceState = imAccount->getPresenceState();//VOXOX CHANGE by Rolando - 2009.07.15 EnumIMProtocol::IMProtocol imProtocol = imAccount->getProtocol();//VOXOX CHANGE by Rolando - 2009.07.15 _userProfile->updateIMAccount(*imAccount); _userProfile->requestSyncData(*imAccount); //VOXOX - JRT - 2009.08.03 OWSAFE_DELETE(imAccount); connectedEvent(*this, imAccountId);//VOXOX CHANGE by Rolando - 2009.05.15 //VOXOX CHANGE by Rolando - 2009.07.15 if( QtEnumIMProtocolMap::supportsPresence( imProtocol ) ) //VOXOX - JRT - 2009.08.28 - moved logic to QtEnumIMProtocol { _userProfile->setPresenceState(presenceState, imAccountId, false, String::null );//VOXOX CHANGE by Rolando - 2009.07.15 //VOXOX - JRT - 2009.09.14 } } } }
void QtAddWengoAccount::load(std::string sipAccountName) { //load userprofile UserProfile * userProfile = _cUserProfileHandler.getUserProfileHandler().getUserProfile(sipAccountName); if (userProfile && userProfile->hasSipAccount()) { //tests account type if (userProfile->hasWengoAccount()) { //loads the wengo acccount WengoAccount * wengoAccount = userProfile->getWengoAccount(); _ui->email->setText(QString::fromStdString(wengoAccount->getWengoLogin())); _ui->password->setText(QString::fromStdString(wengoAccount->getWengoPassword())); setInfoMessage(); } else { //should be loaded as a sip account //_loginDialog->changePage(QtLoginDialog::AddSIPAccount, sipAccountName);//VOXOX CHANGE by Rolando 02-25-09 _loginDialog->changePage(QtLoginDialog::AddVoxOxAccount, sipAccountName);//VOXOX CHANGE by Rolando 02-25-09 } } else { //_loginDialog->changePage(QtLoginDialog::AddAccount);//VOXOX CHANGE by Rolando 02-25-09 _loginDialog->changePage(QtLoginDialog::AddVoxOxAccount, sipAccountName);//VOXOX CHANGE by Rolando 02-25-09 } OWSAFE_DELETE(userProfile); }
QtFileTransferAcceptDialog::~QtFileTransferAcceptDialog() { OWSAFE_DELETE(_ui); }
QtChatRoomInviteDlg::~QtChatRoomInviteDlg() { OWSAFE_DELETE(_ui); OWSAFE_DELETE(_chatRoomInviteWidget); }