# # Patch name: CoolChat # Patch version: 1 # Author's name: Leonid Korogodsky # Author's email: leokor@math.ias.edu (only till September 1997) # Version of PennMUSH: 1.6.10-patch06 # Date patch made: July 20, 1997 # Author is willing to support (yes/no): yes # Patch format: diff -c # # # This is a contributed PennMUSH patch. Its use is subject to the # same restrictions found in PennMUSH's hdrs/copyrite.h file. # # No warranty is given for this patch. It is not necessarily going # to work on your system, with any version of PennMUSH other than # the one above, etc. # # If the author given above was willing to support the patch, you # should write to the author if you have any questions or problems. Do # *NOT* send email messages to Javelin or any PennMUSH mailing list about # this patch! # # Below this line is the author's description of the patch, # followed by the patch itself. If the patch is in context diff # format, you'll probably apply it by typing: patch < patchfile # in your top-level MUSH directory, unless instructed otherwise # below. # This patch introduces a number of helpful new options into the @chat system. One can define default channels. A flexible channel blocking system is developed. Channels can be designated as evaluating expressions in the chat messages or not evaluating them, depending on your choice. Channel nospoof notifications are now possible. The @channel/who command and the cwho() functions start respecting the non-player objects. The cwho() function can be restricted to the players with the Cemit power (as is natural, since the access to cwho() is but by a little less than having Cemit). And some other minor embellishments. The changes in the chatdb and db formats is protected with the CDBF and DBF flags, so that switching from one format to another is done automatically. Please, find below a brief synopsis of the changes in the CHANGE-* style (although, I do not include that in the patch, as is asked of all contributors). However, I do patch pennchat.hlp, so you can have a better look. :) If Penn 1.7.0 is released before the middle of August, I will update the patch to 1.7.0. Cannot say for sure about the time after that. ============================================================================= Special @chat Features (by Leonid Korogodsky) (leokor@math.ias.edu till Sept, 1997) Major Changes: * CHAT_DEFAULT option enables default channels which can be used with the . command. The change of the chatdb format is protected with a DBF flag. * CHAT_BLOCK option defines a channel blocking system. Each channel has a priority level assigned by the player, and the blocking level. If the channel's priority is below the block, all messages are gagged for the player. The change of the chatdb format and of the db format are protected with the CDBF abd DBF flags. * @chan/default, @chan/priority, and @chat/block commands. * CHAT_PARSE introduces a new "access" mode for the channels. The channels marked as "Parse" evaluate the chat messages from the speaker's point of view. Each newline produced by a %r starts with the channel's name as a prefix. Minor Changes: * CHAT_NOSPOOF option enables nospoof notifications to appear on the channels for the NOSPOOF players. * CHAT_LIST_OBJECTS option changes the format of the @channel/who command and the output of the cwho() function by listing also non-player objects. * RESTRICT_CWHO option restricts the cwho() function to the players with the Cemit power. * CHAT_HILITE option highlights the channel names in the chat messages. New Functions: * cblock() and cpriority() come with the CHAT_BLOCK option. * chandflt() comes with the CHAT_DEFAULT option. Fixes: * The '+' token for the short-cut @chat is replaced with ',', thus -fixing- (I insist :) the problem of overriding the popular '+' prefix for softcoded globals. * @cemit messages are prefixed with the channel's name under CHAT_NOSPOOF. ============================================================================= 424a425 > #if (CHAT_SYSTEM > 3) 425a427,470 > /* If defined, allows to change priorities of each channel for any player, > * as well as the channel-block level. So that one can block non-essential > * channels (and then unblock them) without leaving them. Enabled only > * with CHAT_SYSTEM > 3. > */ > /* #define CHAT_BLOCK /* */ > > /* If defined, allows setting one of the channels as one's default channel. > * Enacted only with CHAT_SYSTEM > 3. > */ > /* #define CHAT_DEFAULT /* */ > > /* If defined, allows to create channels, flagged as "Parse" > * that evaluate messages. Warning: Do not overuse this feature: > * flag channels "Parse" only if really needed. The noeval mode > * for the channels serves purpose. Enacted only with CHAT_SYSTEM > 3. > */ > /* #define CHAT_PARSE /* */ > > /* If defined, the channel messages are prepended with the dbref number of > * the enactor (as in [#]), and the system messages are prepended > * as [*], if the player is set NOSPOOF. Enacted only with CHAT_SYSTEM > 3. > */ > /* #define CHAT_NOSPOOF /* */ > > /* If defined, the non-player objects are listed with the @channel/who > * command, and their dbrefs appear in cwho(). Enabled only with > * CHAT_SYSTEM > 3. > */ > /* #define CHAT_LIST_OBJECTS /* */ > > #endif /* CHAT_SYSTEM > 3 */ > > /* If defined, the channel prefixes are highlighted in the inverse > * ANSI hilite. > */ > /* #define CHAT_HILITE /* */ > > /* If defined, the cwho() command is restricted only to those with the > * Cemit power. > */ > /* #define RESTRICT_CWHO /* */ > *** hdrs/conf.h.orig Thu Jul 17 12:54:04 1997 --- hdrs/conf.h Fri Jul 18 09:26:43 1997 *************** *** 30,36 **** #define POSE_TOKEN ':' #define SEMI_POSE_TOKEN ';' #define EMIT_TOKEN '\\' ! #define CHAT_TOKEN '+' /* delimiter for lists of exit aliases */ #define EXIT_DELIMITER ';' --- 30,39 ---- #define POSE_TOKEN ':' #define SEMI_POSE_TOKEN ';' #define EMIT_TOKEN '\\' ! #define CHAT_TOKEN ',' ! #ifdef CHAT_DEFAULT ! #define CHAT_DFLT_TOKEN '.' ! #endif /* delimiter for lists of exit aliases */ #define EXIT_DELIMITER ';' *************** *** 229,234 **** --- 232,240 ---- #define RWHOPASS (options.rwho_pass) #endif + #ifdef CHAT_BLOCK + #define MAX_CHAN_PRTY 100 + #endif #ifdef WIN32 /* --------------- Stuff for Win32 services ------------------ */ *** hdrs/dbdefs.h.orig Thu Jul 17 12:51:51 1997 --- hdrs/dbdefs.h Fri Jul 18 15:03:02 1997 *************** *** 213,218 **** --- 213,224 ---- #if (CHAT_SYSTEM > 0) #if (CHAT_SYSTEM > 3) CHANLIST *channels; + #ifdef CHAT_DEFAULT + char chan_dflt[CHAN_NAME_LEN]; + #endif + #ifdef CHAT_BLOCK + int chan_block; + #endif #else channel_type channels; #endif *** hdrs/extchat.h.orig Thu Jul 17 13:06:40 1997 --- hdrs/extchat.h Thu Jul 17 21:52:14 1997 *************** *** 41,51 **** --- 41,56 ---- #define CU_TITLE_LEN 80 + #define CDBF_BLOCK 0x1 + /* This is a user - someone who's listening on a chat channel */ struct chanuser { dbref who; long int type; char title[CU_TITLE_LEN]; + #ifdef CHAT_BLOCK + int priority; + #endif struct chanuser *next; }; typedef struct chanuser CHANUSER; *************** *** 55,64 **** #define CU_HIDE 0x2 /* Do not appear on the user list */ #define CU_DEFAULT_FLAGS 0x0 ! #define CUdbref(u) ((u)->who) ! #define CUtype(u) ((u)->type) ! #define CUtitle(u) ((u)->title) ! #define CUnext(u) ((u)->next) #define Chanuser_Quiet(u) (CUtype(u) & CU_QUIET) #define Chanuser_Hide(u) ((CUtype(u) & CU_HIDE) || hidden(CUdbref(u))) --- 60,72 ---- #define CU_HIDE 0x2 /* Do not appear on the user list */ #define CU_DEFAULT_FLAGS 0x0 ! #define CUdbref(u) ((u)->who) ! #define CUtype(u) ((u)->type) ! #define CUtitle(u) ((u)->title) ! #ifdef CHAT_BLOCK ! #define CUpriority(u) ((u)->priority) ! #endif ! #define CUnext(u) ((u)->next) #define Chanuser_Quiet(u) (CUtype(u) & CU_QUIET) #define Chanuser_Hide(u) ((CUtype(u) & CU_HIDE) || hidden(CUdbref(u))) *************** *** 90,95 **** --- 98,109 ---- }; typedef struct chanlist CHANLIST; #define Chanlist(x) db[(x)].channels + #ifdef CHAT_DEFAULT + #define Chan_Dflt(x) db[(x)].chan_dflt + #endif + #ifdef CHAT_BLOCK + #define Chan_Block(x) db[(x)].chan_block + #endif /* Channel type flags and macros */ #define CHANNEL_PLAYER 0x1 /* Players may join */ *************** *** 99,104 **** --- 113,121 ---- #define CHANNEL_ADMIN 0x10 /* Wizard and royalty only ok */ #define CHANNEL_WIZARD 0x20 /* Wizard only ok */ #define CHANNEL_CANHIDE 0x40 /* Can non-DARK Wizards hide here? */ + #ifdef CHAT_PARSE + #define CHANNEL_PARSE 0x80 /* Can the functions be evaluated here? */ + #endif #define CHANNEL_DEFAULT_FLAGS (CHANNEL_PLAYER) #define CL_JOIN 0x1 #define CL_SPEAK 0x2 *************** *** 131,136 **** --- 148,156 ---- #define Channel_Wizard(c) (ChanType(c) & CHANNEL_WIZARD) #define Channel_Admin(c) (ChanType(c) & CHANNEL_ADMIN) #define Channel_CanHide(c) (ChanType(c) & CHANNEL_CANHIDE) + #ifdef CHAT_PARSE + #define Channel_Parse(c) (ChanType(c) & CHANNEL_PARSE) + #endif #define Chan_Ok_Type(c,o) \ (((Typeof(o) == TYPE_PLAYER) && Channel_Player(c)) || \ ((Typeof(o) == TYPE_THING) && Channel_Object(c))) *************** *** 170,176 **** --- 190,200 ---- /* Some globals */ int num_channels; + #ifdef CHAT_NOSPOOF + extern void channel_broadcast _((CHAN *channel, dbref player, int checkquiet, const char *fmt,...)); + #else extern void channel_broadcast _((CHAN *channel, int checkquiet, const char *fmt,...)); + #endif extern CHANUSER *onchannel _((dbref who, CHAN *c)); extern void init_chatdb _((void)); extern int load_chatdb _((FILE * fp)); *** hdrs/function.h.orig Sat Jul 19 22:30:16 1997 --- hdrs/function.h Sun Jul 20 16:53:52 1997 *************** *** 59,64 **** --- 59,69 ---- FUNCTION_PROTO(fun_conn); /* bsd.c */ FUNCTION_PROTO(fun_ports); /* bsd.c */ FUNCTION_PROTO(fun_cwho); /* bsd.c */ + #ifdef CHAT_BLOCK + FUNCTION_PROTO(fun_cwhol); /* bsd.c */ + FUNCTION_PROTO(fun_cblock); /* fundb.c */ + FUNCTION_PROTO(fun_cpriority); /* fundb.c */ + #endif FUNCTION_PROTO(fun_doing); /* bsd.c */ FUNCTION_PROTO(fun_poll); /* bsd.c */ FUNCTION_PROTO(fun_gfun); /* function.c */ *************** *** 122,127 **** --- 127,135 ---- FUNCTION_PROTO(fun_atrlock); /* fundb.c */ FUNCTION_PROTO(fun_lstats); /* fundb.c */ FUNCTION_PROTO(fun_channels); /* fundb.c */ + #ifdef CHAT_DEFAULT + FUNCTION_PROTO(fun_chandflt); /* fundb.c */ + #endif FUNCTION_PROTO(fun_munge); /* funlist.c */ FUNCTION_PROTO(fun_fold); /* funlist.c */ FUNCTION_PROTO(fun_filter); /* funlist.c */ *** hdrs/mushdb.h.orig Thu Jul 17 16:27:52 1997 --- hdrs/mushdb.h Thu Jul 17 21:50:00 1997 *************** *** 132,137 **** --- 132,139 ---- #define DBF_SPLIT_IMMORTAL 0x80 #define DBF_NO_TEMPLE 0x100 #define DBF_LESS_GARBAGE 0x200 + #define DBF_CHAT_DEFAULT 0x400 + #define DBF_CHAT_BLOCK 0x800 #ifdef HARSH_GUEST #define Guest_Reject(x) \ *** src/bsd.c.orig Thu Jul 17 12:56:09 1997 --- src/bsd.c Sun Jul 20 17:11:51 1997 *************** *** 102,107 **** --- 102,110 ---- #define FD_ISSET(n,p) (*p & (1<<(n))) #endif /* defines for BSD 4.2 */ + #define EQ_LINE \ + "==============================================================================" + /* Win32 uses closesocket() to close a socket, and so will we */ #ifndef WIN32 #define closesocket(s) close(s) *************** *** 281,286 **** --- 284,292 ---- #ifdef IDLE_TIMEOUT void inactivity_check _((void)); #endif + #ifdef CHAT_BLOCK + void channel_notify _((CHANUSER *user, const char *msg)); + #endif #if (CHAT_SYSTEM > 0) #if (CHAT_SYSTEM > 3) void do_channel_who _((dbref player, CHAN *chan)); *************** *** 1767,1772 **** --- 1773,1781 ---- check_mail(player, 0, 0); set_player_folder(player, 0); #endif + #ifdef CHAT_DEFAULT + check_channels(player); + #endif do_look_around(player); if (Haven(player)) { notify(player, "Your HAVEN flag is set. You cannot receive pages."); *************** *** 2317,2323 **** u = onchannel(player, c); if (u &&!Channel_Quiet(c) && (Channel_Admin(c) || Channel_Wizard(c) || (!Chanuser_Hide(u) && !Dark(player)))) { ! channel_broadcast(c, 1, "<%s> %s", ChanName(c), tbuf1); } } #else --- 2326,2336 ---- u = onchannel(player, c); if (u &&!Channel_Quiet(c) && (Channel_Admin(c) || Channel_Wizard(c) || (!Chanuser_Hide(u) && !Dark(player)))) { ! #ifdef CHAT_NOSPOOF ! channel_broadcast(c, NOTHING, 1, "%s", tbuf1); ! #else ! channel_broadcast(c, 1, "%s", tbuf1); ! #endif } } #else *************** *** 2329,2335 **** if (!Dark(player)) { for (b = 1; b <= 32; b++) { if ((chan & mask) && !QuietChan(mask)) ! channel_broadcast(mask, "<%s> %s", channel_name(mask), tbuf1); mask <<= 1; } } else { --- 2342,2348 ---- if (!Dark(player)) { for (b = 1; b <= 32; b++) { if ((chan & mask) && !QuietChan(mask)) ! channel_broadcast(mask, "%s", tbuf1); mask <<= 1; } } else { *************** *** 2336,2342 **** for (b = 1; b <= 32; b++) { if ((chan & mask) && !QuietChan(mask) && (ChanPrivs(mask) != CHP_PUBLIC)) ! channel_broadcast(mask, "<%s> %s", channel_name(mask), tbuf1); mask <<= 1; } } --- 2349,2355 ---- for (b = 1; b <= 32; b++) { if ((chan & mask) && !QuietChan(mask) && (ChanPrivs(mask) != CHP_PUBLIC)) ! channel_broadcast(mask, "%s", tbuf1); mask <<= 1; } } *************** *** 2582,2588 **** if (u && (!Dark(player) || Channel_Admin(c) || Channel_Wizard(c)) && !Chanuser_Hide(u) && !Channel_Quiet(c)) { ! channel_broadcast(c, 1, "<%s> %s", ChanName(c), tbuf1); } } #else --- 2595,2605 ---- if (u && (!Dark(player) || Channel_Admin(c) || Channel_Wizard(c)) && !Chanuser_Hide(u) && !Channel_Quiet(c)) { ! #ifdef CHAT_NOSPOOF ! channel_broadcast(c, NOTHING, 1, "%s", tbuf1); ! #else ! channel_broadcast(c, 1, "%s", tbuf1); ! #endif } } #else *************** *** 2593,2599 **** if (!Dark(player)) { for (b = 1; b <= 32; b++) { if ((chan & mask) && !QuietChan(mask)) ! channel_broadcast(mask, "<%s> %s", channel_name(mask), tbuf1); mask <<= 1; } } else { --- 2610,2616 ---- if (!Dark(player)) { for (b = 1; b <= 32; b++) { if ((chan & mask) && !QuietChan(mask)) ! channel_broadcast(mask, "%s", tbuf1); mask <<= 1; } } else { *************** *** 2600,2606 **** for (b = 1; b <= 32; b++) { if ((chan & mask) && !QuietChan(mask) && (ChanPrivs(mask) != CHP_PUBLIC)) ! channel_broadcast(mask, "<%s> %s", channel_name(mask), tbuf1); mask <<= 1; } } --- 2617,2623 ---- for (b = 1; b <= 32; b++) { if ((chan & mask) && !QuietChan(mask) && (ChanPrivs(mask) != CHP_PUBLIC)) ! channel_broadcast(mask, "%s", tbuf1); mask <<= 1; } } *************** *** 3100,3107 **** --- 3117,3137 ---- #if (CHAT_SYSTEM >= 2) #if (CHAT_SYSTEM > 3) #ifdef I_STDARG + #ifdef CHAT_NOSPOOF void + channel_broadcast(CHAN *channel, dbref player, int checkquiet, const char *fmt,...) + #else + void channel_broadcast(CHAN *channel, int checkquiet, const char *fmt,...) + #endif /* CHAT_NOSPOOF */ + #else /* I_STDARG */ + #ifdef CHAT_NOSPOOF + void + channel_broadcast(channel, player, checkquiet, va_alist) + CHAN *channel; + dbref player; + int checkquiet; + va_dcl #else void channel_broadcast(channel, checkquiet, va_alist) *************** *** 3108,3117 **** CHAN *channel; int checkquiet; va_dcl ! #endif { va_list args; char tbuf1[BUFFER_LEN]; CHANUSER *u; #ifndef I_STDARG char *fmt; --- 3138,3151 ---- CHAN *channel; int checkquiet; va_dcl ! #endif /* CHAT_NOSPOOF */ ! #endif /* I_STDARG */ { va_list args; char tbuf1[BUFFER_LEN]; + char tbuf2[BUFFER_LEN]; + char hbuf[BUFFER_LEN]; + char *bp; CHANUSER *u; #ifndef I_STDARG char *fmt; *************** *** 3131,3145 **** (void) vsprintf(tbuf1, fmt, args); va_end(args); for (u = ChanUsers(channel); u; u = u->next) { if ((!checkquiet || !Chanuser_Quiet(u)) && (Connected(CUdbref(u)) || (Typeof(CUdbref(u)) != TYPE_PLAYER))) { ! notify(CUdbref(u), tbuf1); } } } void do_channel_who(player, chan) dbref player; CHAN *chan; --- 3165,3224 ---- (void) vsprintf(tbuf1, fmt, args); va_end(args); + bp = hbuf; + #ifdef CHAT_HILITE + sprintf(hbuf, "%s%s<%s>%s", + ANSI_HILITE, ANSI_INVERSE, ChanName(channel), ANSI_NORMAL); + #else + sprintf(hbuf, "<%s>", ChanName(channel)); + #endif + for (u = ChanUsers(channel); u; u = u->next) { if ((!checkquiet || !Chanuser_Quiet(u)) && (Connected(CUdbref(u)) || (Typeof(CUdbref(u)) != TYPE_PLAYER))) { ! #ifdef CHAT_NOSPOOF ! if (Nospoof(CUdbref(u))) { ! if (player != NOTHING) ! sprintf(hbuf, "%s[#%d]", hbuf, player); ! else ! sprintf(hbuf, "%s[*]", hbuf); ! } ! #endif ! #ifdef CHAT_PARSE ! if (Channel_Parse(channel)) { ! /* Have any new line start with hbuf */ ! bp = tbuf1; ! while (*bp) { ! if (!strncmp(bp, (char *) "\r\n", 2)) { ! sprintf(tbuf2, "%s\r\n%s ", tbuf2, hbuf); ! bp += 2; ! } else ! sprintf(tbuf2, "%s%c", tbuf2, *bp++); ! } ! channel_notify(u, tprintf("%s %s", hbuf, tbuf2)); ! } else ! channel_notify(u, tprintf("%s %s", hbuf, tbuf1)); ! #else ! channel_notify(u, tprintf("%s %s", hbuf, tbuf1)); ! #endif } } } void + channel_notify(user, msg) + CHANUSER *user; + const char *msg; + { + #ifdef CHAT_BLOCK + if (CUpriority(user) >= Chan_Block(CUdbref(user))) + notify(CUdbref(user), msg); + #else + notify(CUdbref(user), msg); + #endif + } + + void do_channel_who(player, chan) dbref player; CHAN *chan; *************** *** 3146,3160 **** { DESC *d; char tbuf1[BUFFER_LEN]; ! char *bp; CHANUSER *u; bp = tbuf1; DESC_ITER_CONN(d) { u = onchannel(d->player, chan); ! if (u &&(!Chanuser_Hide(u) || Priv_Who(player))) { if (bp != tbuf1) safe_str(", ", tbuf1, &bp); safe_str(Name(d->player), tbuf1, &bp); } } --- 3225,3322 ---- { DESC *d; char tbuf1[BUFFER_LEN]; ! char tbuf2[BUFFER_LEN]; ! char sbuf[BUFFER_LEN]; ! char *bp, *bp1, *bp2; CHANUSER *u; + int num_pl = 0; + int num_obj = 0; + int check = 0; + int k; + #ifdef CHAT_LIST_OBJECTS + notify(player, EQ_LINE); + bp = sbuf; + for (k = 0; k < (78 - strlen(ChanName(chan))) / 2; k++) + safe_chr(' ', sbuf, &bp); + *bp = '\0'; + notify(player, tprintf("%s%s", sbuf, ChanName(chan))); + notify(player, EQ_LINE); + bp1 = tbuf1; + bp2 = tbuf2; + for (u = ChanUsers(chan); u; u = u->next) { + if ((Typeof(CUdbref(u)) == TYPE_PLAYER) && Connected(CUdbref(u)) && + (!Chanuser_Hide(u) || Priv_Who(player))) { + num_pl++; + if (check++ == 3) { + check = 0; + safe_str("\r\n", tbuf1, &bp1); + } + #ifdef CHAT_BLOCK + if (Chan_Block(CUdbref(u)) > CUpriority(u)) { + safe_chr('*', tbuf1, &bp1); + safe_str(Name(CUdbref(u)), tbuf1, &bp1); + for (k = 0; k < 24 - strlen(Name(CUdbref(u))); k++) + safe_chr(' ', tbuf1, &bp1); + } else { + safe_str(Name(CUdbref(u)), tbuf1, &bp1); + for (k = 0; k < 25 - strlen(Name(CUdbref(u))); k++) + safe_chr(' ', tbuf1, &bp1); + } + #else + safe_str(Name(CUdbref(u)), tbuf1, &bp1); + for (k = 0; k < 25 - strlen(Name(CUdbref(u))); k++) + safe_chr(' ', tbuf1, &bp1); + #endif /* CHAT_BLOCK */ + } else { + if (num_obj++ > 0) + safe_str(", ", tbuf2, &bp2); + #ifdef CHAT_BLOCK + if (Chan_Block(CUdbref(u)) > CUpriority(u)) + safe_chr('*', tbuf2, &bp2); + #endif + safe_str(tprintf("%s (Owner: %s)", + Name(CUdbref(u)), Name(Owner(CUdbref(u)))), + tbuf2, &bp2); + } + } + *bp1 = '\0'; + *bp2 = '\0'; + if (Channel_Player(chan)) { + if (num_pl > 0) + notify(player, tbuf1); + else + notify(player, "There are no connected players on this channel."); + notify(player, EQ_LINE); + } + if (Channel_Object(chan)) { + if (num_obj > 0) + notify(player, tbuf2); + else + notify(player, "There are no objects on this channel."); + notify(player, EQ_LINE); + } + if (Channel_Player(chan) && Channel_Object(chan)) + notify(player, tprintf("CHAT: There are %d players and %d objects on the channel %s.", num_pl, num_obj, ChanName(chan))); + else if (Channel_Player(chan)) + notify(player, tprintf("CHAT: There are %d players on the channel %s.", + num_pl, ChanName(chan))); + else if (Channel_Object(chan)) + notify(player, tprintf("CHAT: There are %d objects on the channel %s.", + num_obj, ChanName(chan))); + else + notify(player, tprintf("CHAT: The channel %s is empty.", ChanName(chan))); + #else /* CHAT_LIST_OBJECTS */ bp = tbuf1; DESC_ITER_CONN(d) { u = onchannel(d->player, chan); ! if (u && (!Chanuser_Hide(u) || Priv_Who(player))) { if (bp != tbuf1) safe_str(", ", tbuf1, &bp); + #ifdef CHAT_BLOCK + if (Chat_Block(d->player) > CUpriority(u)) + safe_chr('*', tbuf1, &bp); + #endif safe_str(Name(d->player), tbuf1, &bp); } } *************** *** 3166,3171 **** --- 3328,3334 ---- notify(player, "Connected players on that channel are:"); notify(player, tbuf1); } + #endif /* CHAT_LIST_OBJECTS */ } /* ARGSUSED */ *************** *** 3177,3182 **** --- 3340,3351 ---- CHANUSER *u; int i; + #ifdef RESTRICT_CWHO + if (!Can_Cemit(executor)) { + notify(executor, "CHAT: Permission denied."); + return; + } + #endif i = find_channel(args[0], &chan); switch (i) { case CMATCH_NONE: *************** *** 3206,3214 **** } *bp = buff; DESC_ITER_CONN(d) { if ((u = onchannel(d->player, chan)) && ! (!Chanuser_Hide(u) || Priv_Who(executor))) { if (first) first = 0; else --- 3375,3406 ---- } *bp = buff; + #ifdef CHAT_LIST_OBJECTS + for (u = ChanUsers(chan); u; u = u->next) { + if (((Typeof(CUdbref(u)) != TYPE_PLAYER) || + (Connected(CUdbref(u)) && + (!Chanuser_Hide(u) || Priv_Who(executor)))) + #ifdef CHAT_BLOCK + && (!strchr(called_as, 'L') || + (CUpriority(u) >= Chan_Block(CUdbref(u)))) + #endif + ) { + if (first) + first = 0; + else + safe_chr(' ', buff, bp); + safe_str(unparse_dbref(CUdbref(u)), buff, bp); + } + } + #else DESC_ITER_CONN(d) { if ((u = onchannel(d->player, chan)) && ! (!Chanuser_Hide(u) || Priv_Who(executor)) ! #ifdef CHAT_BLOCK ! && (!strchr(called_as, 'L') || ! (CUpriority(u) >= Chan_Block(d->player))) ! #endif ! ) { if (first) first = 0; else *************** *** 3216,3221 **** --- 3408,3414 ---- safe_str(unparse_dbref(d->player), buff, bp); } } + #endif /* CHAT_LIST_OBJECTS */ } #else /* CHAT_SYSTEM <= 3 */ *************** *** 3256,3262 **** DESC_ITER_CONN(d) { if ((db[d->player].channels & channel) == channel) { ! queue_string(d, tbuf1); queue_write(d, "\r\n", 2); process_output(d); } --- 3449,3460 ---- DESC_ITER_CONN(d) { if ((db[d->player].channels & channel) == channel) { ! #ifdef CHAT_HILITE ! queue_string(d, tprintf("%s%s<%s>%s %s", ANSI_HILITE, ANSI_INVERSE, ! channel_name(channel), ANSI_NORMAL, tbuf1)); ! #else ! queue_string(d, tprintf("<%s> %s", channel_name(channel), tbuf1)); ! #endif queue_write(d, "\r\n", 2); process_output(d); } *************** *** 3265,3272 **** if (ChanPrivs(channel) == CHP_OBJECT) for (i = 0; i < db_top; i++) if ((Typeof(i) == TYPE_THING) && ((db[i].channels & channel) == channel)) ! notify(i, tbuf1); #endif } void --- 3463,3475 ---- if (ChanPrivs(channel) == CHP_OBJECT) for (i = 0; i < db_top; i++) if ((Typeof(i) == TYPE_THING) && ((db[i].channels & channel) == channel)) ! #ifdef CHAT_HILITE ! notify(i, tprintf("%s%s<%s>%s %s", ANSI_HILITE, ANSI_INVERSE ! channel_name(channel), ANSI_NORMAL, tbuf1)); ! #else ! notify(i, tprintf("<%s> %s", channel_name(channel), tbuf1)); #endif + #endif } void *** src/db.c.orig Thu Jul 17 16:28:49 1997 --- src/db.c Sun Jul 20 00:05:21 1997 *************** *** 185,190 **** --- 185,196 ---- /* initialize channels here, since it's not going to get done otherwise */ #if (CHAT_SYSTEM > 3) o->channels = NULL; + #ifdef CHAT_DEFAULT + o->chan_dflt[0] = '\0'; + #endif + #ifdef CHAT_BLOCK + o->chan_block = 0; + #endif #else o->channels = 0; #endif *************** *** 231,236 **** --- 237,248 ---- /* initialize channels here, since it's not going to get done otherwise */ #if (CHAT_SYSTEM > 3) o->channels = NULL; + #ifdef CHAT_DEFAULT + o->chan_dflt[0] = '\0'; + #endif + #ifdef CHAT_BLOCK + o->chan_block = 0; + #endif #else o->channels = 0; #endif *************** *** 414,421 **** --- 426,440 ---- #if (CHAT_SYSTEM != 0) #if (CHAT_SYSTEM <= 3) putref(f, o->channels); + #else + #ifdef CHAT_DEFAULT + putstring(f, o->chan_dflt); #endif + #ifdef CHAT_BLOCK + putref(f, o->chan_block); #endif + #endif + #endif #ifdef USE_WARNINGS putref(f, o->warnings); #endif *************** *** 487,492 **** --- 506,517 ---- #ifdef DUMP_LESS_GARBAGE dbflag += DBF_LESS_GARBAGE; #endif + #ifdef CHAT_DEFAULT + dbflag += DBF_CHAT_DEFAULT; + #endif + #ifdef CHAT_BLOCK + dbflag += DBF_CHAT_BLOCK; + #endif fprintf(f, "+V%d\n", dbflag * 256 + 2); *************** *** 659,664 **** --- 684,695 ---- #ifdef DUMP_LESS_GARBAGE dbflag += DBF_LESS_GARBAGE; #endif + #ifdef CHAT_DEFAULT + dbflag += DBF_CHAT_DEFAULT; + #endif + #ifdef CHAT_BLOCK + dbflag += DBF_CHAT_BLOCK; + #endif fprintf(f, "+V%d\n", dbflag * 256 + 2); *************** *** 1313,1318 **** --- 1344,1355 ---- #endif int temp = 0; time_t temp_time = 0; + #ifdef CHAT_DEFAULT + const char *skip_str; + #endif + #ifdef CHAT_BLOCK + int skip_int; + #endif clear_players(); db_free(); *************** *** 1408,1414 **** --- 1445,1469 ---- #if (CHAT_SYSTEM != 0) #if (CHAT_SYSTEM > 3) o->channels = NULL; + #ifdef CHAT_DEFAULT + if (indb_flags & DBF_CHAT_DEFAULT) + strcpy(o->chan_dflt, getstring_noalloc(f)); + else + strcpy(o->chan_dflt, ""); #else + if (indb_flags & DBF_CHAT_DEFAULT) + strcpy(skip_str, getstring_noalloc(f)); + #endif + #ifdef CHAT_BLOCK + if (indb_flags & DBF_CHAT_BLOCK) + o->chan_block = getref(f); + else + o->chan_block = 0; + #else + if (indb_flags & DBF_CHAT_BLOCK) + skip_int = getref(f); + #endif + #else o->channels = temp; #endif #endif /* CHAT_SYSTEM */ *** src/extchat.c.orig Thu Jul 17 13:23:10 1997 --- src/extchat.c Sat Jul 19 23:39:12 1997 *************** *** 20,27 **** --- 20,30 ---- #include "externs.h" #include "extchat.h" #include "ansi.h" + #include "parse.h" #include "confmagic.h" + static int chat_flags; + static CHAN *new_channel _((void)); static CHANLIST *new_chanlist _((void)); static CHANUSER *new_user _((dbref who)); *************** *** 48,53 **** --- 51,64 ---- static int yesno _((const char *str)); static int canstilladd _((dbref player)); extern void do_channel_who _((dbref player, CHAN *chan)); + void check_channels _((dbref player)); + #ifdef CHAT_BLOCK + void do_chan_block _((dbref player, const char *arg, const char *target)); + void do_chan_priority _((dbref player, const char *name, const char *arg)); + #endif + #ifdef CHAT_DEFAULT + void do_chan_default _((dbref player, const char *name, const char *target)); + #endif #define YES 1 #define NO 0 *************** *** 58,63 **** --- 69,77 ---- #define remove_user_by_dbref(who,chan) \ remove_user(onchannel(who,chan),chan) + #define EQ_LINE \ + "==============================================================================" + CHAN *channels; typedef struct cpriv_info CPRIV; *************** *** 78,83 **** --- 92,100 ---- {"Object", 'O', CHANNEL_OBJECT, CHANNEL_OBJECT}, {"Quiet", 'Q', CHANNEL_QUIET, CHANNEL_QUIET}, {"Hide_Ok", 'H', CHANNEL_CANHIDE, CHANNEL_CANHIDE}, + #ifdef CHAT_PARSE + {"Parse", 'E', CHANNEL_PARSE, CHANNEL_PARSE}, + #endif {NULL, '\0', 0, 0} }; *************** *** 132,140 **** { int i; CHAN *ch; /* How many channels? */ ! num_channels = getref(fp); if (num_channels > MAX_CHANNELS) return 0; --- 149,168 ---- { int i; CHAN *ch; + char nbuf1[8]; + + chat_flags = 0; + /* How many channels? */ ! fgets(nbuf1, sizeof(nbuf1), fp); ! /* If it starts with +, it is telling us the chat db flags */ ! if (*nbuf1 = '+') { ! chat_flags = atoi(nbuf1 + 1); ! /* If the flags indicates aliases, we'll read them now */ ! fgets(nbuf1, sizeof(nbuf1), fp); ! } ! num_channels = atoi(nbuf1); if (num_channels > MAX_CHANNELS) return 0; *************** *** 196,201 **** --- 224,232 ---- CUdbref(u) = who; CUtype(u) = CU_DEFAULT_FLAGS; u->title[0] = '\0'; + #ifdef CHAT_BLOCK + CUpriority(u) = MAX_CHAN_PRTY - 1; + #endif CUnext(u) = NULL; return u; } *************** *** 270,278 **** FILE *fp; CHAN *ch; { ! int i, num = 0; CHANUSER *user; dbref player; for (i = 0; i < ChanNumUsers(ch); i++) { player = getref(fp); /* Don't bother if the player isn't a valid dbref or the wrong type */ --- 301,310 ---- FILE *fp; CHAN *ch; { ! int i, num = 0, skip_it; CHANUSER *user; dbref player; + for (i = 0; i < ChanNumUsers(ch); i++) { player = getref(fp); /* Don't bother if the player isn't a valid dbref or the wrong type */ *************** *** 282,287 **** --- 314,328 ---- return 0; CUtype(user) = getref(fp); strcpy(CUtitle(user), getstring_noalloc(fp)); + #ifdef CHAT_BLOCK + if (chat_flags & CDBF_BLOCK) + CUpriority(user) = getref(fp); + else + CUpriority(user) = MAX_CHAN_PRTY - 1; + #else + if (chat_flags & CDBF_BLOCK) + skip_it = getref(fp); + #endif CUnext(user) = NULL; if (insert_user(user, ch)) num++; *************** *** 555,561 **** --- 596,611 ---- FILE *fp; { CHAN *ch; + + chat_flags = 0; + #ifdef CHAT_BLOCK + chat_flags += CDBF_BLOCK; + #endif + + if (chat_flags) + fprintf(fp, "+%d\n", chat_flags); + /* How many channels? */ putref(fp, num_channels); *************** *** 598,603 **** --- 648,656 ---- putref(fp, CUdbref(user)); putref(fp, CUtype(user)); putstring(fp, CUtitle(user)); + #ifdef CHAT_BLOCK + putref(fp, CUpriority(user)); + #endif return 1; } *************** *** 760,765 **** --- 813,822 ---- notify(player, "That player is already on that channel."); return; } + if (!Chan_Ok_Type(chan, victim)) { + notify(player, "Permission to join denied."); + return; + } /* Does victim pass the joinlock? */ if (!Chan_Can_Join(chan, victim)) { if (Wizard(player)) { *************** *** 777,784 **** } else notify(victim, tprintf("CHAT: You join channel <%s>.", ChanName(chan))); if (!Channel_Quiet(chan) && !(Wizard(victim) && Dark(victim))) ! channel_broadcast(chan, 1, "<%s> %s has joined this channel.", ! ChanName(chan), Name(victim)); ChanNumUsers(chan)++; } else { notify(player, "That player is already on that channel."); --- 834,846 ---- } else notify(victim, tprintf("CHAT: You join channel <%s>.", ChanName(chan))); if (!Channel_Quiet(chan) && !(Wizard(victim) && Dark(victim))) ! #ifdef CHAT_NOSPOOF ! channel_broadcast(chan, NOTHING, 1, "%s has joined this channel.", ! Name(victim)); ! #else ! channel_broadcast(chan, 1, "%s has joined this channel.", ! Name(victim)); ! #endif ChanNumUsers(chan)++; } else { notify(player, "That player is already on that channel."); *************** *** 791,798 **** } if (remove_user_by_dbref(victim, chan)) { if (!Channel_Quiet(chan) && !(Wizard(victim) && Dark(victim))) ! channel_broadcast(chan, 1, "<%s> %s has left this channel.", ! ChanName(chan), Name(victim)); if (victim != player) { notify(victim, tprintf("CHAT: %s removes you from channel <%s>.", Name(player), ChanName(chan))); notify(player, tprintf("CHAT: You remove %s from channel <%s>.", Name(victim), ChanName(chan))); --- 853,864 ---- } if (remove_user_by_dbref(victim, chan)) { if (!Channel_Quiet(chan) && !(Wizard(victim) && Dark(victim))) ! #ifdef CHAT_NOSPOOF ! channel_broadcast(chan, NOTHING, 1, "%s has left this channel.", ! Name(victim)); ! #else ! channel_broadcast(chan, 1, "%s has left this channel.", Name(victim)); ! #endif if (victim != player) { notify(victim, tprintf("CHAT: %s removes you from channel <%s>.", Name(player), ChanName(chan))); notify(player, tprintf("CHAT: You remove %s from channel <%s>.", Name(victim), ChanName(chan))); *************** *** 838,843 **** --- 904,911 ---- int key; const char *gap; char *title; + char tbuf1[BUFFER_LEN]; + char *bp1; if (!Chan_Ok_Type(chan, player)) { notify(player, "Sorry, you're not the right type to be on that channel."); *************** *** 865,870 **** --- 933,951 ---- break; } + #ifdef CHAT_PARSE + /* If the channel can parse, evaluate the message */ + if (Channel_Parse(chan)) { + bp1 = tbuf1; + process_expression(tbuf1, &bp1, &arg1, player, player, player, + PE_DEFAULT, PT_DEFAULT, NULL); + *bp1 = '\0'; + } else + strcpy(tbuf1, arg1); + #else + strcpy(tbuf1, arg1); + #endif + if ((u = onchannel(player, chan)) &&CUtitle(u) && *CUtitle(u)) title = CUtitle(u); else *************** *** 875,894 **** */ switch (key) { case 1: ! channel_broadcast(chan, 0, "<%s> %s%s%s%s%s", ChanName(chan), title ? title : "", title ? " " : "", ! Name(player), gap, arg1); if (!onchannel(player, chan)) notify(player, tprintf("To channel %s: %s%s%s", ChanName(chan), ! Name(player), gap, arg1)); break; case 2: ! channel_broadcast(chan, 0, "<%s> %s%s%s says, \"%s\"", ChanName(chan), title ? title : "", title ? " " : "", ! Name(player), arg1); if (!onchannel(player, chan)) notify(player, tprintf("To channel %s: %s says, \"%s\"", ! ChanName(chan), Name(player), arg1)); break; case 3: notify(player, "What do you want to say to that channel?"); --- 956,1009 ---- */ switch (key) { case 1: ! #ifdef CHAT_NOSPOOF ! channel_broadcast(chan, player, 0, "%s%s%s%s%s", title ? title : "", title ? " " : "", ! Name(player), gap, tbuf1); ! #else ! channel_broadcast(chan, 0, "%s%s%s%s%s", ! title ? title : "", title ? " " : "", ! Name(player), gap, tbuf1); ! #endif ! #ifdef CHAT_BLOCK ! if (!onchannel(player, chan) || ! (CUpriority(onchannel(player, chan)) < Chan_Block(player))) ! #else if (!onchannel(player, chan)) + #endif + #ifdef CHAT_HILITE + notify(player, tprintf("[To Channel] %s%s<%s>%s %s%s%s", + ANSI_HILITE, ANSI_INVERSE, ChanName(chan), + ANSI_NORMAL, Name(player), gap, tbuf1)); + #else notify(player, tprintf("To channel %s: %s%s%s", ChanName(chan), ! Name(player), gap, tbuf1)); ! #endif break; case 2: ! #ifdef CHAT_NOSPOOF ! channel_broadcast(chan, player, 0, "%s%s%s says, \"%s\"", title ? title : "", title ? " " : "", ! Name(player), tbuf1); ! #else ! channel_broadcast(chan, 0, "%s%s%s says, \"%s\"", ! title ? title : "", title ? " " : "", ! Name(player), tbuf1); ! #endif ! #ifdef CHAT_BLOCK ! if (!onchannel(player, chan) || ! (CUpriority(onchannel(player, chan)) < Chan_Block(player))) ! #else if (!onchannel(player, chan)) + #endif + #ifdef CHAT_HILITE + notify(player, tprintf("[To Channel] %s%s<%s>%s %s says, \"%s\"", + ANSI_HILITE, ANSI_INVERSE, ChanName(chan), + ANSI_NORMAL, Name(player), tbuf1)); + #else notify(player, tprintf("To channel %s: %s says, \"%s\"", ! ChanName(chan), Name(player), tbuf1)); ! #endif break; case 3: notify(player, "What do you want to say to that channel?"); *************** *** 903,908 **** --- 1018,1026 ---- const char *name; const char *msg; { + char tbuf1[BUFFER_LEN]; + char *bp1; + /* Send a message to a channel, no prefix. */ CHAN *chan = NULL; *************** *** 930,939 **** notify(player, "What do you want to emit?"); return; } ! channel_broadcast(chan, 0, "%s", msg); if (!onchannel(player, chan)) notify(player, tprintf("Cemit to channel %s: %s", ! ChanName(chan), msg)); ChanNumMsgs(chan)++; return; } --- 1048,1073 ---- notify(player, "What do you want to emit?"); return; } ! #ifdef CHAT_PARSE ! /* If the channel can parse, evaluate the message */ ! if (Channel_Parse(chan)) { ! bp1 = tbuf1; ! process_expression(tbuf1, &bp1, &msg, player, player, player, ! PE_DEFAULT, PT_DEFAULT, NULL); ! *bp1 = '\0'; ! } else ! strcpy(tbuf1, msg); ! #else ! strcpy(tbuf1, msg); ! #endif ! #ifdef CHAT_NOSPOOF ! channel_broadcast(chan, player, 0, "%s", tbuf1); ! #else ! channel_broadcast(chan, 0, "%s", tbuf1); ! #endif if (!onchannel(player, chan)) notify(player, tprintf("Cemit to channel %s: %s", ! ChanName(chan), tbuf1)); ChanNumMsgs(chan)++; return; } *************** *** 1215,1254 **** CHAN *c; CHANUSER *u; ! notify(player, tprintf("%-*s %-5s %8s %-15s %-8s", ! CHAN_NAME_LEN, ! "Name", "Users", "Msgs", "Chan Type", "Status")); for (c = channels; c; c = c->next) { if (Chan_Can_See(c, player) && string_prefix(ChanName(c), partname)) { u = onchannel(player, c); ! notify(player, ! tprintf("%-30s %5d %8d [%c%c%c%c%c%c %c%c%c%c%c%c] [%-3s %c%c]", ! ChanName(c), ! ChanNumUsers(c), ! ChanNumMsgs(c), ! Channel_Disabled(c) ? 'D' : '-', ! Channel_Player(c) ? 'P' : '-', ! Channel_Object(c) ? 'O' : '-', ! Channel_Admin(c) ? 'A' : ! (Channel_Wizard(c) ? 'W' : '-'), ! Channel_Quiet(c) ? 'Q' : '-', ! Channel_CanHide(c) ? 'H' : '-', /* Locks */ ! ChanJoinLock(c) != TRUE_BOOLEXP ? 'j' : '-', ! ChanSpeakLock(c) != TRUE_BOOLEXP ? 's' : '-', ! ChanModLock(c) != TRUE_BOOLEXP ? 'm' : '-', ! ChanSeeLock(c) != TRUE_BOOLEXP ? 'v' : '-', ! ChanHideLock(c) != TRUE_BOOLEXP ? 'h' : '-', /* Does the player own it? */ ! ChanCreator(c) == player ? '*' : '-', /* User status */ ! u ? "On" : "Off", ! (u &&Chanuser_Quiet(u)) ? 'Q' : ' ', ! (u &&Chanuser_Hide(u)) ? 'H' : ' ' ! )); } } ! } /* Remove all players from a channel, notifying them. This is the --- 1349,1620 ---- CHAN *c; CHANUSER *u; ! notify(player, EQ_LINE); ! #ifdef CHAT_BLOCK ! notify(player, tprintf("%-*s %-5s %8s %-7s %-8s %-8s %s", ! CHAN_NAME_LEN, "Name", "Users", "Msgs", ! "Access", "Locks", "Status", "Level")); ! #else ! notify(player, tprintf("%-*s %-5s %8s %-7s %-8s %-8s", ! CHAN_NAME_LEN, "Name", "Users", "Msgs", ! "Access", "Locks", "Status")); ! #endif ! notify(player, EQ_LINE); for (c = channels; c; c = c->next) { if (Chan_Can_See(c, player) && string_prefix(ChanName(c), partname)) { u = onchannel(player, c); ! #ifdef CHAT_PARSE ! #ifdef CHAT_DEFAULT ! #ifdef CHAT_BLOCK ! notify(player, tprintf("%-30s %5d %8d [%c%c%c%c%c%c%c %c%c%c%c%c%c] [%-3s %c%c%c] %c%s", ! ChanName(c), ! ChanNumUsers(c), ! ChanNumMsgs(c), ! Channel_Disabled(c) ? 'D' : '-', ! Channel_Player(c) ? 'P' : '-', ! Channel_Object(c) ? 'O' : '-', ! Channel_Admin(c) ? 'A' : ! (Channel_Wizard(c) ? 'W' : '-'), ! Channel_Quiet(c) ? 'Q' : '-', ! Channel_CanHide(c) ? 'H' : '-', ! Channel_Parse(c) ? 'E' : '-', /* Locks */ ! ChanJoinLock(c) != TRUE_BOOLEXP ? 'j' : '-', ! ChanSpeakLock(c) != TRUE_BOOLEXP ? 's' : '-', ! ChanModLock(c) != TRUE_BOOLEXP ? 'm' : '-', ! ChanSeeLock(c) != TRUE_BOOLEXP ? 'v' : '-', ! ChanHideLock(c) != TRUE_BOOLEXP ? 'h' : '-', /* Does the player own it? */ ! ChanCreator(c) == player ? '*' : '-', /* User status */ ! u ? "On" : "Off", ! (u && Chanuser_Quiet(u)) ? 'Q' : ' ', ! (u && Chanuser_Hide(u)) ? 'H' : ' ', ! Chan_Dflt(player) ? ! (strcasecmp(Chan_Dflt(player), ChanName(c)) ? ' ' : 'd') : ' ', ! (u && (CUpriority(u) < Chan_Block(player))) ? '*' : ' ', ! u ? unparse_integer(CUpriority(u)) : "-" ! )); ! #else /* CHAT_BLOCK */ ! notify(player, tprintf("%-30s %5d %8d [%c%c%c%c%c%c%c %c%c%c%c%c%c] [%-3s %c%c%c]", ! ChanName(c), ! ChanNumUsers(c), ! ChanNumMsgs(c), ! Channel_Disabled(c) ? 'D' : '-', ! Channel_Player(c) ? 'P' : '-', ! Channel_Object(c) ? 'O' : '-', ! Channel_Admin(c) ? 'A' : ! (Channel_Wizard(c) ? 'W' : '-'), ! Channel_Quiet(c) ? 'Q' : '-', ! Channel_CanHide(c) ? 'H' : '-', ! Channel_Parse(c) ? 'E' : '-', ! /* Locks */ ! ChanJoinLock(c) != TRUE_BOOLEXP ? 'j' : '-', ! ChanSpeakLock(c) != TRUE_BOOLEXP ? 's' : '-', ! ChanModLock(c) != TRUE_BOOLEXP ? 'm' : '-', ! ChanSeeLock(c) != TRUE_BOOLEXP ? 'v' : '-', ! ChanHideLock(c) != TRUE_BOOLEXP ? 'h' : '-', ! /* Does the player own it? */ ! ChanCreator(c) == player ? '*' : '-', ! /* User status */ ! u ? "On" : "Off", ! (u && Chanuser_Quiet(u)) ? 'Q' : ' ', ! (u && Chanuser_Hide(u)) ? 'H' : ' ', ! Chan_Dflt(player) ? ! (strcasecmp(Chan_Dflt(player), ChanName(c)) ? ' ' : 'd') : ' ' ! )); ! #endif /* CHAT_BLOCK */ ! #else /* CHAT_DEFAULT */ ! #ifdef CHAT_BLOCK ! notify(player, tprintf("%-30s %5d %8d [%c%c%c%c%c%c%c %c%c%c%c%c%c] [%-3s %c%c%c] %c%s", ! ChanName(c), ! ChanNumUsers(c), ! ChanNumMsgs(c), ! Channel_Disabled(c) ? 'D' : '-', ! Channel_Player(c) ? 'P' : '-', ! Channel_Object(c) ? 'O' : '-', ! Channel_Admin(c) ? 'A' : ! (Channel_Wizard(c) ? 'W' : '-'), ! Channel_Quiet(c) ? 'Q' : '-', ! Channel_CanHide(c) ? 'H' : '-', ! Channel_Parse(c) ? 'E' : '-', ! /* Locks */ ! ChanJoinLock(c) != TRUE_BOOLEXP ? 'j' : '-', ! ChanSpeakLock(c) != TRUE_BOOLEXP ? 's' : '-', ! ChanModLock(c) != TRUE_BOOLEXP ? 'm' : '-', ! ChanSeeLock(c) != TRUE_BOOLEXP ? 'v' : '-', ! ChanHideLock(c) != TRUE_BOOLEXP ? 'h' : '-', ! /* Does the player own it? */ ! ChanCreator(c) == player ? '*' : '-', ! /* User status */ ! u ? "On" : "Off", ! (u && Chanuser_Quiet(u)) ? 'Q' : ' ', ! (u && Chanuser_Hide(u)) ? 'H' : ' ', ! ' ', ! (u && (CUpriority(u) < Chan_Block(player))) ? '*' : ' ', ! u ? unparse_integer(CUpriority(u)) : "-" ! )); ! #else /* CHAT_BLOCK */ ! notify(player, tprintf("%-30s %5d %8d [%c%c%c%c%c%c%c %c%c%c%c%c%c] [%-3s %c%c%c]", ! ChanName(c), ! ChanNumUsers(c), ! ChanNumMsgs(c), ! Channel_Disabled(c) ? 'D' : '-', ! Channel_Player(c) ? 'P' : '-', ! Channel_Object(c) ? 'O' : '-', ! Channel_Admin(c) ? 'A' : ! (Channel_Wizard(c) ? 'W' : '-'), ! Channel_Quiet(c) ? 'Q' : '-', ! Channel_CanHide(c) ? 'H' : '-', ! Channel_Parse(c) ? 'E' : '-', ! /* Locks */ ! ChanJoinLock(c) != TRUE_BOOLEXP ? 'j' : '-', ! ChanSpeakLock(c) != TRUE_BOOLEXP ? 's' : '-', ! ChanModLock(c) != TRUE_BOOLEXP ? 'm' : '-', ! ChanSeeLock(c) != TRUE_BOOLEXP ? 'v' : '-', ! ChanHideLock(c) != TRUE_BOOLEXP ? 'h' : '-', ! /* Does the player own it? */ ! ChanCreator(c) == player ? '*' : '-', ! /* User status */ ! u ? "On" : "Off", ! (u && Chanuser_Quiet(u)) ? 'Q' : ' ', ! (u && Chanuser_Hide(u)) ? 'H' : ' ', ! ' ' ! )); ! #endif /* CHAT_DEFAULT */ ! #endif /* CHAT_BLOCK */ ! #else /* CHAT_PARSE */ ! #ifdef CHAT_DEFAULT ! #ifdef CHAT_BLOCK ! notify(player, tprintf("%-30s %5d %8d [%c%c%c%c%c%c%c %c%c%c%c%c%c] [%-3s %c%c%c] %c%s", ! ChanName(c), ! ChanNumUsers(c), ! ChanNumMsgs(c), ! Channel_Disabled(c) ? 'D' : '-', ! Channel_Player(c) ? 'P' : '-', ! Channel_Object(c) ? 'O' : '-', ! Channel_Admin(c) ? 'A' : ! (Channel_Wizard(c) ? 'W' : '-'), ! Channel_Quiet(c) ? 'Q' : '-', ! Channel_CanHide(c) ? 'H' : '-', ! '-', ! /* Locks */ ! ChanJoinLock(c) != TRUE_BOOLEXP ? 'j' : '-', ! ChanSpeakLock(c) != TRUE_BOOLEXP ? 's' : '-', ! ChanModLock(c) != TRUE_BOOLEXP ? 'm' : '-', ! ChanSeeLock(c) != TRUE_BOOLEXP ? 'v' : '-', ! ChanHideLock(c) != TRUE_BOOLEXP ? 'h' : '-', ! /* Does the player own it? */ ! ChanCreator(c) == player ? '*' : '-', ! /* User status */ ! u ? "On" : "Off", ! (u && Chanuser_Quiet(u)) ? 'Q' : ' ', ! (u && Chanuser_Hide(u)) ? 'H' : ' ', ! Chan_Dflt(player) ? ! (strcasecmp(Chan_Dflt(player), ChanName(c)) ? ' ' : 'd') : ' ', ! (u && (CUpriority(u) < Chan_Block(player))) ? '*' : ' ', ! u ? unparse_integer(CUpriority(u)) : "-" ! )); ! #else /* CHAT_BLOCK */ ! notify(player, tprintf("%-30s %5d %8d [%c%c%c%c%c%c%c %c%c%c%c%c%c] [%-3s %c%c%c]", ! ChanName(c), ! ChanNumUsers(c), ! ChanNumMsgs(c), ! Channel_Disabled(c) ? 'D' : '-', ! Channel_Player(c) ? 'P' : '-', ! Channel_Object(c) ? 'O' : '-', ! Channel_Admin(c) ? 'A' : ! (Channel_Wizard(c) ? 'W' : '-'), ! Channel_Quiet(c) ? 'Q' : '-', ! Channel_CanHide(c) ? 'H' : '-', ! '-', ! /* Locks */ ! ChanJoinLock(c) != TRUE_BOOLEXP ? 'j' : '-', ! ChanSpeakLock(c) != TRUE_BOOLEXP ? 's' : '-', ! ChanModLock(c) != TRUE_BOOLEXP ? 'm' : '-', ! ChanSeeLock(c) != TRUE_BOOLEXP ? 'v' : '-', ! ChanHideLock(c) != TRUE_BOOLEXP ? 'h' : '-', ! /* Does the player own it? */ ! ChanCreator(c) == player ? '*' : '-', ! /* User status */ ! u ? "On" : "Off", ! (u && Chanuser_Quiet(u)) ? 'Q' : ' ', ! (u && Chanuser_Hide(u)) ? 'H' : ' ', ! Chan_Dflt(player) ? ! (strcasecmp(Chan_Dflt(player), ChanName(c)) ? ' ' : 'd') : ' ' ! )); ! #endif /* CHAT_BLOCK */ ! #else /* CHAT_DEFAULT */ ! #ifdef CHAT_BLOCK ! notify(player, tprintf("%-30s %5d %8d [%c%c%c%c%c%c%c %c%c%c%c%c%c] [%-3s %c%c%c] %c%s", ! ChanName(c), ! ChanNumUsers(c), ! ChanNumMsgs(c), ! Channel_Disabled(c) ? 'D' : '-', ! Channel_Player(c) ? 'P' : '-', ! Channel_Object(c) ? 'O' : '-', ! Channel_Admin(c) ? 'A' : ! (Channel_Wizard(c) ? 'W' : '-'), ! Channel_Quiet(c) ? 'Q' : '-', ! Channel_CanHide(c) ? 'H' : '-', ! '-', ! /* Locks */ ! ChanJoinLock(c) != TRUE_BOOLEXP ? 'j' : '-', ! ChanSpeakLock(c) != TRUE_BOOLEXP ? 's' : '-', ! ChanModLock(c) != TRUE_BOOLEXP ? 'm' : '-', ! ChanSeeLock(c) != TRUE_BOOLEXP ? 'v' : '-', ! ChanHideLock(c) != TRUE_BOOLEXP ? 'h' : '-', ! /* Does the player own it? */ ! ChanCreator(c) == player ? '*' : '-', ! /* User status */ ! u ? "On" : "Off", ! (u && Chanuser_Quiet(u)) ? 'Q' : ' ', ! (u && Chanuser_Hide(u)) ? 'H' : ' ', ! ' ', ! (u && (CUpriority(u) < Chan_Block(player))) ? '*' : ' ', ! u ? unparse_integer(CUpriority(u)) : "-" ! )); ! #else /* CHAT_BLOCK */ ! notify(player, tprintf("%-30s %5d %8d [%c%c%c%c%c%c%c %c%c%c%c%c%c] [%-3s %c%c%c]", ! ChanName(c), ! ChanNumUsers(c), ! ChanNumMsgs(c), ! Channel_Disabled(c) ? 'D' : '-', ! Channel_Player(c) ? 'P' : '-', ! Channel_Object(c) ? 'O' : '-', ! Channel_Admin(c) ? 'A' : ! (Channel_Wizard(c) ? 'W' : '-'), ! Channel_Quiet(c) ? 'Q' : '-', ! Channel_CanHide(c) ? 'H' : '-', ! '-', ! /* Locks */ ! ChanJoinLock(c) != TRUE_BOOLEXP ? 'j' : '-', ! ChanSpeakLock(c) != TRUE_BOOLEXP ? 's' : '-', ! ChanModLock(c) != TRUE_BOOLEXP ? 'm' : '-', ! ChanSeeLock(c) != TRUE_BOOLEXP ? 'v' : '-', ! ChanHideLock(c) != TRUE_BOOLEXP ? 'h' : '-', ! /* Does the player own it? */ ! ChanCreator(c) == player ? '*' : '-', ! /* User status */ ! u ? "On" : "Off", ! (u && Chanuser_Quiet(u)) ? 'Q' : ' ', ! (u && Chanuser_Hide(u)) ? 'H' : ' ', ! ' ' ! )); ! #endif /* CHAT_BLOCK */ ! #endif /* CHAT_DEFAULT */ ! #endif /* CHAT_PARSE */ } } ! notify(player, EQ_LINE); ! #ifdef CHAT_BLOCK ! if (Chan_Block(player) > 0) ! notify(player, ! tprintf("CHAT: Your current level of channel blocking is %d.", ! Chan_Block(player))); ! else ! notify(player, "CHAT: Your channels are not blocked."); ! #endif } /* Remove all players from a channel, notifying them. This is the *************** *** 1436,1460 **** const char *partname; { CHAN *c; ! if (ShowAnsi(player)) { ! for (c = channels; c; c = c->next) { ! if (Chan_Can_See(c, player) && string_prefix(ChanName(c), partname)) { notify(player, tprintf("%s<%s>%s", ANSI_HILITE, ChanName(c), ANSI_NORMAL)); ! notify(player, tprintf("Creator: %s", Name(ChanCreator(c)))); ! notify(player, privs_to_string(ChanType(c))); ! notify(player, ChanTitle(c)); ! } } - } else { - for (c = channels; c; c = c->next) { - if (Chan_Can_See(c, player) && string_prefix(ChanName(c), partname)) { - notify(player, tprintf("<%s>", ChanName(c))); - notify(player, tprintf("Creator: %s", Name(ChanCreator(c)))); - notify(player, privs_to_string(ChanType(c))); - notify(player, ChanTitle(c)); - } - } } } --- 1802,1820 ---- const char *partname; { CHAN *c; ! for (c = channels; c; c = c->next) { ! if (Chan_Can_See(c, player) && string_prefix(ChanName(c), partname)) { ! notify(player, EQ_LINE); ! if (ShowAnsi(player)) notify(player, tprintf("%s<%s>%s", ANSI_HILITE, ChanName(c), ANSI_NORMAL)); ! else ! notify(player, tprintf("<%s>", ChanName(c))); ! notify(player, tprintf("Creator: %s", Name(ChanCreator(c)))); ! notify(player, tprintf("Access: %s", privs_to_string(ChanType(c)))); ! notify(player, tprintf("Description: %s", ChanTitle(c))); ! notify(player, EQ_LINE); } } } *************** *** 1676,1678 **** --- 2036,2218 ---- } return (num < MAX_PLAYER_CHANS); } + + void + check_channels(player) + dbref player; + { + #ifdef CHAT_DEFAULT + if (!strcmp(Chan_Dflt(player), "")) + notify(player, tprintf("CHAT: Your default channel is set to '%s'.", + Chan_Dflt(player))); + else + notify(player, "CHAT: You have no default channel."); + #endif /* CHAT_DEFAULT */ + #ifdef CHAT_BLOCK + if (Chan_Block(player) > 0) + notify(player, tprintf("CHAT: You block all your channels with priority below %d.\r\n", Chan_Block(player))); + else + notify(player, "CHAT: Your channels are not blocked.\r\n"); + #else + notify(player, ""); + #endif + } + + #ifdef CHAT_BLOCK + void + do_chan_block(player, arg, target) + dbref player; + const char *arg; + const char *target; + { + int level; + dbref victim; + + if (!arg || !*arg) { + notify(player, "CHAT: What level do you want to set the channel block at?"); + return; + } + if (!target || !*target) + victim = player; + else + victim = match_result(player, target, NOTYPE, MAT_OBJECTS); + if (!GoodObject(victim) || !controls(player, victim)) { + notify(player, "Invalid target."); + return; + } + level = parse_integer(arg); + if (level <= 0) { + Chan_Block(victim) = 0; + if (player == victim) + notify(victim, "CHAT: You unblock all your channels."); + else { + notify(victim, + tprintf("CHAT: %s unblocks all your channels.", Name(player))); + notify(player, + tprintf("CHAT: You unblock all channels of %s", Name(victim))); + } + } else if (level >= MAX_CHAN_PRTY) { + Chan_Block(victim) = MAX_CHAN_PRTY; + if (player == victim) + notify(victim, "CHAT: You block all your channels."); + else { + notify(victim, tprintf("CHAT: %s blocks all your channels.", + Name(player), Chan_Block(victim))); + notify(player, tprintf("CHAT: You block all channels of %s.", + Name(victim))); + } + } else { + Chan_Block(victim) = level; + if (player == victim) + notify(victim, tprintf("CHAT: You block all your channels with priority below %d.", Chan_Block(victim))); + else { + notify(victim, tprintf("CHAT: %s blocks all your channels with priority below %d.", Name(player), Chan_Block(victim))); + notify(player, tprintf("CHAT: You block all channels of %s with priority below %d.", Name(victim), Chan_Block(victim))); + } + } + } + + void + do_chan_priority(player, name, arg) + dbref player; + const char *name; + const char *arg; + { + CHAN *chan = NULL; + CHANUSER *user; + int level; + + if (!name && !*name) { + notify(player, "You need to specify a channel."); + return; + } + test_channel(player, name, chan); + user = onchannel(player, chan); + if (!Chan_Can_See(chan, player) && !user) { + notify(player, "CHAT: I don't recognize that channel."); + return; + } + if (!user) { + notify(player, "CHAT: You are not on that channel."); + return; + } + if (!Chan_Ok_Type(chan, player)) { + notify(player, "CHAT: Sorry, you're the wrong type of thing."); + return; + } + if (!arg && !*arg) { + notify(player, "CHAT: What level of priority do you want to set?"); + return; + } + level = parse_integer(arg); + if (level < 0) + CUpriority(user) = 0; + else if (level >= MAX_CHAN_PRTY) + CUpriority(user) = MAX_CHAN_PRTY - 1; + else + CUpriority(user) = level; + notify(player, tprintf("CHAT: The priority level for the channel '%s' is set to %d.", ChanName(chan), CUpriority(user))); + } + #endif /* CHAT_BLOCK */ + + #ifdef CHAT_DEFAULT + void + do_chan_default(player, name, target) + dbref player; + const char *name; + const char *target; + { + CHAN *chan = NULL; + dbref victim; + + if (!name && !*name) { + notify(player, "You need to specify a channel."); + return; + } + if (!strcasecmp(name, "none")) { + /* reset the default channel */ + if (!target || !*target) + victim = player; + else + victim = match_result(player, target, NOTYPE, MAT_OBJECTS); + Chan_Dflt(victim)[0] = '\0'; + if (victim == player) + notify(victim, "CHAT: You reset your default channel."); + else + notify(victim, tprintf("CHAT: %s resets your default channel.", + Name(player))); + return; + } + test_channel(player, name, chan); + if (!Chan_Can_See(chan, player)) { + if (onchannel(player, chan)) + notify(player, "You can't do that with that channel."); + else + notify(player, "I don't recognize that channel."); + return; + } + if (!Chan_Ok_Type(chan, player)) { + notify(player, "Sorry, you're the wrong type of thing."); + return; + } + /* set the default channel */ + if (!target || !*target) + victim = player; + else if ((victim = lookup_player(target)) != NOTHING) ; + else if (Channel_Object(chan)) + victim = match_result(player, target, TYPE_THING, MAT_OBJECTS); + else + victim = NOTHING; + if (!GoodObject(victim) || !controls(player, victim)) { + notify(player, "Invalid target."); + return; + } + strcpy(Chan_Dflt(victim), ChanName(chan)); + if (victim == player) + notify(victim, tprintf("CHAT: You set your default channel to '%s'.", + ChanName(chan))); + else + notify(victim, tprintf("CHAT: %s set your default channel to '%s'.", + Name(player), ChanName(chan))); + } + #endif /* CHAT_DEFAULT */ *** src/function.c.orig Sat Jul 19 22:32:43 1997 --- src/function.c Sun Jul 20 16:55:22 1997 *************** *** 115,120 **** --- 115,123 ---- {"BEFORE", fun_before, 2, 2, FN_REG}, {"CAPSTR", fun_capstr, 1, -1, FN_REG}, {"CAT", fun_cat, 1, INT_MAX, FN_REG}, + #ifdef CHAT_BLOCK + {"CBLOCK", fun_cblock, 0, 2, FN_REG}, + #endif #if (CHAT_SYSTEM >= 2) {"CEMIT", fun_cemit, 2, -2, FN_REG}, #endif *************** *** 121,127 **** --- 124,133 ---- {"CENTER", fun_center, 2, 3, FN_REG}, #if (CHAT_SYSTEM >= 2) {"CHANNELS", fun_channels, 0, 1, FN_REG}, + #ifdef CHAT_DEFAULT + {"CHANDFLT", fun_chandflt, 0, 2, FN_REG}, #endif + #endif {"CLONE", fun_clone, 1, 1, FN_REG}, {"COMP", fun_comp, 2, 2, FN_REG}, {"CON", fun_con, 1, 1, FN_REG}, *************** *** 129,134 **** --- 135,143 ---- {"CONTROLS", fun_controls, 2, 2, FN_REG}, {"CONVSECS", fun_convsecs, 1, 1, FN_REG}, {"CONVTIME", fun_convtime, 1, 1, FN_REG}, + #ifdef CHAT_BLOCK + {"CPRIORITY", fun_cpriority, 2, 3, FN_REG}, + #endif {"CREATE", fun_create, 1, 2, FN_REG}, #ifdef CREATION_TIMES {"CTIME", fun_ctime, 1, 1, FN_REG}, *************** *** 135,141 **** --- 144,153 ---- #endif #if (CHAT_SYSTEM >= 2) {"CWHO", fun_cwho, 1, 1, FN_REG}, + #ifdef CHAT_BLOCK + {"CWHOL", fun_cwho, 1, 1, FN_REG}, #endif + #endif {"DEC", fun_dec, 1, 1, FN_REG}, #ifdef CRYPTFUNS {"DECRYPT", fun_decrypt, 2, 2, FN_REG}, *** src/fundb.c.orig Sat Jul 19 22:43:13 1997 --- src/fundb.c Sun Jul 20 17:20:34 1997 *************** *** 1660,1662 **** --- 1660,1814 ---- } #endif #endif + + #ifdef CHAT_DEFAULT + FUNCTION(fun_chandflt) + { + dbref it; + CHAN *chan = NULL; + + if (nargs > 0) { + it = match_thing(executor, args[0]); + if ((it == NOTHING) || !Can_Examine(executor, it)) { + safe_str("#-1", buff, bp); + return; + } + if (nargs == 2) { + if (!controls(executor, it)) { + notify(executor, "CHAT: Permission denied."); + safe_str(Chan_Dflt(it), buff, bp); + return; + } + switch (find_channel(args[1], &chan)) { + case CMATCH_NONE: + notify(executor, "CHAT: I don't recognize that channel."); + case CMATCH_AMBIG: + notify(executor, "CHAT: I don't know which channel you mean."); + default: + strcpy(Chan_Dflt(it), ChanName(chan)); + if (executor == it) + notify(it, tprintf("CHAT: You set your default channel to '%s'.", + Chan_Dflt(it))); + else { + notify(it, tprintf("CHAT: %s sets your default channel to '%s'.", + Name(executor), Chan_Dflt(it))); + notify(executor, + tprintf("CHAT: You set %s's default channel to '%s'.", + Name(it), Chan_Dflt(it))); + } + } + } + safe_str(Chan_Dflt(it), buff, bp); + } else + safe_str(Chan_Dflt(executor), buff, bp); + } + #endif /* CHAT_DEFAULT */ + + #ifdef CHAT_BLOCK + FUNCTION(fun_cblock) + { + dbref it; + int level; + + if (nargs == 0) + safe_str(unparse_integer(Chan_Block(executor)), buff, bp); + else { + it = match_thing(executor, args[0]); + if ((it == NOTHING) || !Can_Examine(executor, it)) { + safe_str("#-1", buff, bp); + return; + } + if (nargs == 2) { + if (!controls(executor, it)) { + notify(executor, "CHAT: Permission denied."); + safe_str(unparse_integer(Chan_Block(it)), buff, bp); + return; + } + level = parse_integer(args[1]); + if (level <= 0) { + Chan_Block(it) = 0; + if (executor == it) + notify(it, "CHAT: You unblock all your channels."); + else { + notify(it, tprintf("CHAT: %s unblocks all your channels.", + Name(executor))); + notify(executor, tprintf("CHAT: You unblock all %s's channels.", + Name(it))); + } + } else if (level >= MAX_CHAN_PRTY) { + Chan_Block(it) = MAX_CHAN_PRTY; + if (executor == it) + notify(it, "CHAT: You block all your channels."); + else { + notify(it, tprintf("CHAT: %s blocks all your channels.", + Name(executor))); + notify(executor, tprintf("CHAT: You block all %s's channels.", + Name(it))); + } + } else { + Chan_Block(it) = level; + if (executor == it) + notify(it, tprintf("CHAT: You block all your channels with priority below %d.", Chan_Block(it))); + else { + notify(it, tprintf("CHAT: %s blocks all your channels with priority below %d.", Name(executor), Chan_Block(it))); + notify(executor, tprintf("CHAT: You block all %s's channels with priority below %d.", Name(it), Chan_Block(it))); + } + } + } + safe_str(unparse_integer(Chan_Block(it)), buff, bp); + } + } + + /* AEGSUSED */ + FUNCTION(fun_cpriority) + { + dbref it; + CHAN *chan = NULL; + CHANUSER *u; + int level; + + it = match_thing(executor, args[0]); + if ((it == NOTHING) || !Can_Examine(executor, it)) { + safe_str("#-1", buff, bp); + return; + } + switch (find_channel(args[1], &chan)) { + case CMATCH_NONE: + safe_str("-1", buff, bp); + notify(executor, "CHAT: I don't recognize that channel."); + return; + case CMATCH_AMBIG: + safe_str("-1", buff, bp); + notify(executor, "CHAT: I don't know which channel you mean."); + return; + } + if (!(u = onchannel(it, chan))) { + safe_str("-1", buff, bp); + notify(executor, "CHAT: Player is not listening on the channel."); + return; + } + if ((nargs == 3) && (!controls(executor, it))) { + notify(executor, "CHAT: Permission denied."); + return; + } else if (nargs == 3) { + level = parse_integer(args[2]); + if (level < 0) + CUpriority(u) = 0; + else if (level >= MAX_CHAN_PRTY) + CUpriority(u) = MAX_CHAN_PRTY - 1; + else + CUpriority(u) = level; + if (executor == it) + notify(it, + tprintf("CHAT: You set the priority of the channel %s to %d.", + ChanName(chan), CUpriority(u))); + else { + notify(it, tprintf("CHAT: %s sets the priority of the channel %s for you to %d.", Name(executor), ChanName(chan), CUpriority(u))); + notify(executor, tprintf("CHAT: You set the priority of the channel %s for %s to %d.", ChanName(chan), Name(it), CUpriority(u))); + } + } + safe_str(unparse_integer(CUpriority(u)), buff, bp); + } + #endif /* CHAT_BLOCK */ + + *** src/game.c.orig Thu Jul 17 13:08:32 1997 --- src/game.c Fri Jul 18 15:40:47 1997 *************** *** 101,106 **** --- 101,109 ---- #if (CHAT_SYSTEM >= 2) static int parse_chat _((dbref player, char *command)); #endif + #ifdef CHAT_DEFAULT + static int parse_chat_default _((dbref player, char *command)); + #endif static void do_readcache _((dbref player)); static void set_interp _((dbref player, dbref cause, char const *obj, char const *attrib, char const *val, int from_port)); *************** *** 893,899 **** dbref player; char *command; { ! /* function hacks up something of the form "+ ", * finding the two args, and passes it to do_chat */ --- 896,902 ---- dbref player; char *command; { ! /* function hacks up something of the form ", ", * finding the two args, and passes it to do_chat */ *************** *** 934,939 **** --- 937,958 ---- } #endif /* CHAT_SYSTEM */ + #ifdef CHAT_DEFAULT + static int + parse_chat_default(player, command) + dbref player; + const char *command; + { + /* Talk on the default channel with something like . */ + if (!strcmp(Chan_Dflt(player), "")) + return do_chat_by_name(player, Chan_Dflt(player), command); + else { + notify(player, "CHAT: You have no default channel."); + return 1; + } + } + #endif /* CHAT_DEFAULT */ + static void set_interp(player, cause, obj, attrib, val, from_port) dbref player; *************** *** 1252,1257 **** --- 1271,1281 ---- */ return; #endif /* CHAT_SYSTEM */ + #ifdef CHAT_DEFAULT + } else if (*command == CHAT_DFLT_TOKEN && !gagged && + parse_chat_default(player, command + 1)) { + return; + #endif /* CHAT_DEFAULT */ /* now check if command is an exact match for an exit in the room */ } else if (can_move(player, command)) { if (!Mobile(player)) *************** *** 1437,1442 **** --- 1461,1476 ---- do_chan_user_flags(player, arg1, arg2, 1); else if (Switch("what")) do_chan_what(player, arg1); + #ifdef CHAT_DEFAULT + else if (Switch("default")) + do_chan_default(player, arg1, arg2); + #endif + #ifdef CHAT_BLOCK + else if (Switch("block")) + do_chan_block(player, arg1, arg2); + else if (Switch("priority")) + do_chan_priority(player, arg1, arg2); + #endif else #endif do_channel(player, arg1, arg2, slashp); *************** *** 3787,3792 **** --- 3821,3838 ---- #if (CHAT_SYSTEM >= 2) #if (CHAT_SYSTEM > 3) notify(player, "The extended chat system is enabled."); + #ifdef CHAT_DEFAULT + notify(player, "Default channels are enabled."); + #endif + #ifdef CHAT_BLOCK + notify(player, "Blocking channels is enabled."); + #endif + #ifdef CHAT_PARSE + notify(player, "Evaluation mode on the chat channels is enabled."); + #endif + #ifdef CHAT_LIST_OBJECTS + notify(player, "Non-player objects appear in @channel/who."); + #endif #else notify(player, "The old chat system is enabled."); #ifdef OBJECT_CHAT *************** *** 3844,3849 **** --- 3890,3898 ---- #else notify(player, "Nospoof notification shows the name of the object only."); #endif + #ifdef CHAT_NOSPOOF + notify(player, "Chat messages provide nospoof notifications."); + #endif #ifdef PLAYER_LOCATE notify(player, "The location of players not set UNFINDABLE can be found."); *** src/look.c.orig Thu Jul 17 13:00:07 1997 --- src/look.c Fri Jul 18 15:38:07 1997 *************** *** 482,487 **** --- 482,493 ---- sprintf(buf, "%s %s", buf, ChanName(c->chan)); } else strcpy(buf, "Channels: *NONE*"); + #ifdef CHAT_DEFAULT + if (!strcmp(Chan_Dflt(player), "")) + sprintf(buf, "%s (Default: %s)", buf, Chan_Dflt(player)); + else + sprintf(buf, "%s (No Default)", buf); + #endif return buf; } #else *** game/txt/hlp/penn.hlp.orig Fri Jul 18 16:20:57 1997 --- game/txt/hlp/penn.hlp Thu Jul 17 22:20:39 1997 *************** *** 31,38 **** look move news page pose QUIT read rpage rules RWHO say score slay take think ! use whisper WHO ! " : ; & + In addition to these, there are '@' commands. @-commands usually are commands which can modify and affect the database in substantial ways. --- 31,38 ---- look move news page pose QUIT read rpage rules RWHO say score slay take think ! use whisper WHO " : ! ; & \\ , . In addition to these, there are '@' commands. @-commands usually are commands which can modify and affect the database in substantial ways. *** game/txt/hlp/pennchat.hlp.orig Thu Jul 17 18:33:21 1997 --- game/txt/hlp/pennchat.hlp Fri Jul 18 13:52:18 1997 *************** *** 15,37 **** administrators only. See the following help topics for details: @chat, @channel, @cemit, @clock, cwho() ! & + ! See @chat. ! & @chat @chat = This tells everyone on your . You can prepend with ':' or ';' to pose instead of talk. This command can ! also be formatted: + You do not need to type the complete name of the channel, only as many letters as needed to make it distinct from another channel. ! Note: if you use the '+' form of this command, and you do not use the name of a known channel, your command will be processed as normal, preventing user-defined commands like "+last" from being clobbered by the chat system. & @cemit @cemit = --- 15,43 ---- administrators only. See the following help topics for details: @chat, @channel, @cemit, @clock, cwho() ! & , ! & . & @chat @chat = + , + . This tells everyone on your . You can prepend with ':' or ';' to pose instead of talk. This command can ! also be formatted: , (the comma is important). You do not need to type the complete name of the channel, only as many letters as needed to make it distinct from another channel. ! Note: if you use the ',' form of this command, and you do not use the name of a known channel, your command will be processed as normal, preventing user-defined commands like "+last" from being clobbered by the chat system. + If the default channels are defined, you can use the . + to talk on your default channel. It can be set with the + @channel/default command and stays regardless of whether you + join it or leave it. + & @cemit @cemit = *************** *** 47,54 **** @channel/off [=] The basic form of this command allows you to see the available ! channels, and join or leave a channel. You do not need to type the ! complete name of the channel, only as many letters as needed to make it distinct from other channels. Wizards may add and remove other players from channels by providing --- 53,60 ---- @channel/off [=] The basic form of this command allows you to see the available ! channels, and join or leave a channel. You do not need to type the ! complete name of the channel, only as many letters as needed to make it distinct from other channels. Wizards may add and remove other players from channels by providing *************** *** 70,76 **** @channel/title = The @channel/who command shows you who is currently on a channel, ! if you are permitted to see it. Some channels broadcast messages when players connect or disconnect from the MUSH. If you're on such a channel and don't want to hear --- 76,85 ---- @channel/title = The @channel/who command shows you who is currently on a channel, ! if you are permitted to see it. If a player has the channel blocked, ! his/her name is prefixed with a * in the listing. Non-player objects ! (if the channel access allows, and such are on the channel) are listed ! separately, together with their owners. Some channels broadcast messages when players connect or disconnect from the MUSH. If you're on such a channel and don't want to hear *************** *** 98,106 **** are "player" (players may use the channel), "object" (objects may use the channel), "admin" (you must be royalty to use the channel), "wizard" (you must be a wizard to use the channel), "quiet" (the ! channel will not broadcast connection messages), and "hide_ok" ! (users can hide from the who list). Combinations are allowed. ! If none are given, "player" is used as the default. @channel/delete allows a Wizard or the channel's owner to delete the channel. --- 107,116 ---- are "player" (players may use the channel), "object" (objects may use the channel), "admin" (you must be royalty to use the channel), "wizard" (you must be a wizard to use the channel), "quiet" (the ! channel will not broadcast connection messages), "hide_ok"(users ! can hide from the who list), and "parse" (the channel can evaluate ! expressions). Combinations are allowed. If none are given, "player" ! is used as the default. @channel/delete allows a Wizard or the channel's owner to delete the channel. *************** *** 124,151 **** @channel/decompile produces a decompile of matching channels. @channel/chown allows a Wizard to change the owner of a channel. & channel-list Here's the legend for reading the @channel/list output: ! Channel Name Num Users Num Msgs Access Locks Status ! Sample 1 0 [DPOWQH jsmvh*] [On QH] ! |||||| |||||| | || ! Channel is DISABLED----------------------------/||||| |||||| | || ! Channel allows PLAYERS--------------------------/|||| |||||| | || ! Channel allows OBJECTS---------------------------/||| |||||| | || ! Channel is Wizard-only (W) or Admin-only (A)------/|| |||||| | || ! Channel is QUIET-----------------------------------/| |||||| | || ! Channel is HIDE_OK----------------------------------/ |||||| | || ! Channel has @clock/join set---------------------------|||||| | || ! Channel has @clock/speak set---------------------------/|||| | || ! Channel has @clock/mod set------------------------------/||| | || ! Channel has @clock/see set-------------------------------/|| | || ! Channel has @clock/hide set-------------------------------/| | || ! Player is the owner of the channel-------------------------/ | || ! Player is currently on/off the channel-------------------------/ || ! If on, player has the channel muted--------------------------------/| ! If on, player is hiding on the channel------------------------------/ ! & @clock @clock/join [= ] @clock/speak [= ] --- 134,189 ---- @channel/decompile produces a decompile of matching channels. @channel/chown allows a Wizard to change the owner of a channel. + See "help @channel5" for more. + & @channel5 + @channel/block [=] + @channel/priority = + @channel/default [=] + @channel/default none[=] + + If channel blocking is defined, each channel that a player is on + has a priority level for that player, which is a non-negative integer. + Providing a level in @channel/block blocks all channels whose + priority for the player is below that level (the player doesn't hear + any channel messages, while not leaving the channels). Providing a + zero or negative block level unblocks all channels. + + The channel priorities can be set with @channel/priority. If the + channel blocking is defined, they are listed with @channel/list. + Upon joining a new channel, the priority for the channel is set to 99. + It is the maximal possible channel priority, so that @channel/block 100 + blocks all channels at once. + + When default channels are defined, @channel/default defines the + default channel for a player. One can talk to the default channel + by using the . short-cut command. The second version of the + @channel/default command resets the default channel. + & channel-list Here's the legend for reading the @channel/list output: ! Channel Name Num Users Num Msgs Access Locks Status Priority ! Sample 1 0 [DPOWQHE jsmvh*] [On QHd] *Level ! ||||||| |||||| | ||| | | ! Channel is DISABLED----------------------------/|||||| |||||| | ||| | | ! Channel allows PLAYERS--------------------------/||||| |||||| | ||| | | ! Channel allows OBJECTS---------------------------/|||| |||||| | ||| | | ! Channel is Wizard-only (W) or Admin-only (A)------/||| |||||| | ||| | | ! Channel is QUIET-----------------------------------/|| |||||| | ||| | | ! Channel is HIDE_OK----------------------------------/| |||||| | ||| | | ! Channel can evaluate expressions---------------------/ |||||| | ||| | | ! Channel has @clock/join set----------------------------|||||| | ||| | | ! Channel has @clock/speak set----------------------------/|||| | ||| | | ! Channel has @clock/mod set-------------------------------/||| | ||| | | ! Channel has @clock/see set--------------------------------/|| | ||| | | ! Channel has @clock/hide set--------------------------------/| | ||| | | ! Player is the owner of the channel--------------------------/ | ||| | | ! Player is currently on/off the channel--------------------------/ ||| | | ! If on, player has the channel muted--------------------------------/|| | | ! If on, player is hiding on the channel------------------------------/| | | ! If on, this is the player's default channel--------------------------/ | | ! If marked with a *, the channel is blocked------------------------------/ | ! The priority level of the channel-----------------------------------------/ & @clock @clock/join [= ] @clock/speak [= ] *** game/txt/hlp/pennfunc.hlp.orig Fri Jul 18 16:29:32 1997 --- game/txt/hlp/pennfunc.hlp Sun Jul 20 17:13:24 1997 *************** *** 82,95 **** & Information functions Information functions return values related to objects. ! andflags() channels() conn() controls() ctime() ! cwho() doing() elock() findable() flags() ! folderstats() fullname() hasattr() hasattrp() hasflag() ! haspower() hastype() hidden() idle() lock() ! lstats() lwho() mail() mailfrom() mailstatus() ! mailtime() money() mtime() mwho() name() ! nearby() objmem() orflags() playermem() poll() ! ports() powers() quota() type() visible() & Floating point functions Floating point functions operate on floating point numbers. Most of --- 82,96 ---- & Information functions Information functions return values related to objects. ! andflags() cblock() channels() chandflt() conn() ! controls() cpriority() ctime() cwho() cwhol() ! doing() elock() findable() flags() folderstats() ! fullname() hasattr() hasattrp() hasflag() haspower() ! hastype() hidden() idle() lock() lstats() ! lwho() mail() mailfrom() mailstatus() mailtime() ! money() mtime() mwho() name() nearby() ! objmem() orflags() playermem() poll() ports() ! powers() quota() type() visible() & Floating point functions Floating point functions operate on floating point numbers. Most of *************** *** 1609,1622 **** --- 1610,1645 ---- This function returns the smallest number in its list of arguments. It can take up to ten numbers as arguments. + & CHANDFLT() & CHANNELS() channels() channels() + chandflt() + chandflt() With no arguments, channels() returns the list of all channel names which are visible to the player. With an argument, returns the list of channel names to which the object is listening. + If default channels are defined, the chandflt() function returns + the default channel. + + & CBLOCK() + cblock() + cblock([, ]) + + With no arguments, cblock() returns the minimum priority level at which + a channel you are on is not blocked for you. With an argument, it returns + such blocking level for the object. If the second argument is provided, + it attempts to set the new blocking level. + + & CPRIORITY() + cpriority(, [, ]) + + With two arguments, the function returns the priority level of the channel + for the object, if the object is listening on the channel, and -1 otherwise. + With three arguments, it also attempts to set up a new priority level. + & MAIL() mail() mail() *************** *** 1691,1702 **** date and time that one of the object's attributes was last added, deleted, or modified. Only things, rooms, and exits have modification times. & CWHO() cwho() This returns a list of connected dbrefs who are on . When used by mortals, hidden ("dark") players do not appear on the list. ! & LWHO() lwho() --- 1714,1730 ---- date and time that one of the object's attributes was last added, deleted, or modified. Only things, rooms, and exits have modification times. + & CWHOL() & CWHO() cwho() + cwhol() This returns a list of connected dbrefs who are on . When used by mortals, hidden ("dark") players do not appear on the list. ! ! If the channel blocking system is enabled, cwhol() returns the list ! of those listening on the channel that do not have that channel blocked. ! & LWHO() lwho()