/**************************************************************************** * * Copyright (c) 2001 Novell, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public License * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, contact Novell, Inc. * * To contact Novell about this file by physical or electronic mail, you * may find current contact information at www.novell.com. * ****************************************************************************/ #ifndef BONGO_SIEVE_H #define BONGO_SIEVE_H #include #ifdef __cplusplus extern "C" { #endif /* Validate one complete UTF-8 RFC 5228 script without executing it. */ int BongoSieveValidate(const char *script, size_t length); typedef enum { BONGO_SIEVE_KEEP, BONGO_SIEVE_DISCARD, BONGO_SIEVE_FILEINTO, BONGO_SIEVE_REDIRECT, BONGO_SIEVE_REJECT, BONGO_SIEVE_VACATION } BongoSieveAction; typedef struct { BongoSieveAction action; const char *argument; const char *subject; const char *from; const char *handle; const char *addresses[32]; size_t address_count; unsigned long days; unsigned long seconds; int has_seconds; int mime; } BongoSieveResult; typedef int (*BongoSieveActionCallback)(const BongoSieveResult *result, void *data); /* Evaluate a script without allowing Mailutils to deliver or send anything. * Each resulting action is reported to Bongo through callback. */ int BongoSieveEvaluate(const char *script, size_t script_length, const char *message, size_t message_length, BongoSieveActionCallback callback, void *data); typedef struct BongoSieveStore BongoSieveStore; int BongoSieveStoreOpen(BongoSieveStore **store, const char *path); void BongoSieveStoreClose(BongoSieveStore **store); int BongoSieveStorePut(BongoSieveStore *store, const char *user, const char *name, const char *script, size_t length); int BongoSieveStoreGet(BongoSieveStore *store, const char *user, const char *name, char **script, size_t *length, int *active); int BongoSieveStoreSetActive(BongoSieveStore *store, const char *user, const char *name); int BongoSieveStoreDelete(BongoSieveStore *store, const char *user, const char *name); int BongoSieveStoreRename(BongoSieveStore *store, const char *user, const char *old_name, const char *new_name); int BongoSieveVacationClaim(BongoSieveStore *store, const char *user, const char *sender, const char *handle, unsigned long interval_seconds); void BongoSieveVacationRelease(BongoSieveStore *store, const char *user, const char *sender, const char *handle); typedef int (*BongoSieveListCallback)(const char *name, int active, void *data); int BongoSieveStoreList(BongoSieveStore *store, const char *user, BongoSieveListCallback callback, void *data); typedef enum { BONGO_MANAGESIEVE_INVALID = 0, BONGO_MANAGESIEVE_AUTHENTICATE, BONGO_MANAGESIEVE_CAPABILITY, BONGO_MANAGESIEVE_CHECKSCRIPT, BONGO_MANAGESIEVE_DELETESCRIPT, BONGO_MANAGESIEVE_GETSCRIPT, BONGO_MANAGESIEVE_HAVESPACE, BONGO_MANAGESIEVE_LISTSCRIPTS, BONGO_MANAGESIEVE_LOGOUT, BONGO_MANAGESIEVE_NOOP, BONGO_MANAGESIEVE_PUTSCRIPT, BONGO_MANAGESIEVE_RENAMESCRIPT, BONGO_MANAGESIEVE_SETACTIVE, BONGO_MANAGESIEVE_STARTTLS } BongoManageSieveCommand; typedef struct { BongoManageSieveCommand command; char arguments[3][1025]; size_t argument_count; size_t literal_length; int literal_nonsynchronizing; } BongoManageSieveRequest; int BongoManageSieveParse(const char *line, size_t length, BongoManageSieveRequest *request); #ifdef __cplusplus } #endif #endif