# Patch name: cname.172p20 # Patch version: 1 # Author's name: Sam Sargeant # Author's email: sam@whackass.com # version of PennMUSH: 1.7.2p20 # Date patch made: 19/01/1999 # Author is willing to support (yes/no): Yes # Patch Format: diff -c # # # This is a contributed PennMUSH patch. Its subject to the same # restrictions found in PennMUSH's hdrs/copyrite.h file. # # No warranty is given for this patch. It is not necassarily 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 allows admin, or players with the chat_privs power, to change their name that is used on a channel. This can be useful for Dark admin who still want to help out on a channel, but want to remain in the shadows. To set your cname, simply set the attribute CNAME_ on yourself. So to set a cname for the 'Admin' channel: &CNAME_ADMIN me=The MUSH God NB: This also includes the addition of ANSI to the channel_broadcast. If you already have colorized or changed this, then you will have to manually patch the relevant code. *** src/extchat.c.cname Tue Jan 19 15:16:25 1999 --- src/extchat.c Tue Jan 19 15:36:12 1999 *************** *** 1,4 **** - #include "copyrite.h" #include "config.h" #include --- 1,3 ---- *************** *** 840,845 **** --- 839,847 ---- int key; const char *gap; char *title; + char *cname; + char *sbuf; + ATTR *use_cname; if (!Chan_Ok_Type(chan, player)) { notify(player, *************** *** 875,904 **** else title = NULL; /* now send out the message. If the player isn't on that channel, tell * him what he said. */ 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?"); break; } ChanNumMsgs(chan)++; } --- 877,925 ---- else title = NULL; + /* Figure out if the player wants to use a CNAME */ + sbuf = NULL; + if (Wizard(player)) { + cname = (char *) mush_malloc((sizeof(char) * BUFFER_LEN), "cname"); + strcpy(cname,"CNAME_"); + strcat(cname,ChanName(chan)); + use_cname = atr_get(player,upcasestr(cname)); + mush_free(cname, "cname"); + if (use_cname) { + sbuf = safe_uncompress(use_cname->value); + } + } + /* now send out the message. If the player isn't on that channel, tell * him what he said. */ switch (key) { case 1: ! channel_broadcast(chan, 0, "%s<%s%s%s%s%s>%s %s%s%s%s%s", ! ANSI_CYAN, ANSI_HILITE, ANSI_WHITE, ChanName(chan), ! ANSI_NORMAL, ANSI_CYAN, ANSI_NORMAL, title ? title : "", title ? " " : "", ! sbuf ? sbuf : Name(player), ! gap, arg1); if (!onchannel(player, chan)) notify(player, tprintf("To channel %s: %s%s%s", ChanName(chan), ! sbuf ? sbuf : Name(player), gap, arg1)); break; case 2: ! channel_broadcast(chan, 0, "%s<%s%s%s%s%s>%s %s%s%s says, \"%s\"", ! ANSI_CYAN, ANSI_HILITE, ANSI_WHITE, ChanName(chan), ! ANSI_NORMAL, ANSI_CYAN, ANSI_NORMAL, title ? title : "", title ? " " : "", ! sbuf ? sbuf : Name(player), arg1); if (!onchannel(player, chan)) notify(player, tprintf("To channel %s: %s says, \"%s\"", ! ChanName(chan), sbuf ? sbuf : Name(player), arg1)); break; case 3: notify(player, "What do you want to say to that channel?"); break; } + if (sbuf) + free((Malloc_t) sbuf); ChanNumMsgs(chan)++; } *** src/bsd.c.cname Tue Jan 19 15:39:20 1999 --- src/bsd.c Tue Jan 19 15:50:03 1999 *************** *** 4245,4250 **** --- 4245,4253 ---- char tbuf1[BUFFER_LEN]; char *bp; CHANUSER *u; + char *sbuf; + ATTR *use_cname; + char *cname; bp = tbuf1; DESC_ITER_CONN(d) { *************** *** 4252,4258 **** if (u &&(!Chanuser_Hide(u) || Priv_Who(player))) { if (bp != tbuf1) safe_str(", ", tbuf1, &bp); ! safe_str(Name(d->player), tbuf1, &bp); if (Chanuser_Gag(u)) safe_str(" (gagging)", tbuf1, &bp); } --- 4255,4275 ---- if (u &&(!Chanuser_Hide(u) || Priv_Who(player))) { if (bp != tbuf1) safe_str(", ", tbuf1, &bp); ! if (Wizard(d->player)) { ! cname = (char *) mush_malloc((sizeof(char) * BUFFER_LEN), "cname"); ! strcpy(cname,"CNAME_"); ! strcat(cname,ChanName(chan)); ! use_cname = atr_get(d->player,upcasestr(cname)); ! if (use_cname) { ! sbuf = safe_uncompress(use_cname->value); ! safe_str(sbuf, tbuf1, &bp); ! } else { ! safe_str(Name(d->player), tbuf1, &bp); ! } ! free((Malloc_t) cname); ! } else { ! safe_str(Name(d->player), tbuf1, &bp); ! } if (Chanuser_Gag(u)) safe_str(" (gagging)", tbuf1, &bp); }