1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
#!/usr/bin/python
import re
# Exit codes
exitcodes = {
'OK' : 0,
'ERROR' : -1
}
# Components of stack trace (indices to tuple)
FILENAME, LINENO, FUNCNAME = 0, 1, 2 #SOURCELINE = 3 ; not used
# Names for output logging levels
loglevels = {
'TRACE' : 1,
'DEBUG' : 2,
'INFO' : 3,
'WARN' : 4,
'ERROR' : 5,
'FATAL' : 6,
}
(TRACE, DEBUG, INFO, WARN, ERROR, FATAL) = range(1, 7)
# Options recognized in configuration getmailrc file
intoptions = (
'command_add_fromline',
'delete',
'delete_after',
'extension_depth',
'log_level',
'max_message_size',
'max_messages_per_session',
'no_delivered_to',
'no_received',
'port',
'readall',
'timeout',
'use_apop',
'use_*env',
'verbose'
)
stringoptions = (
'envelope_recipient',
'extension_sep',
'message_log',
'postmaster',
)
listoptions = (
)
# Line ending conventions
line_end = {
'pop3' : '\r\n',
'maildir' : '\n',
'mbox' : '\n'
}
res = {
# Regular expression object to find line endings
'eol' : re.compile(r'\r?\n\s*', re.MULTILINE),
# Regular expression to do POP3 leading-dot unescapes
'leadingdot' : re.compile(r'^\.\.', re.MULTILINE),
# Percent sign escapes
'percent' : re.compile(r'%(?!\([\S]+\)[si])'),
}
|