/* Example plugin to show how to hook into COPY command. gcc -fPIC -shared -Wall -I../lib -I../.. -I../lib-storage -I../lib-mail -I../lib-imap -DHAVE_CONFIG_H copy_plugin.c -o copy_plugin.so */ #include "common.h" #include "commands.h" static int cmd_copy_plugin(struct client *client) { const char *messageset, *mailbox; /* */ if (!client_read_string_args(client, 2, &messageset, &mailbox)) return FALSE; if (!cmd_copy(client)) return FALSE; i_info("copying done to %s\n", mailbox); return TRUE; } void copy_plugin_init(void) { command_unregister("COPY"); /* i_strdup() here is a kludge to avoid crashing in commands_deinit() since modules are unloaded before it's called, this "COPY" string would otherwise point to nonexisting memory. */ command_register(i_strdup("COPY"), cmd_copy_plugin); } void copy_plugin_deinit(void) { }