From 6816e3387a4d120e7add705c009131e9ac91c328 Mon Sep 17 00:00:00 2001 From: "B.Greenham" Date: Sat, 11 Dec 2010 15:51:11 -0500 Subject: [PATCH] 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. --- extensions/m_roleplay.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/extensions/m_roleplay.c b/extensions/m_roleplay.c index c0b950ee..15aac734 100644 --- a/extensions/m_roleplay.c +++ b/extensions/m_roleplay.c @@ -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; }