forked from oe5hpm/openBCM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
1906 lines (1857 loc) · 51.4 KB
/
main.cpp
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
/***************************************************************
BayCom(R) Packet-Radio fuer IBM PC
OpenBCM-Mailbox
-------------------------
Hauptprogramm der Mailbox
-------------------------
GNU GPL
Copyright (C) Florian Radlherr et al.
Taubenbergstr. 32
83627 Warngau
Alle Rechte vorbehalten / All Rights Reserved
***************************************************************/
//19980115 OE3DZW added "options" to version-cmd
// added time in utc in "time" cmd
//19880118 OE3DZW sec in timestr
//19980124 OE3DZW renamed ELOG to ERLOG (for run-util EL) für DOS
// added rejlog (Log of all rejects)
// date/time in more detail opt -a,-f
//19980202 OE3DZW added support for callformat (output of "version")
//19980211 OE3DZW added option for serv
//19980212 OE3DZW moved "start"-msg to top of start-sequence
//19980308 OE3DZW cd with no parameter will cd to home directory
//19980311 DG9MHZ changes for Linux AX25-Kernel support
//19980329 OE3DZW new osver
//19980404 OE3DZW added options in version, os in startup-msg
//19980404 hrx support for guests
//19980408 hrx putversion() - line with cbmodeid changed
// added checkcount to beftab/befnum/cases
//19980411 hrx added autopath to beftab/befnum/cases, added
// autofwd as installed options identifier
//19980418 OE3DZW added status ipsockets
//19980419 OE3DZW added command ? = help
//19980423 OE3DZW added serv-if to "info", removed "user" from fwd
//19980614 hrx added paclen as installed options identifier,
// changed autopath syntax help
//19980619 OE3DZW added parameter for m_commandnotavail
//19980707 DH3MB Made runutils-interface optional (#define RUNUTILS)
//19980709 DH3MB added "cmdlist"
//19980830 OE3DZW added obligatory string to command not avail - guest-bug
//19980909 OE3DZW fixed DH3MB's runutil-list, showed only last line
//19981013 OE3DZW commented out nntp server (not finished)
//19990117 OE3DZW added convat
//19990220 DK2UI "lt" (=setlifetime)
//19990221 OE3DZW added loadaverage of system (Linux only)
//19990703 DH3MB VERSION shows unix-time
//19990726 DF3VI next will show next mail even if following mail is deleted
//19990814 DH3MB Changed the behaviour of sending CRs after a command
// has been received (see below for details)
//19990816 DH3MB If box is disabled, also "MD2" and "MD5" can be used
// for sysop authentication
//19991125 DF3VI in mailbef(): don't call convers or logouts from convers
//19991220 Jan new cmdnotavail(char *), prints invalid cmd msgs
//19991225 DF3VI Added job j_tell, block commands you cannot tell.
//19999999 DF3VI moved reject- and rlog-cmd to mbsysop!
//20000101 dk2ui (dzw) added QT (quit without quit) and optional UI_LDN
//20000106 F1ULQ "T" will start TALK, not show TIME
//20000116 DK2UI (dzw) added ui-options
//20000414 DF3VI Used Alter Grep for PS, need some changes calling listprocess
//20021211 hpk if user is logged in as guest, some commands like erase,
// unerase, ect. are not allowed for him
//20030726 DH8YMB added emptytempdir
//20041009 DH8YMB added CT (sets lastdirnews to current time)
#include "baycom.h"
mailpara_t m;
#ifdef _TELEPHONE // JJ
ttypara_t tty;
#endif
time_t einschaltzeit, initzeit;
/*---------------------------------------------------------------------------*/
static int near testaktiv (char *call, char *uplink)
//*************************************************************************
//
// Testet, ob die Mailbox disabled/enabled ist
//
//*************************************************************************
{
char s[LINELEN+1];
if ( (m.disable && strcmp(uplink, "Import"))
|| ( m.sf_only && strcmp(uplink, "Import")
&& isforwardpartner(call) == NOTFOUND)) //df3vi: Nur S&F/SYSOPs
{
putf(ms(m_maintenance), m.boxname);
b->msg_loadnum--;
if (stricmp(call, m.sysopcall))
{
getline(s, LINELEN, 1); // accept only pw and sys
if (! strncasecmp(s, "pw", 2) || ! strncasecmp(s, "sy", 2))
getpw();
#ifdef FEATURE_MDPW
else
if (! stricmp(s, "md2"))
getMDsysoppw(2);
else
if (! stricmp(s, "md5"))
getMDsysoppw(5);
#endif
return b->sysop;
}
}
return OK;
}
/*---------------------------------------------------------------------------*/
int checkquota (void)
//*************************************************************************
//
// Testet, ob QUOTA erreicht wurde
//
//*************************************************************************
{
if (m.userquota && ! b->sysop && (u->status != 1)
#ifdef FEATURE_SERIAL
&& strcmp(b->uplink, "TTY")
#endif
)
{
if ((u->daybytes+b->rxbytes+b->txbytes) > ((unsigned) m.userquota*1000L))
{
putf(ms(m_quotaexceed), m.userquota);
putf(ms(m_nobulletinmore));
return OK;
}
}
return NO;
}
/*---------------------------------------------------------------------------*/
static char *near makepath (char *path, char *part)
//*************************************************************************
//
//*************************************************************************
{
if (*part == '/' || *part == '\\' || part[1] == ':') return part;
strcat(path, part);
strlwr(path);
return path;
}
/*---------------------------------------------------------------------------*/
static char *mb (char *path, int total)
//*************************************************************************
//
//*************************************************************************
{
static char s[30];
long kb = dfree(path, total);
if (kb < 10000L) sprintf(s, "%ld kB", kb);
else sprintf(s, "%ld MB", kb >> 10);
return s;
}
/*---------------------------------------------------------------------------*/
#ifdef __LINUX__
static void near putlddversion (void)
//*************************************************************************
//
// Gibt die Ausgabe von "LDD BCM" unter Linux zurueck
//
//*************************************************************************
{
FILE *bcmfile;
if (! (bcmfile = s_fopen("bcm", "srt")))
putf("Can't access file 'bcm' - exiting lddversion.");
else
{
putf("Used Libarys:\n");
oshell("ldd bcm", sh_noinput);
putf("\n");
s_fclose(bcmfile);
}
/*
#include "elf.h"
#include <sys/mman.h>
#include <sys/stat.h>
Elf32_Ehdr *ehdr = NULL;
struct stat statbuf;
FILE *thefile;
if (!(thefile = s_fopen("bcm", "srt")))
putf("Can't open BCM");
else
{
fstat(fileno(thefile), &statbuf);
ehdr = (Elf32_Ehdr *)mmap(0, statbuf.st_size,
PROT_READ|PROT_WRITE, MAP_PRIVATE,
fileno(thefile), 0);
if (ehdr->e_type != ET_EXEC && ehdr->e_type != ET_DYN)
putf("This is not a dynamic executable %d\n", ehdr->e_type);
else
putf("This is a dynamic executable %d\n", ehdr->e_type);
}
*/
}
#endif
/*---------------------------------------------------------------------------*/
static void near putversion (void)
//*************************************************************************
//
// Gibt Versionsinfo aus
//
//*************************************************************************
{
char path[40];
unsigned bs = strlen(globalpath) - 1;
#ifdef __LINUX__
char osver[256];
FILE *f = s_fopen("/proc/version", "srt");
if (f)
{
fgets(osver, sizeof(osver), f);
s_fclose(f);
}
else *osver = 0;
#endif
strcpy(path, globalpath);
strlwr(path);
putf("Date: %s\n", datestr(ad_time(), 12));
putf("\n" LOGINSIGN);
if (m.callformat)
putf(" "CBMODEID);
putf("\n" AUTHOR_ID);
#ifdef __FLAT__
if (b->http)
html_putf("<a href=" WEBSITE ">" WEBSITE "</a>");
else
#endif
putf(WEBSITE);
putf("\n");
if (m.callformat)
{
putf(CBSUPPORT);
#ifdef __FLAT__
if (b->http)
html_putf("<a href=" WEBSITE_CB ">" WEBSITE_CB "</a>");
else
#endif
putf(WEBSITE_CB);
putf("\n");
}
#ifdef __LINUX__
putf("Compiled "__DATE__" "__TIME__ " with GCC "__VERSION__);
#else
putf("Compiled "__DATE__" "__TIME__);
#endif
char features[] = ""
#ifdef FILESURF
"filesurf "
#endif
#ifdef MAILSERVER
"mailserver "
#endif
#ifdef DF3VI_POCSAG
"pocsagserver "
#endif
#ifdef SERVIF
"servif "
#endif
#ifdef RADIOIF
"radioif "
#endif
#ifdef FEATURE_MDPW
"mdpw "
#endif
#ifdef FEATURE_SERIAL
"serial "
#endif
#ifdef FEATURE_EDITOR
"editor "
#endif
#ifdef _TELEPHONE
"telephone "
#endif
#ifdef _GUEST
"guest "
#endif
#ifdef _AX25K
"ax25k "
#endif
#ifdef _AUTOFWD
"autofwd "
#endif
#ifdef _MORSED
"morsed "
#endif
#ifdef RUNUTILS
"runutils "
#endif
#ifdef MACRO
"macro "
#endif
#ifdef _WXSTN
"wxstn "
#endif
#ifdef FEATURE_YAPP
"yapp "
#endif
#ifdef _FILEFWD
"filefwd "
#endif
#ifdef _TELNETFWD
"telnetfwd "
#endif
#ifdef FEATURE_DIDADIT
"didadit "
#endif
#ifdef USERLT
"userLT "
#endif
#ifdef BIOS_Y2K
"y2k "
#endif
#ifdef DF3VI_FWD_EDIT // fwd-editor
"fwd-edit "
#endif
#ifdef DF3VI_REJ_EDIT // reject.bcm-editor
"rej-edit "
#endif
#ifdef DF3VI_CONV_EDIT // convert.bcm-editor
"conv-edit "
#endif
#ifdef DF3VI_EXTRACT // extract-befehl
"extract "
#endif
#ifdef _BCMNET_GW // CB-BCMNET Gateway features
"cb-bcmnet-gateway "
#elif defined _BCMNET_FWD // CB-BCMNET features
"cb-bcmnet "
#endif
#ifdef FBBCHECKREAD
"fbbcheckmode "
#endif
#ifdef _USERS4CONVERT
"users4convert "
#endif
#ifdef DIEBOX_UIMPORT
"diebox-uimport "
#endif
#ifdef FULLTEXTSEARCH
"fts "
#endif
#ifdef OLDMAILIMPORT
"oldmailimport "
#endif
#ifdef LINUXSYSTEMUSER
"linuxsystemuser "
#endif
"";
char *p_features = features;
#ifdef __LINUX__
if (strlen(p_features)) putf("\nand support for:");
#else
if (strlen(p_features)) putf(" with support for:");
#endif
putv(LF);
while (strlen(p_features) > 40 && strchr(p_features + 40, ' ')) // DH3MB
{
subst1(p_features + 40, ' ', 0);
putf("%s\n", p_features);
p_features += strlen(p_features) + 1;
}
if (strlen(p_features))
putf("%s\n", p_features);
putf("Uptime: %s\n", zeitspanne(ad_time() - einschaltzeit, zs_runtime));
putf("%s\n", cpuinfo());
#ifdef __LINUX__
putf("OS: %-20.20s\n", osver);
#endif
putf("PR-Interface: ");
putversion_tnc();
#ifdef __DPMI32__
putf("Available Memory Extended/Real : %s kB / %s kB\n",
memfree(0), memfree(1));
#elif defined(__DOS16__)
putf("Available Memory : %s kB\n",
memfree(0));
#else
putf("Available Memory / Used Swap : %s kB / %s kB\n",
memfree(0), memfree(1));
#endif
putf("Info-Path: %-32s : %s", makepath(path, m.infopath), mb(m.infopath,0));
putf(" (%s)\n", mb(m.infopath, 1));
path[bs + 1] = 0;
putf("User-Path: %-32s : %s", makepath(path, m.userpath), mb(m.userpath,0));
putf(" (%s)\n", mb(m.userpath, 1));
path[bs + 1] = 0;
if (bs > 3) path[bs] = 0;
putf("BCM-Home: %-32s : %s", path, mb(".", 0));
putf(" (%s)\n", mb(".", 1));
#ifdef FILESURF
unsigned int i, anz;
char worte[MAXPARSE];
char s1[FSPATHLEN+1];
char *s2;
strcpy(s1, m.fspath);
anz = parseline(s1, worte);
putf("Filesurf: ");
if (! anz)
putf("disabled\n");
else
{
for (i = 0; i < anz; i++)
{
s2 = (s1 + worte[i]);
if (! strcmp(s2, "off"))
putf("not defined\n");
else
{
if (s2[0] == '+')
{
s2++;
if (filetime(s2) > 0)
putf("*%-31s : %s", makepath(path, s2), mb(s2, 0));
else
putf("*%-31s : not existing", makepath(path, s2));
}
else
if (filetime(s2) > 0)
putf("%-32s : %s", makepath(path, s2), mb(s2, 0));
else
putf("%-32s : not existing", makepath(path, s2));
if (filetime(s2) > 0)
putf(" (%s)\n", mb(s2, 1));
else
putf("\n");
if (((i+1) < anz)) putf(" ");
}
}
}
#endif
}
/*---------------------------------------------------------------------------*/
int mailbef (char *befline, int echo)
//*************************************************************************
//
//*************************************************************************
{
int cmdnum;
char cbuf[CMDBUFLEN+1];
char *befbuf;
char searchitem[31];
char wlogbuf[40];
char boxcall[CALLEN+1];
#ifdef __LINUX__
char loadavg[256];
#endif
#ifdef __FLAT__
char hostname[65];
#endif
#ifdef FILESURF
filesurf fs;
#endif
static char *beftab[]=
{ "ALTER", "DIR", "LIST", "SEND", "SA", "SB", "SP", "READ", "TALK", "WRITE", "WALL",
"ERASE", "FORWARD", "TRANSFER", "REPLY", "HELP", "?", "HEADER", "KOPF",
"CHECK", "CD", "QUIT", "CT", "QT", "BYE", "MSG", "MYBBS", "NEXT", "NH", "USERS", "TIME", "DATE",
"AKTUELL", "PATH", "CONVERS", "CHAT", "UNERASE", "SETLIFETIME", "LT", "STATUS",
"LOG", "INFO", "VERSION", "BIDLIST", "PS", "SEMAPHORES", "MEM", "PW", "SYSOP", "PRIV",
"WHOAMI", "QUOTA", "PURGE", "PARAMETER", "FIND", "#OK#", "BIN-RX", "BIN-TX", "(BIN-RX):", "(BIN-TX):",
"(YAPP-RX):", "(YAPP-TX):", "(DIDADIT-RX):", "(DIDADIT-TX):", "<GP>:", "(WPP)",
"CRONTAB", "CONVAT", "REJECT", "CONVERT", "NAME", "EXIT", "F>", "FINGER", "SLOG", "SWAPLOG", "ERLOG",
"UNKNOWN", "SLEEP", "SF", "MAN", "COMMENT", "FOLLOWUP", "LOGOUT", "PWLOG", "CP", "SFHOLD",
"FWDCHECK",
#ifdef __FLAT__
"NNTPLOG", "HTTPLOG", "POP3LOG", "SMTPLOG", "FTPLOG", "L2INFO",
#endif
#ifdef FULLTEXTSEARCH
"FTS",
#endif
#ifdef _WXSTN
"WX",
#endif
#ifdef HB9EAS_DEBUG
"HB9EAS_DEBUG",
#endif
#ifdef __LINUX__
"LDDVERSION",
#endif
#ifdef FEATURE_MDPW
"MD2", "MD5",
#endif
"RLOG",
#ifdef FILESURF
"FILESURF", "FS", "FILESERVER",
#endif
#ifdef MAILSERVER
"MAILSERVER",
#endif
#ifdef DF3VI_POCSAG
"POCSAGSERVER",
#endif
"CHECKCOUNT",
#ifdef _AUTOFWD
"AUTOPATH",
#endif
#ifdef RUNUTILS
"RUNUTILS",
#endif
"TELL", "PING", "UNREAD", "IMPDEL", "CMDLIST", "WLOG",
NULL
};
enum befnum
{ unsinn,
alter, dir, list, send_, sa, sb, sp, read_, talk, write_, wall,
erase, forward, transfer, reply, help, help_, header, kopf,
check, cd, quit, ct, qt, bye, msg, mybbs, next, nh, users, showtime, showtime_,
aktuell, path, convers_, chat, unerase, setlifetime, lt, status,
log, info, version, bidlist, ps, semas, mem, pw, sysop, priv,
whoami, quota, purge, parameter, find, d_ok, d_binrx, d_bintx, d_binrx2, d_bintx2,
d_yapprx, d_yapptx, d_didaditrx, d_didadittx, d_gp, d_wpp,
crontab, convat_, reject_, convert_, name, exit_, fwd_, finger, slog, swaplog, erlog,
unknown, sleep_, sf, man, comment, followup, logout, pwlog_, cp, sfhold,
fwdcheck_,
#ifdef __FLAT__
nntplog_, httplog_, pop3log_, smtplog_, ftplog_, l2info,
#endif
#ifdef FULLTEXTSEARCH
fts,
#endif
#ifdef _WXSTN
_wx,
#endif
#ifdef HB9EAS_DEBUG
hb9eas_debug,
#endif
#ifdef __LINUX__
lddversion,
#endif
#ifdef FEATURE_MDPW
md2, md5,
#endif
rlog,
#ifdef FILESURF
filesurf_, fs_, fileserver,
#endif
#ifdef MAILSERVER
mailserver,
#endif
#ifdef DF3VI_POCSAG
pocsagserver,
#endif
checkcount,
#ifdef _AUTOFWD
autopath_,
#endif
#ifdef RUNUTILS
runutils,
#endif
send_tell_, ping, unread, impdel, cmdlist, wprotlog_
} cmd = unsinn;
if (strlen(befline) > CMDBUFLEN)
{
befline[CMDBUFLEN] = 0;
}
// use ESCAPE-[-A (upper arrow) to get back to last cmd-line
if (*befline == ESC
&& befline[1] == '['
&& befline[2] == 'A'
&& *t->lastcmd)
strcpy(befline, t->lastcmd);
strncpy(cbuf, befline, CMDBUFLEN);
cbuf[CMDBUFLEN] = 0;
lastcmd(befline);
if (b->quit)
return 1;
cut_blank(cbuf);
befbuf = cbuf;
befbuf += blkill(befbuf);
if (echo && u->echo && t->input == io_tnc)
putf("%s", befbuf);
#ifdef FILESURF
if (b->fsmode)
{
fs.execute(befbuf);
return 0;
}
#endif
if (! *befbuf)
{
if (u->lf != 6)
putv(LF);
b->eingabefehler++;
return 1;
}
trace(report, b->logincall, "%s", befbuf);
if (b->sysop)
cmdlog(befbuf);
#ifdef MACRO
if (mk_perform(MK_CMD, befbuf))
return 0;
if (b->sysop && mk_perform(MK_SCMD, befbuf))
return 0;
#endif
cmd = (befnum) readcmd(beftab, &befbuf, 0);
switch (cmd)
{
case bye:
case quit:
case exit_:
case logout:
case read_:
case unsinn:
break;
default:
if (u->lf != 6)
putv(LF);
if (cmd != pw && cmd != sysop && b->job != j_convers)
leerzeile(); // Sends the number of CRs stored in "ALTER LF"
}
//Negative lists of commands (not available in some cases)
//*** GUEST ***
#ifdef _GUEST
if (! strcmp(b->logincall, m.guestcall))
switch (cmd) //list of commands not available for guests
{
case talk:
case msg:
case chat:
case convers_:
case write_:
case wall:
case priv:
case pw:
case sysop:
#ifdef FEATURE_MDPW
case md2:
case md5:
#endif
#ifdef MAILSERVER
case mailserver:
#endif
#ifdef DF3VI_POCSAG
case pocsagserver:
#endif
{
b->eingabefehler += 5;
putf(ms(m_cmdinvalid), befline);
return 1;
}
default: break;
}
#endif
//*** SPAMER ***
if (u->status & 8)
switch (cmd) //list of commands not available for spamer
{
case wall:
case cp:
case transfer:
#ifdef FILESURF
case filesurf_:
case fs_:
case fileserver:
#endif
#ifdef MAILSERVER
case mailserver:
#endif
#ifdef DF3VI_POCSAG
case pocsagserver:
#endif
{
b->eingabefehler += 5;
putf(ms(m_cmdinvalid), befline);
return 1;
}
default: break;
}
//*** TELL ***
if (b->job == j_tell) //list of commands not available for "tell"
switch (cmd)
{
case next:
case purge:
case nh:
case mybbs:
case bye:
case exit_:
case logout:
case quit:
case ct:
case qt:
case sb:
case sp:
case sa:
case send_:
case reply:
case followup:
case comment:
case name:
case wall:
case talk:
case msg:
case chat:
case convers_:
case write_:
case cp:
case transfer:
#ifdef FILESURF
case filesurf_:
case fs_:
case fileserver:
#endif
case fwd_:
case sleep_:
case impdel:
#ifdef MAILSERVER
case mailserver:
#endif
case priv:
case pw:
case sysop:
#ifdef FEATURE_MDPW
case md2:
case md5:
#endif
case help:
case help_:
case man:
{
b->eingabefehler += 5;
putf(ms(m_cmdinvalid), befline);
return 1;
}
default: break;
}
//*** CONVERS ***
if (b->job == j_convers) //list of commands not available during convers
switch (cmd)
{
case bye:
case exit_:
case logout:
case quit:
case ct:
case qt:
case talk:
case msg:
case chat:
case convers_:
case write_:
case wall:
case priv:
case pw:
#ifdef FEATURE_MDPW
case md2:
case md5:
#endif
#ifdef FILESURF
case filesurf_:
case fs_:
case fileserver:
#endif
{
b->eingabefehler += 5;
putf(ms(m_cmdinvalid), befline);
return 1;
}
default: break;
}
#ifdef __FLAT__
//*** HTTP ***
if (! strcmp (b->uplink, "HTTP")) //list of commands not available via http
switch (cmd)
{
case next:
case bye:
case exit_:
case logout:
case quit:
case reply:
case comment:
case followup:
case talk:
case msg:
case chat:
case convers_:
case write_:
case priv:
case pw:
case sysop:
#ifdef FEATURE_MDPW
case md2:
case md5:
#endif
#ifdef FILESURF
case sleep_:
case filesurf_:
case fs_:
case fileserver:
#endif
{
b->eingabefehler += 5;
putf(ms(m_http_not));
return 1;
}
default: break;
}
#endif
//*** WITHOUT PW ***
if (m.userpw >= 2 && ! b->pwok && ! b->sysop)
switch (cmd) // list of command not available without pw
{
case send_:
case sp:
case sb:
case sa:
case reply:
case followup:
case comment:
case erase:
case unerase:
case transfer:
case cp:
case purge:
case priv:
case sysop:
#ifdef FEATURE_MDPW
case md2:
case md5:
#endif
{
putf(ms(m_no_pw));
return 1;
}
default: break;
}
#ifdef _BCMNET_LOGIN
//*** WRONG LOGINTYPE ***
if (! b->logintype && ! b->sysop)
switch (cmd) //list of commands not available with wrong logintype
{
case erase:
case unerase:
case transfer:
case cp:
case lt:
case purge:
{
putf(ms(m_no_pw));
return 1;
}
default: break;
}
#endif
mk_perform(MK_BEFORECMD, cbuf);
switch (cmd)
{
case unsinn:
if (
#ifdef RUNUTILS
! start_runutil(cbuf) &&
#endif
! (b->sysop && sysbef(cbuf)))
{
if (u->lf != 6)
putv(LF);
putf(ms(m_cmdinvalid), befline);
if (u->helplevel)
putf(ms(m_possiblecommands));
b->eingabefehler += 5;
return 1;
}
break;
case quota:
mbalter("QUOTA", befbuf, b->logincall);
break;
case purge:
if (! b->sysop)
*befbuf = 0;
userpurge(befbuf);
break;
case nh:
case mybbs:
if (*befbuf)
mbalter("FORWARD", befbuf, b->logincall);
else
putf(ms(m_syntaxmybbs));
break;
case finger:
case users:
if (mbcallok(befbuf) == 1)
display_parameter(befbuf, 0);
else
if (! *befbuf)
listusers(1);
else
if (*befbuf == '*')
listusers(2);
else
{
scanoptions(befbuf);
befbuf += blkill(befbuf);
usersuch(befbuf);
}
break;
case alter:
mbalter(NULL, befbuf, b->logincall);
break;
case bye:
b->quit = 1;
break;
case exit_:
case logout:
case quit:
if (cmd == quit)
b->quit = 2;
else
b->quit = 1;
loaduser(b->logincall, u, 1);
u->lastdirnews = b->lastdirnews;
u->lastquit = ad_time();
saveuser(u);
break;
case ct:
#ifdef _GUEST
if (! strcmp(b->logincall, m.guestcall))
{
putf(ms(m_cmdinvalid), "ct");
break;
}
else
#endif
{
loaduser(b->logincall, u, 1);
u->lastdirnews = ad_time();
b->lastdirnews = ad_time();
saveuser(u);
putf("Last D N (CHECK) is set to: %s\n",
datestr(u->lastdirnews, 12));
break;
}
case qt:
#ifdef _GUEST
if (! strcmp(b->logincall, m.guestcall))
{
putf(ms(m_cmdinvalid), "qt");
break;
}
else
#endif
{
loaduser(b->logincall, u, 1);
u->lastdirnews = b->lastdirnews;
u->lastquit = ad_time();
saveuser(u);
putf("Last QUIT is set to current time: %s\n",
datestr(u->lastquit, 12));
break;
}
case send_:
case sb:
case sp:
case sa:
if (cmd == send_)
b->mailtype = '?';
else
if (cmd == sb)
b->mailtype = 'B';
else
if (cmd == sp)
b->mailtype = 'P';
else
if (cmd == sa)
b->mailtype = 'A';
b->job = j_send;
/* if (b->http > 0)
{
putf("Not possible in HTTP session!\n");
break;
}
*/
if (*befbuf)
mbsend(befbuf, 1);