Browse Source

use note automation only for chat related txs

pull/146/head
lucretius 3 months ago
parent
commit
683718008c
  1. 4
      src/chatmodel.cpp
  2. 11
      src/controller.cpp
  3. 4
      src/controller.h
  4. 4
      src/mainwindow.cpp
  5. 2
      src/recurring.cpp
  6. 2
      src/sendtab.cpp

4
src/chatmodel.cpp

@ -596,7 +596,7 @@ void MainWindow::sendChat() {
ui->memoTxtChat->clear();
// And send the Tx
rpc->executeTransaction(tx,
rpc->executeTransaction(tx, true,
[=] (QString txid) {
ui->statusBar->showMessage(Settings::txidStatusMessage + " " + txid);
@ -887,7 +887,7 @@ void MainWindow::ContactRequest() {
ui->memoTxtChat->clear();
// And send the Tx
rpc->executeTransaction(tx,
rpc->executeTransaction(tx, true,
[=] (QString txid) {
ui->statusBar->showMessage(Settings::txidStatusMessage + " " + txid);

11
src/controller.cpp

@ -132,7 +132,7 @@ void Controller::setConnection(Connection* c)
}
// Build the RPC JSON Parameters for this tx
void Controller::fillTxJsonParams(json& allRecepients, Tx tx)
void Controller::fillTxJsonParams(json& allRecepients, Tx tx, bool isChatMessage)
{
Q_ASSERT(allRecepients.is_array());
@ -194,7 +194,8 @@ void Controller::fillTxJsonParams(json& allRecepients, Tx tx)
if (spendableNotesCount < 30 &&
balanceAvailable.toDecimalString().toDouble() > (dustTransactions.size() * 0.0001) &&
isNoteAutomationEnabled) {
isNoteAutomationEnabled &&
isChatMessage) {
// Create extra transaction
for (size_t i = 0; i < dustTransactions.size(); ++i) {
// Generate random memo
@ -1506,7 +1507,7 @@ void Controller::unlockIfEncrypted(std::function<void(void)> cb, std::function<v
*/
void Controller::executeStandardUITransaction(Tx tx)
{
executeTransaction(tx, [=] (QString txid) {
executeTransaction(tx,false, [=] (QString txid) {
ui->statusBar->showMessage(Settings::txidStatusMessage + " " + txid);
},
[=] (QString opid, QString errStr) {
@ -1528,7 +1529,7 @@ void Controller::executeStandardUITransaction(Tx tx)
}
// Execute a transaction!
void Controller::executeTransaction(Tx tx,
void Controller::executeTransaction(Tx tx, bool isChatMessage,
const std::function<void(QString txid)> submitted,
const std::function<void(QString txid, QString errStr)> error)
{
@ -1538,7 +1539,7 @@ void Controller::executeTransaction(Tx tx,
unlockIfEncrypted([=] () {
// First, create the json params
json params = json::array();
fillTxJsonParams(params, tx);
fillTxJsonParams(params, tx, isChatMessage);
std::cout << std::setw(2) << params << std::endl;
zrpc->sendTransaction(QString::fromStdString(params.dump()), [=](const json& reply) {

4
src/controller.h

@ -86,11 +86,11 @@ public:
void executeStandardUITransaction(Tx tx);
void executeTransaction(Tx tx,
void executeTransaction(Tx tx, bool isChatMessage,
const std::function<void(QString txid)> submitted,
const std::function<void(QString txid, QString errStr)> error);
void fillTxJsonParams(json& params, Tx tx);
void fillTxJsonParams(json& params, Tx tx, bool isChatMessage);
const TxTableModel* getTransactionsModel() { return transactionsTableModel; }

4
src/mainwindow.cpp

@ -2032,7 +2032,7 @@ void MainWindow::sendMoneyChat() {
ui->memoTxtChat->clear();
// And send the Tx
rpc->executeTransaction(tx,
rpc->executeTransaction(tx, true,
[=] (QString txid) {
ui->statusBar->showMessage(Settings::txidStatusMessage + " " + txid);
@ -2320,7 +2320,7 @@ void MainWindow::sendMoneyRequestChat() {
ui->memoTxtChat->clear();
// And send the Tx
rpc->executeTransaction(tx,
rpc->executeTransaction(tx, true,
[=] (QString txid) {
ui->statusBar->showMessage(Settings::txidStatusMessage + " " + txid);

2
src/recurring.cpp

@ -600,7 +600,7 @@ void Recurring::executeRecurringPayment(MainWindow* main, RecurringPaymentInfo r
* Execute a send Tx
*/
void Recurring::doSendTx(MainWindow* mainwindow, Tx tx, std::function<void(QString, QString)> cb) {
mainwindow->getRPC()->executeTransaction(tx,
mainwindow->getRPC()->executeTransaction(tx, false,
[=] (QString txid) {
mainwindow->ui->statusBar->showMessage(Settings::txidStatusMessage + " " + txid);
cb(txid, "");

2
src/sendtab.cpp

@ -864,7 +864,7 @@ void MainWindow::sendButton() {
d->show();
// And send the Tx
rpc->executeTransaction(tx,
rpc->executeTransaction(tx, false,
[=] (QString txid) {
ui->statusBar->showMessage(Settings::txidStatusMessage + " " + txid);

Loading…
Cancel
Save