mirror of
https://github.com/znc/znc.git
synced 2026-07-04 00:41:38 +02:00
Merge pull request #629 from jpnurmi/help
Revise *status and *controlpanel help output
This commit is contained in:
@@ -133,7 +133,7 @@ public:
|
||||
|
||||
virtual void ReadLine(const CString& sData);
|
||||
bool SendMotd();
|
||||
void HelpUser();
|
||||
void HelpUser(const CString& sFilter = "");
|
||||
void AuthUser();
|
||||
virtual void Connected();
|
||||
virtual void Timeout();
|
||||
|
||||
+148
-125
@@ -40,100 +40,123 @@ static array_size_helper<N> array_size(T (&)[N]) {
|
||||
class CAdminMod : public CModule {
|
||||
using CModule::PutModule;
|
||||
|
||||
void PrintHelp(const CString&) {
|
||||
HandleHelpCommand();
|
||||
void PrintHelp(const CString& sLine) {
|
||||
HandleHelpCommand(sLine);
|
||||
|
||||
PutModule("The following variables are available when using the Set/Get commands:");
|
||||
|
||||
CTable VarTable;
|
||||
VarTable.AddColumn("Variable");
|
||||
VarTable.AddColumn("Type");
|
||||
static const char* str = "String";
|
||||
static const char* boolean = "Boolean (true/false)";
|
||||
static const char* integer = "Integer";
|
||||
static const char* doublenum = "Double";
|
||||
static const char* vars[][2] = {
|
||||
{"Nick", str},
|
||||
{"Altnick", str},
|
||||
{"Ident", str},
|
||||
{"RealName", str},
|
||||
{"BindHost", str},
|
||||
{"MultiClients", boolean},
|
||||
{"DenyLoadMod", boolean},
|
||||
{"DenySetBindHost", boolean},
|
||||
{"DefaultChanModes", str},
|
||||
{"QuitMsg", str},
|
||||
{"BufferCount", integer},
|
||||
{"AutoClearChanBuffer", boolean},
|
||||
{"AutoClearQueryBuffer",boolean},
|
||||
{"Password", str},
|
||||
{"JoinTries", integer},
|
||||
{"MaxJoins", integer},
|
||||
{"MaxNetworks", integer},
|
||||
{"MaxQueryBuffers", integer},
|
||||
{"Timezone", str},
|
||||
{"Admin", boolean},
|
||||
{"AppendTimestamp", boolean},
|
||||
{"PrependTimestamp", boolean},
|
||||
{"TimestampFormat", str},
|
||||
{"DCCBindHost", str},
|
||||
{"StatusPrefix", str},
|
||||
|
||||
const CString sCmdFilter = sLine.Token(1, false);
|
||||
const CString::size_type iCmdLength = sCmdFilter.size();
|
||||
|
||||
const CString sVarFilter = sLine.Token(2, true);
|
||||
const CString::size_type iVarLength = sVarFilter.size();
|
||||
|
||||
if (sCmdFilter.empty() || sCmdFilter.Equals("Set", false, iCmdLength) || sCmdFilter.Equals("Get", false, iCmdLength)) {
|
||||
CTable VarTable;
|
||||
VarTable.AddColumn("Variable");
|
||||
VarTable.AddColumn("Type");
|
||||
static const char* vars[][2] = {
|
||||
{"Nick", str},
|
||||
{"Altnick", str},
|
||||
{"Ident", str},
|
||||
{"RealName", str},
|
||||
{"BindHost", str},
|
||||
{"MultiClients", boolean},
|
||||
{"DenyLoadMod", boolean},
|
||||
{"DenySetBindHost", boolean},
|
||||
{"DefaultChanModes", str},
|
||||
{"QuitMsg", str},
|
||||
{"BufferCount", integer},
|
||||
{"AutoClearChanBuffer", boolean},
|
||||
{"AutoClearQueryBuffer",boolean},
|
||||
{"Password", str},
|
||||
{"JoinTries", integer},
|
||||
{"MaxJoins", integer},
|
||||
{"MaxNetworks", integer},
|
||||
{"MaxQueryBuffers", integer},
|
||||
{"Timezone", str},
|
||||
{"Admin", boolean},
|
||||
{"AppendTimestamp", boolean},
|
||||
{"PrependTimestamp", boolean},
|
||||
{"TimestampFormat", str},
|
||||
{"DCCBindHost", str},
|
||||
{"StatusPrefix", str},
|
||||
#ifdef HAVE_ICU
|
||||
{"ClientEncoding", str},
|
||||
{"ClientEncoding", str},
|
||||
#endif
|
||||
};
|
||||
for (unsigned int i = 0; i != ARRAY_SIZE(vars); ++i) {
|
||||
VarTable.AddRow();
|
||||
VarTable.SetCell("Variable", vars[i][0]);
|
||||
VarTable.SetCell("Type", vars[i][1]);
|
||||
};
|
||||
for (unsigned int i = 0; i != ARRAY_SIZE(vars); ++i) {
|
||||
if (sVarFilter.empty() || sVarFilter.Equals(vars[i][0], false, iVarLength)) {
|
||||
VarTable.AddRow();
|
||||
VarTable.SetCell("Variable", vars[i][0]);
|
||||
VarTable.SetCell("Type", vars[i][1]);
|
||||
}
|
||||
}
|
||||
if (!VarTable.empty()) {
|
||||
PutModule("The following variables are available when using the Set/Get commands:");
|
||||
PutModule(VarTable);
|
||||
}
|
||||
}
|
||||
PutModule(VarTable);
|
||||
|
||||
PutModule("The following variables are available when using the SetNetwork/GetNetwork commands:");
|
||||
|
||||
CTable NVarTable;
|
||||
NVarTable.AddColumn("Variable");
|
||||
NVarTable.AddColumn("Type");
|
||||
static const char* nvars[][2] = {
|
||||
{"Nick", str},
|
||||
{"Altnick", str},
|
||||
{"Ident", str},
|
||||
{"RealName", str},
|
||||
{"BindHost", str},
|
||||
{"FloodRate", doublenum},
|
||||
{"FloodBurst", integer},
|
||||
if (sCmdFilter.empty() || sCmdFilter.Equals("SetNetwork", false, iCmdLength) || sCmdFilter.Equals("GetNetwork", false, iCmdLength)) {
|
||||
CTable NVarTable;
|
||||
NVarTable.AddColumn("Variable");
|
||||
NVarTable.AddColumn("Type");
|
||||
static const char* nvars[][2] = {
|
||||
{"Nick", str},
|
||||
{"Altnick", str},
|
||||
{"Ident", str},
|
||||
{"RealName", str},
|
||||
{"BindHost", str},
|
||||
{"FloodRate", doublenum},
|
||||
{"FloodBurst", integer},
|
||||
#ifdef HAVE_ICU
|
||||
{"Encoding", str},
|
||||
{"Encoding", str},
|
||||
#endif
|
||||
};
|
||||
for (unsigned int i = 0; i != ARRAY_SIZE(nvars); ++i) {
|
||||
NVarTable.AddRow();
|
||||
NVarTable.SetCell("Variable", nvars[i][0]);
|
||||
NVarTable.SetCell("Type", nvars[i][1]);
|
||||
};
|
||||
for (unsigned int i = 0; i != ARRAY_SIZE(nvars); ++i) {
|
||||
if (sVarFilter.empty() || sVarFilter.Equals(nvars[i][0], false, iVarLength)) {
|
||||
NVarTable.AddRow();
|
||||
NVarTable.SetCell("Variable", nvars[i][0]);
|
||||
NVarTable.SetCell("Type", nvars[i][1]);
|
||||
}
|
||||
}
|
||||
if (!NVarTable.empty()) {
|
||||
PutModule("The following variables are available when using the SetNetwork/GetNetwork commands:");
|
||||
PutModule(NVarTable);
|
||||
}
|
||||
}
|
||||
PutModule(NVarTable);
|
||||
|
||||
|
||||
PutModule("The following variables are available when using the SetChan/GetChan commands:");
|
||||
CTable CVarTable;
|
||||
CVarTable.AddColumn("Variable");
|
||||
CVarTable.AddColumn("Type");
|
||||
static const char* cvars[][2] = {
|
||||
{"DefModes", str},
|
||||
{"Key", str},
|
||||
{"Buffer", integer},
|
||||
{"InConfig", boolean},
|
||||
{"AutoClearChanBuffer", boolean},
|
||||
{"Detached", boolean}
|
||||
};
|
||||
for (unsigned int i = 0; i != ARRAY_SIZE(cvars); ++i) {
|
||||
CVarTable.AddRow();
|
||||
CVarTable.SetCell("Variable", cvars[i][0]);
|
||||
CVarTable.SetCell("Type", cvars[i][1]);
|
||||
if (sCmdFilter.empty() || sCmdFilter.Equals("SetChan", false, iCmdLength) || sCmdFilter.Equals("GetChan", false, iCmdLength)) {
|
||||
CTable CVarTable;
|
||||
CVarTable.AddColumn("Variable");
|
||||
CVarTable.AddColumn("Type");
|
||||
static const char* cvars[][2] = {
|
||||
{"DefModes", str},
|
||||
{"Key", str},
|
||||
{"Buffer", integer},
|
||||
{"InConfig", boolean},
|
||||
{"AutoClearChanBuffer", boolean},
|
||||
{"Detached", boolean}
|
||||
};
|
||||
for (unsigned int i = 0; i != ARRAY_SIZE(cvars); ++i) {
|
||||
if (sVarFilter.empty() || sVarFilter.Equals(cvars[i][0], false, iVarLength)) {
|
||||
CVarTable.AddRow();
|
||||
CVarTable.SetCell("Variable", cvars[i][0]);
|
||||
CVarTable.SetCell("Type", cvars[i][1]);
|
||||
}
|
||||
}
|
||||
if (!CVarTable.empty()) {
|
||||
PutModule("The following variables are available when using the SetChan/GetChan commands:");
|
||||
PutModule(CVarTable);
|
||||
}
|
||||
}
|
||||
PutModule(CVarTable);
|
||||
|
||||
PutModule("You can use $me as the user name for modifying your own user.");
|
||||
if (sCmdFilter.empty())
|
||||
PutModule("You can use $me as the user name for modifying your own user.");
|
||||
}
|
||||
|
||||
CUser* GetUser(const CString& sUsername) {
|
||||
@@ -157,7 +180,7 @@ class CAdminMod : public CModule {
|
||||
CUser* pUser;
|
||||
|
||||
if (sVar.empty()) {
|
||||
PutModule("Usage: get <variable> [username]");
|
||||
PutModule("Usage: Get <variable> [username]");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -234,7 +257,7 @@ class CAdminMod : public CModule {
|
||||
CString sValue = sLine.Token(3, true);
|
||||
|
||||
if (sValue.empty()) {
|
||||
PutModule("Usage: set <variable> <username> <value>");
|
||||
PutModule("Usage: Set <variable> <username> <value>");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -574,7 +597,7 @@ class CAdminMod : public CModule {
|
||||
const CString sChan = sLine.Token(3);
|
||||
|
||||
if (sChan.empty()) {
|
||||
PutModule("Usage: addchan <username> <network> <channel>");
|
||||
PutModule("Usage: AddChan <username> <network> <channel>");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -606,7 +629,7 @@ class CAdminMod : public CModule {
|
||||
const CString sChan = sLine.Token(3);
|
||||
|
||||
if (sChan.empty()) {
|
||||
PutModule("Usage: delchan <username> <network> <channel>");
|
||||
PutModule("Usage: DelChan <username> <network> <channel>");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -644,7 +667,7 @@ class CAdminMod : public CModule {
|
||||
CString sChan = sLine.Token(4, true);
|
||||
|
||||
if (sChan.empty()) {
|
||||
PutModule("Usage: getchan <variable> <username> <network> <chan>");
|
||||
PutModule("Usage: GetChan <variable> <username> <network> <chan>");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -690,7 +713,7 @@ class CAdminMod : public CModule {
|
||||
CString sValue = sLine.Token(5, true);
|
||||
|
||||
if (sValue.empty()) {
|
||||
PutModule("Usage: setchan <variable> <username> <network> <chan> <value>");
|
||||
PutModule("Usage: SetChan <variable> <username> <network> <chan> <value>");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -791,7 +814,7 @@ class CAdminMod : public CModule {
|
||||
sUsername = sLine.Token(1),
|
||||
sPassword = sLine.Token(2);
|
||||
if (sPassword.empty()) {
|
||||
PutModule("Usage: adduser <username> <password>");
|
||||
PutModule("Usage: AddUser <username> <password>");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -823,7 +846,7 @@ class CAdminMod : public CModule {
|
||||
|
||||
const CString sUsername = sLine.Token(1, true);
|
||||
if (sUsername.empty()) {
|
||||
PutModule("Usage: deluser <username>");
|
||||
PutModule("Usage: DelUser <username>");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -860,7 +883,7 @@ class CAdminMod : public CModule {
|
||||
sNewUsername = sLine.Token(2, true);
|
||||
|
||||
if (sOldUsername.empty() || sNewUsername.empty()) {
|
||||
PutModule("Usage: cloneuser <oldusername> <newusername>");
|
||||
PutModule("Usage: CloneUser <old username> <new username>");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -905,7 +928,7 @@ class CAdminMod : public CModule {
|
||||
}
|
||||
|
||||
if (sNetwork.empty()) {
|
||||
PutModule("Usage: " + sLine.Token(0) + " [user] network");
|
||||
PutModule("Usage: AddNetwork [user] network");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -942,7 +965,7 @@ class CAdminMod : public CModule {
|
||||
}
|
||||
|
||||
if (sNetwork.empty()) {
|
||||
PutModule("Usage: " + sLine.Token(0) + " [user] network");
|
||||
PutModule("Usage: DelNetwork [user] network");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1010,7 +1033,7 @@ class CAdminMod : public CModule {
|
||||
CString sServer = sLine.Token(3, true);
|
||||
|
||||
if (sServer.empty()) {
|
||||
PutModule("Usage: addserver <username> <network> <server>");
|
||||
PutModule("Usage: AddServer <username> <network> <server>");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1201,7 +1224,7 @@ class CAdminMod : public CModule {
|
||||
CString sArgs = sLine.Token(3, true);
|
||||
|
||||
if (sModName.empty()) {
|
||||
PutModule("Usage: loadmodule <username> <modulename> [<args>]");
|
||||
PutModule("Usage: LoadModule <username> <modulename> [args]");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1219,7 +1242,7 @@ class CAdminMod : public CModule {
|
||||
CString sArgs = sLine.Token(4, true);
|
||||
|
||||
if (sModName.empty()) {
|
||||
PutModule("Usage: loadnetmodule <username> <network> <modulename> [<args>]");
|
||||
PutModule("Usage: LoadNetModule <username> <network> <modulename> [args]");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1260,7 +1283,7 @@ class CAdminMod : public CModule {
|
||||
CString sModName = sLine.Token(2);
|
||||
|
||||
if (sModName.empty()) {
|
||||
PutModule("Usage: unloadmodule <username> <modulename>");
|
||||
PutModule("Usage: UnloadModule <username> <modulename>");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1277,7 +1300,7 @@ class CAdminMod : public CModule {
|
||||
CString sModName = sLine.Token(3);
|
||||
|
||||
if (sModName.empty()) {
|
||||
PutModule("Usage: unloadnetmodule <username> <network> <modulename>");
|
||||
PutModule("Usage: UnloadNetModule <username> <network> <modulename>");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1317,7 +1340,7 @@ class CAdminMod : public CModule {
|
||||
CString sUsername = sLine.Token(1);
|
||||
|
||||
if (sUsername.empty()) {
|
||||
PutModule("Usage: listmods <username>");
|
||||
PutModule("Usage: ListMods <username>");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1333,7 +1356,7 @@ class CAdminMod : public CModule {
|
||||
CString sNetwork = sLine.Token(2);
|
||||
|
||||
if (sNetwork.empty()) {
|
||||
PutModule("Usage: listnetmods <username> <network>");
|
||||
PutModule("Usage: ListNetMods <username> <network>");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1353,63 +1376,63 @@ class CAdminMod : public CModule {
|
||||
public:
|
||||
MODCONSTRUCTOR(CAdminMod) {
|
||||
AddCommand("Help", static_cast<CModCommand::ModCmdFunc>(&CAdminMod::PrintHelp),
|
||||
"", "Generates this output");
|
||||
"[command] [variable]", "Prints help for matching commands and variables");
|
||||
AddCommand("Get", static_cast<CModCommand::ModCmdFunc>(&CAdminMod::Get),
|
||||
"variable [username]", "Prints the variable's value for the given or current user");
|
||||
"<variable> [username]", "Prints the variable's value for the given or current user");
|
||||
AddCommand("Set", static_cast<CModCommand::ModCmdFunc>(&CAdminMod::Set),
|
||||
"variable username value", "Sets the variable's value for the given user (use $me for the current user)");
|
||||
"<variable> <username> <value>", "Sets the variable's value for the given user (use $me for the current user)");
|
||||
AddCommand("GetNetwork", static_cast<CModCommand::ModCmdFunc>(&CAdminMod::GetNetwork),
|
||||
"variable [username network]", "Prints the variable's value for the given network");
|
||||
"<variable> [username] [network]", "Prints the variable's value for the given network");
|
||||
AddCommand("SetNetwork", static_cast<CModCommand::ModCmdFunc>(&CAdminMod::SetNetwork),
|
||||
"variable username network value", "Sets the variable's value for the given network");
|
||||
"<variable> <username> <network> <value>", "Sets the variable's value for the given network");
|
||||
AddCommand("GetChan", static_cast<CModCommand::ModCmdFunc>(&CAdminMod::GetChan),
|
||||
"variable [username] network chan", "Prints the variable's value for the given channel");
|
||||
"<variable> [username] <network> <chan>", "Prints the variable's value for the given channel");
|
||||
AddCommand("SetChan", static_cast<CModCommand::ModCmdFunc>(&CAdminMod::SetChan),
|
||||
"variable username network chan value", "Sets the variable's value for the given channel");
|
||||
"<variable> <username> <network> <chan> <value>", "Sets the variable's value for the given channel");
|
||||
AddCommand("AddChan", static_cast<CModCommand::ModCmdFunc>(&CAdminMod::AddChan),
|
||||
"username network chan", "Adds a new channel");
|
||||
"<username> <network> <chan>", "Adds a new channel");
|
||||
AddCommand("DelChan", static_cast<CModCommand::ModCmdFunc>(&CAdminMod::DelChan),
|
||||
"username network chan", "Deletes a channel");
|
||||
"<username> <network> <chan>", "Deletes a channel");
|
||||
AddCommand("ListUsers", static_cast<CModCommand::ModCmdFunc>(&CAdminMod::ListUsers),
|
||||
"", "Lists users");
|
||||
"", "Lists users");
|
||||
AddCommand("AddUser", static_cast<CModCommand::ModCmdFunc>(&CAdminMod::AddUser),
|
||||
"username password", "Adds a new user");
|
||||
"<username> <password>", "Adds a new user");
|
||||
AddCommand("DelUser", static_cast<CModCommand::ModCmdFunc>(&CAdminMod::DelUser),
|
||||
"username", "Deletes a user");
|
||||
"<username>", "Deletes a user");
|
||||
AddCommand("CloneUser", static_cast<CModCommand::ModCmdFunc>(&CAdminMod::CloneUser),
|
||||
"oldusername newusername", "Clones a user");
|
||||
"<old username> <new username>", "Clones a user");
|
||||
AddCommand("AddServer", static_cast<CModCommand::ModCmdFunc>(&CAdminMod::AddServer),
|
||||
"username network server", "Adds a new IRC server for the given or current user");
|
||||
"<username> <network> <server>", "Adds a new IRC server for the given or current user");
|
||||
AddCommand("Reconnect", static_cast<CModCommand::ModCmdFunc>(&CAdminMod::ReconnectUser),
|
||||
"username network", "Cycles the user's IRC server connection");
|
||||
"<username> <network>", "Cycles the user's IRC server connection");
|
||||
AddCommand("Disconnect", static_cast<CModCommand::ModCmdFunc>(&CAdminMod::DisconnectUser),
|
||||
"username network", "Disconnects the user from their IRC server");
|
||||
"<username> <network>", "Disconnects the user from their IRC server");
|
||||
AddCommand("LoadModule", static_cast<CModCommand::ModCmdFunc>(&CAdminMod::LoadModuleForUser),
|
||||
"username modulename [args]", "Loads a Module for a user");
|
||||
"<username> <modulename> [args]", "Loads a Module for a user");
|
||||
AddCommand("UnLoadModule", static_cast<CModCommand::ModCmdFunc>(&CAdminMod::UnLoadModuleForUser),
|
||||
"username modulename", "Removes a Module of a user");
|
||||
"<username> <modulename>", "Removes a Module of a user");
|
||||
AddCommand("ListMods", static_cast<CModCommand::ModCmdFunc>(&CAdminMod::ListModulesForUser),
|
||||
"username", "Get the list of modules for a user");
|
||||
"<username>", "Get the list of modules for a user");
|
||||
AddCommand("LoadNetModule",static_cast<CModCommand::ModCmdFunc>(&CAdminMod::LoadModuleForNetwork),
|
||||
"username network modulename [args]", "Loads a Module for a network");
|
||||
"<username> <network> <modulename> [args]", "Loads a Module for a network");
|
||||
AddCommand("UnLoadNetModule",static_cast<CModCommand::ModCmdFunc>(&CAdminMod::UnLoadModuleForNetwork),
|
||||
"username network modulename", "Removes a Module of a network");
|
||||
"<username> <network> <modulename>", "Removes a Module of a network");
|
||||
AddCommand("ListNetMods", static_cast<CModCommand::ModCmdFunc>(&CAdminMod::ListModulesForNetwork),
|
||||
"username network", "Get the list of modules for a network");
|
||||
"<username> <network>", "Get the list of modules for a network");
|
||||
AddCommand("ListCTCPs", static_cast<CModCommand::ModCmdFunc>(&CAdminMod::ListCTCP),
|
||||
"username", "List the configured CTCP replies");
|
||||
"<username>", "List the configured CTCP replies");
|
||||
AddCommand("AddCTCP", static_cast<CModCommand::ModCmdFunc>(&CAdminMod::AddCTCP),
|
||||
"username ctcp [reply]", "Configure a new CTCP reply");
|
||||
"<username> <ctcp> [reply]", "Configure a new CTCP reply");
|
||||
AddCommand("DelCTCP", static_cast<CModCommand::ModCmdFunc>(&CAdminMod::DelCTCP),
|
||||
"username ctcp", "Remove a CTCP reply");
|
||||
"<username> <ctcp>", "Remove a CTCP reply");
|
||||
|
||||
// Network commands
|
||||
AddCommand("AddNetwork", static_cast<CModCommand::ModCmdFunc>(&CAdminMod::AddNetwork),
|
||||
"[username] network", "Add a network for a user");
|
||||
"[username] <network>", "Add a network for a user");
|
||||
AddCommand("DelNetwork", static_cast<CModCommand::ModCmdFunc>(&CAdminMod::DelNetwork),
|
||||
"[username] network", "Delete a network for a user");
|
||||
"[username] <network>", "Delete a network for a user");
|
||||
AddCommand("ListNetworks", static_cast<CModCommand::ModCmdFunc>(&CAdminMod::ListNetworks),
|
||||
"[username]", "List all networks for a user");
|
||||
"[username]", "List all networks for a user");
|
||||
}
|
||||
|
||||
virtual ~CAdminMod() {}
|
||||
|
||||
+78
-252
@@ -42,7 +42,7 @@ void CClient::UserCommand(CString& sLine) {
|
||||
const CString sCommand = sLine.Token(0);
|
||||
|
||||
if (sCommand.Equals("HELP")) {
|
||||
HelpUser();
|
||||
HelpUser(sLine.Token(1));
|
||||
} else if (sCommand.Equals("LISTNICKS")) {
|
||||
if (!m_pNetwork) {
|
||||
PutStatus("You must be connected with a network to use this command");
|
||||
@@ -257,7 +257,7 @@ void CClient::UserCommand(CString& sLine) {
|
||||
CString sMessage = sLine.Token(1, true);
|
||||
|
||||
if (sMessage.empty()) {
|
||||
PutStatus("Usage: SetMOTD <Message>");
|
||||
PutStatus("Usage: SetMOTD <message>");
|
||||
} else {
|
||||
CZNC::Get().SetMotd(sMessage);
|
||||
PutStatus("MOTD set to [" + sMessage + "]");
|
||||
@@ -266,7 +266,7 @@ void CClient::UserCommand(CString& sLine) {
|
||||
CString sMessage = sLine.Token(1, true);
|
||||
|
||||
if (sMessage.empty()) {
|
||||
PutStatus("Usage: AddMOTD <Message>");
|
||||
PutStatus("Usage: AddMOTD <message>");
|
||||
} else {
|
||||
CZNC::Get().AddMotd(sMessage);
|
||||
PutStatus("Added [" + sMessage + "] to MOTD");
|
||||
@@ -587,7 +587,7 @@ void CClient::UserCommand(CString& sLine) {
|
||||
CString sNewNetwork = sLine.Token(4);
|
||||
|
||||
if (sOldUser.empty() || sOldNetwork.empty() || sNewUser.empty()) {
|
||||
PutStatus("Usage: MoveNetwork old-user old-network new-user [new-network]");
|
||||
PutStatus("Usage: MoveNetwork <old user> <old network> <new user> [new network]");
|
||||
return;
|
||||
}
|
||||
if (sNewNetwork.empty()) {
|
||||
@@ -1546,284 +1546,110 @@ void CClient::UserPortCommand(CString& sLine) {
|
||||
}
|
||||
}
|
||||
|
||||
void CClient::HelpUser() {
|
||||
static void AddCommandHelp(CTable& Table, const CString& sCmd, const CString& sArgs, const CString& sDesc, const CString& sFilter = "")
|
||||
{
|
||||
const CString::size_type iFilterLength = sFilter.size();
|
||||
if (sFilter.empty() || sCmd.Equals(sFilter, false, iFilterLength)) {
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", sCmd);
|
||||
Table.SetCell("Arguments", sArgs);
|
||||
Table.SetCell("Description", sDesc);
|
||||
}
|
||||
}
|
||||
|
||||
void CClient::HelpUser(const CString& sFilter) {
|
||||
CTable Table;
|
||||
Table.AddColumn("Command");
|
||||
Table.AddColumn("Arguments");
|
||||
Table.AddColumn("Description");
|
||||
|
||||
PutStatus("In the following list all occurrences of <#chan> support wildcards (* and ?)");
|
||||
PutStatus("(Except ListNicks)");
|
||||
if (sFilter.empty()) {
|
||||
PutStatus("In the following list all occurrences of <#chan> support wildcards (* and ?)");
|
||||
PutStatus("(Except ListNicks)");
|
||||
}
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "Version");
|
||||
Table.SetCell("Description", "Print which version of ZNC this is");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "ListMods");
|
||||
Table.SetCell("Description", "List all loaded modules");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "ListAvailMods");
|
||||
Table.SetCell("Description", "List all available modules");
|
||||
AddCommandHelp(Table, "Version", "", "Print which version of ZNC this is", sFilter);
|
||||
|
||||
AddCommandHelp(Table, "ListMods", "", "List all loaded modules", sFilter);
|
||||
AddCommandHelp(Table, "ListAvailMods", "", "List all available modules", sFilter);
|
||||
if (!m_pUser->IsAdmin()) { // If they are an admin we will add this command below with an argument
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "ListChans");
|
||||
Table.SetCell("Description", "List all channels");
|
||||
AddCommandHelp(Table, "ListChans", "", "List all channels", sFilter);
|
||||
}
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "ListNicks");
|
||||
Table.SetCell("Arguments", "<#chan>");
|
||||
Table.SetCell("Description", "List all nicks on a channel");
|
||||
|
||||
AddCommandHelp(Table, "ListNicks", "<#chan>", "List all nicks on a channel", sFilter);
|
||||
if (!m_pUser->IsAdmin()) {
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "ListClients");
|
||||
Table.SetCell("Description", "List all clients connected to your ZNC user");
|
||||
AddCommandHelp(Table, "ListClients", "", "List all clients connected to your ZNC user", sFilter);
|
||||
}
|
||||
AddCommandHelp(Table, "ListServers", "", "List all servers of current IRC network", sFilter);
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "ListServers");
|
||||
Table.SetCell("Description", "List all servers of current IRC network");
|
||||
AddCommandHelp(Table, "AddNetwork", "<name>", "Add a network to your user", sFilter);
|
||||
AddCommandHelp(Table, "DelNetwork", "<name>", "Delete a network from your user", sFilter);
|
||||
AddCommandHelp(Table, "ListNetworks", "", "List all networks", sFilter);
|
||||
if (m_pUser->IsAdmin()) {
|
||||
AddCommandHelp(Table, "MoveNetwork", "<old user> <old network> <new user> [new network]", "Move an IRC network from one user to another", sFilter);
|
||||
}
|
||||
AddCommandHelp(Table, "JumpNetwork", "<network>", "Jump to another network", sFilter);
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "AddNetwork");
|
||||
Table.SetCell("Arguments", "<name>");
|
||||
Table.SetCell("Description", "Add a network to your user");
|
||||
AddCommandHelp(Table, "AddServer", "<host> [[+]port] [pass]", "Add a server to the list of alternate/backup servers of current IRC network.", sFilter);
|
||||
AddCommandHelp(Table, "DelServer", "<host> [port] [pass]", "Remove a server from the list of alternate/backup servers of current IRC network", sFilter);
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "DelNetwork");
|
||||
Table.SetCell("Arguments", "<name>");
|
||||
Table.SetCell("Description", "Delete a network from your user");
|
||||
AddCommandHelp(Table, "EnableChan", "<#chan>", "Enable the channel", sFilter);
|
||||
AddCommandHelp(Table, "DisableChan", "<#chan>", "Disable the channel", sFilter);
|
||||
AddCommandHelp(Table, "Detach", "<#chan>", "Detach from the channel", sFilter);
|
||||
AddCommandHelp(Table, "Topics", "", "Show topics in all your channels", sFilter);
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "ListNetworks");
|
||||
Table.SetCell("Description", "List all networks");
|
||||
AddCommandHelp(Table, "PlayBuffer", "<#chan|query>", "Play back the specified buffer", sFilter);
|
||||
AddCommandHelp(Table, "ClearBuffer", "<#chan|query>", "Clear the specified buffer", sFilter);
|
||||
AddCommandHelp(Table, "ClearAllChannelBuffers", "", "Clear the channel buffers", sFilter);
|
||||
AddCommandHelp(Table, "ClearAllQueryBuffers", "", "Clear the query buffers", sFilter);
|
||||
AddCommandHelp(Table, "SetBuffer", "<#chan|query> [linecount]", "Set the buffer count", sFilter);
|
||||
|
||||
if (m_pUser->IsAdmin()) {
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "MoveNetwork");
|
||||
Table.SetCell("Arguments", "old-user old-net new-user [new-net]");
|
||||
Table.SetCell("Description", "Move an IRC network from one user to another");
|
||||
}
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "JumpNetwork");
|
||||
Table.SetCell("Arguments", "<network>");
|
||||
Table.SetCell("Description", "Jump to another network");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "AddServer");
|
||||
Table.SetCell("Arguments", "<host> [[+]port] [pass]");
|
||||
Table.SetCell("Description", "Add a server to the list of alternate/backup servers of current IRC network.");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "DelServer");
|
||||
Table.SetCell("Arguments", "<host> [port] [pass]");
|
||||
Table.SetCell("Description", "Remove a server from the list of alternate/backup servers of current IRC network");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "Enablechan");
|
||||
Table.SetCell("Arguments", "<#chan>");
|
||||
Table.SetCell("Description", "Enable the channel");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "Disablechan");
|
||||
Table.SetCell("Arguments", "<#chan>");
|
||||
Table.SetCell("Description", "Disable the channel");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "Detach");
|
||||
Table.SetCell("Arguments", "<#chan>");
|
||||
Table.SetCell("Description", "Detach from the channel");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "Topics");
|
||||
Table.SetCell("Description", "Show topics in all your channels");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "PlayBuffer");
|
||||
Table.SetCell("Arguments", "<#chan|query>");
|
||||
Table.SetCell("Description", "Play back the specified buffer");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "ClearBuffer");
|
||||
Table.SetCell("Arguments", "<#chan|query>");
|
||||
Table.SetCell("Description", "Clear the specified buffer");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "ClearAllChannelBuffers");
|
||||
Table.SetCell("Description", "Clear the channel buffers");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "ClearAllQueryBuffers");
|
||||
Table.SetCell("Description", "Clear the query buffers");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "SetBuffer");
|
||||
Table.SetCell("Arguments", "<#chan|query> [linecount]");
|
||||
Table.SetCell("Description", "Set the buffer count");
|
||||
|
||||
if (m_pUser->IsAdmin()) {
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "AddBindHost");
|
||||
Table.SetCell("Arguments", "<host (IP preferred)>");
|
||||
Table.SetCell("Description", "Adds a bind host for normal users to use");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "DelBindHost");
|
||||
Table.SetCell("Arguments", "<host>");
|
||||
Table.SetCell("Description", "Removes a bind host from the list");
|
||||
AddCommandHelp(Table, "AddBindHost", "<host (IP preferred)>", "Adds a bind host for normal users to use", sFilter);
|
||||
AddCommandHelp(Table, "DelBindHost", "<host>", "Removes a bind host from the list", sFilter);
|
||||
}
|
||||
|
||||
if (m_pUser->IsAdmin() || !m_pUser->DenySetBindHost()) {
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "ListBindHosts");
|
||||
Table.SetCell("Description", "Shows the configured list of bind hosts");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "SetBindHost");
|
||||
Table.SetCell("Arguments", "<host (IP preferred)>");
|
||||
Table.SetCell("Description", "Set the bind host for this connection");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "SetUserBindHost");
|
||||
Table.SetCell("Arguments", "<host (IP preferred)>");
|
||||
Table.SetCell("Description", "Set the default bind host for this user");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "ClearBindHost");
|
||||
Table.SetCell("Description", "Clear the bind host for this connection");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "ClearUserBindHost");
|
||||
Table.SetCell("Description", "Clear the default bind host for this user");
|
||||
AddCommandHelp(Table, "ListBindHosts", "", "Shows the configured list of bind hosts", sFilter);
|
||||
AddCommandHelp(Table, "SetBindHost", "<host (IP preferred)>", "Set the bind host for this connection", sFilter);
|
||||
AddCommandHelp(Table, "SetUserBindHost", "<host (IP preferred)>", "Set the default bind host for this user", sFilter);
|
||||
AddCommandHelp(Table, "ClearBindHost", "", "Clear the bind host for this connection", sFilter);
|
||||
AddCommandHelp(Table, "ClearUserBindHost", "", "Clear the default bind host for this user", sFilter);
|
||||
}
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "ShowBindHost");
|
||||
Table.SetCell("Description", "Show currently selected bind host");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "Jump [server]");
|
||||
Table.SetCell("Description", "Jump to the next or the specified server");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "Disconnect");
|
||||
Table.SetCell("Arguments", "[message]");
|
||||
Table.SetCell("Description", "Disconnect from IRC");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "Connect");
|
||||
Table.SetCell("Description", "Reconnect to IRC");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "Uptime");
|
||||
Table.SetCell("Description", "Show for how long ZNC has been running");
|
||||
AddCommandHelp(Table, "ShowBindHost", "", "Show currently selected bind host", sFilter);
|
||||
AddCommandHelp(Table, "Jump", "[server]", "Jump to the next or the specified server", sFilter);
|
||||
AddCommandHelp(Table, "Disconnect", "[message]", "Disconnect from IRC", sFilter);
|
||||
AddCommandHelp(Table, "Connect", "", "Reconnect to IRC", sFilter);
|
||||
AddCommandHelp(Table, "Uptime", "", "Show for how long ZNC has been running", sFilter);
|
||||
|
||||
if (!m_pUser->DenyLoadMod()) {
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "LoadMod");
|
||||
Table.SetCell("Arguments", "[--type=global|user|network] <module>");
|
||||
Table.SetCell("Description", "Load a module");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "UnloadMod");
|
||||
Table.SetCell("Arguments", "[--type=global|user|network] <module>");
|
||||
Table.SetCell("Description", "Unload a module");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "ReloadMod");
|
||||
Table.SetCell("Arguments", "[--type=global|user|network] <module>");
|
||||
Table.SetCell("Description", "Reload a module");
|
||||
|
||||
AddCommandHelp(Table, "LoadMod", "[--type=global|user|network] <module>", "Load a module", sFilter);
|
||||
AddCommandHelp(Table, "UnloadMod", "[--type=global|user|network] <module>", "Unload a module", sFilter);
|
||||
AddCommandHelp(Table, "ReloadMod", "[--type=global|user|network] <module>", "Reload a module", sFilter);
|
||||
if (m_pUser->IsAdmin()) {
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "UpdateMod");
|
||||
Table.SetCell("Arguments", "<module>");
|
||||
Table.SetCell("Description", "Reload a module everywhere");
|
||||
AddCommandHelp(Table, "UpdateMod", "<module>", "Reload a module everywhere", sFilter);
|
||||
}
|
||||
}
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "ShowMOTD");
|
||||
Table.SetCell("Description", "Show ZNC's message of the day");
|
||||
AddCommandHelp(Table, "ShowMOTD", "", "Show ZNC's message of the day", sFilter);
|
||||
|
||||
if (m_pUser->IsAdmin()) {
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "SetMOTD");
|
||||
Table.SetCell("Arguments", "<Message>");
|
||||
Table.SetCell("Description", "Set ZNC's message of the day");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "AddMOTD");
|
||||
Table.SetCell("Arguments", "<Message>");
|
||||
Table.SetCell("Description", "Append <Message> to ZNC's MOTD");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "ClearMOTD");
|
||||
Table.SetCell("Description", "Clear ZNC's MOTD");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "ListPorts");
|
||||
Table.SetCell("Description", "Show all active listeners");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "AddPort");
|
||||
Table.SetCell("Arguments", "<arguments>");
|
||||
Table.SetCell("Description", "Add another port for ZNC to listen on");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "DelPort");
|
||||
Table.SetCell("Arguments", "<arguments>");
|
||||
Table.SetCell("Description", "Remove a port from ZNC");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "Rehash");
|
||||
Table.SetCell("Description", "Reload znc.conf from disk");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "SaveConfig");
|
||||
Table.SetCell("Description", "Save the current settings to disk");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "ListUsers");
|
||||
Table.SetCell("Description", "List all ZNC users and their connection status");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "ListAllUserNetworks");
|
||||
Table.SetCell("Description", "List all ZNC users and their networks");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "ListChans");
|
||||
Table.SetCell("Arguments", "[User <network>]");
|
||||
Table.SetCell("Description", "List all channels");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "ListClients");
|
||||
Table.SetCell("Arguments", "[User]");
|
||||
Table.SetCell("Description", "List all connected clients");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "Traffic");
|
||||
Table.SetCell("Description", "Show basic traffic stats for all ZNC users");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "Broadcast");
|
||||
Table.SetCell("Arguments", "[message]");
|
||||
Table.SetCell("Description", "Broadcast a message to all ZNC users");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "Shutdown");
|
||||
Table.SetCell("Arguments", "[message]");
|
||||
Table.SetCell("Description", "Shut down ZNC completely");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "Restart");
|
||||
Table.SetCell("Arguments", "[message]");
|
||||
Table.SetCell("Description", "Restart ZNC");
|
||||
AddCommandHelp(Table, "SetMOTD", "<message>", "Set ZNC's message of the day", sFilter);
|
||||
AddCommandHelp(Table, "AddMOTD", "<message>", "Append <message> to ZNC's MOTD", sFilter);
|
||||
AddCommandHelp(Table, "ClearMOTD", "", "Clear ZNC's MOTD", sFilter);
|
||||
AddCommandHelp(Table, "ListPorts", "", "Show all active listeners", sFilter);
|
||||
AddCommandHelp(Table, "AddPort", "<[+]port> <ipv4|ipv6|all> <web|irc|all> [bindhost [uriprefix]]", "Add another port for ZNC to listen on", sFilter);
|
||||
AddCommandHelp(Table, "DelPort", "<port> <ipv4|ipv6|all> [bindhost]", "Remove a port from ZNC", sFilter);
|
||||
AddCommandHelp(Table, "Rehash", "", "Reload znc.conf from disk", sFilter);
|
||||
AddCommandHelp(Table, "SaveConfig", "", "Save the current settings to disk", sFilter);
|
||||
AddCommandHelp(Table, "ListUsers", "", "List all ZNC users and their connection status", sFilter);
|
||||
AddCommandHelp(Table, "ListAllUserNetworks", "", "List all ZNC users and their networks", sFilter);
|
||||
AddCommandHelp(Table, "ListChans", "[user <network>]", "List all channels", sFilter);
|
||||
AddCommandHelp(Table, "ListClients", "[user]", "List all connected clients", sFilter);
|
||||
AddCommandHelp(Table, "Traffic", "", "Show basic traffic stats for all ZNC users", sFilter);
|
||||
AddCommandHelp(Table, "Broadcast", "[message]", "Broadcast a message to all ZNC users", sFilter);
|
||||
AddCommandHelp(Table, "Shutdown", "[message]", "Shut down ZNC completely", sFilter);
|
||||
AddCommandHelp(Table, "Restart", "[message]", "Restart ZNC", sFilter);
|
||||
}
|
||||
|
||||
PutStatus(Table);
|
||||
|
||||
+1
-1
@@ -570,7 +570,7 @@ bool CModule::HandleCommand(const CString& sLine) {
|
||||
}
|
||||
|
||||
void CModule::HandleHelpCommand(const CString& sLine) {
|
||||
CString sFilter = sLine.Token(1, true);
|
||||
CString sFilter = sLine.Token(1);
|
||||
CString::size_type iFilterLength = sFilter.size();
|
||||
CTable Table;
|
||||
map<CString, CModCommand>::const_iterator it;
|
||||
|
||||
Reference in New Issue
Block a user