Start with all symbols from milter module.
This commit is contained in:
+18
-15
@@ -8,15 +8,9 @@ import os
|
|||||||
import milter
|
import milter
|
||||||
import thread
|
import thread
|
||||||
|
|
||||||
from milter import ACCEPT,CONTINUE,REJECT,DISCARD,TEMPFAIL, \
|
from milter import *
|
||||||
set_flags, setdbg, setbacklog, settimeout, error, \
|
|
||||||
ADDHDRS, CHGBODY, ADDRCPT, DELRCPT, CHGHDRS, \
|
|
||||||
V1_ACTS, V2_ACTS, CURR_ACTS
|
|
||||||
|
|
||||||
try: from milter import QUARANTINE
|
__version__ = '0.9.2'
|
||||||
except: pass
|
|
||||||
|
|
||||||
__version__ = '0.8.5'
|
|
||||||
|
|
||||||
_seq_lock = thread.allocate_lock()
|
_seq_lock = thread.allocate_lock()
|
||||||
_seq = 0
|
_seq = 0
|
||||||
@@ -40,7 +34,12 @@ def noreply(func):
|
|||||||
class DisabledAction(RuntimeError):
|
class DisabledAction(RuntimeError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# A do nothing Milter base class from which python milters should derive
|
||||||
|
# unless they are using the milter C module directly.
|
||||||
|
|
||||||
class Base(object):
|
class Base(object):
|
||||||
|
"The core class interface to the milter module."
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.__actions = CURR_ACTS # all actions enabled
|
self.__actions = CURR_ACTS # all actions enabled
|
||||||
def _setctx(self,ctx):
|
def _setctx(self,ctx):
|
||||||
@@ -145,26 +144,30 @@ class Base(object):
|
|||||||
def progress(self):
|
def progress(self):
|
||||||
return self.__ctx.progress()
|
return self.__ctx.progress()
|
||||||
|
|
||||||
|
# A logging but otherwise do nothing Milter base class included
|
||||||
|
# for compatibility with previous versions of pymilter.
|
||||||
|
|
||||||
class Milter(Base):
|
class Milter(Base):
|
||||||
"""A simple class interface to the milter module.
|
"A simple class interface to the milter module."
|
||||||
"""
|
|
||||||
|
|
||||||
# user replaceable callbacks
|
|
||||||
def log(self,*msg):
|
def log(self,*msg):
|
||||||
print 'Milter:',
|
print 'Milter:',
|
||||||
for i in msg: print i,
|
for i in msg: print i,
|
||||||
print
|
print
|
||||||
|
|
||||||
|
@noreply
|
||||||
def connect(self,hostname,family,hostaddr):
|
def connect(self,hostname,family,hostaddr):
|
||||||
"Called for each connection to sendmail."
|
"Called for each connection to sendmail."
|
||||||
self.log("connect from %s at %s" % (hostname,hostaddr))
|
self.log("connect from %s at %s" % (hostname,hostaddr))
|
||||||
return CONTINUE
|
return CONTINUE
|
||||||
|
|
||||||
|
@noreply
|
||||||
def hello(self,hostname):
|
def hello(self,hostname):
|
||||||
"Called after the HELO command."
|
"Called after the HELO command."
|
||||||
self.log("hello from %s" % hostname)
|
self.log("hello from %s" % hostname)
|
||||||
return CONTINUE
|
return CONTINUE
|
||||||
|
|
||||||
|
@noreply
|
||||||
def envfrom(self,f,*str):
|
def envfrom(self,f,*str):
|
||||||
"""Called to begin each message.
|
"""Called to begin each message.
|
||||||
f -> string message sender
|
f -> string message sender
|
||||||
@@ -173,25 +176,25 @@ class Milter(Base):
|
|||||||
self.log("mail from",f,str)
|
self.log("mail from",f,str)
|
||||||
return CONTINUE
|
return CONTINUE
|
||||||
|
|
||||||
|
@noreply
|
||||||
def envrcpt(self,to,*str):
|
def envrcpt(self,to,*str):
|
||||||
"Called for each message recipient."
|
"Called for each message recipient."
|
||||||
self.log("rcpt to",to,str)
|
self.log("rcpt to",to,str)
|
||||||
return CONTINUE
|
return CONTINUE
|
||||||
|
|
||||||
|
@noreply
|
||||||
def header(self,field,value):
|
def header(self,field,value):
|
||||||
"Called for each message header."
|
"Called for each message header."
|
||||||
self.log("%s: %s" % (field,value))
|
self.log("%s: %s" % (field,value))
|
||||||
return CONTINUE
|
return CONTINUE
|
||||||
|
|
||||||
|
@noreply
|
||||||
def eoh(self):
|
def eoh(self):
|
||||||
"Called after all headers are processed."
|
"Called after all headers are processed."
|
||||||
self.log("eoh")
|
self.log("eoh")
|
||||||
return CONTINUE
|
return CONTINUE
|
||||||
|
|
||||||
def body(self,unused):
|
@noreply
|
||||||
"Called to transfer the message body."
|
|
||||||
return CONTINUE
|
|
||||||
|
|
||||||
def eom(self):
|
def eom(self):
|
||||||
"Called at the end of message."
|
"Called at the end of message."
|
||||||
self.log("eom")
|
self.log("eom")
|
||||||
|
|||||||
Reference in New Issue
Block a user