Skip to content

Commit

Permalink
Renamed "module" to "plugin" in all relevant files.
Browse files Browse the repository at this point in the history
  • Loading branch information
bruceg committed Jul 26, 2006
1 parent 87c2c65 commit 2b42351
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 51 deletions.
10 changes: 5 additions & 5 deletions mailfront.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ struct session

extern struct session session;

struct module
struct plugin
{
struct module* next;
struct plugin* next;
const response* (*init)(void);
const response* (*reset)(void);
const response* (*sender)(str*);
const response* (*recipient)(str*);
const response* (*data_start)();
const response* (*data_start)(void);
const response* (*data_block)(const char* bytes, unsigned long len);
const response* (*data_end)();
const response* (*data_end)(void);
};

/* From session.c */
Expand All @@ -55,7 +55,7 @@ extern const response* handle_recipient(str* recip);
extern const response* handle_data_start(void);
extern void handle_data_bytes(const char* bytes, unsigned len);
extern const response* handle_data_end(void);
extern void add_module(struct module*);
extern void add_plugin(struct plugin*);

/* From netstring.c */
int get_netstring_len(ibuf* in, unsigned long* i);
Expand Down
2 changes: 1 addition & 1 deletion null-validate.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "mailfront.h"

struct module backend_validate = {
struct plugin backend_validate = {
.init = 0,
};
2 changes: 1 addition & 1 deletion plugin-add-received.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ static const response* data_start(void)
return 0;
}

struct module add_received = {
struct plugin add_received = {
.init = init,
.data_start = data_start,
};
2 changes: 1 addition & 1 deletion plugin-check-fqdn.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ static const response* either(str* s)
return 0;
}

struct module check_fqdn = {
struct plugin check_fqdn = {
.sender = either,
.recipient = either,
};
2 changes: 1 addition & 1 deletion plugin-counters.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ static const response* block(const char* bytes, unsigned long len)
return 0;
}

struct module counters = {
struct plugin counters = {
.init = init,
.reset = reset,
.sender = sender,
Expand Down
2 changes: 1 addition & 1 deletion plugin-cvm-validate.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static const response* validate_recipient(str* recipient)
return r;
}

struct module cvm_validate = {
struct plugin cvm_validate = {
.init = validate_init,
.recipient = validate_recipient,
};
2 changes: 1 addition & 1 deletion plugin-mailrules.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ static const response* validate_recipient(str* recipient)
return 0;
}

struct module mailrules = {
struct plugin mailrules = {
.init = init,
.reset = reset,
.sender = validate_sender,
Expand Down
2 changes: 1 addition & 1 deletion plugin-patterns.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ static const response* check(const char* bytes, unsigned long len)
return 0;
}

struct module patterns = {
struct plugin patterns = {
.data_start = init,
.data_block = check,
};
2 changes: 1 addition & 1 deletion plugin-qmail-validate.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static const response* validate_recipient(str* recipient)
return 0;
}

struct module backend_validate = {
struct plugin backend_validate = {
.init = validate_init,
.sender = validate_sender,
.recipient = validate_recipient,
Expand Down
2 changes: 1 addition & 1 deletion plugin-relayclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static const response* do_recipient(str* recipient)
return 0;
}

struct module relayclient = {
struct plugin relayclient = {
.reset = reset,
.sender = do_sender,
.recipient = do_recipient,
Expand Down
2 changes: 1 addition & 1 deletion plugin-require-auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ static const response* sender(str* s)
(void)s;
}

struct module require_auth = {
struct plugin require_auth = {
.sender = sender,
};
72 changes: 36 additions & 36 deletions std-handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@ const char UNKNOWN[] = "unknown";
const int authenticating = 0;
extern void set_timeout(void);
extern void report_io_bytes(void);
extern struct module require_auth;
extern struct module backend_validate;
extern struct module cvm_validate;
extern struct module relayclient;
extern struct module add_received;
extern struct module check_fqdn;
extern struct module patterns;
extern struct module counters;
extern struct module mailrules;

static struct module* module_list = 0;
static struct module* module_tail = 0;

void add_module(struct module* module)
extern struct plugin require_auth;
extern struct plugin backend_validate;
extern struct plugin cvm_validate;
extern struct plugin relayclient;
extern struct plugin add_received;
extern struct plugin check_fqdn;
extern struct plugin patterns;
extern struct plugin counters;
extern struct plugin mailrules;

static struct plugin* plugin_list = 0;
static struct plugin* plugin_tail = 0;

void add_plugin(struct plugin* plugin)
{
if (module_tail == 0)
module_list = module;
if (plugin_tail == 0)
plugin_list = plugin;
else
module_tail->next = module;
module_tail = module;
plugin_tail->next = plugin;
plugin_tail = plugin;
}

static void getprotoenv(const char* name, const char** dest)
Expand All @@ -47,10 +47,10 @@ static void getprotoenv(const char* name, const char** dest)
}

#define MODULE_CALL(NAME,PARAMS) do{ \
struct module* module; \
for (module = module_list; module != 0; module = module->next) { \
if (module->NAME != 0) { \
if ((resp = module->NAME PARAMS) != 0) { \
struct plugin* plugin; \
for (plugin = plugin_list; plugin != 0; plugin = plugin->next) { \
if (plugin->NAME != 0) { \
if ((resp = plugin->NAME PARAMS) != 0) { \
if (response_ok(resp)) \
break; \
else \
Expand All @@ -75,15 +75,15 @@ const response* handle_init(void)
getprotoenv("LOCALHOST", &session.local_host);
getprotoenv("REMOTEHOST", &session.remote_host);

add_module(&require_auth);
add_module(&check_fqdn);
add_module(&counters);
add_module(&mailrules);
add_module(&relayclient);
add_module(&backend_validate);
add_module(&cvm_validate);
add_module(&add_received);
add_module(&patterns);
add_plugin(&require_auth);
add_plugin(&check_fqdn);
add_plugin(&counters);
add_plugin(&mailrules);
add_plugin(&relayclient);
add_plugin(&backend_validate);
add_plugin(&cvm_validate);
add_plugin(&add_received);
add_plugin(&patterns);

MODULE_CALL(init, ());

Expand Down Expand Up @@ -137,11 +137,11 @@ const response* handle_data_start(void)
void handle_data_bytes(const char* bytes, unsigned len)
{
const response* r;
struct module* module;
struct plugin* plugin;
if (data_response) return;
for (module = module_list; module != 0; module = module->next)
if (module->data_block != 0)
if ((r = module->data_block(bytes, len)) != 0
for (plugin = plugin_list; plugin != 0; plugin = plugin->next)
if (plugin->data_block != 0)
if ((r = plugin->data_block(bytes, len)) != 0
&& !response_ok(r)) {
data_response = r;
return;
Expand All @@ -154,6 +154,6 @@ const response* handle_data_end(void)
const response* resp;
if (data_response)
return data_response;
MODULE_CALL(data_end, (module, session));
MODULE_CALL(data_end, ());
return backend_handle_data_end();
}

0 comments on commit 2b42351

Please sign in to comment.