Fix logic mistake with parsing parameters for bm_* commands.

This commit is contained in:
/dev/urandom 2016-08-27 10:16:12 +02:00
parent 4756851048
commit 073e984f69
No known key found for this signature in database
GPG Key ID: 41322B973E0F295E

View File

@ -34,10 +34,14 @@ namespace Components
this->BMClient->start(); this->BMClient->start();
Command::Add("bm_sendb", [](Command::Params) { Command::Add("bm_sendb", [](Command::Params params) {
if (params.Length() < 2) return;
ustring msg; ustring msg;
msg.appendVarString("testing"); msg.appendVarString(params.Join(1));
Logger::Print("Sending broadcast...\n");
Singleton->BMClient->sendBroadcast(msg, Singleton->BMClient->PrivAddresses[0]); Singleton->BMClient->sendBroadcast(msg, Singleton->BMClient->PrivAddresses[0]);
Logger::Print("Broadcast done.\n");
}); });
Command::Add("bm_check_messages", [](Command::Params) { Command::Add("bm_check_messages", [](Command::Params) {
while (Singleton->BMClient->new_messages.size() > 0) while (Singleton->BMClient->new_messages.size() > 0)
@ -104,10 +108,10 @@ namespace Components
Singleton->SaveNodes(); Singleton->SaveNodes();
}); });
Command::Add("bm_address_public", [](Command::Params params) { Command::Add("bm_address_public", [](Command::Params params) {
if (params.Length() < 1) return; if (params.Length() < 2) return;
ustring addre; ustring addre;
addre.fromString(params[0]); addre.fromString(params.Join(1));
PubAddr address; PubAddr address;
if (address.loadAddr(addre)) if (address.loadAddr(addre))
{ {
@ -121,10 +125,10 @@ namespace Components
} }
}); });
Command::Add("bm_address_broadcast", [](Command::Params params) { Command::Add("bm_address_broadcast", [](Command::Params params) {
if (params.Length() < 1) return; if (params.Length() < 2) return;
ustring addre; ustring addre;
addre.fromString(params[0]); addre.fromString(params.Join(1));
PubAddr address; PubAddr address;
if (address.loadAddr(addre)) if (address.loadAddr(addre))
{ {