openmagnet_info* TorrentManager::GetTorrentInfo(const torrent_handle& handle) { if (handle.is_valid()) { openmagnet_info* info = new openmagnet_info; #if LIBTORRENT_VERSION_NUM >= 10000 boost::intrusive_ptr<torrent_info const> ti = handle.torrent_file(); info->size = ti->total_size(); info->name = QString::fromUtf8(ti->name().c_str()); info->describtion = QString::fromUtf8(ti->comment().c_str()); info->files = ti->files(); info->infoHash = QString::fromStdString(to_hex(ti->info_hash().to_string())); #else const torrent_info ti = handle.get_torrent_info(); info->size = ti.total_size(); info->name = QString::fromUtf8(ti.name().c_str()); info->describtion = QString::fromUtf8(ti.comment().c_str()); info->files = ti.files(); info->infoHash = QString::fromStdString(to_hex(ti.info_hash().to_string())); #endif info->handle = handle; info->baseSuffix = StaticHelpers::GetBaseSuffix(info->files); return info; } return NULL; }