Ejemplo n.º 1
0
def parseEIMML(view, peer, matchingAddresses, eimml):
    if isMeAddress(peer):
        # If the Chandler EIMML message is from me then
        # ignore it.
        return (0, None)

    try:
        item = inbound(matchingAddresses, eimml)

        mailStamp = MailStamp(item)
        mailStamp.fromEIMML = True

        return (1, mailStamp)

    except sharingErrors.MalformedData, e:
        # The eimml records contained bogus
        # syntax and will not be processed
        # Raising an error here would result
        # in the entire mail download being
        # terminated so we log the error
        # instead
        logging.exception(e)
        return (-1, None)
Ejemplo n.º 2
0
def parseEIMML(view, peer, matchingAddresses, eimml):
    if isMeAddress(peer):
        # If the Chandler EIMML message is from me then
        # ignore it.
        return (0, None)

    try:
        item = inbound(matchingAddresses, eimml)

        mailStamp = MailStamp(item)
        mailStamp.fromEIMML = True

        return (1, mailStamp)

    except sharingErrors.MalformedData, e:
        # The eimml records contained bogus
        # syntax and will not be processed
        # Raising an error here would result
        # in the entire mail download being
        # terminated so we log the error
        # instead
        logging.exception(e)
        return (-1, None)
Ejemplo n.º 3
0
            # The displayName will contain the ics summary
            icsSummary = item.displayName

        if item.body and len(item.displayName.strip()):
            # The body will contain the ics description
            icsDesc = item.body

        if not has_stamp(item, MailStamp):
            if has_stamp(item, EventStamp):
                EventStamp(item).addStampToAll(MailStamp)
            else:
                ms = MailStamp(item)
                ms.add()

        mailStamp = MailStamp(item)
        mailStamp.fromEIMML = False

        return (mailStamp, icsDesc, icsSummary)

    return None

def buildBody(bodyBuffer):
    if len(bodyBuffer.get('plain')):
        body = removeCarriageReturn(u"\n".join(bodyBuffer.get('plain')))

    elif len(bodyBuffer.get('html')):
        htmlBuffer = bodyBuffer.get('html')

        for i in xrange(0, len(htmlBuffer)):
            htmlBuffer[i] = stripHTML(htmlBuffer[i])
Ejemplo n.º 4
0
            # The displayName will contain the ics summary
            icsSummary = item.displayName

        if item.body and len(item.displayName.strip()):
            # The body will contain the ics description
            icsDesc = item.body

        if not has_stamp(item, MailStamp):
            if has_stamp(item, EventStamp):
                EventStamp(item).addStampToAll(MailStamp)
            else:
                ms = MailStamp(item)
                ms.add()

        mailStamp = MailStamp(item)
        mailStamp.fromEIMML = False

        return (mailStamp, icsDesc, icsSummary)

    return None


def buildBody(bodyBuffer):
    if len(bodyBuffer.get('plain')):
        body = removeCarriageReturn(u"\n".join(bodyBuffer.get('plain')))

    elif len(bodyBuffer.get('html')):
        htmlBuffer = bodyBuffer.get('html')

        for i in xrange(0, len(htmlBuffer)):
            htmlBuffer[i] = stripHTML(htmlBuffer[i])