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): ...@@ -12,7 +12,7 @@ class ClientConnection(object, asyncore.dispatcher):
self.authenticated = False self.authenticated = False
self.authentification_sent = False self.authentification_sent = False
self.nickname = 'Anonymous' self.user = 'Anonymous'
self.send_queue = Queue() self.send_queue = Queue()
self.send_buffer = '' self.send_buffer = ''
...@@ -22,6 +22,11 @@ class ClientConnection(object, asyncore.dispatcher): ...@@ -22,6 +22,11 @@ class ClientConnection(object, asyncore.dispatcher):
self.port = addr[1] self.port = addr[1]
super(ClientConnection, self).connect(addr) super(ClientConnection, self).connect(addr)
def username(self, name=''):
if not user:
return self.user
self.user = name
def handle_connect(self): def handle_connect(self):
""" """
Called when a connection is established. This method will/should be Called when a connection is established. This method will/should be
...@@ -82,7 +87,7 @@ class ClientConnection(object, asyncore.dispatcher): ...@@ -82,7 +87,7 @@ class ClientConnection(object, asyncore.dispatcher):
def parse_response(self, buf): def parse_response(self, buf):
if not self.authenticated: if not self.authenticated:
if not self.authentification_sent: 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 self.authentification_sent = True
def parse_notification(self, buf): def parse_notification(self, buf):
......
...@@ -94,11 +94,10 @@ class CLI: ...@@ -94,11 +94,10 @@ class CLI:
# application gracefully. # application gracefully.
try: try:
c = self.stdscr.getch() c = self.stdscr.getch()
except KeyboardInterrupt:
self.execute('quit')
if c != curses.ERR and self.command_bar.handle_input(c): if c != curses.ERR and self.command_bar.handle_input(c):
break break
except KeyboardInterrupt:
self.execute('quit')
def init_command_handler(self): def init_command_handler(self):
......
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