'Retrieve the size of a message, or, if none is specified, the size of
each message in the mailbox.
@type i: L{int} or L{None}
@param i: The 0-based index of a message.
@rtype: L{int} or L{list} of L{int}
@return: The number of octets in the specified message, or, if an index
is not specified, a list of the number of octets for all messages
in the mailbox.  Any value which corresponds to a deleted message
is set to 0.
@raise IndexError: When the index does not correspond to a message in
the mailbox.'

def listMessages(self, i=None):

    if (i is None):
        ret = []
        for mess in self.list:
            if mess:
                ret.append(os.stat(mess)[stat.ST_SIZE])
            else:
                ret.append(0)
        return ret
    return ((self.list[i] and os.stat(self.list[i])[stat.ST_SIZE]) or 0)
