1
0
mirror of https://github.com/anope/anope.git synced 2026-07-01 00:26:37 +02:00

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
This commit is contained in:
Adam-
2010-02-28 22:12:09 +00:00
parent 3f80e1cad0
commit ab1f8e01fa
10 changed files with 50 additions and 30 deletions
+2
View File
@@ -39,6 +39,8 @@ Anope Version 1.9.2
NICK_HELP_CMD_RESETPASS
NICK_HELP_RESETPASS
CHAN_UNBANNED_OTHER
MYSQL_SYNC_UPDATING
MYSQL_SYNC_UPDATED
*** Mod Strings:
CHAN_HELP_SET
+1 -1
View File
@@ -7,7 +7,7 @@ Legend:
-----
[+] Redo database insanity.
[x] Move database load/save to a module
[ ] realtime SQL/whatever module using events (possibly ongoing)
[+] realtime SQL/whatever module using events (possibly ongoing)
[ ] flatfile save on a periodic timer
[x] SANE password encryption - prefix password with the method it was encrypted with, allowing for *seamless* upgrading to different methods
[x] Salted SHA256 (contact Special for this)
+1 -1
View File
@@ -47,7 +47,7 @@ class CoreExport Timer : public Extensible
*/
Timer(long time_from_now, time_t now = time(NULL), bool repeating = false);
/** Default destructor, does nothing
/** Default destructor, removes the timer from the list
*/
virtual ~Timer();
+2 -2
View File
@@ -820,14 +820,14 @@ void Channel::SetModes(BotInfo *bi, bool EnforceMLock, const char *cmodes, ...)
if (add)
{
if (cm->Type == MODE_PARAM && sep.GetToken(sbuf))
if (cm->Type != MODE_REGULAR && sep.GetToken(sbuf))
this->SetMode(bi, cm, sbuf, EnforceMLock);
else
this->SetMode(bi, cm, "", EnforceMLock);
}
else if (add == 0)
{
if (cm->Type == MODE_PARAM && sep.GetToken(sbuf))
if (cm->Type != MODE_REGULAR && sep.GetToken(sbuf))
this->RemoveMode(bi, cm, sbuf, EnforceMLock);
else
this->RemoveMode(bi, cm, "", EnforceMLock);
+24 -20
View File
@@ -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));
+8 -1
View File
@@ -19,6 +19,7 @@ class FakeNickCore : public NickCore
~FakeNickCore()
{
insert_core(this);
Users.clear();
}
bool IsServicesOper() const { return true; }
@@ -54,6 +55,7 @@ class FakeUser : public User
(*list)->prev = this;
*list = this;
++usercnt;
nc = NULL;
}
void SetNewNick(const std::string &newnick) { this->nick = newnick; }
@@ -68,7 +70,12 @@ class FakeUser : public User
class SQLTimer : public Timer
{
public:
SQLTimer() : Timer(Me->Delay, time(NULL), true) { }
SQLTimer() : Timer(Me->Delay, time(NULL), true)
{
mysqlpp::Query query(Me->Con);
query << "TRUNCATE TABLE `anope_commands`";
ExecuteQuery(query);
}
void Tick(time_t)
{
+1 -1
View File
@@ -1057,7 +1057,7 @@ int anope_event_capab(const char *source, int ac, const char **av)
}
else if (capab.find("MAXMODES=") != std::string::npos)
{
std::string maxmodes(capab.begin() + 10, capab.end());
std::string maxmodes(capab.begin() + 9, capab.end());
ircd->maxmodes = atoi(maxmodes.c_str());
}
}
+8 -1
View File
@@ -1011,6 +1011,7 @@ int anope_event_capab(const char *source, int ac, const char **av)
case 'I':
ModeManager::AddChannelMode(new ChannelModeInvite('I'));
continue;
// XXX list modes needs a bit of a rewrite, we need to be able to support +g here
default:
ModeManager::AddChannelMode(new ChannelModeList(CMODE_END, modebuf[t]));
}
@@ -1104,6 +1105,9 @@ int anope_event_capab(const char *source, int ac, const char **av)
case 'T':
ModeManager::AddChannelMode(new ChannelMode(CMODE_NONOTICE, 'T'));
continue;
case 'c':
ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCOLOR, 'c'));
continue;
case 'i':
ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, 'i'));
continue;
@@ -1148,6 +1152,9 @@ int anope_event_capab(const char *source, int ac, const char **av)
{
switch (modebuf[t])
{
case 'h':
ModeManager::AddUserMode(new UserMode(UMODE_HELPOP, 'h'));
continue;
case 's':
ModeManager::AddUserMode(new UserMode(UMODE_STRIPCOLOR, 'S'));
continue;
@@ -1237,7 +1244,7 @@ int anope_event_capab(const char *source, int ac, const char **av)
}
else if (capab.find("MAXMODES=") != std::string::npos)
{
std::string maxmodes(capab.begin() + 10, capab.end());
std::string maxmodes(capab.begin() + 9, capab.end());
ircd->maxmodes = atoi(maxmodes.c_str());
}
}
+2 -2
View File
@@ -433,7 +433,7 @@ bool ChannelInfo::SetMLock(ChannelModeName Name, bool status, const std::string
throw CoreException("Was told to mlock a mode negatively with a param?");
EventReturn MOD_RESULT;
FOREACH_MOD(I_OnMLock, OnMLock(Name, status, param));
FOREACH_RESULT(I_OnMLock, OnMLock(Name, status, param));
if (MOD_RESULT == EVENT_STOP)
return false;
@@ -469,7 +469,7 @@ bool ChannelInfo::RemoveMLock(ChannelModeName Name)
size_t value = Name;
EventReturn MOD_RESULT;
FOREACH_MOD(I_OnUnMLock, OnUnMLock(Name));
FOREACH_RESULT(I_OnUnMLock, OnUnMLock(Name));
if (MOD_RESULT == EVENT_STOP)
return false;
+1 -1
View File
@@ -30,7 +30,7 @@ Timer::Timer(long time_from_now, time_t now, bool repeating)
TimerManager::AddTimer(this);
}
/** Default destructor, does nothing
/** Default destructor, removes the timer from the list
*/
Timer::~Timer()
{