1 /* 2 * (c) Copyright 1990, Kim Fabricius Storm. All rights reserved. 3 * Copyright (c) 1996-2003 Michael T Pins. All rights reserved. 4 * 5 * Interface for decoding article headers. 6 */ 7 8 #ifndef _NN_NEWS_H 9 #define _NN_NEWS_H 1 10 11 struct news_header { 12 13 int ng_flag; /* flags: */ 14 #define N_DIGEST 1 /* article is part of a digest */ 15 #define N_MODERATED 2 /* group is moderated */ 16 17 off_t ng_fpos; /* position of article text */ 18 off_t ng_lpos; /* last text offset */ 19 /* header lines: */ 20 char *ng_from; /* from */ 21 char *ng_name; /* senders name */ 22 char *ng_subj; /* subject */ 23 char *ng_groups; /* newsgroups */ 24 char *ng_path; /* path */ 25 char *ng_reply; /* reply-to */ 26 char *ng_ident; /* message id */ 27 char *ng_follow; /* followup to */ 28 char *ng_ref; /* references */ 29 char *ng_keyw; /* keywords */ 30 char *ng_dist; /* distibution */ 31 char *ng_org; /* organization */ 32 char *ng_appr; /* approved */ 33 char *ng_summ; /* summary */ 34 char *ng_control; /* control */ 35 char *ng_sender; /* sender */ 36 37 char *ng_xref; /* xref */ 38 char *ng_date; /* date */ 39 40 char *ng_rdate; /* date-received (News 3) */ 41 char *ng_bref; /* back-references (News 3) */ 42 char *ng_origr; /* originator */ 43 44 char *ng_xlines; /* lines (from header) */ 45 int ng_lines; /* lines (decoded) */ 46 char *ng_comment; /* comment-to (rfmail) */ 47 } news; 48 49 50 /* 51 * digest article subheader 52 */ 53 54 struct digest_header { 55 off_t dg_hpos; /* position of article header */ 56 off_t dg_fpos; /* position of article text */ 57 off_t dg_lpos; /* last text position */ 58 /* header lines: */ 59 char *dg_date; /* date */ 60 char *dg_from; /* from */ 61 char *dg_subj; /* subject */ 62 char *dg_to; /* to */ 63 64 int dg_lines; /* lines (pseudo field) */ 65 } digest; 66 67 68 #define NEWS_HEADER_BUFFER 4096 69 70 typedef char news_header_buffer[NEWS_HEADER_BUFFER]; 71 72 char *parse_header(FILE *, char **(*) (), int, news_header_buffer); 73 int is_header_line(char *); 74 FILE *open_news_article(article_header *, int, news_header_buffer, news_header_buffer); 75 76 77 /* modes */ 78 79 #define FILL_NEWS_HEADER 0x0001 /* parse first header -> buffer1 */ 80 #define FILL_DIGEST_HEADER 0x0002 /* parse second header -> buffer[12] */ 81 82 83 #define GET_ALL_FIELDS 0x0010 /* get all fields (otherwise only */ 84 /* name, subj, groups, lines */ 85 86 #define GET_DATE_ONLY 0x0020 /* get Date field */ 87 88 #define FILL_OFFSETS 0x0080 /* fill ng_[hfl]pos */ 89 90 91 #define DIGEST_CHECK 0x0100 /* set N_DIGEST if "digest" in subj */ 92 /* only valid with FILL_NEWS_HEADER */ 93 #define LAZY_BODY 0x0200 /* nntp: get body only for digests */ 94 95 96 #define SKIP_HEADER 0x1000 /* position after (sub) header */ 97 #endif /* _NN_NEWS_H */ 98