home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / com / utils / smplnews / snews.h < prev    next >
C/C++ Source or Header  |  1992-08-02  |  6KB  |  172 lines

  1. /*
  2.     SNEWS 2.0
  3.  
  4.     Private decls the SNEWS news reader
  5.  
  6.  
  7.     Copyright (C) 1991  John McCombs, Christchurch, NEW ZEALAND
  8.                         john@ahuriri.gen.nz
  9.                         PO Box 2708, Christchurch, NEW ZEALAND
  10.  
  11.     This program is free software; you can redistribute it and/or modify
  12.     it under the terms of the GNU General Public License, version 1, as
  13.     published by the Free Software Foundation.
  14.  
  15.     This program is distributed in the hope that it will be useful,
  16.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.     GNU General Public License for more details.
  19.  
  20.     See the file COPYING, which contains a copy of the GNU General
  21.     Public License.
  22.  
  23.  */
  24.  
  25.  
  26. #define INCLUDE_SIG        /* enable this to have the reply function put */
  27.                             /* your sig on the reply - mail ususally does */
  28.                             /* this                                       */
  29.  
  30. #define MAXLINE             1024
  31. #define MAXART              256
  32.  
  33. #define ENTER               0x0D
  34. #define ESCAPE              0x1B
  35. #define TAB                 0x09
  36. #define BACKSP              0x08
  37.  
  38. #define EX_DONE             1
  39. #define EX_QUIT             2
  40. #define EX_SAVE             3
  41. #define EX_NEXT             4
  42. #define EX_NEXT_UNREAD      5
  43. #define EX_ROT13            6
  44. #define EX_DUMMY            7
  45. #define EX_PREVIOUS         8
  46. #define EX_SEARCH_FORW      9
  47. #define EX_SEARCH_BACKW     10
  48.  
  49.  
  50. /* screen size */
  51. #define TEXT_LINE           4
  52. #define PAGE_HEADER         3
  53.  
  54. #define PAGE_LENGTH         (_lines - 4)
  55. #define PAGE_SIZE           _lines
  56.  
  57.  
  58. /* if you change these see show_help */
  59. #define HELP_GROUP          0
  60. #define HELP_THREAD         1
  61. #define HELP_ARTICLES       2
  62.  
  63. #define  UP_ARR             'H'
  64. #define  DN_ARR             'P'
  65. #define  L_ARR              'K'
  66. #define  R_ARR              'M'
  67. #define  C_L_ARR            's'
  68. #define  C_R_ARR            't'
  69. #define  PGUP               'I'
  70. #define  PGDN               'Q'
  71. #define  HOME               'G'
  72. #define  END                'O'
  73. #define  F1                 ';'
  74.  
  75.  
  76.  
  77. /*
  78.  *  This structure allows the creation of linked list of article numbers
  79.  */
  80. typedef struct art_id {
  81.     long   id;                  /* article number                 */
  82.     long   art_off;             /* offset of the article          */
  83.     struct art_id *next_art;    /* pointer to next article number */
  84.     struct art_id *last_art;    /* pointer to previous article number */
  85. } ART_ID;
  86.  
  87.  
  88. /*
  89.  *  This structure is a doubly linked list of the unique article headers.  The
  90.  *  linked list of article numbers is built on 'art_num'.  This system
  91.  *  is allows flexible use of memory, but will get slower by n'ish
  92.  *  and there is a fair degree of allocation overhead in the ART_ID structure
  93.  *  But hey, it's simple
  94.  */
  95. typedef struct article {
  96.     char   *header;             /* article header              */
  97.     int    num_articles;        /* number with this header     */
  98.     ART_ID *art_num;            /* pointer to list of articles */
  99.     struct article *next;       /* next topic                  */
  100.     struct article *last;       /* last topic                  */
  101.     int    index;               /* topic number from start     */
  102.     struct article *left;       /* for tree structure          */
  103.     struct article *right;
  104. } ARTICLE;
  105.  
  106.  
  107. /*
  108.  *  This structure is the handle for an article in ram.  The file
  109.  *  is read in and the linked list built.
  110.  */
  111. typedef struct {
  112.     char  *subject;           /* header              */
  113.     char  *author;            /* author              */
  114.     char  *organisation;      /* organisation        */
  115.     char  *follow_up;         /* group for follow-up article             */
  116.     int   lines;              /* total lines in article                  */
  117.     int   startline;          /* first text line in article              */
  118.     LINE  *top;               /* points to start of article, incl header */
  119.     LINE  *start;             /* points to start of text                 */
  120. } TEXT;
  121.  
  122.  
  123. ACTIVE *select_group(ACTIVE *head, ACTIVE *current);
  124. void show_help(int h);
  125. int read_group(ACTIVE *gp);
  126. void show_groups(ACTIVE **top, ACTIVE *this, int force, ACTIVE *head);
  127. ARTICLE *get_headers(ACTIVE *gp);
  128. void eat_gunk(char *buf);
  129. void free_header(ARTICLE *start);
  130.  
  131.  
  132. void show_threads(ACTIVE *gp, ARTICLE **top, ARTICLE *this, int force, ARTICLE *head);
  133. void select_thread(ACTIVE *gp, ARTICLE *head);
  134. int read_thread(ACTIVE *gp, ARTICLE *this, ART_ID *first, int a_ct);
  135.  
  136. int count_unread_in_thread(ACTIVE *gp, ARTICLE *a);
  137. int count_unread_in_group(ACTIVE *gp);
  138. void mark_group_as_read(ACTIVE *gp);
  139. void mark_thread_as_read(ACTIVE *gp, ARTICLE *a);
  140.  
  141. void command(char *msg);
  142. void message(char *msg);
  143. void lmessage(char *msg);
  144.  
  145. TEXT *load_article(char *fnx, long offset);
  146. void free_article(TEXT *t);
  147.  
  148.  
  149. int read_article(ACTIVE *gp, TEXT *tx, int a_ct, int of_ct);
  150. void show_article(ACTIVE *gp, TEXT *tx, LINE *this, int a_ct,
  151.                   int of_ct, int margin);
  152.  
  153.  
  154. void save_to_disk(TEXT *tx);
  155. void reply_to_article(TEXT *tx);
  156. void get_his_stuff(TEXT *tx, char *author, char *msg_id);
  157.  
  158.  
  159. void post(TEXT *tx, char *newsgroups);
  160. void post_it(FILE *article, char *newsgroups, char *subject, char *dist,
  161.                   char *msg_id);
  162.  
  163. void rot13(TEXT *tx);
  164.  
  165. void expand_tabs(char *buf, int max_len);
  166.  
  167. int newsgroups_valid(char *ng);
  168.  
  169. void mail_to_someone(TEXT *tx);
  170.  
  171. void save_thread_to_disk(ACTIVE *gp, ARTICLE *this);
  172.