commit b4385b6d43dfbb2cf1972b8e5130e35162dab9de
parent 3c4e54212a06880a44efd0aa4195573d068207d4
Author: Dominik Schmidt <dominik@schm1dt.ch>
Date: Wed, 5 Sep 2018 14:10:16 +0200
Provide commands to add and remove endpoints
Diffstat:
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/bastlibridge/bot.d b/src/bastlibridge/bot.d
@@ -97,6 +97,8 @@ static this(){
globalCommands.add!((Message m){m.source.stop();})("quit", CommandOptions(true));
globalCommands.add!((Message m){m.source.manager.teardown();})("teardown", CommandOptions(true));
globalCommands.add!((Message m, in char[] other){m.respond(enforce(m.source.manager.getEndpoint(other),"Endpoint unknown").endpoint.lastSeen());})("lastUpdate");
+ globalCommands.add!((Message m, in char[] endpoint){m.source.manager.addEndpoint(endpoint.idup))("addEndpoint",CommandOptions(true));
+ globalCommands.add!((Message m, in char[] endpoint){m.source.manager.removeEndpoint(endpoint.idup))("removeEndpoint",CommandOptions(true));
}
/**
diff --git a/src/bastlibridge/manager.d b/src/bastlibridge/manager.d
@@ -129,6 +129,7 @@ class Manager{
info("All processes stopped. We will now exit");
}
+ alias removeEndpoint = terminate;
void terminate(in char[] name){
auto val=getEndpoint(name);
if(val){