|
@@ -908,6 +908,16 @@ static void cmd_groups(int idx, char *par)
|
|
|
putlog(LOG_CMDS, "*", "#%s# groups %s", dcc[idx].nick, par);
|
|
putlog(LOG_CMDS, "*", "#%s# groups %s", dcc[idx].nick, par);
|
|
|
bd::String botnick(newsplit(&par));
|
|
bd::String botnick(newsplit(&par));
|
|
|
|
|
|
|
|
|
|
+ if (botnick.length() && !(u = get_user_by_handle(userlist, botnick.c_str()))) {
|
|
|
|
|
+ dprintf(idx, "No such bot.\n");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (u && !u->bot) {
|
|
|
|
|
+ dprintf(idx, "%s is not a bot.\n", botnick.c_str());
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
bd::Array<bd::String> globalgroups = bd::String(var_get_gdata("groups")).split(",");
|
|
bd::Array<bd::String> globalgroups = bd::String(var_get_gdata("groups")).split(",");
|
|
|
bd::Array<bd::String> allgroups;
|
|
bd::Array<bd::String> allgroups;
|
|
|
bd::HashTable<bd::String, bd::Array<bd::String> > groupBots;
|
|
bd::HashTable<bd::String, bd::Array<bd::String> > groupBots;
|
|
@@ -937,6 +947,7 @@ static void cmd_groups(int idx, char *par)
|
|
|
|
|
|
|
|
if (botnick.length()) {
|
|
if (botnick.length()) {
|
|
|
dprintf(idx, "%s is in groups: %s\n", botnick.c_str(), static_cast<bd::String>(botGroups[botnick].join(" ")).c_str());
|
|
dprintf(idx, "%s is in groups: %s\n", botnick.c_str(), static_cast<bd::String>(botGroups[botnick].join(" ")).c_str());
|
|
|
|
|
+ dprintf(idx, "Total groups: %zu/%zu\n", botGroups[botnick].length(), allgroups.length());
|
|
|
} else {
|
|
} else {
|
|
|
// Display all groups and which bots are in them
|
|
// Display all groups and which bots are in them
|
|
|
for (size_t i = 0; i < allgroups.length(); ++i) {
|
|
for (size_t i = 0; i < allgroups.length(); ++i) {
|
|
@@ -944,9 +955,9 @@ static void cmd_groups(int idx, char *par)
|
|
|
const bd::Array<bd::String> bots(groupBots[group]);
|
|
const bd::Array<bd::String> bots(groupBots[group]);
|
|
|
dumplots(idx, bd::String::printf("%-*s: ", int(maxGroupLen), group.c_str()).c_str(), static_cast<bd::String>(bots.join(" ")).c_str());
|
|
dumplots(idx, bd::String::printf("%-*s: ", int(maxGroupLen), group.c_str()).c_str(), static_cast<bd::String>(bots.join(" ")).c_str());
|
|
|
}
|
|
}
|
|
|
|
|
+ dprintf(idx, "Total groups: %zu\n", allgroups.length());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- dprintf(idx, "Total groups: %zu\n", allgroups.length());
|
|
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|