Back to index

courier  0.68.2
filter.h
Go to the documentation of this file.
00001 /*
00002 */
00003 #ifndef       filter_h
00004 #define       filter_h
00005 
00006 /*
00007 ** Copyright 1998 - 2011 Double Precision, Inc.  See COPYING for
00008 ** distribution information.
00009 */
00010 
00011 
00012 /*
00013        The filter set of function is used to format message text for
00014        display. The message text gets converted from unicode to the
00015        display character set, and excessively long lines get truncated to
00016        some reasonable value.
00017 
00018        Special characters: <, >, &, and " get replaced by their HTML
00019        entities.
00020 
00021 
00022        filter(ptr, cnt) - repeated calls to this function are used to
00023        supply text being filtered.
00024 
00025        filter_end() - is called when the end of the text being filtered
00026        is reached.
00027 
00028 */
00029 
00030 #if    HAVE_CONFIG_H
00031 #undef PACKAGE
00032 #undef VERSION
00033 #include      "config.h"
00034 #endif
00035 
00036 #if    HAVE_UNISTD_H
00037 #include      <unistd.h>
00038 #endif
00039 
00040 #include      <stdlib.h>
00041 
00042 #include      "unicode/unicode.h"
00043 
00044 struct filter_info {
00045        libmail_u_convert_handle_t handle;
00046 
00047        int conversion_error;
00048 
00049        unicode_char prevchar;
00050 
00051        size_t u_w;
00052 
00053        void (*handler_func)(const char *, size_t, void *);
00054        void *func_arg;
00055 
00056        size_t linesize;
00057 };
00058 
00059 void   filter_start(struct filter_info *, const char *,
00060                    void (*)(const char *, size_t, void *), void *);
00061 void   filter(struct filter_info *,
00062               const unicode_char *, size_t);
00063 void   filter_passthru(struct filter_info *info,
00064                      const unicode_char *ptr, size_t cnt);
00065 void   filter_end(struct filter_info *info);
00066 
00067 #endif