* to clearly show that it is fake. SCENE is a special case and not underlined.
* these commands only work on channels set +N
*
- * also adds oper commands FSAY and FACTION, which are like NPC and NPCA
+ * also adds oper commands FSAY and FACTION, which are like NPC and NPCA
* except without the underline.
- *
+ *
* all of these messages have the hostmask npc.fakeuser.invalid, and their ident
* is the nickname of the user running the commands.
*/
#include "chmode.h"
#include "tgchange.h"
#include "channel.h"
+#include "packet.h"
+#include "messages.h"
static int m_scene(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int m_fsay(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
struct Message ambiance_msgtab = {
"AMBIANCE", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_scene, 3}, mg_ignore, mg_ignore, mg_ignore, {m_scene, 3}}
-};
+};
struct Message fsay_msgtab = {
"FSAY", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_npc, 4}, mg_ignore, mg_ignore, mg_ignore, {m_fsay, 4}}
-};
+};
struct Message faction_msgtab = {
"FACTION", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_npca, 4}, mg_ignore, mg_ignore, mg_ignore, {m_faction, 4}}
-};
+};
struct Message npc_msgtab = {
"NPC", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_npc, 4}, mg_ignore, mg_ignore, mg_ignore, {m_npc, 4}}
-};
+};
struct Message npca_msgtab = {
"NPCA", 0, 0, 0, MFLG_SLOW,
{mg_unreg, {m_npca, 4}, mg_ignore, mg_ignore, mg_ignore, {m_npca, 4}}
-};
+};
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 };
struct Channel *chptr;
struct membership *msptr;
char nick2[NICKLEN+1];
- char *nick3 = rb_strdup(nick);
+ char nick3[NICKLEN+1];
+ char text3[BUFSIZE];
char text2[BUFSIZE];
+ rb_strlcpy(nick3, nick, sizeof nick3);
+
+ if(!IsFloodDone(source_p))
+ flood_endgrace(source_p);
+
if((chptr = find_channel(channel)) == NULL)
{
- sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL), channel);
+ sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
+ form_str(ERR_NOSUCHCHANNEL), channel);
return 0;
}
return 0;
}
+ rb_snprintf(text3, sizeof(text3), "%s (%s)", text, source_p->name);
+
if(action)
- rb_snprintf(text2, sizeof(text2), "\1ACTION %s", text);
+ rb_snprintf(text2, sizeof(text2), "\1ACTION %s\1", text3);
else
- rb_snprintf(text2, sizeof(text2), "%s", text);
+ rb_snprintf(text2, sizeof(text2), "%s", text3);
- 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_channel_local(ALL_MEMBERS, chptr, ":%s!%s@npc.fakeuser.invalid PRIVMSG %s :%s", nick2, source_p->name, channel, text2);
+ sendto_match_servs(source_p, "*", CAP_ENCAP, NOCAPS, "ENCAP * ROLEPLAY %s %s :%s",
+ channel, nick2, text2);
return 0;
}
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;
}