コード例 #1
0
ファイル: example.c プロジェクト: chrullrich/libsieve
int my_notify(sieve2_context_t *s, void *my)
{
	struct my_context *m = (struct my_context *)my;
	char ** options;
	int i;

	printf( "Action is NOTIFY: \n" );
	printf( "  ID \"%s\" is %s\n",
		sieve2_getvalue_string(s, "id"),
		sieve2_getvalue_string(s, "active"));
	printf( "    Method is %s\n",
		sieve2_getvalue_string(s, "method"));
	printf( "    Priority is %s\n",
		sieve2_getvalue_string(s, "priority"));
	printf( "    Message is %s\n",
		sieve2_getvalue_string(s, "message"));

	options = sieve2_getvalue_stringlist(s, "options");
	if (!options)
		return SIEVE2_ERROR_BADARGS;
	for (i = 0; options[i] != NULL; i++) {
		printf( "    Options are %s\n", options[i] );
	}

	m->actiontaken = 1;
	return SIEVE2_OK;
}
コード例 #2
0
ファイル: sortsieve.c プロジェクト: alniaky/dbmail
/*
From http://www.ietf.org/internet-drafts/draft-ietf-sieve-notify-07.txt

   Usage:  notify [":from" string] [":importance" <"1" / "2" / "3">]
                  [":options" string-list] [":message" string] <method: string>
*/
int sort_notify(sieve2_context_t *s, void *my)
{
	struct sort_context *m = (struct sort_context *)my;
	const char *message, *fromaddr, *method;
	const char *rc_to, *rc_from;
	int importance;
	char * const * options;

	fromaddr = sieve2_getvalue_string(s, "fromaddr");
	method = sieve2_getvalue_string(s, "method");
	message = sieve2_getvalue_string(s, "message");
	importance = sieve2_getvalue_int(s, "importance");
	options = sieve2_getvalue_stringlist(s, "options");

	// FIXME: should be validated as a user might try
	// to forge an address from their script.
	rc_from = fromaddr;
	if (!rc_from)
		rc_from = dbmail_message_get_header(m->message, "Delivered-To");
	if (!rc_from)
		rc_from = m->message->envelope_recipient->str;

	rc_to = dbmail_message_get_header(m->message, "Reply-To");
	if (!rc_to)
		rc_to = dbmail_message_get_header(m->message, "Return-Path");

//	send_notification(m->message, rc_to, rc_from, method, message);

	TRACE(TRACE_INFO, "Notification from [%s] to [%s] was not sent as notify is not supported in this release.", rc_from, rc_to);

	return SIEVE2_OK;
}
コード例 #3
0
ファイル: example.c プロジェクト: chrullrich/libsieve
int my_fileinto(sieve2_context_t *s, void *my)
{
	struct my_context *m = (struct my_context *)my;
	char ** flags;
	int i;

	printf( "Action is KEEP or FILEINTO: \n" );
	printf( "  Destination is %s\n",
		sieve2_getvalue_string(s, "mailbox"));
	flags = sieve2_getvalue_stringlist(s, "flags");
	if (flags) {
		printf( "  Flags are:");
		for (i = 0; flags[i]; i++)
			printf( " %s", flags[i]);
		printf( ".\n");
	} else {
			printf( "  No flags specified.\n");
	}

	m->actiontaken = 1;
	return SIEVE2_OK;
}