include all users messages if level was not requested in find command
This commit is contained in:
@@ -288,7 +288,7 @@ void MainLoop::run() {
|
|||||||
}
|
}
|
||||||
time(&now);
|
time(&now);
|
||||||
if (!dataSinks.empty()) {
|
if (!dataSinks.empty()) {
|
||||||
messages = m_messages->findAll("", "", "*", false, true, true, true, true, sinkSince, now);
|
messages = m_messages->findAll("", "", "*", false, true, true, true, true, true, sinkSince, now);
|
||||||
for (deque<Message*>::iterator it = messages.begin(); it != messages.end(); it++) {
|
for (deque<Message*>::iterator it = messages.begin(); it != messages.end(); it++) {
|
||||||
Message* message = *it;
|
Message* message = *it;
|
||||||
for (list<DataSink*>::iterator it = dataSinks.begin(); it != dataSinks.end(); it++) {
|
for (list<DataSink*>::iterator it = dataSinks.begin(); it != dataSinks.end(); it++) {
|
||||||
@@ -328,7 +328,7 @@ void MainLoop::run() {
|
|||||||
}
|
}
|
||||||
if (listening) {
|
if (listening) {
|
||||||
string levels = getUserLevels(user);
|
string levels = getUserLevels(user);
|
||||||
messages = m_messages->findAll("", "", levels, false, true, true, true, true, since, now);
|
messages = m_messages->findAll("", "", levels, false, true, true, true, true, true, since, now);
|
||||||
for (deque<Message*>::iterator it = messages.begin(); it != messages.end(); it++) {
|
for (deque<Message*>::iterator it = messages.begin(); it != messages.end(); it++) {
|
||||||
Message* message = *it;
|
Message* message = *it;
|
||||||
ostream << message->getCircuit() << " " << message->getName() << " = " << dec;
|
ostream << message->getCircuit() << " " << message->getName() << " = " << dec;
|
||||||
@@ -963,7 +963,7 @@ string MainLoop::executeHex(vector<string> &args) {
|
|||||||
string MainLoop::executeFind(vector<string> &args, string levels) {
|
string MainLoop::executeFind(vector<string> &args, string levels) {
|
||||||
size_t argPos = 1;
|
size_t argPos = 1;
|
||||||
bool configFormat = false, exact = false, withRead = true, withWrite = false, withPassive = true, first = true,
|
bool configFormat = false, exact = false, withRead = true, withWrite = false, withPassive = true, first = true,
|
||||||
onlyWithData = false, hexFormat = false;
|
onlyWithData = false, hexFormat = false, userLevel = true;
|
||||||
OutputFormat verbosity = 0;
|
OutputFormat verbosity = 0;
|
||||||
vector<column_t> columns;
|
vector<column_t> columns;
|
||||||
string circuit;
|
string circuit;
|
||||||
@@ -1075,6 +1075,7 @@ string MainLoop::executeFind(vector<string> &args, string levels) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
levels = args[argPos];
|
levels = args[argPos];
|
||||||
|
userLevel = false;
|
||||||
} else {
|
} else {
|
||||||
argPos = 0; // print usage
|
argPos = 0; // print usage
|
||||||
break;
|
break;
|
||||||
@@ -1103,7 +1104,7 @@ string MainLoop::executeFind(vector<string> &args, string levels) {
|
|||||||
" NAME NAME of the messages to find (or a part thereof without '-e')";
|
" NAME NAME of the messages to find (or a part thereof without '-e')";
|
||||||
}
|
}
|
||||||
deque<Message*> messages = m_messages->findAll(
|
deque<Message*> messages = m_messages->findAll(
|
||||||
circuit, args.size() == argPos ? "" : args[argPos], levels, exact, withRead, withWrite, withPassive);
|
circuit, args.size() == argPos ? "" : args[argPos], levels, exact, withRead, withWrite, withPassive, userLevel);
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
ostringstream result;
|
ostringstream result;
|
||||||
|
|||||||
@@ -2002,8 +2002,8 @@ Message* MessageMap::find(const string& circuit, const string& name, const strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
deque<Message*> MessageMap::findAll(const string& circuit, const string& name, const string& levels,
|
deque<Message*> MessageMap::findAll(const string& circuit, const string& name, const string& levels,
|
||||||
const bool completeMatch, const bool withRead, const bool withWrite,
|
const bool completeMatch, const bool withRead, const bool withWrite, const bool withPassive,
|
||||||
const bool withPassive, const bool onlyAvailable,
|
const bool includeEmptyLevel, const bool onlyAvailable,
|
||||||
const time_t since, const time_t until) {
|
const time_t since, const time_t until) {
|
||||||
deque<Message*> ret;
|
deque<Message*> ret;
|
||||||
string lcircuit = circuit;
|
string lcircuit = circuit;
|
||||||
@@ -2019,7 +2019,7 @@ deque<Message*> MessageMap::findAll(const string& circuit, const string& name, c
|
|||||||
}
|
}
|
||||||
for (vector<Message*>::iterator msgIt = it->second.begin(); msgIt != it->second.end(); msgIt++) {
|
for (vector<Message*>::iterator msgIt = it->second.begin(); msgIt != it->second.end(); msgIt++) {
|
||||||
Message* message = *msgIt;
|
Message* message = *msgIt;
|
||||||
if (checkLevel && !message->hasLevel(levels, !completeMatch)) {
|
if (checkLevel && !message->hasLevel(levels, includeEmptyLevel)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (checkCircuit) {
|
if (checkCircuit) {
|
||||||
|
|||||||
@@ -1320,6 +1320,8 @@ class MessageMap : public FileReader {
|
|||||||
* @param withWrite true to include write messages (default false).
|
* @param withWrite true to include write messages (default false).
|
||||||
* @param withPassive true to include passive messages (default false).
|
* @param withPassive true to include passive messages (default false).
|
||||||
* @return the found @a Message instances.
|
* @return the found @a Message instances.
|
||||||
|
* @param includeEmptyLevel true to also include messages with no access level, false to include only messages with
|
||||||
|
* the specified level.
|
||||||
* @param onlyAvailable true to include only available messages (default true), false to also include messages that
|
* @param onlyAvailable true to include only available messages (default true), false to also include messages that
|
||||||
* are currently not available (e.g. due to unresolved or false conditions).
|
* are currently not available (e.g. due to unresolved or false conditions).
|
||||||
* @param since the start time from which to add updates (inclusive, also removes messages with unset destination
|
* @param since the start time from which to add updates (inclusive, also removes messages with unset destination
|
||||||
@@ -1330,7 +1332,7 @@ class MessageMap : public FileReader {
|
|||||||
*/
|
*/
|
||||||
deque<Message*> findAll(const string& circuit, const string& name, const string& levels,
|
deque<Message*> findAll(const string& circuit, const string& name, const string& levels,
|
||||||
const bool completeMatch = true, const bool withRead = true, const bool withWrite = false,
|
const bool completeMatch = true, const bool withRead = true, const bool withWrite = false,
|
||||||
const bool withPassive = false, const bool onlyAvailable = true,
|
const bool withPassive = false, const bool includeEmptyLevel = true, const bool onlyAvailable = true,
|
||||||
const time_t since = 0, const time_t until = 0);
|
const time_t since = 0, const time_t until = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user