Bail out of !opchan if someone has made ChanServ part from the channel.
authorMichael Poole <mdpoole@troilus.org>
Wed, 30 Jul 2008 23:49:47 +0000 (19:49 -0400)
committerMichael Poole <mdpoole@troilus.org>
Wed, 30 Jul 2008 23:49:47 +0000 (19:49 -0400)
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

index 345951d44d45a1ba1110959a2fac6bd88999be56..23a55b5a08fea204cddbed9475e7ce356f99a0ed 100644 (file)
@@ -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;