Separated 'exit' and 'self-destroy' and added functionality to remove agents from the teamserver to cleanup the sessions table.
This commit is contained in:
@@ -54,6 +54,16 @@ proc sendAgentTask*(connection: WsConnection, agentId: string, command: string,
|
||||
)
|
||||
connection.ws.sendEvent(event, connection.sessionKey)
|
||||
|
||||
proc sendAgentRemove*(connection: WsConnection, agentId: string) =
|
||||
let event = Event(
|
||||
eventType: CLIENT_AGENT_REMOVE,
|
||||
timestamp: now().toTime().toUnix(),
|
||||
data: %*{
|
||||
"agentId": agentId
|
||||
}
|
||||
)
|
||||
connection.ws.sendEvent(event, connection.sessionKey)
|
||||
|
||||
proc sendRemoveLoot*(connection: WsConnection, lootId: string) =
|
||||
let event = Event(
|
||||
eventType: CLIENT_LOOT_REMOVE,
|
||||
@@ -72,4 +82,5 @@ proc sendGetLoot*(connection: WsConnection, lootId: string) =
|
||||
"lootId": lootId
|
||||
}
|
||||
)
|
||||
connection.ws.sendEvent(event, connection.sessionKey)
|
||||
connection.ws.sendEvent(event, connection.sessionKey)
|
||||
|
||||
|
||||
@@ -193,6 +193,9 @@ proc draw*(component: SessionsTableComponent, showComponent: ptr bool, connectio
|
||||
for i, agent in component.agents:
|
||||
if not ImGuiSelectionBasicStorage_Contains(component.selection, cast[ImGuiID](i)):
|
||||
newAgents.add(agent)
|
||||
else:
|
||||
# Send message to team server to remove delete the agent from the database and stop it from re-appearing when the client is restarted
|
||||
connection.sendAgentRemove(agent.agentId)
|
||||
|
||||
component.agents = newAgents
|
||||
ImGuiSelectionBasicStorage_Clear(component.selection)
|
||||
|
||||
Reference in New Issue
Block a user