Browse Source

fix for eth_changed

cl-refactor
Marek Kotewicz 10 years ago
parent
commit
81dbf3ec5f
  1. 24
      libqethereum/QEthereum.cpp

24
libqethereum/QEthereum.cpp

@ -134,34 +134,22 @@ void QWebThree::onDataProcessed(QString _json, QString _addInfo)
if (!_addInfo.compare("internal")) if (!_addInfo.compare("internal"))
return; return;
if (!_addInfo.compare("eth_changed")) if (!_addInfo.compare("shh_changed") || !_addInfo.compare("eth_changed"))
{ {
QJsonArray resultsArray = QJsonDocument::fromJson(_json.toUtf8()).array(); QJsonArray resultsArray = QJsonDocument::fromJson(_json.toUtf8()).array();
for (int i = 0; i < resultsArray.size(); i++) for (int i = 0; i < resultsArray.size(); i++)
{ {
QJsonObject elem = resultsArray[i].toObject(); QJsonObject elem = resultsArray[i].toObject();
if (elem.contains("result") && elem["result"].toBool() == true) if (elem.contains("result"))
{ {
QJsonObject res; QJsonObject res;
res["_event"] = _addInfo; res["_event"] = _addInfo;
res["_id"] = (int)m_watches[i]; // we can do that couse poll is synchronous
response(QString::fromUtf8(QJsonDocument(res).toJson()));
}
}
return;
}
if (!_addInfo.compare("shh_changed")) if (!_addInfo.compare("shh_changed"))
{ res["_id"] = (int)m_shhWatches[i]; // we can do that couse poll is synchronous
QJsonArray resultsArray = QJsonDocument::fromJson(_json.toUtf8()).array(); else
for (int i = 0; i < resultsArray.size(); i++) res["_id"] = (int)m_watches[i];
{
QJsonObject elem = resultsArray[i].toObject();
if (elem.contains("result"))
{
QJsonObject res;
res["_event"] = _addInfo;
res["_id"] = (int)m_shhWatches[i];
res["data"] = elem["result"].toArray(); res["data"] = elem["result"].toArray();
response(QString::fromUtf8(QJsonDocument(res).toJson())); response(QString::fromUtf8(QJsonDocument(res).toJson()));
} }

Loading…
Cancel
Save