int do_invite(User * u, Channel *c, char *nick) { ChannelInfo *ci = c->ci; if (!nick) noticeLang(ci->bi->nick, u, LANG_INVITE_SYNTAX); else { if (check_access(u, ci, CA_OPDEOP) && check_access(u, ci, CA_OPDEOPME)) { User *u2; if ((u2 = finduser(nick))) { if (stricmp(u2->nick, u->nick) != 0) { if (!is_on_chan(c, u2)) { anope_cmd_invite(ci->bi->nick, ci->name, u2->nick); notice(ci->bi->nick, ci->name, "%s was invited to the channel.", u2->nick); } else noticeLang(ci->bi->nick, u, LANG_INVITE_IS_ON); } else noticeLang(ci->bi->nick, u, LANG_INVITE_YOURSELF); } else noticeLang(ci->bi->nick, u, LANG_INVITE_NO_USER); } else notice_lang(ci->bi->nick, u, PERMISSION_DENIED); } return MOD_CONT; }
/** * The /cs invite command. * @param u The user who issued the command * @param MOD_CONT to continue processing other modules, MOD_STOP to stop processing. **/ int do_invite(User * u) { char *chan = strtok(NULL, " "); Channel *c; ChannelInfo *ci; if (!chan) { syntax_error(s_ChanServ, u, "INVITE", CHAN_INVITE_SYNTAX); } else if (!(c = findchan(chan))) { notice_lang(s_ChanServ, u, CHAN_X_NOT_IN_USE, chan); } else if (!(ci = c->ci)) { notice_lang(s_ChanServ, u, CHAN_X_NOT_REGISTERED, chan); } else if (ci->flags & CI_VERBOTEN) { notice_lang(s_ChanServ, u, CHAN_X_FORBIDDEN, chan); } else if (ci->flags & CI_SUSPENDED) { notice_lang(s_ChanServ, u, CHAN_X_FORBIDDEN, chan); } else if (!u || !check_access(u, ci, CA_INVITE)) { notice_lang(s_ChanServ, u, PERMISSION_DENIED); } else { anope_cmd_invite(whosends(ci), chan, u->nick); } return MOD_CONT; }