-
Notifications
You must be signed in to change notification settings - Fork 1
/
JEO.c
1399 lines (1267 loc) · 36 KB
/
JEO.c
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include <JEO:JEO.h>
#include <proto/exec.h>
#include <exec/memory.h>
#include <proto/dos.h>
#include <dos/datetime.h>
#include <bbs.h>
#include <node.h>
#include <proto/utility.h>
#include <string.h>
#include <ctype.h>
#include <dos.h>
int HandleMsg (struct ABBSmsg *msg);
char Dummy[3000];
struct ABBSmsg msg;
extern far int msprintf (char *, const char *, ...);
#define a4a5 register __a4 struct ramblocks *nodebase,register __a5 struct Mainmemory *mainmeory
#define usea4a5 nodebase,mainmeory
extern far ULONG exebase;
extern far char CursorOffData[];
extern far char CursorOnData[];
extern far char deltext[];
extern far char moretext[];
extern far char morenohelptext[];
extern far char accessbitstext[];
extern far char invalidacctext[];
extern far char deadtext[];
extern far char invalidacctext[];
extern far char versionstr[];
extern __asm far VOID CheckInvited (a4a5);
extern __asm far BOOL saveuser (register __a0 char *Name, register __a1 struct UserRecord *cu);
extern __asm far BOOL saveuserarea (register __d0 UWORD size, register __a0 UWORD access);
extern __asm far writecontext (register __a0 char *text,a4a5);
extern __asm far writetexto (register __a0 char *text,a4a5); // Med return
extern __asm far loadusernrnr (register __d0 ULONG usernr, register __a0 struct UserRecord *ur, a4a5); // Med return
extern __asm far writetexti (register __a0 char *text,a4a5); // Uten return
extern __asm far writetext (register __a0 char *text,a4a5);
extern __asm far BOOL Handle_Preview (register __d0 int filedirnr, register __a0 struct Fileentry *fileentry, a4a5);
extern __asm far sendfile (register __a0 char *Filename,a4a5);
//extern __asm far sendpreviewfile (register __a0 char *Filename,a4a5);
extern __asm far VOID Write_user_CPS (register __d5 UWORD cps, a4a5);
extern __asm far readchar (a4a5);
extern __asm far readlineall (register __d0 int len, a4a5);
extern __asm far mayedlineprompt (register __d0 int len, register __a0 char *Text, register __a1 char *TextArg, a4a5);
extern __asm far VOID Hebbe (register __a0 char *Buf, register __d0 int len, a4a5);
__asm far VOID DelText (register __d0 UWORD nr, a4a5);
__asm far BOOL CheckTextMode (register __d1 int pos, register __d2 char Tegn,
register __d3 int len, register __a3 char *Buf, a4a5)
{
/*
int i;
BPTR fh;
char Buffer[200];
if (fh = Open ("PRT:", MODE_NEWFILE))
{
msprintf (Buffer, "pos = %ld, Tegn = %ld, len = %ld\n", pos, Tegn, len);
Write (fh, Buffer, strlen (Buffer));
Close (fh);
}
if (pos + 1 < len)
{
for (i = pos + 1; i < len; i++)
{
switch (Buf[i])
{
case ' ': return (FALSE);
case '.': return (FALSE);
case ',': return (FALSE);
case Tegn: return (TRUE);
}
}
}
*/
return (FALSE);
}
#define START 0
#define GO 1
#define STOP 2
__asm far VOID WriteLineNr (a4a5)
{
WORD i;
if (!nodebase->readlinemore)
{
nodebase->linesleft = 65535; // Vi vil ikke ha noen more her..
putreg (REG_A6,exebase);
writetexti ("\f[32m", usea4a5);
for (i = 70; i >= 3; i--)
{
msprintf (Dummy, "%2ld\n", i);
writetexti (Dummy, usea4a5);
}
writetexti ("[0m\n", usea4a5);
nodebase->linesleft = nodebase->CU.PageLength;
}
}
// Filer fra killa brukerer blir fra sysop i steden!
//
LONG FileSize (UBYTE *Name)
{
register BPTR lock = 0;
register struct FileInfoBlock *fib = 0;
register LONG size = ERROR;
if (!(fib = (struct FileInfoBlock *)AllocMem (sizeof (struct FileInfoBlock), MEMF_CLEAR)))
return (-2);
if (lock = Lock (Name, ACCESS_READ))
{
if (Examine (lock, fib))
size = fib->fib_Size;
}
if (lock)
UnLock (lock);
if (fib)
FreeMem (fib, sizeof (struct FileInfoBlock));
return (size);
}
__asm far VOID PackUserDoFiles (a4a5)
{
BPTR fh;
if (fh = Open ("RAM:JEOJEO", MODE_NEWFILE))
{
Write (fh, &nodebase->tmpmsgmem, nodebase->msgmemsize);
Close (fh);
}
}
VOID Slash_to_space (char *S)
{
while (*S)
{
if (*S == '/')
*S = ' ';
*S++;
}
}
ULONG CenterText (UBYTE *String, UBYTE max)
{
ULONG len;
len = strlen (String);
if (len >= max)
return (0);
return ((max / 2) - (len / 2));
}
__asm far VOID Make_conf_text (register __a0 char *Conf, a4a5)
{
char Confname[51];
char Hold[200];
char Line[80];
char Filename[108];
BPTR fh = 0, lock = 0;
int line;
BOOL go_flag;
char Conf_text_dir[] = "ABBS:Text/Conf_text";
UBYTE start;
lock = CreateDir (Conf_text_dir);
if (lock)
UnLock (lock);
strcpy (Confname, Conf);
Slash_to_space (Confname);
msprintf (Filename, "%s/%s", Conf_text_dir, Confname);
if (fh = Open (Filename, MODE_NEWFILE))
{
go_flag = TRUE;
line = Dummy[0] = 0;
strcpy (Dummy, "[1;1H[2J\n[32m __ __\n");
strcat (Dummy, " ___/ / \\ \\___\n");
strcat (Dummy, " \\ / /\\ [31m Conference [32m/\\ \\ /\n");
strcat (Dummy, " ___________/ \\/\\ \\ [31m ------------ [32m/ /\\/ \\___________\n");
strcat (Dummy, " / / / \\ \\ \\\n");
Write (fh, &Dummy, strlen (Dummy));
start = CenterText (Conf, 71);
strcpy (Hold, " \\ ___ \\/[36m [32m\\/ ___ /\n");
strncpy (&Hold[start+9], Conf, strlen (Conf));
Write (fh, &Hold, strlen (Hold));
strcpy (Dummy, " \\__ / \\______________________ _____________________/ \\ __/\n");
strcat (Dummy, " \\/ \\_/ \\/\n\n");
Write (fh, &Dummy, strlen (Dummy));
strcpy (Dummy, " [34m***************************************************************************\n");
Write (fh, &Dummy, strlen (Dummy));
putreg (REG_A6,exebase);
writetexto ("\n[32mPlease enter conference text (enter on blank line quits)", usea4a5);
putreg (REG_A6,exebase);
writetexto ("[32mType ç (ALT-C) at the end of each line to allign text to center.", usea4a5);
while (go_flag)
{
msprintf (Dummy, "[36m%02ld: [0m", line + 1);
putreg (REG_A6,exebase);
writetexti (Dummy, usea4a5);
putreg (REG_A6,exebase);
readlineall (71, usea4a5);
if (*(nodebase->intextbuffer))
{
strcpy (Line, nodebase->intextbuffer);
if (Line[strlen (Line) - 1] == 'ç') // Skal vi sentrere?
{
Line[strlen (Line) - 1] = 0; // Ta bort ç
start = CenterText (Line, 71); // Ja
strcpy (Hold, " ");
strncpy (&Hold[start], Line, strlen (Line));
msprintf (Dummy, "[34m * [33m%-71s [34m*\n", Hold);
}
else
msprintf (Dummy, "[34m * [33m%-71s [34m*\n", nodebase->intextbuffer);
if (*(Dummy))
{
Write (fh, &Dummy, strlen (Dummy));
line++;
}
}
else
{
if (line) // Har vi skrevet noe?
{
strcpy (Dummy, " ***************************************************************************\n");
Write (fh, &Dummy, strlen (Dummy));
}
go_flag = FALSE;
}
}
strcpy (Dummy, "[0m"); // Resetter sakene ;)
Write (fh, &Dummy, strlen (Dummy));
Close (fh);
if (line)
{
putreg (REG_A6,exebase);
writetexto ("[32mDone.\n", usea4a5);
}
}
else
{
msprintf (Dummy, "\n[31mError opening '%s'.\nCouldn't create conference text file...[0m\n\n", Filename);
putreg (REG_A6,exebase);
writetexti (Dummy, usea4a5);
}
}
/*
__asm far char GetChar (a4a5)
{
putreg (REG_A6,exebase);
writetexti ("[32mTast inne et eller annet: [0m", usea4a5);
}
*/
/*
__asm far VOID Test (a4a5)
{
putreg (REG_A6,exebase);
writetexti ("[32mTast inne et eller annet: [0m", usea4a5);
putreg (REG_A6,exebase);
readline (usea4a5);
msprintf (Dummy, "[31mDu tastet: [33m%s[0m", nodebase->intextbuffer);
putreg (REG_A6,exebase);
writetexto (Dummy, usea4a5);
// msprintf (Dummy, "status = %ld\n", nodebase->readcharstatus);
// writetexto (Dummy, usea4a5);
}
*/
/*
BOOL GetUser (ULONG nr, UBYTE *User) // Henter bare navnet fra nummer...
{
int err;
BOOL ret = FALSE;
msg.Command = Main_getusername;
msg.UserNr = nr;
err = HandleMsg (&msg);
if (err == Error_OK)
{
strcpy (User, msg.Name);
ret = TRUE;
}
return (ret);
}
*/
BOOL Check_bits (char *Scan_bits, ULONG access)
{
UBYTE i;
for (i = 0; Scan_bits[i] != 0; i++) // Sjekker for valide bits
{
switch (Scan_bits[i])
{
case 'R': { if (!(access & ACCF_Read)) return (FALSE); break; }
case 'W': { if (!(access & ACCF_Write)) return (FALSE); break; }
case 'U': { if (!(access & ACCF_Upload)) return (FALSE); break; }
case 'D': { if (!(access & ACCF_Download)) return (FALSE); break; }
case 'F': { if (!(access & ACCF_FileVIP)) return (FALSE); break; }
case 'I': { if (!(access & ACCF_Invited)) return (FALSE); break; }
case 'S': { if (!(access & ACCF_Sigop)) return (FALSE); break; }
case 'Z': { if (!(access & ACCF_Sysop)) return (FALSE); break; }
}
}
return (TRUE);
}
VOID Do_bits (char *Bits, ULONG access)
{
if (access & ACCF_Read) strcat (Bits, "R");
if (access & ACCF_Write) strcat (Bits, "W");
if (access & ACCF_Upload) strcat (Bits, "U");
if (access & ACCF_Download) strcat (Bits, "D");
if (access & ACCF_FileVIP) strcat (Bits, "F");
if (access & ACCF_Invited) strcat (Bits, "I");
if (access & ACCF_Sigop) strcat (Bits, "S");
if (access & ACCF_Sysop) strcat (Bits, "Z");
}
char Bits[] = "RWUDFISZ";
BOOL Parse_bits (char *Scan_bits)
{
UBYTE i, j;
BOOL flag;
for (i = 0; Scan_bits[i] != 0; i++) // Sjekker for valide bits
{
flag = FALSE;
for (j = 0; Bits[j] != 0; j++)
{
if (Scan_bits[i] == Bits[j])
{
flag = TRUE;
break;
}
}
if (!flag)
return (FALSE);
}
return (TRUE);
}
VOID ReverseString (char *String)
{
ULONG i, len, x;
UBYTE c;
x = len = strlen (String);
x >>= 1; // Deler på 2
len--;
for (i = 0; i < x; i++, len--)
{
c = String[i];
String[i] = String[len];
String[len] = c;
}
}
VOID Strip_access (char *Access)
{
char Hold[10];
BYTE i, j;
for (i = strlen (Access) - 1, j = 0; i >= 0; i--, j++)
{
Hold[j] = Access[i];
if (Hold[j] == ' ')
break;
}
Hold[j] = 0;
strcpy (Access, Hold);
ReverseString (Access);
}
__asm far VOID ShowUsers_c (a4a5)
{
struct ConfigRecord *config = &mainmeory->config;
BOOL c_flag, go_flag = TRUE;
char Time[15];
char Access_scan[9];
ULONG usernr, linesleft, listed = 0, killed = 0, i;
char Date[20], Hold[30];
struct DateTime dt = { NULL };
char DayString[][4] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
char m1, m2, c;
UBYTE month;
UWORD active_conf;
UWORD cur_line;
BOOL sysop = FALSE;
char Name[45];
BOOL rip;
char Bits[9];
struct UserRecord *ur = 0;
char User[] = "user", Users[] = "users";
char MonthString[][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
"Aug", "Sep", "Oct", "Nov", "Dec" };
if (!(ur = AllocMem (config->UserrecordSize, MEMF_CLEAR)))
return;
active_conf = nodebase->confnr / 2;
strcpy (Access_scan, "R");
if (nodebase->CU.firstuserconf[active_conf].uc_Access & ACCF_Sysop)
{
sysop = TRUE;
putreg (REG_A6,exebase);
mayedlineprompt (8, "[33mAccess type <RWUDFISZ>: [0m", Access_scan, usea4a5);
strcpy (Access_scan, nodebase->intextbuffer);
for (i = 0; Access_scan[i] != 0; i++)
Access_scan[i] = toupper (Access_scan[i]);
Strip_access (Access_scan);
if (*(Access_scan))
{
if (!Parse_bits (Access_scan))
{
putreg (REG_A6,exebase);
sprintf (Dummy, "[31m%s %s\n", invalidacctext, Access_scan);
writetext (Dummy, usea4a5);
goto end;
}
}
else
goto end;
}
linesleft = nodebase->linesleft;
nodebase->linesleft = 65535; // Slår av more-prompt
if (sysop)
cur_line = 1;
else
cur_line = 1;
for (usernr = 0; usernr < config->MaxUsers; usernr++)
{
if (!go_flag)
break;
loadusernrnr (usernr, ur, usea4a5);
strcpy (Name, ur->Name);
if (usernr == 0)
{
putreg (REG_A6,exebase);
writetext ("\n", usea4a5);
}
if (!Check_bits (Access_scan, ur->firstuserconf[active_conf].uc_Access))
continue; // Ikke det vi spurte etter!
rip = FALSE;
if (ur->Userbits & USERF_Killed) // Er killa?
{
killed++;
if (sysop) // Er det sysop som ser? ;)
{
sprintf (Dummy, "[31m%s", deadtext);
strcat (Name, Dummy);
rip = TRUE;
}
else
continue;
}
dt.dat_Stamp.ds_Days = ur->LastAccess.ds_Days;
dt.dat_Stamp.ds_Minute = ur->LastAccess.ds_Minute;
dt.dat_Stamp.ds_Tick = ur->LastAccess.ds_Tick;
dt.dat_Format = FORMAT_CDN;
dt.dat_Flags = 0;
dt.dat_StrDate = Date;
dt.dat_StrTime = Time;
if (DateToStr (&dt))
{
if (ur->LastAccess.ds_Days > 0)
{
strncpy (Hold, Date, 3);
Hold[3] = 0;
m1 = Date[3];
m2 = Date[4];
month = 0;
if (m1 == '1')
month += 10;
month += (m2 - 48);
month--;
strcat (Hold, MonthString[month]);
strncat (Hold, &Date[5], 3);
Time[5] = 0;
}
else
strcpy (Hold, "N/A");
}
else
strcpy (Hold, "DATE ERROR");
strcpy (Bits, " ");
if (sysop)
Do_bits (Bits, ur->firstuserconf[active_conf].uc_Access);
if (!rip)
msprintf (Dummy, "%-39s [33m%s [35m%s [36m%s[31m%s[0m", Name, DayString[ur->LastAccess.ds_Days%7], Hold, Time, Bits);
else
msprintf (Dummy, "%-44s [33m%s [35m%s [36m%s[31m%s[0m", Name, DayString[ur->LastAccess.ds_Days%7], Hold, Time, Bits);
putreg (REG_A6,exebase);
writetexto (Dummy, usea4a5);
listed++;
cur_line++;
if (cur_line == nodebase->CU.PageLength) // Da spør vi om mere ;)
{
if (nodebase->CU.XpertLevel > 1) // Er vi expert eller høyere
msprintf (Dummy, "[0m%s", morenohelptext);
else
msprintf (Dummy, "[0m%s", moretext);
putreg (REG_A6,exebase);
writetexti (Dummy, usea4a5);
c_flag = TRUE;
while (c_flag)
{
nodebase->dosleepdetect = 1;
c = readchar (usea4a5);
c = toupper (c);
nodebase->dosleepdetect = 0;
switch (c)
{
case 'Y':
{
c_flag = FALSE;
if (nodebase->CU.XpertLevel > 1) // Er vi expert eller høyere
DelText (8, usea4a5);
else
DelText (17, usea4a5);
cur_line = 0;
break;
}
case ' ': // Samme som Y
{
c_flag = FALSE;
if (nodebase->CU.XpertLevel > 1) // Er vi expert eller høyere
DelText (8, usea4a5);
else
DelText (17, usea4a5);
cur_line = 0;
break;
}
case 13: // Return da gir vi kun 1 linje
{
c_flag = FALSE;
if (nodebase->CU.XpertLevel > 1) // Er vi expert eller høyere
DelText (8, usea4a5);
else
DelText (17, usea4a5);
cur_line = nodebase->CU.PageLength - 1;
break;
}
case 'N':
{
c_flag = FALSE;
go_flag = FALSE;
putreg (REG_A6,exebase);
writetexti ("\n", usea4a5);
break;
}
case -1: // Ejecta?
{
c_flag = FALSE;
go_flag = FALSE;
putreg (REG_A6,exebase);
writetexti ("\n", usea4a5);
break;
}
case 0: // Quit ABBS
{
c_flag = FALSE;
go_flag = FALSE;
putreg (REG_A6,exebase);
writetexti ("\n", usea4a5);
break;
}
case 'C': // Vi fortsetter
{
c_flag = FALSE;
if (nodebase->CU.XpertLevel > 1) // Er vi expert eller høyere
DelText (8, usea4a5);
else
DelText (17, usea4a5);
cur_line = 35535; // Skal vel holde det ;)
break;
}
}
}
}
}
end:
if (sysop)
{
listed -= killed;
sprintf (Dummy, "\n[32m%ld active %s and %ld killed %s listed.", listed, listed == 1 ? User : Users, killed, killed == 1 ? User : Users);
}
else
sprintf (Dummy, "\n[32m%ld %s listed.", listed, listed == 1 ? User : Users);
putreg (REG_A6,exebase);
writetexto (Dummy, usea4a5);
if (ur)
{
FreeMem (ur, config->UserrecordSize);
ur = 0;
}
nodebase->linesleft = linesleft;
}
__asm far VOID DelText (register __d0 UWORD nr, a4a5)
{
UWORD i;
putreg (REG_A6,exebase);
for (i = 0; i < nr; i++)
writetexti (deltext, usea4a5);
}
UWORD Find_max_conf_name_len (struct ConfigRecord *config)
{
UWORD n;
UBYTE max = 0, len;
for (n = 0; n < config->Maxconferences; n++) // Går igjenom alle konfer
{
if (*(config->firstconference[n].n_ConfName)) // Er det et navn her?
{
len = strlen (config->firstconference[n].n_ConfName);
if (len > max)
max = len;
}
}
return (max);
}
// d0 = fildirnr
// a0 = fileentry
int HandleMsg (struct ABBSmsg *msg)
{
struct MsgPort *mainport, *inport;
struct ABBSmsg *inmsg;
int ret;
inport = msg->msg.mn_ReplyPort;
Forbid();
if (mainport = FindPort(MainPortName))
{
PutMsg (mainport, (struct Message*)msg);
Permit ();
while (1)
{
if (!WaitPort(inport))
continue;
if (inmsg = (struct ABBSmsg *)GetMsg (inport))
break;
}
ret = inmsg->Error;
}
else
{
Permit ();
ret = Error_NoPort;
}
return (ret);
}
__asm far BOOL Handle_Preview (register __d0 int filedirnr, register __a0 struct Fileentry *fileentry, a4a5)
{
char Filedir[] = "ABBS:Previews/";
char Filename[108];
char Holdpath[108];
msprintf (Filename, "%s%s_@PREVIEW@", Filedir, fileentry->Filename);
if (Exists (Filename)) // Eksisterer det?
{
strcpy (Holdpath, nodebase->Nodemem.HoldPath);
if (Holdpath[strlen (Holdpath) - 1] != ':') // Vi må sjekke etter slash
{
if (Holdpath[strlen (Holdpath) - 1] != '/') // Er det en slash?
strcat (Holdpath, "/"); // Nei, da legger vi til...
}
msprintf (Dummy, "C:Copy \"%s\" TO \"%s\"", Filename, Holdpath);
Execute (Dummy, NULL, NULL);
putreg (REG_A6,exebase);
msprintf (Dummy, "[33mPreview file of '%s' has been moved to hold...\n", fileentry->Filename);
writetexti (Dummy, usea4a5);
}
else
{
putreg (REG_A6,exebase);
writetexti ("[31mFile has no preview attached!\n", usea4a5);
}
return (TRUE);
}
__asm far BOOL ShowConferencesAll (register __d1 char argument, a4a5)
{
ULONG n, i, teller, k;
BOOL member, show, go_flag, c_flag;
char Hold[181], c;
struct ConferenceRecord *confarray;
struct ConfigRecord *config = &mainmeory->config;
UWORD linesleft;
UWORD cur_line;
char Bulletins[19];
UBYTE max_len, tot;
if (argument != 'A') // Ikke all
return (FALSE);
linesleft = nodebase->linesleft;
nodebase->linesleft = 65535; // Slår av more-prompt
confarray = (struct ConferenceRecord *)(((int) config) + (SIZEOFCONFIGRECORD));
putreg (REG_A6,exebase);
writetexti ("\n", usea4a5);
putreg (REG_A6,exebase);
writetexti ("[32mConference status\n", usea4a5);
putreg (REG_A6,exebase);
writetexti ("-----------------\n", usea4a5);
teller = 0;
cur_line = 4;
go_flag = TRUE;
max_len = Find_max_conf_name_len (config);
for (i = 0;; i++) // Går igjenom alle konfer
{
if (!go_flag)
break;
for (n = 0; n < config->Maxconferences; n++) // Går igjenom alle konfer
{ // for å finne neste order
if (!go_flag)
break;
if (i == config->firstconference[n].n_ConfOrder) // Leter etter neste rekkefølge
{ // FUNNET!!
if (*(config->firstconference[n].n_ConfName)) // Er det et navn her?
{
teller++;
member = FALSE;
if (nodebase->CU.firstuserconf[n].uc_Access & ACCF_Read) // Medlem?
{
strcpy (Hold, "[32mMember[0m");
member = TRUE;
}
else
strcpy (Hold, "[31mNon-member[0m");
show = TRUE;
if (confarray[n].n_ConfSW & CONFSWF_VIP) // VIP conf?
{
if (!member)
show = FALSE;
}
else // Ikke vise READ ONLY i VIP konfer, de er jo alltid READ ONLY
{ // fra starten av
if (n > 3)
{
if (!(config->firstconference[n].n_ConfSW & CONFSWF_ImmWrite)) // Har vi READ ONLY?
strcat (Hold, ", READ ONLY");
}
}
if (show)
{
if (n == 2)
strcat (Hold, ", USER INFO");
if (n == 3)
strcat (Hold, ", FILE INFO");
if (config->firstconference[n].n_ConfSW & CONFSWF_PostBox) // MAIL?
strcat (Hold, ", MAIL");
if (config->firstconference[n].n_ConfSW & CONFSWF_Private) // Private meldinger?
strcat (Hold, ", Private allowed");
if (!(config->firstconference[n].n_ConfSW & CONFSWF_Resign)) // Obligatory?
strcat (Hold, ", Obligatory");
if (config->firstconference[n].n_ConfSW & CONFSWF_Network) // MAIL?
strcat (Hold, ", Network");
Bulletins[0] = 0;
if (config->firstconference[n].n_ConfBullets > 0)
strcpy (Bulletins, "[33m(Bulletins)");
msprintf (Dummy, "[36m%s", config->firstconference[n].n_ConfName);
putreg (REG_A6,exebase);
writetexti (Dummy, usea4a5);
tot = max_len - strlen (config->firstconference[n].n_ConfName);
for (k = 0; k < tot; k++)
Dummy[k] = ' ';
Dummy[tot] = ':';
Dummy[tot + 1] = 0;
putreg (REG_A6,exebase);
writetexti (Dummy, usea4a5);
msprintf (Dummy, " [0m%s. %s\n", Hold, Bulletins);
putreg (REG_A6,exebase);
writetexti (Dummy, usea4a5);
cur_line++;
// msprintf (Dummy, "status = %ld, n = %ld, linesleft = %ld, cursorpos = %ld\n", nodebase->outtextbufferpos, n, nodebase->linesleft, nodebase->cursorpos);
// putreg (REG_A6,exebase);
// writetexto (Dummy, usea4a5);
if (cur_line == nodebase->CU.PageLength) // Da spør vi om mere ;)
{
if (nodebase->CU.XpertLevel > 1) // Er vi expert eller høyere
msprintf (Dummy, "[0m%s", morenohelptext);
else
msprintf (Dummy, "[0m%s", moretext);
putreg (REG_A6,exebase);
writetexti (Dummy, usea4a5);
c_flag = TRUE;
while (c_flag)
{
nodebase->dosleepdetect = 1;
c = readchar (usea4a5);
c = toupper (c);
nodebase->dosleepdetect = 0;
switch (c)
{
case 'Y':
{
c_flag = FALSE;
if (nodebase->CU.XpertLevel > 1) // Er vi expert eller høyere
DelText (8, usea4a5);
else
DelText (17, usea4a5);
cur_line = 0;
break;
}
case ' ': // Samme som Y
{
c_flag = FALSE;
if (nodebase->CU.XpertLevel > 1) // Er vi expert eller høyere
DelText (8, usea4a5);
else
DelText (17, usea4a5);
cur_line = 0;
break;
}
case 13: // Return da gir vi kun 1 linje
{
c_flag = FALSE;
if (nodebase->CU.XpertLevel > 1) // Er vi expert eller høyere
DelText (8, usea4a5);
else
DelText (17, usea4a5);
cur_line = nodebase->CU.PageLength - 1;
break;
}
case 'N':
{
c_flag = FALSE;
go_flag = FALSE;
putreg (REG_A6,exebase);
writetexti ("\n", usea4a5);
break;
}
case -1: // Ejecta?
{
c_flag = FALSE;
go_flag = FALSE;
putreg (REG_A6,exebase);
writetexti ("\n", usea4a5);
break;
}
case 0: // Quit ABBS
{
c_flag = FALSE;
go_flag = FALSE;
putreg (REG_A6,exebase);
writetexti ("\n", usea4a5);
break;
}
case 'C': // Vi fortsetter
{
c_flag = FALSE;
if (nodebase->CU.XpertLevel > 1) // Er vi expert eller høyere
DelText (8, usea4a5);
else
DelText (17, usea4a5);
cur_line = 35535; // Skal vel holde det ;)
break;
}
/*
default:
{
msprintf (Dummy, "%ld\n", c);
putreg (REG_A6,exebase);
writetexti (Dummy, usea4a5);
break;
}
*/
}
}
}
}
if (teller == config->ActiveConf)
go_flag = FALSE;
}
}
}
}
nodebase->linesleft = linesleft;
return (TRUE);
}
// ******************************************************************************
// ***************************** CONFERENCE BROWSER (CB) ************************
// ******************************************************************************
#define MEMBER 31
#define OBLIGATORY 34
#define NON_MEMBER 36
typedef struct
{
char Name[81];
UWORD flag;
UWORD confnr;
} CB_header;
CB_header far head[500];
__asm far VOID Update_names (register __d0 int active_conf, register __d1 int max_lines, register __d2 BOOL mode, a4a5)
{
int n;
int start;
if (mode) // ned
start = active_conf - max_lines;
else
start = active_conf - 1;
putreg (REG_A6,exebase);
writecontext (CursorOffData,usea4a5);
putreg (REG_A6,exebase);
writetexti ("[4;1H", usea4a5);
putreg (REG_A6,exebase);
for (n = start; n < start + max_lines; n++) // Printer ut...
{
msprintf (Dummy, "[%ldm%-30s", head[n].flag, head[n].Name);
writetexti (Dummy, usea4a5);
if (n < start + max_lines - 1)
writetexti ("\n", usea4a5);
else
{
msprintf (Dummy, "[%ld;1H", max_lines + 3);
writetexti (Dummy, usea4a5);
}
}
putreg (REG_A6,exebase);
writecontext (CursorOnData,usea4a5);
}
BOOL Check_conf_text (char *Conf)
{
char My_conf[31];
char Filename[108] = "ABBS:Text/Conf_text/";
strcpy (My_conf, Conf);
Slash_to_space (My_conf);
strcat (Filename, My_conf);
if (FileSize (Filename) > 0)
return (TRUE);
else
return (FALSE);
}
__asm far VOID ABBS_version (a4a5)
{
BPTR fh;