Commit 4835e157 authored by Taddeus Kroes's avatar Taddeus Kroes

Fixed control-c in input handler

parent 4e94aa8d
......@@ -12,7 +12,7 @@ class ClientConnection(object, asyncore.dispatcher):
self.authenticated = False
self.authentification_sent = False
self.nickname = 'Anonymous'
self.user = 'Anonymous'
self.send_queue = Queue()
self.send_buffer = ''
......@@ -22,6 +22,11 @@ class ClientConnection(object, asyncore.dispatcher):
self.port = addr[1]
super(ClientConnection, self).connect(addr)
def username(self, name=''):
if not user:
return self.user
self.user = name
def handle_connect(self):
"""
Called when a connection is established. This method will/should be
......@@ -82,7 +87,7 @@ class ClientConnection(object, asyncore.dispatcher):
def parse_response(self, buf):
if not self.authenticated:
if not self.authentification_sent:
self.send_queue.put('USER %s' % self.username)
self.send_queue.put('USER %s' % self.user)
self.authentification_sent = True
def parse_notification(self, buf):
......
......@@ -94,12 +94,11 @@ class CLI:
# application gracefully.
try:
c = self.stdscr.getch()
if c != curses.ERR and self.command_bar.handle_input(c):
break
except KeyboardInterrupt:
self.execute('quit')
if c != curses.ERR and self.command_bar.handle_input(c):
break
def init_command_handler(self):
def close(main):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment