mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Added DUMP command
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@39 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -249,6 +249,8 @@ public:
|
||||
Help();
|
||||
} else if (strcasecmp(sCmdName.c_str(), "LIST") == 0) {
|
||||
List();
|
||||
} else if (strcasecmp(sCmdName.c_str(), "DUMP") == 0) {
|
||||
Dump();
|
||||
} else if (strcasecmp(sCmdName.c_str(), "ENABLE") == 0) {
|
||||
string sTok = CUtils::Token(sCommand, 1);
|
||||
|
||||
@@ -358,6 +360,34 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
void Dump() {
|
||||
if (!m_lsWatchers.size()) {
|
||||
PutModule("You have no entries.");
|
||||
return;
|
||||
}
|
||||
|
||||
PutModule("---------------");
|
||||
PutModule("/msg " + GetModNick() + " CLEAR");
|
||||
|
||||
unsigned int uIdx = 1;
|
||||
|
||||
for (list<CWatchEntry>::iterator it = m_lsWatchers.begin(); it != m_lsWatchers.end(); it++, uIdx++) {
|
||||
CWatchEntry& WatchEntry = *it;
|
||||
|
||||
PutModule("/msg " + GetModNick() + " WATCH " + WatchEntry.GetHostMask() + " " + WatchEntry.GetTarget() + " " + WatchEntry.GetPattern());
|
||||
|
||||
if (WatchEntry.GetSourcesStr().size()) {
|
||||
PutModule("/msg " + GetModNick() + " SETSOURCES " + CUtils::ToString(uIdx) + " " + WatchEntry.GetSourcesStr());
|
||||
}
|
||||
|
||||
if (WatchEntry.IsDisabled()) {
|
||||
PutModule("/msg " + GetModNick() + " DISABLE " + CUtils::ToString(uIdx));
|
||||
}
|
||||
}
|
||||
|
||||
PutModule("---------------");
|
||||
}
|
||||
|
||||
void SetSources(unsigned int uIdx, const string& sSources) {
|
||||
uIdx--; // "convert" index to zero based
|
||||
if (uIdx >= m_lsWatchers.size()) {
|
||||
@@ -400,6 +430,10 @@ private:
|
||||
Table.SetCell("Command", "List");
|
||||
Table.SetCell("Description", "List all entries being watched.");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "Dump");
|
||||
Table.SetCell("Description", "Dump a list of all current entries to be used later.");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "Del <Id>");
|
||||
Table.SetCell("Description", "Deletes Id from the list of watched entries.");
|
||||
|
||||
Reference in New Issue
Block a user