]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
submission: Implement basic client vfuncs.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Sun, 13 May 2018 09:15:59 +0000 (11:15 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 12 Feb 2019 13:40:54 +0000 (15:40 +0200)
Currently, only client_destroy can be overriden.

src/submission/submission-client.c
src/submission/submission-client.h

index 62258123dbf193b29d56e1e60101636da7f0e069..e01a86134558ec4a4c6708d45b772adb8d30b4b7 100644 (file)
 /* Disconnect client after idling this many milliseconds */
 #define CLIENT_IDLE_TIMEOUT_MSECS (10*60*1000)
 
+static const struct smtp_server_callbacks smtp_callbacks;
+static const struct submission_client_vfuncs submission_client_vfuncs;
+
 struct client *submission_clients;
 unsigned int submission_client_count;
 
-static const struct smtp_server_callbacks smtp_callbacks;
-
 static void client_input_pre(void *context)
 {
        struct client *client = context;
@@ -195,6 +196,7 @@ struct client *client_create(int fd_in, int fd_out,
        pool = pool_alloconly_create("submission client", 2048);
        client = p_new(pool, struct client, 1);
        client->pool = pool;
+       client->v = submission_client_vfuncs;
        client->user = user;
        client->service_user = service_user;
        client->set = set;
@@ -277,6 +279,13 @@ static void client_state_reset(struct client *client)
 
 void client_destroy(struct client *client, const char *prefix,
                    const char *reason)
+{
+       client->v.destroy(client, prefix, reason);
+}
+
+static void
+client_default_destroy(struct client *client, const char *prefix,
+                      const char *reason)
 {
        if (client->destroyed)
                return;
@@ -508,3 +517,7 @@ static const struct smtp_server_callbacks smtp_callbacks = {
        .conn_disconnect = client_connection_disconnect,
        .conn_destroy = client_connection_destroy,
 };
+
+static const struct submission_client_vfuncs submission_client_vfuncs = {
+       client_default_destroy,
+};
index f6f89c960243f363b3036a9e6f30aee106a14041..98fb9d1242be9d8642d1867552f7426903627d26 100644 (file)
@@ -17,11 +17,17 @@ struct client_state {
        uoff_t data_size;
 };
 
+struct submission_client_vfuncs {
+       void (*destroy)(struct client *client, const char *prefix,
+                       const char *reason);
+};
+
 struct client {
        struct client *prev, *next;
        pool_t pool;
 
-       const char *session_id;
+       struct submission_client_vfuncs v;
+       char *session_id;
 
        const struct setting_parser_info *user_set_info;
        const struct submission_settings *set;