imh

Check-in [6da5b555b8]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Defend against timezone names
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:6da5b555b821ab0fe67511112d04e5356a58c2dc78005159990ff05d02998300
User & Date: ajv-899-334-8894@vsta.org 2016-11-11 17:00:25
Context
2016-11-13
00:50
Gracefully handle failed SMTP send check-in: d1a5dd1a0c user: ajv-899-334-8894@vsta.org tags: master, trunk
2016-11-11
17:00
Defend against timezone names check-in: 6da5b555b8 user: ajv-899-334-8894@vsta.org tags: master, trunk
03:39
If no messages, just quietly exit, don't Exception out check-in: 5761a5db23 user: ajv-899-334-8894@vsta.org tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to imh.py.

422
423
424
425
426
427
428






429
430
431
432
433
434
435
436
437
438
439
440
    # Parse an email Date: field as a timeval
    def dt_parse(self, t):
        tup = t.split()
        base = " ".join(tup[:5])
        tm = time.strptime(base, "%a, %d %b %Y %H:%M:%S")
        tmf = time.mktime(tm)
        hrs = tup[5]






        deltaval = 60*60*int(hrs[1:3]) + 60*int(hrs[3:5])
        if hrs.startswith('+'):
            tmf += deltaval
        elif hrs.startswith('-'):
            tmf -= deltaval
        return time.localtime(tmf)

    # Parse a BODYSTRUCTURE hierarchy
    def parse_body(self, s):
        return BodyParser(s).parse()

    # Accept text as in "Cc: <addrs...>", and return the







>
>
>
>
>
>
|
|
|
|
|







422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
    # Parse an email Date: field as a timeval
    def dt_parse(self, t):
        tup = t.split()
        base = " ".join(tup[:5])
        tm = time.strptime(base, "%a, %d %b %Y %H:%M:%S")
        tmf = time.mktime(tm)
        hrs = tup[5]
        if hrs[0].isalpha():
            # TBD, decode timezone name like "EST" and get
            #  an offset.  But standard Python doesn't
            #  appear to have this?!?
            pass
        else:
            deltaval = 60*60*int(hrs[1:3]) + 60*int(hrs[3:5])
            if hrs.startswith('+'):
                tmf += deltaval
            elif hrs.startswith('-'):
                tmf -= deltaval
        return time.localtime(tmf)

    # Parse a BODYSTRUCTURE hierarchy
    def parse_body(self, s):
        return BodyParser(s).parse()

    # Accept text as in "Cc: <addrs...>", and return the