mirror of
https://git.wownero.com/wownero/tippero.git
synced 2024-08-15 00:33:14 +00:00
command_manager: time out on auth
If we miss a nickserv reply, delete the scheduled command
This commit is contained in:
parent
08691aadbb
commit
64749a9afa
1 changed files with 13 additions and 1 deletions
|
@ -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]<now:
|
||||
log_info('deleting old command: %s, %s' % (str(calltable[identity][0][1]), str(calltable[identity][0][3])))
|
||||
link.send("Nickserv didn't reply, gonna have to deny access, mate")
|
||||
del calltable[identity][0]
|
||||
Unlock()
|
||||
|
||||
def Commands(link,cmd):
|
||||
if IsAdmin(link):
|
||||
all = True
|
||||
|
@ -213,6 +224,7 @@ def RunIdleFunctions(param=None):
|
|||
log_error("Exception running idle function %s from module %s: %s" % (str(f),module,str(e)))
|
||||
finally:
|
||||
Unlock()
|
||||
PruneOldWaitingCommands()
|
||||
|
||||
def RunModuleHelpFunction(module,link):
|
||||
if module in modules:
|
||||
|
|
Loading…
Reference in a new issue