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 #include <stdio.h>
35 #include <dos.h>
36 #include <ws.h>
37 #include <ws_mcb.h>
38 #include <ws_error.h>
39 #include "wstdefs.h"
40 #include "wstglob.h"
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57 show_bkmsg ()
58 {
59 signal_bg(ON);
60 bk_msg_showing = ON;
61 }
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82 display_bkmsg ()
83 {
84 char message [MAX_BG_MESS_LENGTH+1];
85 int msg_type,
86 sender;
87 int bg_msg_pending;
88 char statline[SCREEN_COLS+1];
89 int ch;
90 char *msg_ptr;
91
92
93 bg_msg_pending = tdata_arg.background_pending_flag;
94
95
96 bk_msg_showing = OFF;
97
98
99 save_wst_screen(&wst_fg_screen);
100 restore_wst_screen(&wst_bg_screen);
101
102
103 while (ON) {
104
105
106 if (bg_msg_pending > 0) {
107
108
109 sprintf(statline,"Background Screen: %d message(s). <ALT-H>-help [<q>,<p>,<ALT-M>,<ALT-D>]",
110 bg_msg_pending);
111 status_line(statline);
112
113
114 cursor_move(HIDE_CURSOR_ROW,HIDE_CURSOR_COL);
115
116
117 while (TRUE) {
118 ch = getkey(BLOCK);
119
120
121 if (uppercase(ch) == 'Q') {
122 bg_msg_pending = 0;
123 cursor_move(wst_bg_screen.cursor_row,
124 wst_bg_screen.cursor_col);
125 exit_bg_screen();
126 return;
127 }
128
129
130 else if (ch == ALT_M || ch == ALT_D)
131 break;
132
133
134 else if (uppercase(ch) == 'P') {
135 poll_bg_msg();
136 cursor_move(wst_bg_screen.cursor_row,
137 wst_bg_screen.cursor_col);
138 exit_bg_screen();
139 return;
140 }
141
142
143 else if (ch == ALT_H) {
144 help(BG_HELP);
145
146
147 status_line(statline);
148 }
149
150 else
151 beep();
152 }
153
154
155 if (getbgmes (message, &msg_type, &sender) == WSNOMESS) {
156
157
158 bg_msg_pending = 0;
159 continue;
160 }
161
162
163 bg_msg_pending--;
164 msg_ptr = message;
165
166 cursor_move(wst_bg_screen.cursor_row,
167 wst_bg_screen.cursor_col);
168
169 while (*msg_ptr)
170 put_wst_screen(&wst_bg_screen,*msg_ptr++);
171 put_wst_screen(&wst_bg_screen,'\n');
172
173
174 cursor_move(HIDE_CURSOR_ROW,HIDE_CURSOR_COL);
175
176
177 if (wst_f_audit) {
178 f_audit_msg("==BG==> ",8);
179 f_audit_msg(message,strlen(message));
180 f_audit_msg("\n",1);
181 }
182
183 if (wst_p_audit) {
184 p_audit_msg("==BG==> ",8,statline);
185 p_audit_msg(message,strlen(message),statline);
186 p_audit_msg("\n",1,statline);
187 }
188
189
190 if (msg_type == WSQUERY) {
191
192 strcpy(statline,"Background Screen: Enter reply <ALT-H>-help");
193 status_line(statline);
194
195
196 cursor_move(wst_bg_screen.cursor_row,
197 wst_bg_screen.cursor_col);
198
199
200 wst_getline(&wst_bg_screen,message,statline);
201
202
203 cursor_move(HIDE_CURSOR_ROW,HIDE_CURSOR_COL);
204
205
206 sendqrep (message, sender);
207
208
209 if (wst_f_audit) {
210 f_audit_msg("==BGR=> ",8);
211 f_audit_msg(message,strlen(message));
212 f_audit_msg("\n",1);
213 }
214
215 if (wst_p_audit) {
216 p_audit_msg("==BGR=> ",8,statline);
217 p_audit_msg(message,strlen(message),statline);
218 p_audit_msg("\n",1,statline);
219 }
220
221 }
222 }
223
224
225 else {
226 strcpy(statline,"Background Screen: No more messages. <ALT-H>-help [<p>,<q>]");
227 status_line(statline);
228
229
230 cursor_move(HIDE_CURSOR_ROW,HIDE_CURSOR_COL);
231
232
233 while (TRUE) {
234 ch = getkey(BLOCK);
235 if (ch == ALT_H) {
236 help(BG_HELP);
237 status_line(statline);
238 }
239 else if (uppercase(ch) == 'P' || uppercase(ch) == 'Q')
240 break;
241 else
242 beep();
243 }
244
245
246 if (uppercase(ch) == 'P')
247 poll_bg_msg();
248
249 cursor_move(wst_bg_screen.cursor_row,
250 wst_bg_screen.cursor_col);
251
252 exit_bg_screen();
253
254 return;
255 }
256 }
257 }
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276 exit_bg_screen()
277 {
278 save_wst_screen(&wst_bg_screen);
279 restore_wst_screen(&wst_fg_screen);
280 update_status();
281 }
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302 poll_bg_msg()
303 {
304 int msg_type;
305 int sender;
306 char message[MAX_BG_MESS_LENGTH+1];
307 int scroll;
308 int ch;
309 char *bgp_stat_ns;
310 char *bgp_stat_s;
311 char *bgp_stat_q;
312 char *msg_ptr;
313
314 scroll = 1;
315 bgp_stat_ns = "Background Screen(Poll): [NO-SCROLL] <ALT-H>-help [<q>,<other>]";
316 bgp_stat_s = "Background Screen(Poll): <ALT-H>-help [<q>,<other>]";
317 bgp_stat_q = "Background Screen(Poll): Enter reply <ALT-H>-help";
318
319
320 status_line(bgp_stat_s);
321
322
323 while (TRUE) {
324 if (scroll && getbgmes (message, &msg_type, &sender) != WSNOMESS) {
325
326
327 cursor_move(wst_bg_screen.cursor_row,
328 wst_bg_screen.cursor_col);
329
330
331 msg_ptr = message;
332 while (*msg_ptr)
333 put_wst_screen(&wst_bg_screen,*msg_ptr++);
334 put_wst_screen(&wst_bg_screen,'\n');
335
336
337 if (wst_f_audit) {
338 f_audit_msg("==BG==> ",8);
339 f_audit_msg(message,strlen(message));
340 f_audit_msg("\n",1);
341 }
342
343 if (wst_p_audit) {
344 p_audit_msg("==BG==> ",8,bgp_stat_s);
345 p_audit_msg(message,strlen(message),bgp_stat_s);
346 p_audit_msg("\n",1,bgp_stat_s);
347 }
348
349
350 cursor_move(HIDE_CURSOR_ROW,HIDE_CURSOR_COL);
351
352
353 if (msg_type == WSQUERY) {
354
355
356 cursor_move(wst_bg_screen.cursor_row,
357 wst_bg_screen.cursor_col);
358
359
360 status_line(bgp_stat_q);
361
362
363 wst_getline(&wst_bg_screen,message,bgp_stat_q);
364
365 cursor_pos(&wst_bg_screen.cursor_row,
366 &wst_bg_screen.cursor_col);
367
368
369 cursor_move(HIDE_CURSOR_ROW,HIDE_CURSOR_COL);
370
371
372 sendqrep (message, sender);
373
374
375 if (wst_f_audit) {
376 f_audit_msg("==BGR=> ",8);
377 f_audit_msg(message,strlen(message));
378 f_audit_msg("\n",1);
379 }
380
381 if (wst_p_audit) {
382 p_audit_msg("==BGR=> ",8,bgp_stat_q);
383 p_audit_msg(message,strlen(message),bgp_stat_q);
384 p_audit_msg("\n",1,bgp_stat_q);
385 }
386
387
388 status_line(bgp_stat_s);
389 }
390 }
391
392
393 if (checkkey() >= 0) {
394
395
396 ch = getkey(BLOCK);
397
398
399 if (uppercase(ch) == 'Q')
400 return;
401
402
403 else if (ch == ALT_H) {
404 help(BG_HELP);
405 if (scroll)
406 status_line(bgp_stat_s);
407 else
408 status_line(bgp_stat_ns);
409 }
410
411
412 else {
413
414
415 scroll = !scroll;
416 if (scroll)
417 status_line(bgp_stat_s);
418 else
419 status_line(bgp_stat_ns);
420 }
421 }
422 }
423 }
424