From b9a4aa8889eeb168013b3b4b83cbfdeab6767960 Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Wed, 3 Jun 2020 22:15:46 +0200 Subject: [PATCH] fix for outgoing messages --- src/controller.cpp | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/controller.cpp b/src/controller.cpp index 46f7342..b5754a4 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -882,12 +882,13 @@ void Controller::refreshTransactions() { auto txid = QString::fromStdString(it["txid"]); auto datetime = it["datetime"].get(); - + // First, check if there's outgoing metadata if (!it["outgoing_metadata"].is_null()) { - for (auto o: it["outgoing_metadata"].get()) { - + for (auto o: it["outgoing_metadata"].get()) + { + // if (chatModel->getCidByTx(txid) == QString("0xdeadbeef")){ QString address; address = QString::fromStdString(o["address"]); @@ -966,7 +967,7 @@ void Controller::refreshTransactions() { /////We need to filter out Memos smaller then the ciphertext size, or it will dump - if ((memo.startsWith("{") == false) && (headerbytes > 0)) + if ((memo.startsWith("{") == false) && (headerbytes.length() > 20)) { QString passphrase = main->getPassword(); @@ -1053,13 +1054,11 @@ void Controller::refreshTransactions() { } std::string decryptedMemo(reinterpret_cast(decrypted),MESSAGE1_LEN); - QString memodecrypt; + /////Now we can convert it to QString - memodecrypt = QString::fromUtf8( decryptedMemo.data(), decryptedMemo.size()); - - - + QString memodecrypt = QString::fromUtf8( decryptedMemo.data(), decryptedMemo.size()); + //////////////Give us the output of the decrypted message as debug to see if it was successfully qDebug()<<"OUT decrypt:" << memodecrypt; @@ -1080,10 +1079,11 @@ void Controller::refreshTransactions() { false ); DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item); - + updateUIBalances(); - }else{ + } + /*else{ ChatItem item = ChatItem( @@ -1102,12 +1102,17 @@ void Controller::refreshTransactions() { ); DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item); updateUIBalances(); - } + }*/ } items.push_back(TransactionItemDetail{address, amount, memo}); total_amount = total_amount + amount; - } + // }else{ + + + // } + // } + } { QList addresses;