/* SPAMKILLER.H - Declares constants and function prototypes for spamkiller 

   Copyright 2008-1011, Martin Gregorie.

   This file is part of the Spamkiller package.

   Spamkiller is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 3 as
   published by the Free Software Foundation.

   Spamkiller 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 Foobar.  If not, see <http://www.gnu.org/licenses/>.
*/
             
#ifndef TRUE
#define TRUE            1
#endif

#ifndef FALSE
#define FALSE           0
#endif

#define FLAGCNT         7

#define HELP            0      /* -? help                */
#define DEBUG           1      /* -d debug mode          */
#define COMMAND         2      /* -c=command             */
#define QUARANTINE      3      /* -q quarantine mode     */
#define RULES           4      /* -r=prefix              */
#define SPAMSTORE       5      /* -s=spamstore directory */
#define VERBOSE         6      /* -v verbose mode        */

#define MAYBEMARK       '%'
#define BADMARK         '!'
#define OK              ' '
#define OPTLIST         "?dc:q%r%s:v"

#define BUFFINC         4096
#define EMPTYSTRING     ""
#define QROOT           "quarantined"
#define SUBJECT         "Subject:"
#define SENDER          "From:"
#define X_SPAM_FLAG     "X-Spam-Flag: YES"
#define X_SPAM_STATUS   "X-Spam-Status"

void  abandon(int error, char *msg1, char *msg2);
char  *append_filename(char *buff, int bufflen, char *caption, char* name);
void  check_command(char *command, int verbose, int debug); 
void  close_quarantine_file(FILE* f);
int   header_matches(char *key, char *line, int debug);
int   is_flag(char *marker, char *line, int debug);
void  log_message(int err, char *msg1, char *msg2);
FILE* open_quarantine_file(char *qdir, char *name, char *testname, int debug);
int   readargs(int argc,
               char *argv[],
               int flags[],
               char **files,
               char **prefix,
               char **qtestname,
               char **sdir);
void  showhelp();
void  show_classification(int spam,
                          int quarantined,
                          char *qname,
                          char *subject,
                          char *sender,
                          char *rules,
                          char *command,
                          int debug,
                          int show_rules);
int   store_rules(char **buffer, char *value, char *prefix, int debug);
void  store_value(char **buffer, char *value, int debug);
void  tidy_up(char *headers, char *subject, char *sender, char *rules);

