From 5eaffb47d33d10843bdf3ef8f43689f7393012ff Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Wed, 30 Jul 2008 19:49:47 -0400 Subject: [PATCH] Bail out of !opchan if someone has made ChanServ part from the channel. src/chanserv.c (CSMSG_OUT_OF_CHANNEL): New error string. (cmd_opchan): Use it if ChanServ wasn't in the channel for some reason. --- src/chanserv.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/chanserv.c b/src/chanserv.c index 345951d..23a55b5 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -180,6 +180,7 @@ static const struct message_entry msgtab[] = { { "CSMSG_ALREADY_VOICED", "You are already voiced in $b%s$b." }, { "CSMSG_ALREADY_DOWN", "You are not opped or voiced in $b%s$b." }, { "CSMSG_ALREADY_OPCHANNED", "There has been no net.join since the last opchan in $b%s$b." }, + { "CSMSG_OUT_OF_CHANNEL", "For some reason I don't seem to be in $b%s$b." }, { "CSMSG_OPCHAN_DONE", "I have (re-)opped myself in $b%s$b." }, /* Removing yourself from a channel. */ @@ -2527,6 +2528,11 @@ static CHANSERV_FUNC(cmd_opchan) change.argc = 1; change.args[0].mode = MODE_CHANOP; change.args[0].u.member = GetUserMode(channel, chanserv); + if(!change.args[0].u.member) + { + reply("CSMSG_OUT_OF_CHANNEL", channel->name); + return 0; + } mod_chanmode_announce(chanserv, channel, &change); reply("CSMSG_OPCHAN_DONE", channel->name); return 1; -- 2.20.1