2016-11-12 17:20:45 +01:00
|
|
|
from debug import logger
|
|
|
|
from messagetypes import MsgBase
|
|
|
|
|
|
|
|
class Message(MsgBase):
|
|
|
|
def __init__(self):
|
|
|
|
return
|
|
|
|
|
|
|
|
def decode(self, data):
|
2016-11-03 22:41:36 +01:00
|
|
|
self.subject = data["subject"]
|
|
|
|
self.body = data["body"]
|
|
|
|
|
2016-11-12 17:20:45 +01:00
|
|
|
def encode(self, data):
|
|
|
|
super(Message, self).encode()
|
|
|
|
try:
|
|
|
|
self.data["subject"] = data["subject"]
|
|
|
|
self.data["body"] = data["body"]
|
|
|
|
except KeyError as e:
|
|
|
|
logger.error("Missing key ", e.name)
|
|
|
|
return self.data
|
|
|
|
|
2016-11-03 22:41:36 +01:00
|
|
|
def process(self):
|
2016-11-12 17:20:45 +01:00
|
|
|
logger.debug("Subject: %i bytes", len(self.subject))
|
|
|
|
logger.debug("Body: %i bytes", len(self.body))
|