-
Notifications
You must be signed in to change notification settings - Fork 0
/
1.8.4-patch02
18243 lines (16465 loc) · 551 KB
/
1.8.4-patch02
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
This is patch02 to PennMUSH 1.8.4. After applying this patch, you will
have version 1.8.4p02
To apply this patch, save it to a file in your top-level 1.8.4p1 MUSH directory,
and do the following:
patch -p0 < 1.8.4-patch02
make install
If you use GNU patch 2.2, you probably want the above to be 'patch -b -p0',
not just 'patch -p0'.
Users need not worry about failed hunks in src/switchinc.c,
hdrs/switches.h, hdrs/cmds.h, or hdrs/funs.h. These files are automatically
rebuilt on compile. On the off chance they appear not to be, simply
rm them and re-run make.
Then @shutdown/reboot your MUSH.
- Shawn/Raevnos
In this patch:
Major Changes:
* Wildcard matcher completely rewritten to avoid hangs and to provide
ansi-aware capturing. [GM]
* connection_fail_limit now lets you limit the # of connection fails in
a 10 minute time by any given IP. [GM]
Minor Changes:
* update-cnf.pl perl script now handles optional config lines, by placing
A # OPTIONAL above them. This is for message translation. [GM]
* Config options can now be marked as optional. If they don't exist,
Penn will not complain in the log. [MG]
* Player names with spaces no longer need to be in given in quotes for
@name. Suggested by Minion. [MG]
* @decompile no longer shows flags which can't be set by players, like
GOING and CONNECTED. [MG]
* %il substitution as preparation to get rid of ##. [GM]
* hardcode: call_attrib is now a wrapper around call_ufun. [GM]
* The %i<n> substitution, and itext()/inum()/ilev() functions, now work
for @dolist as well as iter(). [MG]
* iter() context (itext(), inum(), etc) is no longer propagated through
ufuns. [MG]
* @hook/overrides on huh_command are now matched against "huh_command" and
"huh_command <input>". From a suggestion by Mercutio. [MG]
* Various help fixes.
* @list and list() can now show only built-in or only local commands or
functions. Suggested by Trelane@M*U*S*H. [MG]
* Mortals can now use @search to find any objects they can examine.
Suggested by Paige. [MG]
* @function names can start with numbers again. Requested by Mercutio. [MG]
* @include and @break now work when entered directly from a client. [MG]
* The Drop and Give @locks now trigger verb <name>_LOCK`FAILURE attributes
when you fail to pass them, as described in 'help failure'. Suggested by
Cas@BeforeTheDarkness. [MG]
* Set several attributes used internally AF_NOCOPY so they won't be included
in @decompile output. Suggested by Paige. [GM]
* The help for the chat system (@channel) has been rewritten. [MG]
* autodetect_list now returns 'm' sort for unknown list types instead of
alphanum, so sorting on strings will now treat numbers in them as
separate comparisons by default. [GM]
* setunion(), setdiff(), setinter() now autodetect lists in all cases where
no sort type is provided instead of just some cases. [GM]
* The pipe (|) character is no longer valid in channel names. [MG]
Functions:
* ibreak(), for breaking out of an iter() loop. [Rhost] [MG]
* New stext() function and %$N sub, equivilent of #$ in @switch, switch*(),
and reswitch*(), but can be used in nested switches/on user input. [MG]
* New slev() function, returns the current nesting depth of switches. [MG]
* maillist() returns a list of @mail messages matching a range, as per
@mail/list. Suggested by AnneLions. [MG]
* New sorttype, lattr, sorts a list of attribute names. [MG]
Commands:
* @channel/combine and @channel/uncombine let you combine spammy connect
messages for channels into one line. [SW] [GM]
* @grep now accepts /wild and /regexp switches, for wildcard/globbing and
regular expression greps (a la wildgrep() and regrep()). Also /nocase
for case-insensitive greps. Suggested by Paige. [MG]
* @attribute now allows limiting attribute values through /enum and
/limit switches. [GM]
* @ps <pid> shows info for a single queue entry. Suggested by Paige. [MG]
Fixes:
* Off-by-one bug in 'm' sort when using embedded numbers fixed. [GM]
* Debug output was sometimes sent to the wrong executor. [GM]
* A crashbug in @search was fixed. Reported by Paige. [GM]
* A crashbug in lpids() was fixed. Reported by Mercutio. Fixed by Javelin.
* @search elock class failed to report invalid lock strings. Fixed. [GM]
* @cpattr and @mvattr could break attribute trees. Reported by Sketch. [MG]
* benchmark() calculated the average incorrectly. Reported by Cheetah. [DC]
* map(), iter(), mix() and step() are ansi-aware, now. Using any of the
list functions without ansi should also be considerably faster. [GM]
* "look <container>'s <object>" incorrectly stopped working in p1 when
<object>'s desc was set "nearby". Reported by Yuriko@M*U*SH. [MG]
* Attribute names are now sorted better with regard to attribute trees,
hopefully fixing the recurring bug of @wipe leaving branch attributes
when removing a root attr for good. [MG]
Summary:
CHANGES.184 | 80 +
FAQ | 10
Makefile.in | 2
Patchlevel | 2
game/mushcnf.dst | 35
game/txt/hlp/index.hlp | 869 +++++++++---------
game/txt/hlp/pennchat.hlp | 558 ++++++------
game/txt/hlp/penncmd.hlp | 265 +++--
game/txt/hlp/pennconf.hlp | 3
game/txt/hlp/pennfunc.hlp | 214 +++-
game/txt/hlp/pennmail.hlp | 36
game/txt/hlp/penntop.hlp | 28
game/txt/hlp/pennv184.hlp | 83 +
game/txt/hlp/pennvOLD.hlp | 2
hdrs/ansi.h | 1
hdrs/atr_tab.h | 40
hdrs/attrib.h | 10
hdrs/command.h | 4
hdrs/conf.h | 10
hdrs/extchat.h | 22
hdrs/externs.h | 53 -
hdrs/function.h | 2
hdrs/game.h | 1
hdrs/mushtype.h | 6
hdrs/parse.h | 1
hdrs/sort.h | 18
hdrs/svninfo.h | 2
hdrs/switches.h | 283 +++---
hdrs/version.h | 6
po/bg_BG.pox | 299 +++---
po/da_DK.pox | 12
po/de_DE.pox | 12
po/es_ES.pox | 20
po/fr_FR.pox | 20
po/hr_HR.pox | 147 ++-
po/hu_HU.pox | 20
po/id_ID.pox | 4
po/nl_NL.pox | 20
po/no_NO.pox | 130 ++
po/pennmush.pot | 2138 ++++++++++++++++++++++++----------------------
po/pl_PL.pox | 20
po/pt_BR.pox | 4
po/ro_RO.pox | 4
po/sv_SE.pox | 20
po/zh_CN.pox | 325 ++++++
src/Makefile.in | 2
src/SWITCHES | 7
src/atr_tab.c | 268 +++++
src/attrib.c | 30
src/bsd.c | 15
src/cmds.c | 50 -
src/command.c | 31
src/conf.c | 108 +-
src/cque.c | 184 +++
src/extchat.c | 152 ++-
src/extmail.c | 46
src/flags.c | 3
src/function.c | 18
src/fundb.c | 25
src/funlist.c | 445 ++++-----
src/funmisc.c | 82 +
src/funstr.c | 40
src/funufun.c | 98 +-
src/game.c | 50 -
src/help.c | 6
src/lock.c | 9
src/look.c | 7
src/markup.c | 9
src/move.c | 6
src/mysocket.c | 4
src/parse.c | 103 +-
src/pcre.c | 4
src/player.c | 79 +
src/predicat.c | 394 +++++---
src/rob.c | 3
src/set.c | 133 +-
src/sort.c | 185 ++-
src/sql.c | 2
src/switchinc.c | 7
src/utils.c | 221 +---
src/wild.c | 579 ++++--------
src/wiz.c | 38
utils/update-cnf.pl | 62 +
win32/README.cygwin | 28
84 files changed, 5604 insertions(+), 3770 deletions(-)
Prereq: 1.8.4p1
===================================================================
--- Patchlevel (.../184p1) (revision 682)
+++ Patchlevel (.../184p2) (revision 682)
@@ -1,3 +1,3 @@
Do not edit this file. It is maintained by the official PennMUSH patches.
-This is PennMUSH 1.8.4p1
+This is PennMUSH 1.8.4p2
Index: Makefile.in
===================================================================
--- Makefile.in (.../184p1) (revision 682)
+++ Makefile.in (.../184p2) (revision 682)
@@ -3,7 +3,7 @@
# - System configuration - #
VERSION=1.8.4
-PATCHLEVEL=1
+PATCHLEVEL=2
#
# This section of the file should be automatically configured by the
Index: src/mysocket.c
===================================================================
--- src/mysocket.c (.../184p1) (revision 682)
+++ src/mysocket.c (.../184p2) (revision 682)
@@ -467,7 +467,7 @@
* From UNP, with changes. If nsec > 0, we set the socket
* nonblocking and connect with timeout. The socket is STILL
* nonblocking after it returns. If nsec == 0, a normal blocking
- * connect is done.
+ * connect is done.
* \param sockfd file descriptor of socket.
* \param saptr pointer to sockaddr structure with connection data.
* \param salen length of saptr.
@@ -539,7 +539,7 @@
}
/* The following functions are from W. Ridhard Steven's libgai,
- * modified by Shawn Wagner for PennMUSH. These arn't full
+ * modified by Shawn Wagner for PennMUSH. These aren't full
* implementations- they don't handle unix-domain sockets or named
* services, because we don't need them for what we're doing. */
Index: src/fundb.c
===================================================================
--- src/fundb.c (.../184p1) (revision 682)
+++ src/fundb.c (.../184p2) (revision 682)
@@ -160,7 +160,7 @@
lh.count = parse_integer(args[2]);
if (lh.start < 1 || lh.count < 1) {
- safe_str(T("#-1 ARGUMENT OUT OF RANGE"), buff, bp);
+ safe_str(T(e_argrange), buff, bp);
return;
}
@@ -773,7 +773,7 @@
start = parse_integer(args[1]);
count = parse_integer(args[2]);
if (start < 1 || count < 1) {
- safe_str(T("#-1 ARGUMENT OUT OF RANGE"), buff, bp);
+ safe_str(T(e_argrange), buff, bp);
return;
}
break;
@@ -1914,7 +1914,7 @@
char *wenv[2];
if (nargs > 1 && args[1] && *args[1]) {
- if (fetch_ufun_attrib(args[1], executor, &ufun, 1)) {
+ if (fetch_ufun_attrib(args[1], executor, &ufun, UFUN_DEFAULT)) {
report = 1;
} else {
safe_str(ufun.errmess, buff, bp);
@@ -2299,9 +2299,7 @@
/* ARGSUSED */
FUNCTION(fun_grep)
{
- char *tp;
- int wild;
- int sensitive;
+ int flags = 0;
dbref it = match_thing(executor, args[0]);
if (!GoodObject(it)) {
@@ -2318,11 +2316,16 @@
return;
}
- sensitive = !strcmp(called_as, "GREP") || !strcmp(called_as, "WILDGREP");
- wild = !strcmp(called_as, "WILDGREPI") || !strcmp(called_as, "WILDGREP");
- tp = grep_util(executor, it, args[1], args[2], sensitive, wild);
- safe_str(tp, buff, bp);
- mush_free(tp, "grep_util.buff");
+ if (!strcmp(called_as, "GREPI") || !strcmp(called_as, "WILDGREPI")
+ || !strcmp(called_as, "REGREPI"))
+ flags |= GREP_NOCASE;
+
+ if (*called_as == 'W')
+ flags |= GREP_WILD;
+ else if (*called_as == 'R')
+ flags |= GREP_REGEXP;
+
+ grep_util(executor, it, args[1], args[2], buff, bp, flags);
}
/* Get database size statistics */
Index: src/sql.c
===================================================================
--- src/sql.c (.../184p1) (revision 682)
+++ src/sql.c (.../184p2) (revision 682)
@@ -481,7 +481,7 @@
return;
}
- if (!fetch_ufun_attrib(args[0], executor, &ufun, 1))
+ if (!fetch_ufun_attrib(args[0], executor, &ufun, UFUN_DEFAULT))
return;
if (nargs > 2) {
/* we have an output separator in args[2]. */
Index: src/utils.c
===================================================================
--- src/utils.c (.../184p1) (revision 682)
+++ src/utils.c (.../184p2) (revision 682)
@@ -137,80 +137,105 @@
/** Given an attribute [<object>/]<name> pair (which may include #lambda),
* fetch its value, owner (thing), and pe_flags, and store in the struct
* pointed to by ufun
- * \param attrname The obj/name of attribute.
+ * \param attrstring The obj/name of attribute.
* \param executor Dbref of the executing object.
* \param ufun Pointer to an allocated ufun_attrib struct to fill in.
- * \param accept_lambda true if #lambda can be used.
+ * \param flags A bitwise or of desired UFUN_* flags.
* \return 0 on failure, true on success.
*/
bool
-fetch_ufun_attrib(char *attrname, dbref executor, ufun_attrib * ufun,
- bool accept_lambda)
+fetch_ufun_attrib(const char *attrstring, dbref executor, ufun_attrib * ufun,
+ int flags)
{
+ char *thingname, *attrname;
+ char astring[BUFFER_LEN];
ATTR *attrib;
- dbref thing;
- int pe_flags = PE_UDEFAULT;
if (!ufun)
- return 0; /* We should never NOT receive a ufun. */
+ return 0;
+
+ ufun->contents[0] = '\0';
ufun->errmess = (char *) "";
+ ufun->thing = executor;
+ ufun->pe_flags = PE_UDEFAULT;
+ ufun->ufun_flags = flags;
- /* find our object and attribute */
- if (accept_lambda) {
- parse_anon_attrib(executor, attrname, &thing, &attrib);
+ ufun->thing = executor;
+ thingname = NULL;
+
+ if (!attrstring)
+ return 0;
+ strncpy(astring, attrstring, BUFFER_LEN);
+
+ /* Split obj/attr */
+ if ((flags & UFUN_OBJECT) && ((attrname = strchr(astring, '/')) != NULL)) {
+ thingname = astring;
+ *(attrname++) = '\0';
} else {
- parse_attrib(executor, attrname, &thing, &attrib);
+ attrname = astring;
}
- /* Is it valid? */
- if (!GoodObject(thing)) {
- ufun->errmess = (char *) "#-1 INVALID OBJECT";
- free_anon_attrib(attrib);
- return 0;
- } else if (!attrib) {
- ufun->contents[0] = '\0';
- ufun->thing = thing;
- ufun->pe_flags = pe_flags;
- free_anon_attrib(attrib);
+ if (thingname && (flags & UFUN_LAMBDA) && !strcasecmp(thingname, "#lambda")) {
+ /* It's a lambda. */
+ thingname = NULL;
+ ufun->thing = executor;
+ mush_strncpy(ufun->contents, attrname, BUFFER_LEN);
return 1;
- } else if (!Can_Read_Attr(executor, thing, attrib)) {
+ }
+
+ if (thingname) {
+ /* Attribute is on something else. */
+ ufun->thing =
+ noisy_match_result(executor, thingname, NOTYPE, MAT_EVERYTHING);
+ if (!GoodObject(ufun->thing)) {
+ ufun->errmess = (char *) "#-1 INVALID OBJECT";
+ return 0;
+ }
+ }
+
+ attrib = (ATTR *) atr_get(ufun->thing, upcasestr(attrname));
+ // An empty attrib is the same as no attrib.
+ if (attrib == NULL) {
+ if (flags & UFUN_REQUIRE_ATTR) {
+ if (!(flags & UFUN_IGNORE_PERMS) && !Can_Examine(executor, ufun->thing))
+ ufun->errmess = e_atrperm;
+ return 0;
+ } else {
+ return 1;
+ }
+ }
+ if (!(flags & UFUN_IGNORE_PERMS)
+ && !Can_Read_Attr(executor, ufun->thing, attrib)) {
ufun->errmess = e_atrperm;
- free_anon_attrib(attrib);
return 0;
}
-
- /* Can we evaluate it? */
- if (!CanEvalAttr(executor, thing, attrib)) {
+ if (!(flags & UFUN_IGNORE_PERMS)
+ && !CanEvalAttr(executor, ufun->thing, attrib)) {
ufun->errmess = e_perm;
- free_anon_attrib(attrib);
return 0;
}
/* DEBUG attributes */
- if (AF_Debug(attrib))
- pe_flags |= PE_DEBUG;
+ if (AF_Debug(attrib)) {
+ ufun->pe_flags |= PE_DEBUG;
+ }
/* Populate the ufun object */
mush_strncpy(ufun->contents, atr_value(attrib), BUFFER_LEN);
- ufun->thing = thing;
- ufun->pe_flags = pe_flags;
-
- /* Cleanup */
- free_anon_attrib(attrib);
/* We're good */
return 1;
}
/** Given a ufun, executor, enactor, PE_Info, and arguments for %0-%9,
- * call the ufun with appropriate permissions on values given for
- * wenv_args. The value returned is stored in the buffer pointed to
- * by retval, if given.
+ * call the ufun with appropriate permissions on values given for
+ * wenv_args. The value returned is stored in the buffer pointed to
+ * by ret, if given.
* \param ufun The ufun_attrib that was initialized by fetch_ufun_attrib
* \param wenv_args An array of string values for global_eval_context.wenv
* \param wenv_argc The number of wenv args to use.
* \param ret If desired, a pointer to a buffer in which the results
- * of the process_expression are stored in.
+ * of the process_expression are stored in.
* \param executor The executor.
* \param enactor The enactor.
* \param pe_info The pe_info passed to the FUNCTION
@@ -224,6 +249,9 @@
char rbuff[BUFFER_LEN];
char *rp;
char *old_wenv[10];
+ char *saveqs[NUMQ];
+ int iter_nest = -1;
+ int switch_nest = -1;
int old_args = 0;
int i;
int pe_ret;
@@ -231,28 +259,32 @@
struct re_save rsave;
- save_regexp_context(&rsave);
-
/* Make sure we have a ufun first */
if (!ufun)
return 1;
/* If the user doesn't care about the return of the expression,
- * then use our own rbuff.
- */
+ * then use our own rbuff. */
if (!ret)
ret = rbuff;
rp = ret;
+ /* Save contexts, globals, regexp vals, etc */
for (i = 0; i < wenv_argc; i++) {
old_wenv[i] = global_eval_context.wenv[i];
global_eval_context.wenv[i] = wenv_args[i];
}
+
for (; i < 10; i++) {
old_wenv[i] = global_eval_context.wenv[i];
global_eval_context.wenv[i] = NULL;
}
+ save_regexp_context(&rsave);
+ if (ufun->ufun_flags & UFUN_LOCALIZE) {
+ save_global_regs("localize", saveqs);
+ }
+
/* Set all the regexp patterns to NULL so they are not
* propogated */
global_eval_context.re_code = NULL;
@@ -260,11 +292,14 @@
global_eval_context.re_offsets = NULL;
global_eval_context.re_from = NULL;
-
/* And now, make the call! =) */
if (pe_info) {
old_args = pe_info->arg_count;
pe_info->arg_count = wenv_argc;
+ iter_nest = pe_info->local_iter_nesting;
+ pe_info->local_iter_nesting = -1;
+ switch_nest = pe_info->local_switch_nesting;
+ pe_info->local_switch_nesting = -1;
}
ap = ufun->contents;
@@ -277,9 +312,14 @@
global_eval_context.wenv[i] = old_wenv[i];
}
if (pe_info) {
+ pe_info->local_iter_nesting = iter_nest;
+ pe_info->local_switch_nesting = switch_nest;
pe_info->arg_count = old_args;
}
+ if (ufun->ufun_flags & UFUN_LOCALIZE) {
+ restore_global_regs("localize", saveqs);
+ }
/* Restore regexp patterns */
restore_regexp_context(&rsave);
@@ -305,97 +345,14 @@
call_attrib(dbref thing, const char *attrname, const char *wenv_args[],
int wenv_argc, char *ret, dbref enactor, PE_Info *pe_info)
{
- char atrbuf[BUFFER_LEN];
- char rbuff[BUFFER_LEN];
- char *rp;
- char *old_wenv[10];
- int old_args = 0;
- int i;
- int pe_ret;
- char const *ap;
- ATTR *attrib;
- char *saver[NUMQ];
-
- struct re_save rsave;
-
- /* Make sure we have a valid object to call first */
- if (!GoodObject(thing) || IsGarbage(thing))
- return 0;
-
- if (attrname == NULL || !*attrname)
- return 0;
-
- /* Fetch the attrib contents */
- attrib = (ATTR *) atr_get(thing, attrname);
- if (attrib == NULL)
+ ufun_attrib ufun;
+ if (!fetch_ufun_attrib(attrname, thing, &ufun,
+ UFUN_LOCALIZE | UFUN_REQUIRE_ATTR | UFUN_IGNORE_PERMS))
+ {
return 0;
-
- mush_strncpy(atrbuf, atr_value(attrib), BUFFER_LEN);
-
- if (!*atrbuf) {
- if (ret)
- *ret = '\0';
- return 1;
- }
-
- save_global_regs("localize", saver);
-
- /* Store regepx info */
- save_regexp_context(&rsave);
-
- /* If the user doesn't care about the return of the expression,
- * then use our own rbuff.
- */
- if (!ret)
- ret = rbuff;
- rp = ret;
-
- /* Set up %0-%9 */
- for (i = 0; i < wenv_argc; i++) {
- old_wenv[i] = global_eval_context.wenv[i];
- global_eval_context.wenv[i] = (char *) wenv_args[i];
- }
- for (; i < 10; i++) {
- old_wenv[i] = global_eval_context.wenv[i];
- global_eval_context.wenv[i] = NULL;
}
- /* Clear all q-regs */
- for (i = 0; i < NUMQ; i++) {
- global_eval_context.renv[i][0] = '\0';
- }
-
- /* Set all the regexp patterns to NULL so they are not
- * propogated */
- global_eval_context.re_code = NULL;
- global_eval_context.re_subpatterns = -1;
- global_eval_context.re_offsets = NULL;
- global_eval_context.re_from = NULL;
-
- /* And now, make the call! =) */
- if (pe_info) {
- old_args = pe_info->arg_count;
- pe_info->arg_count = wenv_argc;
- }
-
- ap = atrbuf;
- pe_ret = process_expression(ret, &rp, &ap, thing, thing,
- enactor, PE_DEFAULT, PT_DEFAULT, pe_info);
- *rp = '\0';
-
- /* Restore the old wenv */
- for (i = 0; i < 10; i++) {
- global_eval_context.wenv[i] = old_wenv[i];
- }
-
- if (pe_info) {
- pe_info->arg_count = old_args;
- }
-
- /* Restore regexp patterns */
- restore_regexp_context(&rsave);
- restore_global_regs("localize", saver);
-
- return !pe_ret;
+ return !call_ufun(&ufun, (char **) wenv_args, wenv_argc, ret, thing, enactor,
+ pe_info);
}
/** Given an exit, find the room that is its source through brute force.
Index: src/extchat.c
===================================================================
--- src/extchat.c (.../184p1) (revision 682)
+++ src/extchat.c (.../184p2) (revision 682)
@@ -125,6 +125,7 @@
{"Quiet", 'Q', CU_QUIET, CU_QUIET},
{"Hide", 'H', CU_HIDE, CU_HIDE},
{"Gag", 'G', CU_GAG, CU_GAG},
+ {"Combine", 'C', CU_COMBINE, CU_COMBINE},
{NULL, '\0', 0, 0}
};
@@ -1864,7 +1865,7 @@
/* only printable characters */
for (p = name; p && *p; p++) {
- if (!isprint((unsigned char) *p))
+ if (!isprint((unsigned char) *p) || *p == '|')
return 0;
}
@@ -1886,7 +1887,7 @@
* \param player the enactor.
* \param name the name of the channel.
* \param isyn a yes/no string.
- * \param flag switch indicator: 0=mute, 1=hide, 2=gag
+ * \param flag CU_* option
* \param silent if 1, no notification of actions.
*/
void
@@ -1899,6 +1900,11 @@
int setting = abs(yesno(isyn));
p = NULL;
+ if (!IsPlayer(player) && flag == CU_COMBINE) {
+ notify(player, T("Only players can use that option."));
+ return;
+ }
+
if (!name || !*name) {
p = Chanlist(player);
if (!p) {
@@ -1907,18 +1913,22 @@
}
silent = 1;
switch (flag) {
- case 0:
+ case CU_QUIET:
notify(player, setting ? T("All channels have been muted.")
: T("All channels have been unmuted."));
break;
- case 1:
+ case CU_HIDE:
notify(player, setting ? T("You hide on all the channels you can.")
: T("You unhide on all channels."));
break;
- case 2:
+ case CU_GAG:
notify(player, setting ? T("All channels have been gagged.")
: T("All channels have been ungagged."));
break;
+ case CU_COMBINE:
+ notify(player, setting ? T("All channels have been combined.")
+ : T("All channels have been uncombined."));
+ break;
}
} else {
test_channel_on(player, name, c);
@@ -1943,7 +1953,7 @@
}
switch (flag) {
- case 0:
+ case CU_QUIET:
/* Mute */
if (setting) {
CUtype(u) |= CU_QUIET;
@@ -1962,7 +1972,7 @@
}
break;
- case 1:
+ case CU_HIDE:
/* Hide */
if (setting) {
if (!Chan_Can_Hide(c, player) && !Wizard(player)) {
@@ -1986,7 +1996,7 @@
ChanName(c));
}
break;
- case 2:
+ case CU_GAG:
/* Gag */
if (setting) {
CUtype(u) |= CU_GAG;
@@ -2003,6 +2013,23 @@
ChanName(c));
}
break;
+ case CU_COMBINE:
+ /* Combine */
+ if (setting) {
+ CUtype(u) |= CU_COMBINE;
+ if (!silent)
+ notify_format(player,
+ T
+ ("Connect messages on channel <%s> will now be combined with others."),
+ ChanName(c));
+ } else {
+ CUtype(u) &= ~CU_COMBINE;
+ if (!silent)
+ notify_format(player,
+ T("Connect messages on channel <%s> will no longer be combined with others."),
+ ChanName(c));
+ }
+ break;
}
} while (p != NULL);
@@ -2090,7 +2117,7 @@
if (SUPPORT_PUEBLO)
notify_noenter(player, open_tag("SAMP"));
- notify_format(player, "%-30s %-5s %8s %-16s %-8s %-3s",
+ notify_format(player, "%-30s %-5s %8s %-16s %-9s %-3s",
T("Name"), T("Users"), T("Msgs"), T("Chan Type"), T("Status"),
T("Buf"));
for (c = channels; c; c = c->next) {
@@ -2124,7 +2151,7 @@
blanks[0] = '\0';
}
notify_format(player,
- "%-30s%s %s %8ld [%c%c%c%c%c%c%c %c%c%c%c%c%c] [%-3s %c%c] %3d",
+ "%-30s%s %s %8ld [%c%c%c%c%c%c%c %c%c%c%c%c%c] [%-3s %c%c%c] %3d",
ChanName(c), blanks, numusers, ChanNumMsgs(c),
Channel_Disabled(c) ? 'D' : '-',
Channel_Player(c) ? 'P' : '-',
@@ -2144,6 +2171,7 @@
u ? (Chanuser_Gag(u) ? T("Gag") : T("On")) : T("Off"),
(u && Chanuser_Quiet(u)) ? 'Q' : ' ',
(u && Chanuser_Hide(u)) ? 'H' : ' ',
+ (u && Chanuser_Combine(u)) ? 'C' : ' ',
bufferq_blocks(ChanBufferQ(c)));
}
}
@@ -3036,7 +3064,7 @@
return (num < MAX_PLAYER_CHANS);
}
-
+extern DESC *descriptor_list;
/** Tell players on a channel when someone connects or disconnects.
* \param player player that is connecting or disconnecting.
@@ -3046,18 +3074,80 @@
void
chat_player_announce(dbref player, char *msg, int ungag)
{
+ DESC *d;
+ size_t msglen;
CHAN *c;
- CHANUSER *u;
+ CHANUSER *up, *uv;
+ char buff[BUFFER_LEN], *bp;
+ dbref viewer;
+ bool shared = false;
+ msglen = strlen(msg);
+
+ /* Use the regular channel_send() for all non-combined players. */
for (c = channels; c; c = c->next) {
- u = onchannel(player, c);
- if (u) {
+ up = onchannel(player, c);
+ if (up) {
if (!Channel_Quiet(c) && (Channel_Admin(c) || Channel_Wizard(c)
- || (!Chanuser_Hide(u) && !Dark(player)))) {
- channel_send(c, player, CB_CHECKQUIET | CB_PRESENCE | CB_POSE, msg);
+ || (!Chanuser_Hide(up) && !Dark(player)))) {
+ channel_send(c, player,
+ CB_NOCOMBINE | CB_CHECKQUIET | CB_PRESENCE | CB_POSE,
+ msg);
+ }
+ if (ungag) {
+ CUtype(up) &= ~CU_GAG;
+ }
+ }
+ }
+ for (d = descriptor_list; d != NULL; d = d->next) {
+ viewer = d->player;
+ if (d->connected) {
+ shared = false;
+ bp = buff;
+
+ for (c = channels; c; c = c->next) {
+ up = onchannel(player, c);
+ uv = onchannel(viewer, c);
+ if (up && uv) {
+ if (!Channel_Quiet(c) && !Chanuser_Quiet(uv)
+ && (Channel_Admin(c) || Channel_Wizard(c)
+ || (!Chanuser_Hide(up) && !Dark(player)))) {
+ if (Chanuser_Combine(uv)) {
+ shared = true;
+ safe_str(ChanName(c), buff, &bp);
+ safe_strl(" | ", 3, buff, &bp);
+ }
+ }
+ }
+ if (up && ungag)
+ CUtype(up) &= ~CU_GAG;
+ }
+
+ bp -= 3;
+ *bp = '\0';
+
+ if (shared) {
+ char defmsg[BUFFER_LEN], *dmp;
+ char shrtmsg[BUFFER_LEN], *smp;
+ char *accname;
+
+ dmp = defmsg;
+ smp = shrtmsg;
+
+ accname = mush_strdup(accented_name(player), "chat_announce.name");
+
+ safe_format(shrtmsg, &smp, "%s %s", accname, msg);
+ *smp = '\0';
+
+ safe_format(defmsg, &dmp, "<%s> %s %s", buff, accname, msg);
+ *dmp = '\0';
+
+ if (!vmessageformat(viewer, "CHATFORMAT", player, NA_INTER_PRESENCE, 6,
+ "@", buff, shrtmsg, accname, "", defmsg))
+ notify_anything(player, na_one, &viewer, ns_esnotify, NA_INTER_PRESENCE, defmsg);
+
+ mush_free(accname, "chat_announce.name");
}
- if (ungag)
- CUtype(u) &= ~CU_GAG;
}
}
}
@@ -3401,17 +3491,21 @@
else if (SW_ISSET(sw, SWITCH_WIPE))
do_chan_wipe(player, arg_left);
else if (SW_ISSET(sw, SWITCH_MUTE))
- do_chan_user_flags(player, arg_left, args_right[1], 0, 0);
+ do_chan_user_flags(player, arg_left, args_right[1], CU_QUIET, 0);
else if (SW_ISSET(sw, SWITCH_UNMUTE))
- do_chan_user_flags(player, arg_left, "n", 0, 0);
+ do_chan_user_flags(player, arg_left, "n", CU_QUIET, 0);
else if (SW_ISSET(sw, SWITCH_HIDE))
- do_chan_user_flags(player, arg_left, args_right[1], 1, 0);
+ do_chan_user_flags(player, arg_left, args_right[1], CU_HIDE, 0);
else if (SW_ISSET(sw, SWITCH_UNHIDE))
- do_chan_user_flags(player, arg_left, "n", 1, 0);
+ do_chan_user_flags(player, arg_left, "n", CU_HIDE, 0);
else if (SW_ISSET(sw, SWITCH_GAG))
- do_chan_user_flags(player, arg_left, args_right[1], 2, 0);
+ do_chan_user_flags(player, arg_left, args_right[1], CU_GAG, 0);
else if (SW_ISSET(sw, SWITCH_UNGAG))
- do_chan_user_flags(player, arg_left, "n", 2, 0);
+ do_chan_user_flags(player, arg_left, "n", CU_GAG, 0);
+ else if (SW_ISSET(sw, SWITCH_COMBINE))
+ do_chan_user_flags(player, arg_left, args_right[1], CU_COMBINE, 0);
+ else if (SW_ISSET(sw, SWITCH_UNCOMBINE))
+ do_chan_user_flags(player, arg_left, "n", CU_COMBINE, 0);
else if (SW_ISSET(sw, SWITCH_WHAT))
do_chan_what(player, arg_left);
else if (SW_ISSET(sw, SWITCH_BUFFER))
@@ -3515,6 +3609,7 @@
{
/* flags:
* CB_CHECKQUIET CB_NOSPOOF CB_PRESENCE CB_POSE CB_EMIT CB_SPEECH
+ * CB_NOCOMBINE
*/
/* These are static only to prevent them from chewing up
@@ -3595,7 +3690,7 @@
notify(player, blockstr);
return;
}
- // Do we override chatformats?
+ /* Do we override chatformats? */
if (parse_boolean
(mogrify(mogrifier, "MOGRIFY`OVERRIDE", player, 6, argv, ""))) {
override_chatformat = 1;
@@ -3666,7 +3761,7 @@
}
*bp = '\0';
- // @chatformat
+ /* @chatformat */
if (flags & CB_PRESENCE) {
snprintf(title, BUFFER_LEN, "%s", message);
snprintf(message, BUFFER_LEN, "%s %s", Name(player), title);
@@ -3695,6 +3790,9 @@
for (u = ChanUsers(channel); u; u = u->next) {
current = CUdbref(u);
+ if ((flags & CB_NOCOMBINE) && Chanuser_Combine(u)) {
+ continue;
+ }
if (!(((flags & CB_CHECKQUIET) && Chanuser_Quiet(u)) ||
Chanuser_Gag(u) || (IsPlayer(current) && !Connected(current)))) {
if (override_chatformat
@@ -3726,7 +3824,7 @@
* \endverbatim
* \param player the enactor.
* \param name the name of the channel.
- * \param lineinfo point to array containing lines, optoinal start
+ * \param lineinfo point to array containing lines, optional start
* \param quiet if true, don't show timestamps.
*/
void
Index: src/Makefile.in
===================================================================
--- src/Makefile.in (.../184p1) (revision 682)
+++ src/Makefile.in (.../184p2) (revision 682)
@@ -243,6 +243,7 @@
atr_tab.o: ../hdrs/mymalloc.h
atr_tab.o: ../hdrs/log.h
atr_tab.o: ../hdrs/parse.h
+atr_tab.o: ../hdrs/ansi.h
attrib.o: ../hdrs/copyrite.h
attrib.o: ../config.h
attrib.o: ../hdrs/conf.h
@@ -268,6 +269,7 @@
attrib.o: ../hdrs/lock.h
attrib.o: ../hdrs/boolexp.h
attrib.o: ../hdrs/log.h
+attrib.o: ../hdrs/sort.h
boolexp.o: ../hdrs/copyrite.h
boolexp.o: ../config.h
boolexp.o: ../hdrs/conf.h
Index: src/wiz.c
===================================================================
--- src/wiz.c (.../184p1) (revision 682)
+++ src/wiz.c (.../184p2) (revision 682)
@@ -624,7 +624,7 @@
global_eval_context.wnxt[j] = global_eval_context.wenv[j];
for (j = 0; j < NUMQ; j++)
global_eval_context.rnxt[j] = global_eval_context.renv[j];
- parse_que(victim, command, player);
+ parse_que(victim, command, player, NULL);
}
/** Parse a force token command, but don't force with it.
@@ -1167,7 +1167,7 @@
arg1 = "me";
/* First argument is a player, so we could have a quoted name */
- if (PLAYER_NAME_SPACES && *arg1 == '\"') {
+ if (*arg1 == '\"') {
for (; *arg1 && ((*arg1 == '\"') || isspace((unsigned char) *arg1));
arg1++) ;
strcpy(tbuf, arg1);
@@ -1768,7 +1768,6 @@
struct search_spec *spec)
{