Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pymilter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
misc
pymilter
Commits
31aa3903
Commit
31aa3903
authored
May 28, 2009
by
Stuart Gathman
Browse files
Options
Downloads
Patches
Plain Diff
Start with all symbols from milter module.
parent
cb319634
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Milter/__init__.py
+18
-15
18 additions, 15 deletions
Milter/__init__.py
with
18 additions
and
15 deletions
Milter/__init__.py
+
18
−
15
View file @
31aa3903
...
...
@@ -8,15 +8,9 @@ import os
import
milter
import
thread
from
milter
import
ACCEPT
,
CONTINUE
,
REJECT
,
DISCARD
,
TEMPFAIL
,
\
set_flags
,
setdbg
,
setbacklog
,
settimeout
,
error
,
\
ADDHDRS
,
CHGBODY
,
ADDRCPT
,
DELRCPT
,
CHGHDRS
,
\
V1_ACTS
,
V2_ACTS
,
CURR_ACTS
from
milter
import
*
try
:
from
milter
import
QUARANTINE
except
:
pass
__version__
=
'
0.8.5
'
__version__
=
'
0.9.2
'
_seq_lock
=
thread
.
allocate_lock
()
_seq
=
0
...
...
@@ -40,7 +34,12 @@ def noreply(func):
class
DisabledAction
(
RuntimeError
):
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
):
"
The core class interface to the milter module.
"
def
__init__
(
self
):
self
.
__actions
=
CURR_ACTS
# all actions enabled
def
_setctx
(
self
,
ctx
):
...
...
@@ -145,26 +144,30 @@ class Base(object):
def
progress
(
self
):
return
self
.
__ctx
.
progress
()
# A logging but otherwise do nothing Milter base class included
# for compatibility with previous versions of pymilter.
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
):
print
'
Milter:
'
,
for
i
in
msg
:
print
i
,
print
@noreply
def
connect
(
self
,
hostname
,
family
,
hostaddr
):
"
Called for each connection to sendmail.
"
self
.
log
(
"
connect from %s at %s
"
%
(
hostname
,
hostaddr
))
return
CONTINUE
@noreply
def
hello
(
self
,
hostname
):
"
Called after the HELO command.
"
self
.
log
(
"
hello from %s
"
%
hostname
)
return
CONTINUE
@noreply
def
envfrom
(
self
,
f
,
*
str
):
"""
Called to begin each message.
f -> string message sender
...
...
@@ -173,25 +176,25 @@ class Milter(Base):
self
.
log
(
"
mail from
"
,
f
,
str
)
return
CONTINUE
@noreply
def
envrcpt
(
self
,
to
,
*
str
):
"
Called for each message recipient.
"
self
.
log
(
"
rcpt to
"
,
to
,
str
)
return
CONTINUE
@noreply
def
header
(
self
,
field
,
value
):
"
Called for each message header.
"
self
.
log
(
"
%s: %s
"
%
(
field
,
value
))
return
CONTINUE
@noreply
def
eoh
(
self
):
"
Called after all headers are processed.
"
self
.
log
(
"
eoh
"
)
return
CONTINUE
def
body
(
self
,
unused
):
"
Called to transfer the message body.
"
return
CONTINUE
@noreply
def
eom
(
self
):
"
Called at the end of message.
"
self
.
log
(
"
eom
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment