dovecot-2.2: imap: Made client_destroy() a virtual method.
dovecot at dovecot.org
dovecot at dovecot.org
Mon Feb 27 10:32:14 EET 2012
details: http://hg.dovecot.org/dovecot-2.2/rev/e20af99c6d20
changeset: 14219:e20af99c6d20
user: Timo Sirainen <tss at iki.fi>
date: Mon Feb 27 10:30:57 2012 +0200
description:
imap: Made client_destroy() a virtual method.
diffstat:
src/imap/imap-client.c | 12 ++++++++++++
src/imap/imap-client.h | 25 ++++++++++++++++---------
2 files changed, 28 insertions(+), 9 deletions(-)
diffs (92 lines):
diff -r 5e4e6c57c142 -r e20af99c6d20 src/imap/imap-client.c
--- a/src/imap/imap-client.c Sun Feb 26 04:59:36 2012 +0200
+++ b/src/imap/imap-client.c Mon Feb 27 10:30:57 2012 +0200
@@ -20,6 +20,8 @@
#include <unistd.h>
extern struct mail_storage_callbacks mail_storage_callbacks;
+extern struct imap_client_vfuncs imap_client_vfuncs;
+
struct imap_module_register imap_module_register = { 0 };
struct client *imap_clients = NULL;
@@ -47,6 +49,7 @@
pool = pool_alloconly_create("imap client", 2048);
client = p_new(pool, struct client, 1);
client->pool = pool;
+ client->v = imap_client_vfuncs;
client->set = set;
client->service_user = service_user;
client->fd_in = fd_in;
@@ -165,6 +168,11 @@
void client_destroy(struct client *client, const char *reason)
{
+ client->v.destroy(client, reason);
+}
+
+static void client_default_destroy(struct client *client, const char *reason)
+{
struct client_command_context *cmd;
i_assert(!client->destroyed);
@@ -997,3 +1005,7 @@
client_destroy(imap_clients, "Server shutting down.");
}
}
+
+struct imap_client_vfuncs imap_client_vfuncs = {
+ client_default_destroy
+};
diff -r 5e4e6c57c142 -r e20af99c6d20 src/imap/imap-client.h
--- a/src/imap/imap-client.h Sun Feb 26 04:59:36 2012 +0200
+++ b/src/imap/imap-client.h Mon Feb 27 10:30:57 2012 +0200
@@ -44,15 +44,6 @@
CLIENT_COMMAND_STATE_DONE
};
-struct imap_module_register {
- unsigned int id;
-};
-
-union imap_module_context {
- struct imap_module_register *reg;
-};
-extern struct imap_module_register imap_module_register;
-
struct client_command_context {
struct client_command_context *prev, *next;
struct client *client;
@@ -96,9 +87,15 @@
struct message_size pos;
};
+struct imap_client_vfuncs {
+ void (*destroy)(struct client *client, const char *reason);
+};
+
struct client {
struct client *prev, *next;
+ struct imap_client_vfuncs v;
+
int fd_in, fd_out;
struct io *io;
struct istream *input;
@@ -165,6 +162,16 @@
unsigned int modseqs_sent_since_sync:1;
};
+struct imap_module_register {
+ unsigned int id;
+};
+
+union imap_module_context {
+ struct imap_client_vfuncs super;
+ struct imap_module_register *reg;
+};
+extern struct imap_module_register imap_module_register;
+
extern struct client *imap_clients;
extern unsigned int imap_client_count;
More information about the dovecot-cvs
mailing list