fix: d.group.name should return group name instead of group index

This commit is contained in:
trim21
2024-12-05 19:22:04 +08:00
committed by Jari Sundell
parent 713067ba94
commit 5a200f5d8f
2 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -905,7 +905,7 @@ initialize_command_download() {
// CG_GROUP_INDEX())); // CG_GROUP_INDEX()));
CMD2_DL ("d.group", std::bind(&cg_d_group, std::placeholders::_1)); CMD2_DL ("d.group", std::bind(&cg_d_group, std::placeholders::_1));
CMD2_DL ("d.group.name", std::bind(&cg_d_group, std::placeholders::_1)); CMD2_DL ("d.group.name", std::bind(&cg_d_group_name, std::placeholders::_1));
CMD2_DL_V ("d.group.set", std::bind(&cg_d_group_set, std::placeholders::_1, std::placeholders::_2)); CMD2_DL_V ("d.group.set", std::bind(&cg_d_group_set, std::placeholders::_1, std::placeholders::_2));
CMD2_DL_LIST ("f.multicall", std::bind(&f_multicall, std::placeholders::_1, std::placeholders::_2)); CMD2_DL_LIST ("f.multicall", std::bind(&f_multicall, std::placeholders::_1, std::placeholders::_2));
+3 -1
View File
@@ -154,12 +154,14 @@ cg_get_group(const torrent::Object& raw_args) {
} }
int64_t cg_d_group(core::Download* download) { return download->group(); } int64_t cg_d_group(core::Download* download) { return download->group(); }
const std::string& cg_d_group_name(core::Download* download) {
return cg_list_hack.at(download->group())->name();
}
void cg_d_group_set(core::Download* download, const torrent::Object& arg) { download->set_group(cg_get_index(arg)); } void cg_d_group_set(core::Download* download, const torrent::Object& arg) { download->set_group(cg_get_index(arg)); }
torrent::Object torrent::Object
apply_cg_list() { apply_cg_list() {
torrent::Object::list_type result; torrent::Object::list_type result;
for (std::vector<torrent::choke_group*>::iterator itr = cg_list_hack.begin(), last = cg_list_hack.end(); itr != last; itr++) for (std::vector<torrent::choke_group*>::iterator itr = cg_list_hack.begin(), last = cg_list_hack.end(); itr != last; itr++)
result.push_back((*itr)->name()); result.push_back((*itr)->name());