I tried to use http://www.dovecot.org/patches/copy_plugin.c as simple
example. My code is attached. I see plugin loading in logs:
Nov 20 12:29:33 mail dovecot-auth: pam_tcb(dovecot:auth):
Authentication passed for enp from (uid=0)
Nov 20 12:29:33 mail dovecot: imap-login: Login: user=enp,
method=PLAIN, rip=192.168.46.23, lip=10.0.101.103
Nov 20 12:29:33 mail dovecot: IMAP(enp): copy plugin init
Nov 20 12:29:33 mail dovecot: IMAP(enp):
But I can't see nothing while message is copied :(
I tried to send mail to Fabio M. Catunda catunda at
contactnet.com.br yesterday, but I see no relpy. Fábio, can you show
me you code?
/*
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;
i_info(copy plugin action init\n);
/* message set 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)
{
i_info(copy plugin init\n);
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)
{
i_info(copy plugin deinit\n);
}