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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
|
/* Prototype plugin file.
* Remove any functions that are not needed.
*/
#include "mailfront.h"
/* The init function is called once after the plugin is loaded. */
static const response* init(void)
{
return 0;
}
/* The helo function is called once by the SMTP protocol when either the
* HELO or EHLO command is issued. The parameter is the hostname given
* in the command. */
static const response* helo(str* hostname, str* capabilities)
{
return 0;
}
/* The reset function is called at least once per message before any of
* the envelope or data is processed. */
static const response* reset(void)
{
return 0;
}
/* The sender function is called exactly once per message. The parameter
* is the sender email addres, and may be modified. */
static const response* sender(str* address, str* params)
{
return 0;
}
/* The recipient function is called one or more times per message, once
* for each recipient. The parameter is the recipient email address,
* and may be modified. */
static const response* recipient(str* address, str* params)
{
return 0;
}
/* The data_start function is called when the sender starts transmitting
* data. Depending on the protocol, this may happen before (QMTP) or
* after (SMTP) the envelope is processed. The parameter is the file
* descriptor of the temporary file, or -1 if none was created. */
static const response* data_start(int fd)
{
return 0;
}
/* The data_block function is called once for each block of data
* received by the protocol. If this function returns an error
* response, further data blocks will be received but not processed. */
static const response* data_block(const char* bytes, unsigned long len)
{
}
/* The message_end function is called after both the message envelope
* and data have been completely transmitted. The parameter is the file
* descriptor of the temporary file, or -1 if none was created. */
static const response* message_end(int fd)
{
return 0;
}
/* To define a new command, write the function that will be executed
* when the command is invoked, and add it to a "struct command" array
* as below. The function is passed the entire command argument, and
* must handle sending responses itself. Return positive for success or
* 0 to disconnect. */
static int cmd_X_CMD0(void)
{
return 1;
}
static int cmd_X_CMD1(str* param)
{
return 1;
}
static const struct command commands[] = {
{ "X-CMD0", .fn_noparam = cmd_X_CMD0 },
{ "X-CMD1", .fn_hasparam = cmd_X_CMD1 },
{ 0, 0 }
};
/* Plugins must export this structure.
* Remove any of the entries that are not used (ie 0 or NULL).
*/
struct plugin plugin = {
.version = PLUGIN_VERSION,
.flags = 0,
.commands = commands,
.init = init,
.helo = helo,
.reset = reset,
.sender = sender,
.recipient = recipient,
.data_start = data_start,
.data_block = data_block,
.message_end = message_end,
};
|