Esempio n. 1
0
void FinishedManager::on(QueueManagerListener::Finished, const QueueItemPtr& qi, const string&, const DownloadPtr& p_download) noexcept
{
	if (!ClientManager::isShutdown())
	{
		const bool isFile = !qi->isAnySet(QueueItem::FLAG_USER_LIST | QueueItem::FLAG_DCLST_LIST | QueueItem::FLAG_USER_GET_IP);
		if (isFile)
		{
			PLAY_SOUND(SOUND_FINISHFILE);
		}
		if (isFile || (qi->isAnySet(QueueItem::FLAG_USER_LIST | QueueItem::FLAG_DCLST_LIST) && BOOLSETTING(LOG_FILELIST_TRANSFERS)))
		{
			auto item = std::make_shared<FinishedItem>(qi->getTarget(), p_download->getHintedUser(),
			                                           qi->getSize(), p_download->getRunningAverage(),
			                                           GET_TIME(), qi->getTTH(), p_download->getActual(), p_download->getUser()->getIPAsString());
			if (SETTING(DB_LOG_FINISHED_DOWNLOADS))
			{
				CFlylinkDBManager::getInstance()->save_transfer_history(false, e_TransferDownload, item);
			}
			rotation_items(item, e_Download);
			fly_fire2(FinishedManagerListener::AddedDl(), item, false);
			log(p_download->getUser()->getCID(), qi->getTarget(), STRING(FINISHED_DOWNLOAD));
		}
	}
}