Added parsing class

master
root 2012-10-20 16:52:50 -07:00
parent 0a43947937
commit eef928ba57
1 changed files with 29 additions and 1 deletions

View File

@ -36,4 +36,32 @@ class ToorChatMessage():
return self.start + self.xid + self.user + self.data + self.end return self.start + self.xid + self.user + self.data + self.end
def to_string(self): def to_string(self):
return self.__str__() return self.__str__()
class ToorChatParsePacket():
''' This is a class for parsing the data of the packet '''
def __init__(self):
self.start = ToorChatProtocol.get_packet_start
self.end = ToorChatProtocol.get_packet_end
def check_packet_start(self, message):
if message.start == self.start
return True
else
return False
def check_packet_end(self, message):
if message.end == self.end
return True
else
return False
def get_xid(cls):
return self.xid
def get_user(cls):
return self.user
def get_message(cls):
return self.message