milter.milterContext Class Reference

Hold context for a milter connection. More...

Inheritance diagram for milter.milterContext:

## Public Member Functions

def | getsymval (self, sym)
| Calls smfi_getsymval. More...
def | setreply (self, rcode, xcode, msg)
| Calls smfi_setreply or smfi_setmlreply. More...
def | addheader
| Calls smfi_addheader. More...
def | chgheader (self, name, idx, value)
| Calls smfi_chgheader. More...
def | addrcpt
| Calls smfi_addrcpt. More...
def | delrcpt (self, rcpt)
| Calls smfi_delrcpt. More...
def | replacebody (self, data)
| Calls smfi_replacebody. More...
def | setpriv (self, priv)
| Attach a Python object to this connection context. More...
def | getpriv (self)
| Return the Python object attached to this connection context. More...
def | quarantine (self, reason)
| Calls smfi_quarantine. More...
def | progress (self)
| Calls smfi_progress. More...
def | chgfrom
| Calls smfi_chgfrom. More...
def | setsymlist (self, stage, macrolist)
| Tell the MTA which macro values we are interested in for a given stage. More...

## Detailed Description

Hold context for a milter connection.

Each connection to sendmail creates a new `SMFICTX` struct within libmilter. The milter module in turn creates a milterContext tied to the `SMFICTX` struct via `smfi_setpriv` to hold a PyThreadState and a user defined Python object for the connection.

Most application interaction with libmilter takes places via the milterContext object for the connection. It is passed to callback functions as the first parameter.

The `Milter` module creates a python class for each connection, and converts function callbacks to instance method invocations.

## Member Function Documentation

def milter.milterContext.addheader | ( |  | self,
|  |  | name,
|  |  | value,
|  |  | idx = `-1`
| ) |  |

Calls smfi_addheader.

def milter.milterContext.addrcpt | ( |  | self,
|  |  | rcpt,
|  |  | params = `None`
| ) |  |

Calls smfi_addrcpt.

def milter.milterContext.chgfrom | ( |  | self,
|  |  | sender,
|  |  | param = `None`
| ) |  |

Calls smfi_chgfrom.

def milter.milterContext.chgheader | ( |  | self,
|  |  | name,
|  |  | idx,
|  |  | value
| ) |  |

Calls smfi_chgheader.

def milter.milterContext.delrcpt | ( |  | self,
|  |  | rcpt
| ) |  |

Calls smfi_delrcpt.

def milter.milterContext.getpriv | ( |  | self | ) |

Return the Python object attached to this connection context.

def milter.milterContext.getsymval | ( |  | self,
|  |  | sym
| ) |  |

Calls smfi_getsymval.

def milter.milterContext.progress | ( |  | self | ) |

Calls smfi_progress.

def milter.milterContext.quarantine | ( |  | self,
|  |  | reason
| ) |  |

Calls smfi_quarantine.

def milter.milterContext.replacebody | ( |  | self,
|  |  | data
| ) |  |

Calls smfi_replacebody.

def milter.milterContext.setpriv | ( |  | self,
|  |  | priv
| ) |  |

Attach a Python object to this connection context.

Returns
  the old value or None

def milter.milterContext.setreply | ( |  | self,
|  |  | rcode,
|  |  | xcode,
|  |  | msg
| ) |  |

Calls smfi_setreply or smfi_setmlreply.

Parameters

  rcode | SMTP response code
  xcode | extended SMTP response code
  msg | one or more message lines. If the MTA does not support multiline messages, only the first is used.

def milter.milterContext.setsymlist | ( |  | self,
|  |  | stage,
|  |  | macrolist
| ) |  |

Tell the MTA which macro values we are interested in for a given stage.

Of interest only when you need to squeeze a few more bytes of bandwidth. It may only be called from the negotiate callback. The protocol stages are M_CONNECT, M_HELO, M_ENVFROM, M_ENVRCPT, M_DATA, M_EOM, M_EOH. Calls smfi_setsymlist.

Parameters

  stage | protocol stage in which the macro list should be used
  macrolist | a space separated list of macro names

The documentation for this class was generated from the following file:

- doc/milter.py