home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / os2 / thread / pmnews.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-12  |  7.4 KB  |  250 lines

  1. /*
  2.     PMNEWS 1.0
  3.  
  4.     Private decls the PMNEWS news reader
  5.  
  6.     This program is free software; you can redistribute it and/or modify
  7.     it under the terms of the GNU General Public License, version 1, as
  8.     published by the Free Software Foundation.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     See the file COPYING, which contains a copy of the GNU General
  16.     Public License.
  17.  
  18.  */
  19.  
  20. #include <stdlib.h>
  21. #include <process.h>
  22. #include <io.h>
  23.  
  24.  
  25. /* #define INCLUDE_SIG */   /* enable this to have the reply function put */
  26.                             /* your sig on the reply - mail ususally does */
  27.                             /* this                                       */
  28.  
  29.  
  30.  
  31. #define EX_DONE             1
  32. #define EX_QUIT             2
  33. #define EX_SAVE             3
  34. #define EX_NEXT             4
  35. #define EX_NEXT_UNREAD      5
  36. #define EX_ROT13            6
  37. #define EX_DUMMY            7
  38.  
  39. #define TEXT_LINE           5
  40.  
  41.  
  42. #define PAGE_HEADER         4
  43. #define PAGE_LENGTH         19
  44.  
  45. /* default article window size */
  46. #define ARTWIDTH            620
  47. #define ARTHEIGHT           450
  48. /* default articlel winidow location */
  49. #define ARTX                20
  50. #define ARTY                20
  51.  
  52. /* if you change these see show_help */
  53. #define HELP_GROUP          0
  54. #define HELP_THREAD         1
  55. #define HELP_ARTICLES       2
  56.  
  57. #pragma linkage (main,optlink)
  58. #define MSGBOXID    1001
  59.  
  60. #define ID_WINDOW   256
  61. #define IDM_MAINT   258
  62. #define IDM_EXPIRE  259
  63. #define ID_ART      260
  64.  
  65. #define IDD_GLIST   300
  66. #define IDD_GRLIST  301
  67. #define ID_MENUBAR    302
  68. #define IDM_ADDGROUP  303
  69. #define IDM_DELGROUP  304
  70. #define IDM_ELAPSED   305
  71. #define IDM_EXPGROUP  306
  72. #define IDD_HLIST   308
  73. #define IDD_HRLIST  309
  74. #define IDD_GNAME   310
  75. #define IDD_FRAME   311
  76. #define IDM_MAIL    312
  77. #define IDM_POST    313
  78. #define IDM_FOLLOWUP 314
  79. #define IDM_NEWPOST  315
  80. #define IDM_REPLY    316
  81. #define IDM_MAILART  317
  82.  
  83. #define IDM_NEXTART  318
  84. #define IDM_RETHDRS  319
  85. #define IDM_NEXTUNR  320
  86. #define IDD_HMARK    321
  87. #define IDD_GMARK    322
  88. #define IDM_PRINT    323
  89. #define IDD_SUBBOX   324
  90.  
  91. #define IDE_GROUP    325
  92. #define IDE_SUBJ     326
  93. #define IDE_GSOK     327
  94. #define IDE_GSCAN    328
  95. #define IDE_GSOK2    329
  96. #define IDE_GSCAN2   330
  97. #define IDE_MAILADR  331
  98. #define IDD_MAILIST  332
  99. #define IDD_MAILBOX  333
  100. #define IDM_SAVED    334
  101. #define IDD_SEARCH   335
  102. #define IDD_SRCHBOX  336
  103.  
  104. #define IDE_SBOK     337
  105. #define IDE_SBCAN    338
  106. #define IDE_SRCHSTR  339
  107. #define IDM_PREVART  340
  108.  
  109.  
  110. #define PMNEWS_CLASS "PMNews"
  111.  
  112.  
  113. /* WM_SEM2 messages - to HlistProc */
  114. #define GET_FOCUS    0x00000004
  115. #define STOP_READING 0x00000003
  116. #define NEXT_ARTICLE 0x00000002
  117. #define NEXT_UNREAD  0x00000001
  118.  
  119.  
  120. /* WM_USER messages - to ArticleProc from util task */
  121. #define MAIL_VERIFY   0x00000004
  122. #define MAIL_FILERR   0x00000005
  123. #define REPART_QUOTE  0x00000006
  124. #define WE_CANCELLED  0x00000007
  125. #define POST_ARTICLE  0x00000008
  126. #define POST_VERIFY   0x00000009
  127. #define MAIL_ARTICLE  0x0000000A
  128. #define START_SEARCH  0x0000000B
  129. #define DISP_LIST     0x0000000C
  130. #define PREV_ARTICLE  0x0000000D
  131. #define ART_FOCUS     0x0000000E
  132.  
  133.  
  134. /*
  135.  *  This structure allows the creation of linked list of article numbers
  136.  */
  137. typedef struct art_id {
  138.     long   id;                  /* article number                 */
  139.     long   art_off;             /* offset of the article          */
  140.     struct art_id *next_art;    /* pointer to next article number */
  141.     struct art_id *last_art;    /* pointer to prev article number */
  142. } ART_ID;
  143.  
  144. /*
  145.  *  This structure is a doubly linked list of the unique article headers.  The
  146.  *  linked list of article numbers is built on 'art_num'.  This system
  147.  *  is allows flexible use of memory, but will get slower by n'ish
  148.  *  and there is a fair degree of allocation overhead in the ART_ID structure
  149.  *  But hey, it's simple
  150.  */
  151. typedef struct article {
  152.     char   *header;              /* article header              */
  153.     int    num_articles;        /* number with this header     */
  154.     ART_ID *art_num;            /* pointer to list of articles */
  155.     struct article *next;       /* next topic                  */
  156.     struct article *last;       /* last topic                  */
  157.     int    index;               /* topic number from start     */
  158.     struct article *left;       /* for threading               */
  159.     struct article *right;      /*     search                  */
  160. } ARTICLE;
  161.  
  162.  
  163.  
  164.  
  165.  
  166. /*
  167.  *  This structure is a linked list of lines that make up an article. The
  168.  *  file is read in and the linked list is built
  169.  */
  170. typedef struct line {
  171.     char   data[80];            /* line of text                */
  172.     struct line *next;          /* next line                   */
  173.     struct line *last;          /* last line                   */
  174.     int    index;               /* line number from start      */
  175. } aLINE;
  176.  
  177.  
  178. /*
  179.  *  This structure is the handle for an article in ram.  The file
  180.  *  is read in and the linked list built.
  181.  */
  182. #define WHO_LENGTH 35
  183. typedef struct {
  184.     char  *author;                      /* From address                  */
  185.     char  *rname;                       /* real name of author           */
  186.     char  organisation[WHO_LENGTH];     /* truncated organisation        */
  187.     char  follow_up[80];      /* group for follow-up article             */
  188.     int   lines;              /* total lines in file                     */
  189.     aLINE  *top;               /* points to start of article, incl header */
  190.     aLINE  *start;             /* points to start of text                 */
  191. } TEXT;
  192.  
  193.  
  194.  
  195.  
  196.  
  197. ARTICLE *get_headers(ACTIVE *gp);
  198. void eat_gunk(char *buf);
  199. void free_header(ARTICLE *start);
  200.  
  201.  
  202. int count_unread_in_thread(ACTIVE *gp, ARTICLE *a);
  203. int count_unread_in_group(ACTIVE *gp);
  204. void mark_read_in_thread(ACTIVE *gp, ARTICLE * ap );
  205. void mark_group_as_read(ACTIVE *gp);
  206.  
  207. USHORT message(PSZ text, PSZ label, ULONG mstyle );
  208.  
  209. TEXT *load_article(char *fnx, long offset);
  210. void free_article(TEXT *t);
  211.  
  212. void save_to_disk(TEXT *tx);
  213. void reply_to_article(TEXT *tx);
  214. void get_his_stuff(TEXT *tx, char *author, char *msg_id);
  215.  
  216.  
  217. void post(TEXT *tx, char *newsgroups, char *subject);
  218. void post_it(FILE *article, char *newsgroups, char *subject, char *dist,
  219.                   char *msg_id);
  220.  
  221. void rot13(TEXT *tx);
  222.  
  223. void expand_tabs(char *buf, int max_len);
  224.  
  225. int newsgroups_valid(char *ng);
  226.  
  227. void mail_to_someone(TEXT *tx, char * who);
  228. void post_art( USHORT doquote );
  229. ARTICLE *search_group( ACTIVE *gp, char *archarg );
  230.  
  231. /* common data area */
  232. HWND hwndClient=0L;                     /* Client area window handle    */
  233. HWND hwndArt=0L;                        /* Article window handle          */
  234.  
  235. HEV  work_to_do,  /* schedule utility task */
  236.      eojsem;      /* terminate util task */
  237. USHORT  queryans;   /* last message box query result */
  238.  
  239. ARTICLE * artp;               /* selected thread */
  240. TEXT    * tx;                   /* current article text info */
  241. /* MBID_YES or no -- quote current article in post */
  242. USHORT quotans;
  243.  
  244.  
  245. #define RECIPL  80
  246. char   recipient[RECIPL+1];   /* mail recipient */
  247. char   ngroup[128];   /* post group */
  248. char   nsubj[128];   /* post subject */
  249.  
  250.