From 64749a9afa932fd00f9c339d89c32fe5c5dcfd13 Mon Sep 17 00:00:00 2001 From: moneromooo Date: Mon, 6 Nov 2017 23:27:52 +0000 Subject: [PATCH] command_manager: time out on auth If we miss a nickserv reply, delete the scheduled command --- tipbot/command_manager.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tipbot/command_manager.py b/tipbot/command_manager.py index 0bf555b..12ac726 100644 --- a/tipbot/command_manager.py +++ b/tipbot/command_manager.py @@ -9,6 +9,7 @@ # any later version. # +import time import tipbot.config as config from tipbot.utils import * @@ -23,7 +24,7 @@ def SendToProxy(link,msg): def RunRegisteredCommand(link,ifyes,yesdata,ifno,nodata): if link.identity() not in calltable: calltable[link.identity()] = [] - calltable[link.identity()].append([link,ifyes,yesdata,ifno,nodata]) + calltable[link.identity()].append([link,ifyes,yesdata,ifno,nodata,time.time()+10]) if link.network.is_identified(link): RunNextCommand(link,True) else: @@ -58,6 +59,16 @@ def RunNextCommand(link,registered): finally: Unlock() +def PruneOldWaitingCommands(): + Lock() + now=time.time() + for identity in calltable.keys(): + while len(calltable[identity])>0 and calltable[identity][0][5]