Make ENCAP ROLEPLAY originate from the user running the command, rather than just including the user in the message, as per jilles' suggestion.

This has the benefit of checking ROLEPLAY messages for fake direction.
This commit is contained in:
B.Greenham 2010-12-11 15:51:11 -05:00
parent c7562c2c6c
commit 6816e3387a

View file

@ -88,7 +88,7 @@ struct Message npca_msgtab = {
struct Message roleplay_msgtab = {
"ROLEPLAY", 0, 0, 0, MFLG_SLOW,
{mg_ignore, mg_ignore, mg_ignore, mg_ignore, {me_roleplay, 5}, mg_ignore}
{mg_ignore, mg_ignore, mg_ignore, mg_ignore, {me_roleplay, 4}, mg_ignore}
};
mapi_clist_av1 roleplay_clist[] = { &scene_msgtab, &ambiance_msgtab, &fsay_msgtab, &faction_msgtab, &npc_msgtab, &npca_msgtab, &roleplay_msgtab, NULL };
@ -195,8 +195,8 @@ m_displaymsg(struct Client *source_p, const char *channel, int underline, int ac
rb_snprintf(text2, sizeof(text2), "%s", text);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@npc.fakeuser.invalid PRIVMSG %s :%s", nick2, source_p->name, channel, text2);
sendto_match_servs(&me, "*", CAP_ENCAP, NOCAPS, "ENCAP * ROLEPLAY %s %s %s :%s",
source_p->name, channel, nick2, text2);
sendto_match_servs(source_p, "*", CAP_ENCAP, NOCAPS, "ENCAP * ROLEPLAY %s %s :%s",
channel, nick2, text2);
return 0;
}
@ -206,11 +206,10 @@ me_roleplay(struct Client *client_p, struct Client *source_p, int parc, const ch
struct Channel *chptr;
/* Don't segfault if we get ROLEPLAY with an invalid channel.
* This shouldn't happen but it's best to be on the safe side.
* Other than that, we're going to trust remote ROLEPLAY messages. */
if((chptr = find_channel(parv[2])) == NULL)
* This shouldn't happen but it's best to be on the safe side. */
if((chptr = find_channel(parv[1])) == NULL)
return 0;
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@npc.fakeuser.invalid PRIVMSG %s :%s", parv[3], parv[1], parv[2], parv[4]);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@npc.fakeuser.invalid PRIVMSG %s :%s", parv[2], source_p->name, parv[1], parv[3]);
return 0;
}