struct smtp_server_command *
smtp_server_command_new(struct smtp_server_connection *conn,
- const char *name, const char *params)
+ const char *name)
{
struct smtp_server *server = conn->server;
struct smtp_server_command *cmd;
set_name("smtp_server_command_started");
e_debug(e->event(), "New command");
+ return cmd;
+}
+
+void smtp_server_command_execute(struct smtp_server_command *cmd,
+ const char *params)
+{
+ struct smtp_server_connection *conn = cmd->context.conn;
+
if (cmd->reg == NULL) {
/* RFC 5321, Section 4.2.4: Reply Code 502
if (!smtp_server_command_unref(&tmp_cmd))
cmd = NULL;
}
- return cmd;
}
void smtp_server_command_ref(struct smtp_server_command *cmd)
struct smtp_server_command *cmd;
smtp_server_connection_ref(tmp_conn);
- cmd = smtp_server_command_new(tmp_conn, cmd_name, cmd_params);
+ cmd = smtp_server_command_new(tmp_conn, cmd_name);
+ smtp_server_command_execute(cmd, cmd_params);
if (!smtp_server_connection_unref(&tmp_conn)) {
/* the command start callback managed to get this connection
destroyed */
struct smtp_server_command *
smtp_server_command_new_invalid(struct smtp_server_connection *conn);
struct smtp_server_command *
-smtp_server_command_new(struct smtp_server_connection *conn,
- const char *name, const char *params);
+smtp_server_command_new(struct smtp_server_connection *conn, const char *name);
+
+void smtp_server_command_execute(struct smtp_server_command *cmd,
+ const char *params);
+
void smtp_server_command_ref(struct smtp_server_command *cmd);
bool smtp_server_command_unref(struct smtp_server_command **_cmd);
void smtp_server_command_abort(struct smtp_server_command **_cmd);