diff --git a/lib/xenu_nntp/mbox.py b/lib/xenu_nntp/mbox.py index ca3b966..e77cedf 100644 --- a/lib/xenu_nntp/mbox.py +++ b/lib/xenu_nntp/mbox.py @@ -48,6 +48,12 @@ class MBoxReaderBuffer(): else: return False + def is_end(self): + return self.lines[0] is not None \ + and self.is_empty_line(1) \ + and self.is_empty_line(2) \ + and self.is_from_line(3) + class MBoxReader(): __slots__ = 'path', 'fh', 'line', 'buf', 'message', @@ -98,12 +104,12 @@ class MBoxReader(): # ...Prepare a new message object. # self.message = Message() - - if self.message is not None: - # - # Buffer the line into the current message. - # - self.message.readline(line) + elif not self.buf.is_end(): + if self.message is not None: + # + # Buffer the line into the current message. + # + self.message.readline(line) # # Return the message if we have one.