void CallHandler::prune() { QList<Call *> list = calls.values(); for (int i = 0; i < list.size(); i++) { Call *c = list.at(i); if (c->statusDone() && c->okToDelete()) { // we ignore this call from now on, because Skype might still send // us information about it, like "SEEN" or "VAA_INPUT_STATUS" calls.remove(c->getID()); ignore.insert(c->getID()); delete c; } } }
CallHandler::~CallHandler() { prune(); QList<Call *> list = calls.values(); if (!list.isEmpty()) { debug(QString("Destroying CallHandler, these calls still exist:")); for (int i = 0; i < list.size(); i++) { Call *c = list.at(i); debug(QString(" call %1, status=%2, okToDelete=%3").arg(c->getID()).arg(c->getStatus()).arg(c->okToDelete())); } } delete legalInformationDialog; }
// remove timeouted and unconfirmed calls // must be locked; void CallManager::MaintainCalls(Connection *sqlCon) { for (size_t i=0; i<calls.size(); i++) { Call *call = calls[i]; if (PhoneCall *pcall = dynamic_cast<PhoneCall *>(call)) if ((call->getState() == ACTIVE && call->getStartTime() + SessionManager::getOptions().Timeout_CallStatus < time(0)) || (pcall->getState() == AWAIT && pcall->getRequestTime() + SessionManager::getOptions().Timeout_CallRequest < time(0)) || (pcall->getState() == CONFIRMED && pcall->getConfirmTime() + SessionManager::getOptions().Timeout_CallConfirm < time(0))) { log(LOG_VERBOSE, "MaintainCalls: deleting call %d[%d->%d] with timeouted confirmation.", call->getID(), call->getClient(), call->getTranslator()); call->sendTimeouts(); EndCall(sqlCon, call->getID()); } } }