updated users

master
haddaway 2012-10-20 21:46:59 -07:00
parent 9a43cb7ca1
commit 16c2f0499f
2 changed files with 6 additions and 4 deletions

View File

@ -1,4 +1,6 @@
USER_NAME_SIZE = 9
class ToorChatProtocol(): class ToorChatProtocol():
''' This is a class to allow for easy of use with anything to do with messaging ''' ''' This is a class to allow for easy of use with anything to do with messaging '''
def __init__(self, device): def __init__(self, device):
@ -21,8 +23,8 @@ class ToorChatProtocol():
return None return None
message.start = raw_message[start_index:start_index + 4] message.start = raw_message[start_index:start_index + 4]
message.xid = raw_message[start_index + 4: start_index + 12] message.xid = raw_message[start_index + 4: start_index + 12]
message.user = raw_message[start_index + 12: start_index + 44] message.user = raw_message[start_index + 12: start_index + 21]
message.data = raw_message[start_index + 44: end_index] message.data = raw_message[start_index + 21: end_index]
message.end = raw_message[end_index: end_index+4] message.end = raw_message[end_index: end_index+4]
return message return message
@ -44,7 +46,7 @@ class ToorChatMessage():
if user != None: if user != None:
self.user = user self.user = user
else: else:
self.user = "\xAA"*32 self.user = "anonymous"
self.data = message self.data = message
self.end = ToorChatProtocol.get_packet_end() self.end = ToorChatProtocol.get_packet_end()

View File

@ -76,7 +76,7 @@ class Visualizer():
if entry == ord('u'): if entry == ord('u'):
self.screen.nodelay(0) self.screen.nodelay(0)
user_input = self.screen.getstr(1, 1, 60) user_input = self.screen.getstr(1, 1, 60)
self.user = user_input self.user = user_input[:USER_NAME_SIZE]
self.screen.nodelay(1) self.screen.nodelay(1)
self.screen.addstr(1,1," "*(self.screen_max_x-3)) self.screen.addstr(1,1," "*(self.screen_max_x-3))