forked from csgauthier/iscabbs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.c
1439 lines (1257 loc) · 33.3 KB
/
setup.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
/*
* setup.c: Handles function of the change (setup) menu.
*/
#include "defs.h"
#include "ext.h"
static void assignquickx (int slot, struct user *tmpuser);
static void change_addr(struct user *tuser, int chflag);
static void change_aide_info(struct user *tuser);
static void change_anonymous(struct user *tuser, int chflag);
static void change_info(struct user *tuser);
static void change_name(struct user *workuser);
static void change_pass(struct user *tuser, int noold);
static void change_reminder(struct user *tuser);
static struct user * change_user(void);
static void change_vanityflag (struct user *tmpuser);
static void do_bigzap (struct user *tmpuser);
static void foptions(struct user *tuser);
static void ooptions(struct user *tuser);
static void show_verified(struct user *workuser);
static void userlist_config(struct user *tmpuser, int chflag);
static void xoptions(struct user *tuser);
/*
* Setup Menu.
*/
void
change_setup(struct user *workuser)
{
int c = -1;
int i;
int chflag;
struct user *up = NULL;
if (ouruser->f_twit)
{
my_printf("\nYou are not allowed to enter the change menu.\n");
return;
}
if (!workuser)
{
workuser = ouruser;
chflag = 0;
if (!ouruser->f_admin)
my_printf("\nPress '?' for a list of commands.\n");
}
else
chflag = -1;
for(;;)
{
if (c)
{
if (chflag)
colorize("\n@YChange config (@R%s@Y) -> @G", workuser->name);
else
colorize("\n@YChange config -> @G");
}
if (ouruser->f_admin)
c = get_single_quiet(" aACfFHIKMnNOPqQRSTUvVXZ?\n");
else
{
c = get_single_quiet(" ACfHIMOPqQRSTXZ?\n");
if (c == 'A')
c = 'a';
}
if (strchr("dn", c))
{
c = 0;
continue;
}
else if (chflag && (c == 'C' || c == 'R' || c == 'T') && !workuser->f_admin)
{
my_printf("\n\nMust be working on yourself to use this option.\n");
continue;
}
else if (!chflag && (c == 'F' || c == 'N'))
{
my_printf("\n\nMust be working on a user to use this option.\n");
continue;
}
else if (chflag < 0 && (c == 'U' || c == 'N'))
{
my_printf("\n\nCannot use this option while validating.\n");
continue;
}
else if (c == 'C' && !client)
{
my_printf("\n\nYou are not using the BBS client. For more information on the BBS client,\nplease see the 'Client' helpfile.\n");
continue;
}
switch (c)
{
case 'a':
my_printf("Change address\n");
change_addr(workuser, chflag);
break;
case 'A':
my_printf("Change sysop info\n");
change_aide_info(workuser);
break;
case 'C':
my_printf("Client configuration\n");
my_putchar(IAC);
my_putchar(CONFIG);
my_putchar(0);
my_putc((byte >> 16) & 255, stdout);
my_putc((byte >> 8) & 255, stdout);
my_putc(byte & 255, stdout);
block = 1;
(void)get_single_quiet("\n");
break;
case 'f':
my_printf ("Edit vanityflag\n");
change_vanityflag (workuser);
break;
case 'F':
my_printf("Edit flags\n");
foptions(workuser);
break;
case 'H':
my_printf("Help\n");
help("setup", NO);
break;
case '?':
my_printf("Short help\n");
if(ouruser->f_admin) {
help("setupshort.aide", NO);
} else {
help("setupshort.user", NO);
}
break;
case 'I':
my_printf("Change profile info\n\n");
change_info(workuser);
break;
case 'K':
knrooms (workuser);
break;
case '\n':
case ' ':
case 'M':
if (chflag >= 0)
{
my_printf("Return to message system\n");
freeuser(workuser);
}
else
my_putchar('\n');
return;
case 'N':
my_printf("Change user name\n");
change_name(workuser);
break;
case 'O':
my_printf("Other options\n");
ooptions(workuser);
break;
case 'P':
my_printf("Change password\n");
change_pass(workuser, chflag);
break;
case 'q':
case 'Q':
my_printf("\n\nIf you have a question related to this BBS to ask a Guide, you need to exit the\nconfig menu (the menu you are currently in) first. To do so, press the space\nbar. You may then hit shift 'Q' (capital 'Q' not lowercase 'q') to ask your\nquestion.\n");
break;
case 'R':
my_printf("Change reminder\n");
change_reminder(workuser);
break;
case 'S':
my_printf("Change secret status\n");
change_anonymous(workuser, chflag);
break;
case 'T':
my_printf ("Termset\n");
askansi();
break;
case 'U':
my_printf("Change user\n");
if ((workuser = change_user()))
chflag = 1;
else
{
workuser = ouruser;
chflag = 0;
}
break;
case 'V':
my_printf("Verify address information\n");
do_verify(workuser, 1);
break;
case 'v':
my_printf("Show verified information\n");
my_printf("\nVerified information for user: %s\n", workuser->name);
show_verified(workuser);
break;
case 'X':
my_printf("X message configuration\n");
while (c != '\n' && c != 'Q' && c != ' ')
{
colorize("\n@Y<0-9> @GAssign QuickX @Y<L>@Gist QuickX @Y<O>@Gptions @Y<U>@Gser @Y<Q>@Guit -> ");
c = get_single_quiet("0123456789LUO\n Q");
switch (c)
{
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
my_printf ("%c\n\n", c);
assignquickx (c - '0', workuser);
break;
case 'L':
my_printf ("List QuickX\n\n");
my_printf (" Key User\n");
for (i = 0; i < 10; i++)
{
up = NULL;
if (workuser->quickx[i])
{
up = finduser (NULL, workuser->quickx[i], 0);
if (!up)
{
locks (SEM_USER);
ouruser->quickx[i] = 0L;
unlocks (SEM_USER);
}
}
my_printf (" %d %s\n", i, up ? up->name : "<empty>");
}
break;
case 'U':
userlist_config (workuser, chflag);
break;
case 'O':
my_printf ("\n\n");
xoptions (workuser);
break;
default:
my_putchar ('\n');
break;
} /* switch */
} /* for (;;) */
break;
case 'Z':
my_printf ("BBS wide room zapper\n\n");
do_bigzap (workuser);
break;
}
}
}
static void
change_addr(struct user *tuser, int chflag)
{
char answer[41];
my_printf("\nEnter your address information. To leave a entry alone, just hit return.\n\n");
if (chflag)
{
char * name = my_sprintf(NULL,"Name [%s]: ", tuser->real_name);
get_string(name, 40, answer, -1);
if (*answer)
{
locks(SEM_USER);
strcpy(tuser->real_name, answer);
unlocks(SEM_USER);
}
free(name);
}
else
{
my_printf("Are you sure? (Y/N) -> ");
if (!yesno(-1))
return;
}
// addr1
char * addr1 = my_sprintf(NULL,"Street & house/apt# [%s]: ", tuser->addr1);
get_string(addr1, 40, answer, -1);
if (*answer)
{
locks(SEM_USER);
strcpy(tuser->addr1, answer);
unlocks(SEM_USER);
}
free(addr1);
// addr2
char * addr2 = my_sprintf(NULL," [%s]: ", tuser->addr2);
get_string (addr2, 40, answer, -1);
if (*answer)
{
if (!strcmp (answer, "NONE"))
*answer = 0;
locks (SEM_USER);
strcpy (tuser->addr2, answer);
unlocks (SEM_USER);
}
free(addr2);
// city
char * city = my_sprintf(NULL,"City [%s]: ", tuser->city);
get_string(city, 20, answer, -1);
if (*answer)
{
locks(SEM_USER);
strcpy(tuser->city, answer);
unlocks(SEM_USER);
}
free(city);
char * state = my_sprintf(NULL,"State or country [%s]: ", tuser->state);
get_string(state, 20, answer, -1);
if (*answer)
{
locks(SEM_USER);
strcpy(tuser->state, answer);
unlocks(SEM_USER);
}
free(state);
char * zip = my_sprintf(NULL,"ZIP or mail code [%s]: ", tuser->zip);
get_string(zip, 10, answer, -1);
if (*answer)
{
locks(SEM_USER);
strcpy(tuser->zip, answer);
unlocks(SEM_USER);
}
free(zip);
char * phone = my_sprintf(NULL,"Phone number (including all prefixes!) [%s]: ", tuser->phone);
get_string(phone, 20, answer, -1);
if (*answer)
{
if (!strcmp(answer, "NONE"))
*answer = 0;
locks(SEM_USER);
strcpy(tuser->phone, answer);
unlocks(SEM_USER);
}
free(phone);
char * email = my_sprintf(NULL,"Internet e-mail address [%s]: ", tuser->mail);
get_string(email, 40, answer, -1);
if (*answer)
{
locks(SEM_USER);
strcpy(tuser->mail, answer);
unlocks(SEM_USER);
}
free(email);
char * www = my_sprintf(NULL,"WWW address [%s]: ", tuser->www);
get_string(www, 59, answer, -1);
if (*answer)
{
if (!strcmp(answer, "NONE"))
*answer = 0;
locks(SEM_USER);
strcpy(tuser->www, answer);
unlocks(SEM_USER);
}
free(www);
}
static void
change_aide_info(struct user *tuser)
{
char junk[80];
if (*tuser->aideinfo)
my_printf("\nPrevious line of sysop info for %s:\n%s\n\nDo you wish to change this? (Y/N) -> ", tuser->name, tuser->aideinfo);
else
my_printf("\nDo you wish to add a line of sysop info for %s? (Y/N) -> ", tuser->name);
if (yesno(-1))
{
my_printf("\nEnter a single line of sysop info for %s:\n", tuser->name);
get_string(">", 77, junk, -1);
locks(SEM_USER);
strcpy(tuser->aideinfo, junk);
unlocks(SEM_USER);
}
}
static void
change_anonymous(struct user *tuser, int chflag)
{
int c;
my_printf("\nYou have the option of hiding some or all of your personal information (name,\naddress, phone, and e-mail) from others on this BBS.\n\n");
if (chflag)
{
my_printf("<H>ide all <Q>uit -> ");
c = get_single_quiet("HQ \n");
}
else
{
my_printf("<H>ide all <U>nhide all <S>elect individual items <Q>uit -> ");
c = get_single_quiet("HUSQ \n");
}
switch (c)
{
case ' ':
case '\n':
my_printf("Nothing changed\n");
return;
case 'H':
my_printf("Hide\n\nAll information hidden.\n");
locks(SEM_USER);
tuser->an_name = tuser->an_addr = tuser->an_location = tuser->an_phone = tuser->an_mail = tuser->an_www = tuser->an_site = 1;
tuser->an_all = 0;
unlocks(SEM_USER);
break;
case 'U':
my_printf("Unhide\n\nAll information public.\n");
locks(SEM_USER);
tuser->an_name = tuser->an_addr = tuser->an_location = tuser->an_phone = tuser->an_mail = tuser->an_www = tuser->an_site = 0;
tuser->an_all = 0;
unlocks(SEM_USER);
break;
case 'S':
my_printf("Select\n\nSelect individual items to hide...\n\n");
if (tuser->an_all)
{
locks(SEM_USER);
tuser->an_name = tuser->an_addr = tuser->an_location = tuser->an_phone = tuser->an_mail = tuser->an_www = tuser->an_site = 1;
tuser->an_all = 0;
unlocks(SEM_USER);
}
my_printf("Do you want to hide your real name? -> ");
if (yesno(tuser->an_name) != tuser->an_name)
{
locks(SEM_USER);
tuser->an_name ^= 1;
unlocks(SEM_USER);
}
my_printf("Do you want to hide your address? -> ");
if (yesno(tuser->an_addr) != tuser->an_addr)
{
locks(SEM_USER);
tuser->an_addr ^= 1;
unlocks(SEM_USER);
}
my_printf("Do you want to hide your city/state/zip? -> ");
if (yesno(tuser->an_location) != tuser->an_location)
{
locks(SEM_USER);
tuser->an_location ^= 1;
unlocks(SEM_USER);
}
my_printf("Do you want to hide your phone number? -> ");
if (yesno(tuser->an_phone) != tuser->an_phone)
{
locks(SEM_USER);
tuser->an_phone ^= 1;
unlocks(SEM_USER);
}
my_printf("Do you want to hide your e-mail address? -> ");
if (yesno(tuser->an_mail) != tuser->an_mail)
{
locks(SEM_USER);
tuser->an_mail ^= 1;
unlocks(SEM_USER);
}
my_printf("Do you want to hide your WWW address? -> ");
if (yesno(tuser->an_www) != tuser->an_www)
{
locks(SEM_USER);
tuser->an_www ^= 1;
unlocks(SEM_USER);
}
break;
}
}
static void
change_pass(struct user *tuser, int noold)
{
char pas[9],
original[9], pas2[9];
char temp[MAXALIAS + 1];
int i;
char *cp;
my_printf("\nChanging password for %s...\n", tuser->name);
if (!noold)
{
get_string("Old Password: ", -8, original, -1);
if (!*original)
{
my_printf("Ok, so I won't change it then.\n");
return;
}
cp = (char *)crypt(original, tuser->passwd);
if (strncmp(tuser->passwd, cp, 13))
{
my_printf("Incorrect old password!\n");
return;
}
}
get_string("New Password: ", -8, pas, -1);
get_string("Again for verification: ", -8, pas2, -1);
if (strcmp(pas, pas2))
{ /* If they didn't match */
colorize("\n@RYour passwords didn't match. Please try again.\n\n");
return;
}
if (strlen(pas) < 6)
{
colorize("\n@RYour password must be at least 6 characters long. Please try again.\n\n");
return;
}
for (i = 0; i <= strlen(tuser->name); i++)
if (tuser->name[i] >= 'A' && tuser->name[i] <= 'Z')
temp[i] = tuser->name[i] + 32;
else
temp[i] = tuser->name[i];
for (i = 0; i <= strlen(pas2); i++)
if (pas2[i] >= 'A' && pas2[i] <= 'Z')
pas2[i] += 32;
if (!strcmp(temp, pas2))
{
my_printf("\nYou cannot use your name as your password!\n\n");
return;
}
change_password(tuser, original, pas, noold);
my_printf("\nSo be it.\n");
}
static void
change_reminder(struct user *tuser)
{
char junk[80];
if (*tuser->reminder)
my_printf("\nCurrent Reminder line is:\n\n%s\n\nDo you want to change this? (Y/N) -> ", tuser->reminder);
else
my_printf("\nDo you want to set a reminder? (Y/N) -> ");
if (!yesno(-1))
return;
my_printf("\nEnter a single line of what you want yourself reminded of upon login:\n(Hit return to leave it blank and turn off the reminder)\n");
get_string(">", 77, junk, -1);
locks(SEM_USER);
strcpy(tuser->reminder, junk);
unlocks(SEM_USER);
}
/*
* Change user info
*
* Allow the user to change the description part of his/her profile.
*/
static void
change_info(struct user *tuser)
{
char junk[5][80];
int i;
if (*tuser->desc1)
my_printf("\nYour current info:\n %s\n", tuser->desc1);
if (*tuser->desc2)
my_printf(" %s\n", tuser->desc2);
if (*tuser->desc3)
my_printf(" %s\n", tuser->desc3);
if (*tuser->desc4)
my_printf(" %s\n", tuser->desc4);
if (*tuser->desc5)
my_printf(" %s\n", tuser->desc5);
if (*tuser->desc1)
{
my_printf("\nDo you wish to change this? (Y/N) -> ");
if (!yesno(-1))
return;
my_printf("Ok, you have five lines to do something creative.\n\n");
}
else
my_printf("Enter a description, up to 5 lines\n\n");
if (client)
{
my_putchar(IAC);
my_putchar(G_FIVE);
my_putchar(0);
my_putc((byte >> 16) & 255, stdout);
my_putc((byte >> 8) & 255, stdout);
my_putc(byte & 255, stdout);
block = 1;
}
*junk[1] = *junk[2] = *junk[3] = *junk[4] = 0;
for (i = 0; i < 5 && (!i || *junk[i - 1]); i++)
get_string(client ? "" : ">", 78, junk[i], i);
locks(SEM_USER);
strcpy(tuser->desc1, junk[0]);
strcpy(tuser->desc2, junk[1]);
strcpy(tuser->desc3, junk[2]);
strcpy(tuser->desc4, junk[3]);
strcpy(tuser->desc5, junk[4]);
unlocks(SEM_USER);
}
static void
change_name(struct user *workuser)
{
char work[60];
struct user *tmpuser = NULL;
int i;
my_printf("\nNew name for user '%s' -> ", workuser->name);
char * name = get_name("", 2);
if (!*name)
return;
else if (!strcmp(workuser->name, name))
my_printf("\nName has to be different!\n");
else if (strlen(name) == 1)
my_printf("\nName too short.\n");
else if (strlen(name) >= MAXALIAS)
my_printf("\nName too long.\n");
else if (!strcmp(name, "new") || strstr(name, "sysop") || strstr(name, "moderator") || strstr(name, "isca") || !strcmp(name, "guest") || (tmpuser = getuser(name)))
{
if (tmpuser != workuser)
freeuser(tmpuser);
my_printf("\nName already in use.\n");
}
else
{
my_printf("\nChange name of '%s' to '%s'? (Y/N) -> ", workuser->name, name);
flush_input(0);
if (yesno(-1))
{
long usernum;
locks(SEM_NEWBIE);
usernum = ++msg->eternal;
unlocks(SEM_NEWBIE);
if (!(tmpuser = adduser(name, usernum)))
{
errlog("Failed sysop user creation of '%s'", name);
my_printf("\nError creating new user file.\n");
return;
}
logout_user(workuser, NULL, 0);
bzero((void *)tmpuser, sizeof(struct user));
tmpuser->an_all = workuser->an_all;
tmpuser->an_name = workuser->an_name;
tmpuser->an_addr = workuser->an_addr;
tmpuser->an_location = workuser->an_location;
tmpuser->an_phone = workuser->an_phone;
tmpuser->an_mail = workuser->an_mail;
tmpuser->an_site = workuser->an_site;
strcpy(tmpuser->name, name);
strcpy(tmpuser->passwd, workuser->passwd);
strcpy(tmpuser->real_name, workuser->real_name);
strcpy(tmpuser->addr1, workuser->addr1);
strcpy(tmpuser->city, workuser->city);
strcpy(tmpuser->state, workuser->state);
strcpy(tmpuser->zip, workuser->zip);
strcpy(tmpuser->phone, workuser->phone);
strcpy(tmpuser->mail, workuser->mail);
strcpy(tmpuser->aideinfo, workuser->aideinfo);
strcpy(tmpuser->A_real_name, workuser->A_real_name);
strcpy(tmpuser->A_addr1, workuser->A_addr1);
strcpy(tmpuser->A_city, workuser->A_city);
strcpy(tmpuser->A_state, workuser->A_state);
strcpy(tmpuser->A_zip, workuser->A_zip);
strcpy(tmpuser->A_phone, workuser->A_phone);
strcpy(tmpuser->A_mail, workuser->A_mail);
for (i = 5; i < MAXROOMS; i++)
tmpuser->generation[i] = tmpuser->forget[i] = NEWUSERFORGET;
tmpuser->f_duplicate = workuser->f_duplicate;
tmpuser->f_admin = workuser->f_admin;
tmpuser->f_restricted = workuser->f_restricted;
tmpuser->f_prog = workuser->f_prog;
tmpuser->f_badinfo = workuser->f_badinfo;
tmpuser->f_newbie = workuser->f_newbie;
tmpuser->f_inactive = workuser->f_inactive;
tmpuser->f_deleted = workuser->f_deleted;
tmpuser->f_noanon = workuser->f_noanon;
tmpuser->f_noclient = workuser->f_noclient;
tmpuser->f_trouble = workuser->f_trouble;
tmpuser->f_invisible = workuser->f_invisible;
tmpuser->f_elf = workuser->f_elf;
tmpuser->f_twit = workuser->f_twit;
tmpuser->f_aide = workuser->f_aide;
tmpuser->time = time(0);
strcpy(tmpuser->remote, "(Username changed by sysop)");
tmpuser->usernum = usernum;
msync((void *)tmpuser, sizeof(struct user), MS_SYNC);
checked_snprintf(work,sizeof(work), "NAMECHANGE: %s to %s", workuser->name, name);
logevent(work);
locks(SEM_USER);
strcpy(workuser->reminder, tmpuser->name);
workuser->f_deleted = workuser->f_invisible = workuser->f_namechanged = 1;
unlocks(SEM_USER);
freeuser(workuser);
workuser = tmpuser;
my_printf("\nUsername changed.\n");
strcpy(profile_default, name);
profile(NULL, workuser, PROF_ALL);
}
}
}
void
do_verify (struct user *workuser, int ask)
{
if (ask)
my_printf("\nVerify information for user: %s.\nAre you sure? (Y/N) -> ", workuser->name);
if (!ask || yesno(-1))
{
locks(SEM_USER);
strcpy(workuser->A_real_name, workuser->real_name);
strcpy(workuser->A_addr1, workuser->addr1);
strcpy(workuser->A_city, workuser->city);
strcpy(workuser->A_state, workuser->state);
strcpy(workuser->A_zip, workuser->zip);
strcpy(workuser->A_phone, workuser->phone);
if (ask)
strcpy(workuser->A_mail, workuser->mail);
if (workuser->f_trouble)
{
workuser->f_trouble = 0;
unlocks(SEM_USER);
}
else
unlocks(SEM_USER);
}
}
static void
show_verified(struct user *workuser)
{
my_printf("\nReal name: %s\nAddress: %s\nCity: %s\nState: %s\nZIP: %s\nPhone: %s\nEmail: %s\n\n", workuser->A_real_name, workuser->A_addr1, workuser->A_city, workuser->A_state, workuser->A_zip, workuser->A_phone, workuser->A_mail);
}
static void
ooptions(struct user *tuser)
{
my_printf("\nMark yourself as a novice user? -> ");
if (yesno (tuser->f_novice) != tuser->f_novice)
{
locks (SEM_USER);
tuser->f_novice ^= 1;
unlocks (SEM_USER);
}
my_printf("Show own posts when reading new? -> ");
if (yesno(tuser->f_ownnew) != tuser->f_ownnew)
{
locks(SEM_USER);
tuser->f_ownnew ^= 1;
unlocks(SEM_USER);
}
my_printf("Print last old message on New message request? -> ");
if (yesno(tuser->f_lastold) != tuser->f_lastold)
{
locks (SEM_USER);
tuser->f_lastold ^= 1;
unlocks (SEM_USER);
}
my_printf("Make new messages old after any read? -> ");
if (yesno(tuser->f_clear) != tuser->f_clear)
{
locks (SEM_USER);
tuser->f_clear ^= 1;
unlocks (SEM_USER);
}
my_printf("Be asked if you are on an ANSI-compatible terminal when you login? -> ");
if (yesno(tuser->f_ansi) != tuser->f_ansi)
{
locks(SEM_USER);
tuser->f_ansi ^= 1;
unlocks(SEM_USER);
}
my_printf("Show time in 12-hour format? -> ");
if (yesno (tuser->f_ampm) != tuser->f_ampm)
{
locks (SEM_USER);
tuser->f_ampm ^= 1;
unlocks(SEM_USER);
}
my_printf("Show short version of the wholist by default? -> ");
if (yesno (tuser->f_shortwho) != tuser->f_shortwho)
{
locks (SEM_USER);
tuser->f_shortwho ^= 1;
unlocks (SEM_USER);
}
my_printf("Show wholist with oldest logins first? -> ");
if (yesno (tuser->f_revwho) != tuser->f_revwho)
{
locks (SEM_USER);
tuser->f_revwho ^= 1;
unlocks (SEM_USER);
}
}
static void
foptions(struct user *tuser)
{
int answer;
my_printf("\nMark user as having bad address information? -> ");
if (yesno(tuser->f_badinfo) != tuser->f_badinfo)
{
locks(SEM_USER);
tuser->f_restricted = (tuser->f_badinfo ^= 1) | tuser->f_newbie | tuser->f_duplicate;
unlocks(SEM_USER);
if (!tuser->f_badinfo)
do_verify(tuser, 1);
}
my_printf("Mark user for deletion? -> ");
if (yesno(tuser->f_deleted) != tuser->f_deleted)
{
locks(SEM_USER);
tuser->f_invisible = (tuser->f_deleted ^= 1) | tuser->f_inactive;
unlocks(SEM_USER);
if (tuser->f_deleted)
logout_user(tuser, NULL, 0);
}
my_printf("Twitify user? -> ");
if (yesno(tuser->f_twit) != tuser->f_twit)
{
locks(SEM_USER);
tuser->f_twit ^= 1;
unlocks(SEM_USER);
}
my_printf("Mark user as a new user? -> ");
if (yesno(tuser->f_newbie) != tuser->f_newbie)
{
locks(SEM_USER);
tuser->f_restricted = (tuser->f_newbie ^= 1) | tuser->f_badinfo | tuser->f_duplicate;
unlocks(SEM_USER);
}
my_printf("Make user a guide? -> ");
if ((answer = yesno(tuser->f_elf)) && !tuser->f_elf && (tuser->timescalled < 100 || tuser->posted < 100))
{
my_printf(" %s has %d calls, %d posts. Are you sure? (Y/N) -> ", tuser->name, tuser->timescalled, tuser->posted);
answer = yesno(-1);
}
if (answer != tuser->f_elf)
{
locks(SEM_USER);
tuser->f_elf ^= 1;
unlocks(SEM_USER);
}
my_printf("Mark user as having multiple accounts? -> ");
if (yesno(tuser->f_duplicate) != tuser->f_duplicate)
{
locks(SEM_USER);
tuser->f_restricted = (tuser->f_duplicate ^= 1) | tuser->f_newbie | tuser->f_badinfo;
unlocks(SEM_USER);
}
my_printf("Mark user inactive? -> ");
if (yesno(tuser->f_inactive) != tuser->f_inactive)
{
locks(SEM_USER);
tuser->f_invisible = (tuser->f_inactive ^= 1) | tuser->f_deleted;
unlocks(SEM_USER);
}
if (tuser->f_inactive)
logout_user(tuser, NULL, 0);
my_printf("Disallow user from using a BBS client? -> ");
if (yesno(tuser->f_noclient) != tuser->f_noclient)
{
locks(SEM_USER);
tuser->f_noclient ^= 1;
unlocks(SEM_USER);
}
my_printf("Disallow user from using the anon posting option? -> ");
if (yesno(tuser->f_noanon) != tuser->f_noanon)
{
locks(SEM_USER);
tuser->f_noanon ^= 1;
unlocks(SEM_USER);
}
/*
if (ouruser->usernum == 2L)
{
my_printf ("Completely Phuck User Up? -> ");
if (yesno(tuser->f_phucked) != tuser->f_phucked)
{
locks (SEM_USER);
tuser->f_phucked ^= 1;
unlocks (SEM_USER);
}
}
*/
if (ouruser->f_admin)
{
my_printf ("Allow user to use the BEEPS keyword? -> ");
if (yesno (tuser->f_beeps) != tuser->f_beeps)
{
locks (SEM_USER);
tuser->f_beeps ^= 1;
unlocks (SEM_USER);
}
my_printf("Make user a sysop? -> ");
if (yesno(tuser->f_aide) != tuser->f_aide)
{
locks(SEM_USER);
tuser->f_admin = (tuser->f_aide ^= 1) | tuser->f_prog;
unlocks(SEM_USER);
}
my_printf("Make user a programmer? -> ");
if (yesno(tuser->f_prog) != tuser->f_prog)
{