Back to index

courier  0.68.2
Classes | Typedefs | Functions
rfc3676parser.h File Reference
#include "../rfc2045/rfc2045_config.h"
#include "../unicode/unicode.h"
#include <stdlib.h>
#include <string.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  rfc3676_parser_info

Typedefs

typedef struct
rfc3676_parser_struct
rfc3676_parser_t

Functions

rfc3676_parser_t rfc3676parser_init (const struct rfc3676_parser_info *info)
int rfc3676parser (rfc3676_parser_t handle, const char *txt, size_t txt_cnt)
int rfc3676parser_deinit (rfc3676_parser_t handle, int *errptr)

Typedef Documentation

Definition at line 24 of file rfc3676parser.h.


Function Documentation

int rfc3676parser ( rfc3676_parser_t  handle,
const char *  txt,
size_t  txt_cnt 
)

Definition at line 208 of file rfc3676parser.c.

{
       if (handle->errflag)
              return handle->errflag; /* Error occured previously */

       /* Convert to unicode and invoke parse_unicode() */

       return libmail_u_convert(handle->uhandle, txt, txt_cnt);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int rfc3676parser_deinit ( rfc3676_parser_t  handle,
int *  errptr 
)

Definition at line 267 of file rfc3676parser.c.

{
       /* Finish unicode conversion */

       int rc=libmail_u_convert_deinit(handle->uhandle, errptr);

       if (rc == 0)
              rc=handle->errflag;

       if (rc == 0)
       {
              (*handle->line_handler)(handle, NULL, 0);
              rc=handle->errflag;
       }

       if (handle->lb)
       {
              int rc2=unicode_lbc_end(handle->lb);

              if (rc2 && rc == 0)
                     rc=rc2;
       }

       unicode_buf_deinit(&handle->nonflowed_line);
       unicode_buf_deinit(&handle->nonflowed_next_word);

       free(handle);
       return rc;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 165 of file rfc3676parser.c.

{
       rfc3676_parser_t handle=
              (rfc3676_parser_t)calloc(1,
                                    sizeof(struct rfc3676_parser_struct));

       if (!handle)
              return NULL;

       handle->info=*info;
       if ((handle->uhandle=libmail_u_convert_init(info->charset,
                                              libmail_u_ucs4_native,
                                              parse_unicode,
                                              handle)) == NULL)
       {
              free(handle);
              return NULL;
       }

       if (!handle->info.isflowed)
              handle->info.isdelsp=0; /* Sanity check */

       handle->line_handler=scan_crlf;
       handle->content_handler=start_of_line;
       handle->has_previous_quote_level=0;
       handle->previous_quote_level=0;

       handle->line_begin_handler=emit_line_begin;
       handle->line_content_handler=emit_line_contents;
       handle->line_end_handler=emit_line_end;

       unicode_buf_init(&handle->nonflowed_line, (size_t)-1);
       unicode_buf_init(&handle->nonflowed_next_word, (size_t)-1);

       if (!handle->info.isflowed)
       {
              handle->line_begin_handler=nonflowed_line_begin;
              handle->line_content_handler=nonflowed_line_contents;
              handle->line_end_handler=nonflowed_line_end;
       }
       return handle;
}

Here is the call graph for this function:

Here is the caller graph for this function: