home *** CD-ROM | disk | FTP | other *** search
- /*
- * MSGED.H - Global header for Msged/Q
- *
- * Msged/Q message editor for QuickBBS Copyright 1990 by P.J. Muller
- *
- * This program was adapted from the source code of Jim Nutt's Msged 1.99
- *
- */
-
- /*
- * I use Turbo C 2.0, but this source might work with MSC with a few
- * modifications
- *
- * Everything should set itself up nicely if you select the
- * Medium or Large models. The Small model is too small.
- *
- */
-
- /* Some model defines */
-
- #ifdef __MSC__
- # ifdef M_I86SM
- # define __SMALL__
- # endif
- # ifdef M_I86MM
- # define __MEDIUM__
- # endif
- # ifdef M_I86LM
- # define __LARGE__
- # endif
- #endif
-
- #ifdef __SMALL__
- # define MINI /* mini msged/q */
- #endif
-
- /* enable some code */
-
- #define SETTINGS /* settings screen */
- #define TOFMPT /* insert ^aTOPT and ^aFMPT */
- #define BMGSEARCH /* search algorithm */
- #define ASSERT /* assert debugging */
- /*#define EXTERNEDIT*/ /* external editor */
- #define TEXTDATE /* "Yesterday" etc. */
- /*#define INTERNETHACK*/ /* show netmail addresses in internet format */
- #define DBRIDGE /* D'Bridge config courtesy of Frederik Chabot */
-
- /* don't enable some code */
-
- #ifdef ZAPTHISOUT
- #define SHOWMEM /* debugging */
- #define TEARLINE /* 'tearline' config */
- #define GATE /* 'gate' config */
- #define SEENBY /* 'seen-bys' config */
- #define NOIBM /* don't use IBM high-ASCII characters */
- #endif
-
- /* disable some code */
-
- #ifdef MINI
- # undef SETTINGS /* MINI version doesn't have settings */
- # undef BMGSEARCH /* use strstr search instead (smaller) */
- # undef ASSERT /* no asserts */
- #endif
-
- #ifndef ASSERT /* don't want ASSERT debugging */
- # define NDEBUG /* so disable it */
- #endif
-
- /* some C compilers don't do min/max */
-
- #ifndef max
- # define max(a,b) (a > b) ? a : b
- #endif
-
- #ifndef min
- # define min(a,b) (a < b) ? a : b
- #endif
-
- /* propagate some Msged headers */
-
- #include "nedit.h"
-
- /* version defines */
-
- #define VER "1.60" /* Main version */
- #define PID "Msged/Q" /* PID Product code/ID max 10 chars */
- #define PIDVER VER /*"/b"*/ /* PID Version, max 8 chars */
- #define VERSION VER /*"b"*/ /* Version displayed */
-
- /* some constants */
-
- #define NO 0
- #define YES 1
- #define HIDE 2
-
- #define ON 1
- #define OFF 0
-
- #define GDOMAINS 1
- #define GZONES 2
-
- #define PATHLEN 70 /* 64 in 1.99 */
- #define GUTTER 8 /* cols. in which to recognize '>' for quotes */
-
- enum {Z_A=1, N_A=2, P_A=4, D_A=8, Z_O=16, N_O=32, P_O=64, D_O=128,
- A_INT=256};
- /* used by formaddr */
-
- #ifdef MAIN
- # define global
- #else
- # define global extern
- #endif
-
- #if defined(__TURBOC__) || defined(__MSC__) || defined(__JPIC__)
- # define strcmpl strcmpi
- #endif
-
- #define checkmem(x) { if ((x) == NULL) outamemory(); }
-
- /* structures and typedefs */
-
- #include "qtypes.h"
- #include "quickbbs.h"
-
- struct _address {
- int zone;
- int net;
- int node;
- int point;
- char *domain;
- };
-
- struct _area {
- char *description; /* what the user calls the area */
- char *tag; /* what confmail calls it! */
- BYTE board; /* board number of the area */
- unsigned int local:1; /* local message area */
- unsigned int netmail:1; /* netmail message area */
- unsigned int echomail:1;/* echomail area */
- unsigned int new:1; /* a message has been entered */
- unsigned int softcr:1; /* add soft-cr's */
- char *areaorig; /* origin override */
- MSGBITS msgbits; /* message bits for this area */
- BYTE aka; /* number of address 0-MAXAKA */
- };
-
- typedef struct _address ADDRESS;
- typedef struct _area AREA;
-
- #ifdef EIDS
- typedef struct {
- WORD crc; /* crc part of EID */
- DWORD st; /* time/date stamp part of EID */
- } EID;
- #endif
-
- typedef struct {
- DWORD st; /* time/date stamp part of MSGID: */
- } MSGID;
-
- struct _msg {
- MSGHEADER header; /* header above */
- ADDRESS to; /* extended destination address of message */
- ADDRESS from; /* extended origin address of message */
- MSGID msgid; /* MSGID of this message */
- #ifdef EIDS
- EID eid; /* EID of this message */
- #endif
- };
-
- typedef struct _msg MSG;
-
- struct _command {
- char *label;
- void (*action)();
- };
-
- /* imports from screen */
-
- extern unsigned int *macros[40]; /* one for each of the various
- function key states
- */
- extern int maxy, /* how many screen lines? */
- maxx, /* how many screen columns? */
- videomethod; /* DIRECT, BIOS or FOSSIL */
-
- extern unsigned int vbase; /* the video segment */
-
- /* global variables */
-
- global AREA *arealist;
-
- global char *username, /* who is you */
- *quotestr, /* how to prefix a quote */
- *attribline, /* attribution line */
- *fidolist, /* nodelist user list */
- *userlist, /* personal user list */
- *origin, /* origin line */
- *outfile, /* default export filename */
- *newnetpath, /* for creating CONFIG.BBS */
- *bbspath; /* path with '\' for *.BBS */
-
- global BUFFER msgbuf;
-
- global int usernum, /* user number in USERS.BBS */
- highmsgread, /* highest message read */
- area, /* current area number */
- rm, /* the right margin */
- shownotes, /* show hidden lines */
- pointnet, /* private net number of point */
- tabsize, /* how many spaces for a tab */
- domains, /* how many domains listed */
- confirmations, /* confirm deletes, aborts? */
- override, /* override the area origin line */
- #ifdef SEENBY
- seenbys, /* show seenby lines */
- #endif
- #ifdef TEARLINE
- tearline, /* show a tearline? */
- #endif
- #ifdef GATE
- gate, /* zone/domain gate messages? */
- #endif
- quoteright, /* right margin for quoting */
- co_normal, /* the normal text color */
- co_quote, /* quoted text color */
- co_warn, /* warning and error message color */
- co_block, /* block color */
- co_info, /* informational messages */
- co_hilite, /* general highlighting */
- rot13, /* rot13 this message? */
- areas; /* how many message areas */
-
- global BOOLEAN beepson, /* beeps & bells on */
- createconfig, /* create CONFIG.BBS */
- configdebug, /* display config debugging info */
- globsrch, /* search globally */
- msgids, /* add ^aMSGID: */
- #ifdef EIDS
- eids, /* add ^aEID: */
- #endif
- strip, /* strip exising kludge lines */
- techie, /* show 'Of' in all areas */
- protectnet, /* protect netmail */
- rastruct, /* use RA structures */
- #ifdef DBRIDGE
- dbridgestruct, /* use D'Bridge structures */
- #endif
- useusersbbs, /* Use USERS.BBS */
- quicksysop; /* QuickBBS sysop */
-
- global ADDRESS thisnode[MAXAKA+1]; /* addresses */
- global BYTE addresses; /* number of addresses */
-
- global MSG message;
-
- global ADDRESS *domain_list;
-
- /* command key scancode table */
-
- #define DONE 0x001b /* <ESC> done */
- #define RUBOUT 0x007f /* DEL */
- #define SPACE 0x0020 /* space bar */
- #define ENTER 0x000d /* <enter> */
- #define LINKTO 0x7400 /* <CTL><right> */
- #define LINKFR 0x7300 /* <CTL><left> */
- #define ROOT 0x4700 /* <Home> */
- #define LAST 0x4f00 /* <End> */
- #define KAREA 0x1e00 /* <ALT><A> */
- #define CHANGE 0x2e00 /* <ALT><C> */
- #define DELMSG 0x2000 /* <ALT><D> */
- #define NEWMSG 0x1200 /* <ALT><E> */
- #define SEARCH 0x2100 /* <ALT><F> */
- #define GOTO 0x2200 /* <ALT><G> */
- #define HELP 0x2300 /* <ALT><H> */
- #define LIST 0x2600 /* <ALT><L> */
- #define MOVE 0x3200 /* <ALT><M> */
- #define OS 0x1800 /* <ALT><O> */
- #define REPLY 0x1300 /* <ALT><R> */
- #define QUOTE 0x1000 /* <ALT><Q> */
- #define SCAN 0x1f00 /* <ALT><S> */
- #define SET 0x1f00 /* <ALT><S> */
- #define TOGGLE 0x1400 /* <ALT><T> */
- #define VIEW 0x2f00 /* <ALT><V> */
- #define WRITE 0x1100 /* <ALT><W> */
- #define DONE2 0x2d00 /* <ALT><X> */
- #define SEARCHD 0x2c00 /* <ALT><Z> */
- #define TOP 0x8400 /* CtrlPgUp */
- #define BOTTOM 0x7600 /* CtrlPgDn */
-
-
- /* Area macros */
-
- #define CurBoard arealist[area].board
- #define CurAKA arealist[area].aka
-
- /* replaced functions */
-
- #define prependline(s) (void)insertline(&msgbuf,msgbuf.first,(s))
- #define ptrfree(p) {free(p); p = NULL;}
-
- /* prototypes */
-
- void main(int argc, char *argv[]);
- void outamemory(void);
- int scanmail(int area); /* readmail.c */
- int showmsg(MSG); /* showmail.c */
- BUFFER buffer(char **); /* bufmsg.c */
- void opening(char *,char *,char *); /* config.c */
- int nextmsg(int); /* msged.c */
- void parseareas(char *); /* areas.c */
- int selectarea(char *title); /* areas.c */
- void createmsg(void); /* makemsg.c */
- void showheader(MSG m); /* showmail.c */
- void newmsg(void); /* makemsg.c */
- ADDRESS parsenode(char *s); /* config.c */
- void reply(void); /* makemsg.c */
- void quote(void); /* makemsg.c */
- void clearbuffer(BUFFER *buf); /* bufmsg.c */
- void change(void); /* makemsg.c */
- void import(LINE *l); /* textfile.c */
- void export(LINE *f); /* textfile.c */
- void movemsg(void); /* maintmsg.c */
- void maintarea(void); /* maintmsg.c */
- void writetxt(void); /* textfile.c */
- void timestr(char *tim, char *dat); /* makemsg.c */
- BOOLEAN confirm(int confirmations); /* msgedq.c */
- void settings(void); /* settings.c */
- void editheader(void); /* makemsg.c */
- void save(MSG message); /* makemsg.c */
- void help(void); /* help.c */
- void list(void); /* msglist.c */
- ADDRESS lookup(char *name, char *fn); /* userlist.c */
- int dorot13(int c); /* editmail.c */
- void rotate(void); /* msged.c */
-
- int editmsg(void); /* editmail.c */
- void fatal(char *s); /* msgedq.c */
- void halt(int status); /* msgedq.c */
- void os(void); /* msgedq.c */
- char *timedate(char *t, char *d, BOOLEAN longform);
- /* showmail.c */
- void clear_attributes(MSGHEADER * h); /* makemsg.c */
- void cleanup(void); /* qmsged.c */
- void beep(int freq, int len); /* qmsged.c */
- void refresh(LINE * c, int y); /* showmail.c */
- char *bits2ascii(MSGBITS, BOOLEAN); /* showmail.c */
- char *formaddr(ADDRESS addr, int mask); /* showmail.c */
-
- /* Message base functions in msgbase.c */
-
- char *readtext(MSGHEADER *m);
- BOOLEAN readmsg(MSG *m, int msgnum);
- int newmsgnum(void);
- int writemsg(MSG *m);
- void formatorigin(char *buffer, char *origin, ADDRESS thisnode);
-
- int searchuser(char *name, BOOLEAN create);
- int boardmsg(BYTE board, int cur);
- int searchto(BYTE board, int msgnum, char *name);
- BOOLEAN updatehigh(int usernum, int high);
- void working(BOOLEAN on);
- void helped(void);
- void helpedit(void);
- void helparea(void);
- void helplist(void);
-
- /* editbuf.c */
- LINE *insertline(BUFFER *buf, LINE *cur, char *txt);
- void deleteline(BUFFER *buf, LINE *cur);
-
- /* textfile.c */
- BOOLEAN writebuffile(char *path, BUFFER *buf);
- BOOLEAN readbuffile(char *path, BUFFER *buf);