diff options
| author | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-02-28 22:12:09 +0000 |
|---|---|---|
| committer | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2010-02-28 22:12:09 +0000 |
| commit | ab1f8e01faf322f2da77369e5700f2e7ff817ae5 (patch) | |
| tree | 88830e0943e5cda5912dc5a1eba8995615afd9ae /src/core | |
| parent | 3f80e1cad02735f692a5a300ee3b200a21f330aa (diff) | |
Made it so you can register empty nonregistered channels to make registering channels through SQL a bit more effective, fixed a some small bugs found on the testnet, added some missing modes into InspIRCd1.2 support, and updated TODO and Changes.lang
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2799 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/cs_register.c | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/src/core/cs_register.c b/src/core/cs_register.c index 8d0766304..4514ea85d 100644 --- a/src/core/cs_register.c +++ b/src/core/cs_register.c @@ -27,7 +27,7 @@ class CommandCSRegister : public Command { const char *chan = params[0].c_str(); const char *desc = params[1].c_str(); - Channel *c; + Channel *c = findchan(chan); ChannelInfo *ci; ChannelMode *cm; @@ -43,13 +43,11 @@ class CommandCSRegister : public Command notice_lang(Config.s_ChanServ, u, CHAN_SYMBOL_REQUIRED); else if (!ircdproto->IsChannelValid(chan)) notice_lang(Config.s_ChanServ, u, CHAN_X_INVALID, chan); - else if (!(c = findchan(chan))) - notice_lang(Config.s_ChanServ, u, CHAN_REGISTER_NONE_CHANNEL, chan); else if ((ci = cs_findchan(chan))) notice_lang(Config.s_ChanServ, u, CHAN_ALREADY_REGISTERED, chan); else if (!stricmp(chan, "#")) notice_lang(Config.s_ChanServ, u, CHAN_MAY_NOT_BE_REGISTERED, chan); - else if (!c->HasUserStatus(u, CMODE_OP)) + else if (c && !c->HasUserStatus(u, CMODE_OP)) notice_lang(Config.s_ChanServ, u, CHAN_MUST_BE_CHANOP); else if (Config.CSMaxReg && u->Account()->channelcount >= Config.CSMaxReg && !u->Account()->HasPriv("chanserv/no-register-limit")) notice_lang(Config.s_ChanServ, u, u->Account()->channelcount > Config.CSMaxReg ? CHAN_EXCEEDED_CHANNEL_LIMIT : CHAN_REACHED_CHANNEL_LIMIT, Config.CSMaxReg); @@ -60,12 +58,15 @@ class CommandCSRegister : public Command } else { - c->ci = ci; - ci->c = c; + if (c) + { + c->ci = ci; + ci->c = c; + } ci->founder = u->Account(); ci->desc = sstrdup(desc); - if (c->topic) + if (c && c->topic) { ci->last_topic = sstrdup(c->topic); ci->last_topic_setter = c->topic_setter; @@ -80,20 +81,23 @@ class CommandCSRegister : public Command notice_lang(Config.s_ChanServ, u, CHAN_REGISTERED, chan, u->nick.c_str()); /* Implement new mode lock */ - check_modes(c); - /* On most ircds you do not receive the admin/owner mode till its registered */ - if ((cm = ModeManager::FindChannelModeByName(CMODE_OWNER))) - c->SetMode(NULL, cm, u->nick); - else if ((cm = ModeManager::FindChannelModeByName(CMODE_PROTECT))) - c->RemoveMode(NULL, cm, u->nick); - - /* Mark the channel as persistant */ - if (c->HasMode(CMODE_PERM)) - ci->SetFlag(CI_PERSIST); - /* Persist may be in def cflags, set it here */ - else if (ci->HasFlag(CI_PERSIST) && (cm = ModeManager::FindChannelModeByName(CMODE_PERM))) + if (c) { - c->SetMode(NULL, CMODE_PERM); + check_modes(c); + /* On most ircds you do not receive the admin/owner mode till its registered */ + if ((cm = ModeManager::FindChannelModeByName(CMODE_OWNER))) + c->SetMode(NULL, cm, u->nick); + else if ((cm = ModeManager::FindChannelModeByName(CMODE_PROTECT))) + c->RemoveMode(NULL, cm, u->nick); + + /* Mark the channel as persistant */ + if (c->HasMode(CMODE_PERM)) + ci->SetFlag(CI_PERSIST); + /* Persist may be in def cflags, set it here */ + else if (ci->HasFlag(CI_PERSIST) && (cm = ModeManager::FindChannelModeByName(CMODE_PERM))) + { + c->SetMode(NULL, CMODE_PERM); + } } FOREACH_MOD(I_OnChanRegistered, OnChanRegistered(ci)); |
