~case/dbns

ref: 0f9985edf4d2b9e98aaac388d30fd4ab8c4722cf dbns/src/board.h -rw-r--r-- 3.0 KiB
0f9985edcase rm extern 10 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/* Includes for board system */
/* This is version 2 of the board system, (c) 1995-96 erwin@pip.dknet.dk */

/*
 * This is not needed here. Needs to be put into the connected_state enum.
 * These values will most likely cause conflicts....
 *
#define CON_NOTE_TO						10
#define CON_NOTE_SUBJECT				11
#define CON_NOTE_EXPIRE					12
#define CON_NOTE_TEXT					13
#define CON_NOTE_FINISH					14
 *
 */


#define PREFIX_DIR      "/opt/dbns/db"	/* prefix where the information is */
#define NOTE_DIR PREFIX_DIR "/notes/" /* set it to something you like */

#define DEF_NORMAL  0 /* No forced change, but default (any string)   */
#define DEF_INCLUDE 1 /* 'names' MUST be included (only ONE name!)    */
#define DEF_EXCLUDE 2 /* 'names' must NOT be included (one name only) */

#define MAX_BOARD 	  12

#define DEFAULT_BOARD 0 /* default board is board #0 in the boards      */
/* It should be readable by everyone!           */

#define MAX_LINE_LENGTH 80 /* enforce a max length of 80 on text lines, reject longer lines */
/* This only applies in the Body of the note */

#define MAX_NOTE_TEXT (4*MAX_STRING_LENGTH - 1000)

#define BOARD_NOTFOUND -1 /* Error code from board_lookup() and board_number */

/* Access types */
#define BOARD_CLAN_ONLY		2
#define BOARD_AUTHED_BIO	3

/* Data about a board */
struct global_board_data
{
	char *short_name; /* Max 8 chars */
	char *long_name;  /* Explanatory text, should be no more than 40 ? chars */

	int read_level; /* minimum level to see board */
	int write_level; /* minimum level to post notes */

	char *names;       /* Default recipient */
	int force_type; /* Default action (DEF_XXX) */

	int purge_days; /* Default expiration */

	/* Non-constant data */

	NOTE_DATA *note_first; /* pointer to board's first note */
	bool changed; /* currently unused */
	int access; /* access type */

};

typedef struct global_board_data GLOBAL_BOARD_DATA;


/* External variables */

extern GLOBAL_BOARD_DATA boards[MAX_BOARD]; /* Declare */


/* Prototypes */

void finish_note(GLOBAL_BOARD_DATA *board, NOTE_DATA *note); /* attach a note to a board */
void free_note (NOTE_DATA *note); /* deallocate memory used by a note */
void load_global_boards(void); /* load all boards */
int board_lookup(const char *name); /* Find a board with that name */
bool is_note_to (CHAR_DATA *ch, NOTE_DATA *note); /* is tha note to ch? */
void personal_message (const char *sender, const char *to, const char *subject, const int expire_days, const char *text);
void make_note(const char* board_name, const char *sender, const char *to, const char *subject, const int expire_days, const char *text);
void save_notes ();

/* for nanny */
void handle_con_note_to (DESCRIPTOR_DATA *d, char * argument);
void handle_con_note_subject (DESCRIPTOR_DATA *d, char * argument);
void handle_con_note_expire (DESCRIPTOR_DATA *d, char * argument);
void handle_con_note_text (DESCRIPTOR_DATA *d, char * argument);
void handle_con_note_finish (DESCRIPTOR_DATA *d, char * argument);


/* Commands */

DECLARE_DO_FUN (do_global_note );
DECLARE_DO_FUN (do_global_boards );