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.
|
# any later version.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import time
|
||||||
import tipbot.config as config
|
import tipbot.config as config
|
||||||
from tipbot.utils import *
|
from tipbot.utils import *
|
||||||
|
|
||||||
|
@ -23,7 +24,7 @@ def SendToProxy(link,msg):
|
||||||
def RunRegisteredCommand(link,ifyes,yesdata,ifno,nodata):
|
def RunRegisteredCommand(link,ifyes,yesdata,ifno,nodata):
|
||||||
if link.identity() not in calltable:
|
if link.identity() not in calltable:
|
||||||
calltable[link.identity()] = []
|
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):
|
if link.network.is_identified(link):
|
||||||
RunNextCommand(link,True)
|
RunNextCommand(link,True)
|
||||||
else:
|
else:
|
||||||
|
@ -58,6 +59,16 @@ def RunNextCommand(link,registered):
|
||||||
finally:
|
finally:
|
||||||
Unlock()
|
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):
|
def Commands(link,cmd):
|
||||||
if IsAdmin(link):
|
if IsAdmin(link):
|
||||||
all = True
|
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)))
|
log_error("Exception running idle function %s from module %s: %s" % (str(f),module,str(e)))
|
||||||
finally:
|
finally:
|
||||||
Unlock()
|
Unlock()
|
||||||
|
PruneOldWaitingCommands()
|
||||||
|
|
||||||
def RunModuleHelpFunction(module,link):
|
def RunModuleHelpFunction(module,link):
|
||||||
if module in modules:
|
if module in modules:
|
||||||
|
|
Loading…
Reference in a new issue