ui: plugin ping

added update pings on token activation (just to have a somewhat regularly reoccuring event to trigger the ping)
This commit is contained in:
wrongway88
2017-02-16 20:30:22 +01:00
parent 50df7cace2
commit ed9ff6d1bc
3 changed files with 33 additions and 5 deletions
@@ -71,7 +71,7 @@ void IDECommunicationController::setEnabled(const bool enabled)
void IDECommunicationController::sendInitialPing()
{
sendMessage(NetworkProtocolHelper::buildPingMessage());
sendUpdatePing();
}
void IDECommunicationController::handleSetActiveTokenMessage(
@@ -179,11 +179,12 @@ void IDECommunicationController::handlePing(const NetworkProtocolHelper::PingMes
if (msg.ideId == "vs")
{
ideName = "Visual Studio";
msg.ideName = ideName;
ideName = "Visual Studio";
}
// TODO: add the other ides
msg.ideName = ideName;
std::string statusMessage = ideName + " instance detected via plugin port";
MessageStatus(statusMessage, false, false).dispatch();
@@ -195,6 +196,11 @@ void IDECommunicationController::handlePing(const NetworkProtocolHelper::PingMes
}
}
void IDECommunicationController::handleMessage(MessageActivateTokens* message)
{
sendUpdatePing();
}
void IDECommunicationController::handleMessage(MessageIDECreateCDB* message)
{
std::string networkMessage = NetworkProtocolHelper::buildCreateCDBMessage();
@@ -223,3 +229,15 @@ void IDECommunicationController::handleMessage(MessagePluginPortChange* message)
stopListening();
startListening();
}
void IDECommunicationController::sendUpdatePing()
{
// first reset connection status
MessagePingReceived msg;
msg.ideId = "";
msg.ideName = "";
msg.dispatch();
// send ping to update connection status
sendMessage(NetworkProtocolHelper::buildPingMessage());
}