@@ -128,10 +128,8 @@ def __init__(self, *ini, **config):
128
128
self .log .fatal ('realname = %(userinfo)s' , self .config )
129
129
import sys
130
130
sys .exit (- 1 )
131
- self .queue = None
132
- if self .config .asynchronous :
133
- self .queue = Queue (loop = self .loop )
134
- self .awaiting_queue = self .create_task (self .process_queue ())
131
+ self .queue = Queue (loop = self .loop )
132
+ self .awaiting_queue = self .create_task (self .process_queue ())
135
133
self ._ip = self ._dcc = None
136
134
# auto include the sasl plugin if needed
137
135
if 'sasl_username' in self .config and \
@@ -373,29 +371,25 @@ def dcc(self):
373
371
self ._dcc = DCCManager (self )
374
372
return self ._dcc
375
373
376
- @asyncio .coroutine
377
- def dcc_chat (self , mask , host = None , port = None ):
374
+ async def dcc_chat (self , mask , host = None , port = None ):
378
375
"""Open a DCC CHAT whith mask. If host/port are specified then connect
379
376
to a server. Else create a server"""
380
377
return self .dcc .create (
381
378
'chat' , mask , host = host , port = port ).ready
382
379
383
- @asyncio .coroutine
384
- def dcc_get (self , mask , host , port , filepath , filesize = None ):
380
+ async def dcc_get (self , mask , host , port , filepath , filesize = None ):
385
381
"""DCC GET a file from mask. filepath must be an absolute path with an
386
382
existing directory. filesize is the expected file size."""
387
383
return self .dcc .create (
388
384
'get' , mask , filepath = filepath , filesize = filesize ,
389
385
host = host , port = port ).ready
390
386
391
- @asyncio .coroutine
392
- def dcc_send (self , mask , filepath ):
387
+ async def dcc_send (self , mask , filepath ):
393
388
"""DCC SEND a file to mask. filepath must be an absolute path to
394
389
existing file"""
395
390
return self .dcc .create ('send' , mask , filepath = filepath ).ready
396
391
397
- @asyncio .coroutine
398
- def dcc_accept (self , mask , filepath , port , pos ):
392
+ async def dcc_accept (self , mask , filepath , port , pos ):
399
393
"""accept a DCC RESUME for an axisting DCC SEND. filepath is the
400
394
filename to sent. port is the port opened on the server.
401
395
pos is the expected offset"""
@@ -420,6 +414,11 @@ def cancel(self):
420
414
except asyncio .CancelledError :
421
415
pass
422
416
417
+ def close (self ):
418
+ self .cancel ()
419
+ super ().close ()
420
+
421
+
423
422
def run (argv = None ):
424
423
bots = {}
425
424
bot = IrcBot .from_argv (argv , botnet = bots )
0 commit comments