aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2016-10-04 15:43:10 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2016-12-29 11:43:29 +0000
commit1755c04576eb42467ba16af9f2658e12b707b7d0 (patch)
tree864b1f14ef2c2dd9e423b4e615f2a237c543e690 /src/qt
parentd80a00660f5b26ee16c60b941c2bbbd2d49e711f (diff)
Qt/RPCConsole: Truncate filtered commands to just the command name, rather than skip it entirely in history
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/rpcconsole.cpp30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index c979fdf87b..c53ae53c64 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -74,14 +74,14 @@ const QStringList historyFilter = QStringList()
<< "walletpassphrasechange"
<< "encryptwallet";
-bool command_may_contain_sensitive_data(const QString cmd)
+QString command_filter_sensitive_data(const QString cmd)
{
Q_FOREACH(QString unallowedCmd, historyFilter) {
if (cmd.trimmed().startsWith(unallowedCmd)) {
- return true;
+ return unallowedCmd;
}
}
- return false;
+ return cmd;
}
}
@@ -779,20 +779,18 @@ void RPCConsole::on_lineEdit_returnPressed()
message(CMD_REQUEST, cmd);
Q_EMIT cmdRequest(cmd);
- bool storeHistory = !command_may_contain_sensitive_data(cmd);
+ cmd = command_filter_sensitive_data(cmd);
+
+ // Remove command, if already in history
+ history.removeOne(cmd);
+ // Append command to history
+ history.append(cmd);
+ // Enforce maximum history size
+ while(history.size() > CONSOLE_HISTORY)
+ history.removeFirst();
+ // Set pointer to end of history
+ historyPtr = history.size();
- if (storeHistory)
- {
- // Remove command, if already in history
- history.removeOne(cmd);
- // Append command to history
- history.append(cmd);
- // Enforce maximum history size
- while(history.size() > CONSOLE_HISTORY)
- history.removeFirst();
- // Set pointer to end of history
- historyPtr = history.size();
- }
// Scroll console view to end
scrollToEnd();
}