mirror of
https://github.com/anope/anope.git
synced 2026-06-12 19:14:47 +02:00
Merge branch '1.9' of ssh://anope.git.sf.net/gitroot/anope/anope into 1.9
This commit is contained in:
@@ -309,6 +309,11 @@ if(NOT DEFUMASK)
|
||||
endif(RUNGROUP)
|
||||
endif(NOT DEFUMASK)
|
||||
|
||||
# Set the DEBUG_BUILD for sysconf.h
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
|
||||
set(DEBUG_BUILD TRUE)
|
||||
endif(CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
|
||||
|
||||
# Check for the existance of the following include files
|
||||
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
|
||||
check_include_file(strings.h HAVE_STRINGS_H)
|
||||
|
||||
@@ -78,6 +78,11 @@ This is safer than C-style casting in that an invalid pointer conversion will
|
||||
return a NULL pointer, and an invalid reference conversion will throw a
|
||||
Bad_cast exception.
|
||||
|
||||
Note that in Anope we prefer if Anope::debug_cast is used.
|
||||
This uses dynamic_cast (and checks for a NULL pointer return) on debug builds
|
||||
and static_cast on release builds, to speed up the program beacuse of dynamic_cast's
|
||||
reliance on RTTI.
|
||||
|
||||
reinterpret_cast
|
||||
----------------
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ class CoreExport Extensible
|
||||
|
||||
if (it != this->Extension_Items.end())
|
||||
{
|
||||
p = dynamic_cast<ExtensibleItemRegular<T> *>(it->second)->GetItem();
|
||||
p = debug_cast<ExtensibleItemRegular<T> *>(it->second)->GetItem();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ class CoreExport Extensible
|
||||
|
||||
if (it != this->Extension_Items.end())
|
||||
{
|
||||
p = dynamic_cast<ExtensibleItemPointer<T> *>(it->second)->GetItem();
|
||||
p = debug_cast<ExtensibleItemPointer<T> *>(it->second)->GetItem();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ class CoreExport Extensible
|
||||
|
||||
if (it != this->Extension_Items.end())
|
||||
{
|
||||
p = dynamic_cast<ExtensibleItemPointerArray<T> *>(it->second)->GetItem();
|
||||
p = debug_cast<ExtensibleItemPointerArray<T> *>(it->second)->GetItem();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+17
-1
@@ -39,8 +39,8 @@
|
||||
|
||||
#include <sys/stat.h> /* for umask() on some systems */
|
||||
#include <sys/types.h>
|
||||
#include <assert.h>
|
||||
#include <fcntl.h>
|
||||
#include <typeinfo>
|
||||
|
||||
#ifndef _WIN32
|
||||
# include <unistd.h>
|
||||
@@ -268,6 +268,22 @@ class DatabaseException : public CoreException
|
||||
virtual ~DatabaseException() throw() { }
|
||||
};
|
||||
|
||||
/** Debug cast to be used instead of dynamic_cast, this uses dynamic_cast
|
||||
* for debug builds and static_cast on releass builds to speed up the program
|
||||
* because dynamic_cast relies on RTTI.
|
||||
*/
|
||||
template<typename T, typename O> inline T debug_cast(O ptr)
|
||||
{
|
||||
#ifdef DEBUG_BUILD
|
||||
T ret = dynamic_cast<T>(ptr);
|
||||
if (ret == NULL)
|
||||
throw CoreException(Anope::string("debug_cast<") + typeid(T).name() + ">(" + typeid(O).name() + ") fail");
|
||||
return ret;
|
||||
#else
|
||||
return static_cast<T>(ptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/** Class with the ability to keep flags on items, they should extend from this
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef _SYSCONF_H_
|
||||
#define _SYSCONF_H_
|
||||
|
||||
#cmakedefine DEBUG_BUILD
|
||||
|
||||
#cmakedefine DEFUMASK @DEFUMASK@
|
||||
#cmakedefine HAVE_SYS_TYPES_H 1
|
||||
#cmakedefine HAVE_STDINT_H 1
|
||||
|
||||
@@ -23,7 +23,8 @@ class CommandCSSASetNoexpire : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
assert(ci);
|
||||
if (!ci)
|
||||
throw CoreException("NULL ci in CommandCSSASetNoexpire");
|
||||
|
||||
if (params[1].equals_ci("ON"))
|
||||
{
|
||||
|
||||
@@ -23,7 +23,8 @@ class CommandCSSetBanType : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
assert(ci);
|
||||
if (!ci)
|
||||
throw CoreException("NULL ci in CommandCSSetBanType");
|
||||
|
||||
Anope::string end;
|
||||
|
||||
|
||||
@@ -23,7 +23,8 @@ class CommandCSSetDescription : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
assert(ci);
|
||||
if (!ci)
|
||||
throw CoreException("NULL ci in CommandCSSetDescription");
|
||||
|
||||
ci->desc = params[1];
|
||||
|
||||
|
||||
@@ -23,7 +23,8 @@ class CommandCSSetEntryMsg : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
assert(ci);
|
||||
if (!ci)
|
||||
throw CoreException("NULL ci in CommandCSSetEntryMsg");
|
||||
|
||||
if (params.size() > 1)
|
||||
{
|
||||
|
||||
@@ -23,7 +23,8 @@ class CommandCSSetFounder : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
assert(ci);
|
||||
if (!ci)
|
||||
throw CoreException("NULL ci in CommandCSSetFounder");
|
||||
|
||||
if (this->permission.empty() && (ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !check_access(u, ci, CA_FOUNDER)))
|
||||
{
|
||||
|
||||
@@ -23,7 +23,8 @@ class CommandCSSetKeepTopic : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
assert(ci);
|
||||
if (!ci)
|
||||
throw CoreException("NULL ci in CommandCSSetKeepTopic");
|
||||
|
||||
if (params[1].equals_ci("ON"))
|
||||
{
|
||||
|
||||
@@ -23,7 +23,8 @@ class CommandCSSetMLock : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
assert(ci);
|
||||
if (!ci)
|
||||
throw CoreException("NULL ci in CommandCSSetMLock");
|
||||
|
||||
int add = -1; /* 1 if adding, 0 if deleting, -1 if neither */
|
||||
ChannelMode *cm;
|
||||
@@ -66,7 +67,7 @@ class CommandCSSetMLock : public Command
|
||||
|
||||
Anope::string param = params[paramcount];
|
||||
|
||||
ChannelModeParam *cmp = dynamic_cast<ChannelModeParam *>(cm);
|
||||
ChannelModeParam *cmp = debug_cast<ChannelModeParam *>(cm);
|
||||
|
||||
if (!cmp || !cmp->IsValid(param))
|
||||
continue;
|
||||
|
||||
@@ -23,7 +23,8 @@ class CommandCSSetOpNotice : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
assert(ci);
|
||||
if (!ci)
|
||||
throw CoreException("NULL ci in CommandCSSetOpNotice");
|
||||
|
||||
if (params[1].equals_ci("ON"))
|
||||
{
|
||||
|
||||
@@ -23,7 +23,8 @@ class CommandCSSetPeace : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
assert(ci);
|
||||
if (!ci)
|
||||
throw CoreException("NULL ci in CommandCSSetPeace");
|
||||
|
||||
if (params[1].equals_ci("ON"))
|
||||
{
|
||||
|
||||
@@ -23,7 +23,8 @@ class CommandCSSetPersist : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
assert(ci);
|
||||
if (!ci)
|
||||
throw CoreException("NULL ci in CommandCSSetPersist");
|
||||
|
||||
ChannelMode *cm = ModeManager::FindChannelModeByName(CMODE_PERM);
|
||||
|
||||
|
||||
@@ -23,7 +23,8 @@ class CommandCSSetPrivate : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
assert(ci);
|
||||
if (!ci)
|
||||
throw CoreException("NULL ci in CommandCSSetPrivate");
|
||||
|
||||
if (params[1].equals_ci("ON"))
|
||||
{
|
||||
|
||||
@@ -22,7 +22,8 @@ class CommandCSSetRestricted : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
assert(ci);
|
||||
if (!ci)
|
||||
throw CoreException("NULL ci in CommandCSSetRestricted");
|
||||
|
||||
if (params[1].equals_ci("ON"))
|
||||
{
|
||||
|
||||
@@ -23,7 +23,8 @@ class CommandCSSetSecure : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
assert(ci);
|
||||
if (!ci)
|
||||
throw CoreException("NULL ci in CommandCSSetSecure");
|
||||
|
||||
if (params[1].equals_ci("ON"))
|
||||
{
|
||||
|
||||
@@ -23,7 +23,8 @@ class CommandCSSetSecureFounder : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
assert(ci);
|
||||
if (!ci)
|
||||
throw CoreException("NULL ci in CommandCSSetSecureFounder");
|
||||
|
||||
if (this->permission.empty() && ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !check_access(u, ci, CA_FOUNDER))
|
||||
{
|
||||
|
||||
@@ -23,7 +23,8 @@ class CommandCSSetSecureOps : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
assert(ci);
|
||||
if (!ci)
|
||||
throw CoreException("NULL ci in CommandCSSetSecureIos");
|
||||
|
||||
if (params[1].equals_ci("ON"))
|
||||
{
|
||||
|
||||
@@ -23,7 +23,8 @@ class CommandCSSetSignKick : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
assert(ci);
|
||||
if (!ci)
|
||||
throw CoreException("NULL ci in CommandCSSetSignKick");
|
||||
|
||||
if (params[1].equals_ci("ON"))
|
||||
{
|
||||
|
||||
@@ -23,7 +23,8 @@ class CommandCSSetSuccessor : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
assert(ci);
|
||||
if (!ci)
|
||||
throw CoreException("NULL ci in CommandCSSetSuccessor");
|
||||
|
||||
if (this->permission.empty() && ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !check_access(u, ci, CA_FOUNDER))
|
||||
{
|
||||
|
||||
@@ -23,7 +23,8 @@ class CommandCSSetTopicLock : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
assert(ci);
|
||||
if (!ci)
|
||||
throw CoreException("NULL ci in CommandCSSetTopicLock");
|
||||
|
||||
if (params[1].equals_ci("ON"))
|
||||
{
|
||||
|
||||
@@ -30,7 +30,8 @@ class CommandCSSetXOP : public Command
|
||||
}
|
||||
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
assert(ci);
|
||||
if (!ci)
|
||||
throw CoreException("NULL ci in CommandCSSetXOP");
|
||||
|
||||
if (params[1].equals_ci("ON"))
|
||||
{
|
||||
|
||||
@@ -1014,7 +1014,7 @@ class DBPlain : public Module
|
||||
{
|
||||
if ((*it)->Class == MC_CHANNEL)
|
||||
{
|
||||
ChannelMode *cm = dynamic_cast<ChannelMode *>(*it);
|
||||
ChannelMode *cm = debug_cast<ChannelMode *>(*it);
|
||||
|
||||
if (ci->HasMLock(cm->Name, true))
|
||||
db << " " << cm->NameAsString;
|
||||
@@ -1029,7 +1029,7 @@ class DBPlain : public Module
|
||||
{
|
||||
if ((*it)->Class == MC_CHANNEL)
|
||||
{
|
||||
ChannelMode *cm = dynamic_cast<ChannelMode *>(*it);
|
||||
ChannelMode *cm = debug_cast<ChannelMode *>(*it);
|
||||
|
||||
if (ci->HasMLock(cm->Name, false))
|
||||
db << " " << cm->NameAsString;
|
||||
@@ -1042,7 +1042,7 @@ class DBPlain : public Module
|
||||
{
|
||||
if ((*it)->Class == MC_CHANNEL)
|
||||
{
|
||||
ChannelMode *cm = dynamic_cast<ChannelMode *>(*it);
|
||||
ChannelMode *cm = debug_cast<ChannelMode *>(*it);
|
||||
|
||||
if (ci->GetParam(cm->Name, Param))
|
||||
db << "MD MLP " << cm->NameAsString << " " << Param << endl;
|
||||
|
||||
@@ -128,7 +128,8 @@ class CommandNSSASetDisplay : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
NickCore *nc = findcore(params[0]);
|
||||
assert(nc);
|
||||
if (!nc)
|
||||
throw CoreException("NULL nc in CommandNSSASetDisplay");
|
||||
|
||||
NickAlias *na = findnick(params[1]);
|
||||
if (!na || na->nc != nc)
|
||||
@@ -170,7 +171,8 @@ class CommandNSSASetPassword : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
NickCore *nc = findcore(params[0]);
|
||||
assert(nc);
|
||||
if (!nc)
|
||||
throw CoreException("NULL nc in CommandNSSASetPassword");
|
||||
|
||||
size_t len = params[1].length();
|
||||
|
||||
|
||||
@@ -23,7 +23,8 @@ class CommandNSSASetNoexpire : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
NickAlias *na = findnick(params[0]);
|
||||
assert(na);
|
||||
if (!na)
|
||||
throw CoreException("NULL na in CommandNSSASsetNoexpire");
|
||||
|
||||
Anope::string param = params.size() > 1 ? params[1] : "";
|
||||
|
||||
|
||||
@@ -65,7 +65,8 @@ class CommandNSSASetAutoOp : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
NickCore *nc = findcore(params[0]);
|
||||
assert(nc);
|
||||
if (!nc)
|
||||
throw CoreException("NULL nc in CommandNSSASetAutoOp");
|
||||
|
||||
Anope::string param = params[1];
|
||||
|
||||
|
||||
@@ -71,7 +71,8 @@ class CommandNSSASetEmail : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
NickCore *nc = findcore(params[0]);
|
||||
assert(nc);
|
||||
if (!nc)
|
||||
throw CoreException("NULL nc in CommandNSSASetEmail");
|
||||
|
||||
Anope::string param = params.size() > 1 ? params[1] : "";
|
||||
|
||||
|
||||
@@ -58,7 +58,8 @@ class CommandNSSASetGreet : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
NickCore *nc = findcore(params[0]);
|
||||
assert(nc);
|
||||
if (!nc)
|
||||
throw CoreException("NULL nc in CommandNSSASetGreet");
|
||||
|
||||
Anope::string param = params.size() > 1 ? params[1] : "";
|
||||
|
||||
|
||||
@@ -98,7 +98,8 @@ class CommandNSSASetHide : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
NickCore *nc = findcore(params[0]);
|
||||
assert(nc);
|
||||
if (!nc)
|
||||
throw CoreException("NULL nc in CommandNSSASetHide");
|
||||
|
||||
Anope::string param = params[1];
|
||||
|
||||
|
||||
@@ -88,7 +88,8 @@ class CommandNSSASetKill : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
NickCore *nc = findcore(params[0]);
|
||||
assert(nc);
|
||||
if (!nc)
|
||||
throw CoreException("NULL nc in CommandNSSASetKill");
|
||||
|
||||
Anope::string param = params[1];
|
||||
|
||||
|
||||
@@ -70,7 +70,8 @@ class CommandNSSASetLanguage : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
NickCore *nc = findcore(params[0]);
|
||||
assert(nc);
|
||||
if (!nc)
|
||||
throw CoreException("NULL nc in CommandNSSASetLanguage");
|
||||
|
||||
Anope::string param = params[1];
|
||||
|
||||
|
||||
@@ -71,7 +71,8 @@ class CommandNSSASetMessage : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
NickCore *nc = findcore(params[0]);
|
||||
assert(nc);
|
||||
if (!nc)
|
||||
throw CoreException("NULL nc in CommandNSSASetMessage");
|
||||
|
||||
Anope::string param = params[1];
|
||||
|
||||
|
||||
@@ -65,7 +65,8 @@ class CommandNSSASetPrivate : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
NickCore *nc = findcore(params[0]);
|
||||
assert(nc);
|
||||
if (!nc)
|
||||
throw CoreException("NULL nc in CommandNSSASetPrivate");
|
||||
|
||||
Anope::string param = params[1];
|
||||
|
||||
|
||||
@@ -65,7 +65,8 @@ class CommandNSSASetSecure : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
NickCore *nc = findcore(params[0]);
|
||||
assert(nc);
|
||||
if (!nc)
|
||||
throw CoreException("NULL nc in CommandNSSASetSecure");
|
||||
|
||||
Anope::string param = params[1];
|
||||
|
||||
|
||||
@@ -428,7 +428,7 @@ void defconParseModeString(const Anope::string &str)
|
||||
|
||||
if (cm->Type == MODE_PARAM)
|
||||
{
|
||||
cmp = dynamic_cast<ChannelModeParam *>(cm);
|
||||
cmp = debug_cast<ChannelModeParam *>(cm);
|
||||
|
||||
if (!ss.GetToken(param))
|
||||
{
|
||||
|
||||
@@ -23,7 +23,8 @@ class CommandCSSetMisc : public Command
|
||||
CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
ChannelInfo *ci = cs_findchan(params[0]);
|
||||
assert(ci);
|
||||
if (!ci)
|
||||
throw CoreException("NULL ci in CommandCSSetMisc");
|
||||
|
||||
ci->Shrink("chanserv:" + this->name);
|
||||
if (params.size() > 1)
|
||||
|
||||
@@ -66,7 +66,7 @@ static std::string MakeMLock(ChannelInfo *ci, bool status)
|
||||
{
|
||||
if ((*it)->Class == MC_CHANNEL)
|
||||
{
|
||||
ChannelMode *cm = dynamic_cast<ChannelMode *>(*it);
|
||||
ChannelMode *cm = debug_cast<ChannelMode *>(*it);
|
||||
|
||||
if (ci->HasMLock(cm->Name, status))
|
||||
ret += " " + cm->NameAsString;
|
||||
@@ -97,7 +97,7 @@ static std::string GetMLockParams(ChannelInfo *ci)
|
||||
{
|
||||
if ((*it)->Class == MC_CHANNEL)
|
||||
{
|
||||
ChannelMode *cm = dynamic_cast<ChannelMode *>(*it);
|
||||
ChannelMode *cm = debug_cast<ChannelMode *>(*it);
|
||||
|
||||
std::string param;
|
||||
if (ci->GetParam(cm->Name, param))
|
||||
|
||||
@@ -22,7 +22,8 @@ class CommandNSSetMisc : public Command
|
||||
CommandReturn RealExecute(User *u, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
NickCore *nc = findcore(params[0]);
|
||||
assert(nc);
|
||||
if (!nc)
|
||||
throw CoreException("NULL nc in CommandNSSetMisc");
|
||||
|
||||
nc->Shrink("nickserv:" + this->name);
|
||||
if (params.size() > 1)
|
||||
|
||||
@@ -319,7 +319,7 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
|
||||
if (m->Type != MODE_STATUS)
|
||||
continue;
|
||||
|
||||
ChannelMode *cm = dynamic_cast<ChannelMode *>(m);
|
||||
ChannelMode *cm = debug_cast<ChannelMode *>(m);
|
||||
|
||||
for (CUserList::const_iterator uit = c->users.begin(), uit_end = c->users.end(); uit != uit_end; ++uit)
|
||||
{
|
||||
|
||||
@@ -413,7 +413,7 @@ int anope_event_fjoin(const Anope::string &source, int ac, const char **av)
|
||||
if (m->Type != MODE_STATUS)
|
||||
continue;
|
||||
|
||||
ChannelMode *cm = dynamic_cast<ChannelMode *>(m);
|
||||
ChannelMode *cm = debug_cast<ChannelMode *>(m);
|
||||
|
||||
for (CUserList::const_iterator uit = c->users.begin(), uit_end = c->users.end(); uit != uit_end; ++uit)
|
||||
{
|
||||
|
||||
@@ -454,7 +454,7 @@ int anope_event_fjoin(const Anope::string &source, int ac, const char **av)
|
||||
if (m->Type != MODE_STATUS)
|
||||
continue;
|
||||
|
||||
ChannelMode *cm = dynamic_cast<ChannelMode *>(m);
|
||||
ChannelMode *cm = debug_cast<ChannelMode *>(m);
|
||||
|
||||
for (CUserList::const_iterator uit = c->users.begin(), uit_end = c->users.end(); uit != uit_end; ++uit)
|
||||
{
|
||||
|
||||
@@ -452,7 +452,7 @@ int anope_event_fjoin(const Anope::string &source, int ac, const char **av)
|
||||
if (m->Type != MODE_STATUS)
|
||||
continue;
|
||||
|
||||
ChannelMode *cm = dynamic_cast<ChannelMode *>(m);
|
||||
ChannelMode *cm = debug_cast<ChannelMode *>(m);
|
||||
|
||||
for (CUserList::const_iterator uit = c->users.begin(), uit_end = c->users.end(); uit != uit_end; ++uit)
|
||||
{
|
||||
|
||||
@@ -302,7 +302,7 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
|
||||
if (m->Type != MODE_STATUS)
|
||||
continue;
|
||||
|
||||
ChannelMode *cm = dynamic_cast<ChannelMode *>(m);
|
||||
ChannelMode *cm = debug_cast<ChannelMode *>(m);
|
||||
|
||||
for (CUserList::const_iterator uit = c->users.begin(), uit_end = c->users.end(); uit != uit_end; ++uit)
|
||||
{
|
||||
@@ -726,17 +726,17 @@ int anope_event_bmask(const Anope::string &source, int ac, const char **av)
|
||||
Anope::string b = myStrGetToken(bans, ' ', i);
|
||||
if (!stricmp(av[2], "b"))
|
||||
{
|
||||
cms = dynamic_cast<ChannelModeList *>(ModeManager::FindChannelModeByChar('b'));
|
||||
cms = debug_cast<ChannelModeList *>(ModeManager::FindChannelModeByChar('b'));
|
||||
cms->AddMask(c, b);
|
||||
}
|
||||
if (!stricmp(av[2], "e"))
|
||||
{
|
||||
cms = dynamic_cast<ChannelModeList *>(ModeManager::FindChannelModeByChar('e'));
|
||||
cms = debug_cast<ChannelModeList *>(ModeManager::FindChannelModeByChar('e'));
|
||||
cms->AddMask(c, b);
|
||||
}
|
||||
if (!stricmp(av[2], "I"))
|
||||
{
|
||||
cms = dynamic_cast<ChannelModeList *>(ModeManager::FindChannelModeByChar('I'));
|
||||
cms = debug_cast<ChannelModeList *>(ModeManager::FindChannelModeByChar('I'));
|
||||
cms->AddMask(c, b);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1008,7 +1008,7 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
|
||||
if (m->Type != MODE_STATUS)
|
||||
continue;
|
||||
|
||||
ChannelMode *cm = dynamic_cast<ChannelMode *>(m);
|
||||
ChannelMode *cm = debug_cast<ChannelMode *>(m);
|
||||
|
||||
for (CUserList::const_iterator uit = c->users.begin(), uit_end = c->users.end(); uit != uit_end; ++uit)
|
||||
{
|
||||
@@ -1052,7 +1052,7 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
|
||||
if (keep_their_modes && buf[0] == '&')
|
||||
{
|
||||
buf.erase(buf.begin());
|
||||
ChannelModeList *cml = dynamic_cast<ChannelModeList *>(ModeManager::FindChannelModeByName(CMODE_BAN));
|
||||
ChannelModeList *cml = debug_cast<ChannelModeList *>(ModeManager::FindChannelModeByName(CMODE_BAN));
|
||||
|
||||
if (cml->IsValid(buf))
|
||||
cml->AddMask(c, buf);
|
||||
@@ -1061,7 +1061,7 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
|
||||
else if (keep_their_modes && buf[0] == '"')
|
||||
{
|
||||
buf.erase(buf.begin());
|
||||
ChannelModeList *cml = dynamic_cast<ChannelModeList *>(ModeManager::FindChannelModeByName(CMODE_EXCEPT));
|
||||
ChannelModeList *cml = debug_cast<ChannelModeList *>(ModeManager::FindChannelModeByName(CMODE_EXCEPT));
|
||||
|
||||
if (cml->IsValid(buf))
|
||||
cml->AddMask(c, buf);
|
||||
@@ -1070,7 +1070,7 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
|
||||
else if (keep_their_modes && buf[0] == '\'')
|
||||
{
|
||||
buf.erase(buf.begin());
|
||||
ChannelModeList *cml = dynamic_cast<ChannelModeList *>(ModeManager::FindChannelModeByName(CMODE_INVITEOVERRIDE));
|
||||
ChannelModeList *cml = debug_cast<ChannelModeList *>(ModeManager::FindChannelModeByName(CMODE_INVITEOVERRIDE));
|
||||
|
||||
if (cml->IsValid(buf))
|
||||
cml->AddMask(c, buf);
|
||||
|
||||
+13
-13
@@ -232,7 +232,7 @@ bool Channel::HasUserStatus(User *u, ChannelModeStatus *cms) const
|
||||
*/
|
||||
bool Channel::HasUserStatus(User *u, ChannelModeName Name) const
|
||||
{
|
||||
return HasUserStatus(u, dynamic_cast<ChannelModeStatus *>(ModeManager::FindChannelModeByName(Name)));
|
||||
return HasUserStatus(u, debug_cast<ChannelModeStatus *>(ModeManager::FindChannelModeByName(Name)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -298,7 +298,7 @@ void Channel::SetModeInternal(ChannelMode *cm, const Anope::string ¶m, bool
|
||||
return;
|
||||
}
|
||||
|
||||
ChannelModeList *cml = dynamic_cast<ChannelModeList *>(cm);
|
||||
ChannelModeList *cml = debug_cast<ChannelModeList *>(cm);
|
||||
cml->AddMask(this, param);
|
||||
return;
|
||||
}
|
||||
@@ -357,7 +357,7 @@ void Channel::SetModeInternal(ChannelMode *cm, const Anope::string ¶m, bool
|
||||
/* If this is a param mode and its mlocked +, check to ensure someone didn't reset it with the wrong param */
|
||||
else if (cm->Type == MODE_PARAM && ci->HasMLock(cm->Name, true))
|
||||
{
|
||||
ChannelModeParam *cmp = dynamic_cast<ChannelModeParam *>(cm);
|
||||
ChannelModeParam *cmp = debug_cast<ChannelModeParam *>(cm);
|
||||
Anope::string cparam, ciparam;
|
||||
/* Get the param currently set on this channel */
|
||||
GetParam(cmp->Name, cparam);
|
||||
@@ -429,7 +429,7 @@ void Channel::RemoveModeInternal(ChannelMode *cm, const Anope::string ¶m, bo
|
||||
return;
|
||||
}
|
||||
|
||||
ChannelModeList *cml = dynamic_cast<ChannelModeList *>(cm);
|
||||
ChannelModeList *cml = debug_cast<ChannelModeList *>(cm);
|
||||
cml->DelMask(this, param);
|
||||
return;
|
||||
}
|
||||
@@ -509,7 +509,7 @@ void Channel::SetMode(BotInfo *bi, ChannelMode *cm, const Anope::string ¶m,
|
||||
else if (cm->Type == MODE_STATUS)
|
||||
{
|
||||
User *u = finduser(param);
|
||||
if (u && HasUserStatus(u, dynamic_cast<ChannelModeStatus *>(cm)))
|
||||
if (u && HasUserStatus(u, debug_cast<ChannelModeStatus *>(cm)))
|
||||
return;
|
||||
}
|
||||
else if (cm->Type == MODE_LIST)
|
||||
@@ -562,7 +562,7 @@ void Channel::RemoveMode(BotInfo *bi, ChannelMode *cm, const Anope::string ¶
|
||||
else if (cm->Type == MODE_STATUS)
|
||||
{
|
||||
User *u = finduser(param);
|
||||
if (u && !HasUserStatus(u, dynamic_cast<ChannelModeStatus *>(cm)))
|
||||
if (u && !HasUserStatus(u, debug_cast<ChannelModeStatus *>(cm)))
|
||||
return;
|
||||
}
|
||||
else if (cm->Type == MODE_LIST)
|
||||
@@ -574,7 +574,7 @@ void Channel::RemoveMode(BotInfo *bi, ChannelMode *cm, const Anope::string ¶
|
||||
bool SendParam = true;
|
||||
if (cm->Type == MODE_PARAM)
|
||||
{
|
||||
ChannelModeParam *cmp = dynamic_cast<ChannelModeParam *>(cm);
|
||||
ChannelModeParam *cmp = debug_cast<ChannelModeParam *>(cm);
|
||||
if (cmp->MinusNoArg)
|
||||
SendParam = false;
|
||||
}
|
||||
@@ -677,7 +677,7 @@ void Channel::ClearBans(BotInfo *bi)
|
||||
Entry *entry, *nexte;
|
||||
ChannelModeList *cml;
|
||||
|
||||
cml = dynamic_cast<ChannelModeList *>(ModeManager::FindChannelModeByName(CMODE_BAN));
|
||||
cml = debug_cast<ChannelModeList *>(ModeManager::FindChannelModeByName(CMODE_BAN));
|
||||
|
||||
if (cml && this->bans && this->bans->count)
|
||||
for (entry = this->bans->entries; entry; entry = nexte)
|
||||
@@ -696,7 +696,7 @@ void Channel::ClearExcepts(BotInfo *bi)
|
||||
Entry *entry, *nexte;
|
||||
ChannelModeList *cml;
|
||||
|
||||
cml = dynamic_cast<ChannelModeList *>(ModeManager::FindChannelModeByName(CMODE_EXCEPT));
|
||||
cml = debug_cast<ChannelModeList *>(ModeManager::FindChannelModeByName(CMODE_EXCEPT));
|
||||
|
||||
if (cml && this->excepts && this->excepts->count)
|
||||
for (entry = this->excepts->entries; entry; entry = nexte)
|
||||
@@ -715,7 +715,7 @@ void Channel::ClearInvites(BotInfo *bi)
|
||||
Entry *entry, *nexte;
|
||||
ChannelModeList *cml;
|
||||
|
||||
cml = dynamic_cast<ChannelModeList *>(ModeManager::FindChannelModeByName(CMODE_INVITEOVERRIDE));
|
||||
cml = debug_cast<ChannelModeList *>(ModeManager::FindChannelModeByName(CMODE_INVITEOVERRIDE));
|
||||
|
||||
if (cml && this->invites && this->invites->count)
|
||||
for (entry = this->invites->entries; entry; entry = nexte)
|
||||
@@ -823,7 +823,7 @@ void ChanSetInternalModes(Channel *c, int ac, const char **av)
|
||||
}
|
||||
else if (cm->Type == MODE_PARAM)
|
||||
{
|
||||
ChannelModeParam *cmp = dynamic_cast<ChannelModeParam *>(cm);
|
||||
ChannelModeParam *cmp = debug_cast<ChannelModeParam *>(cm);
|
||||
|
||||
if (!add && cmp->MinusNoArg)
|
||||
{
|
||||
@@ -927,7 +927,7 @@ Anope::string chan_get_modes(Channel *chan, int complete, int plus)
|
||||
if ((*it)->Class != MC_CHANNEL)
|
||||
continue;
|
||||
|
||||
ChannelMode *cm = dynamic_cast<ChannelMode *>(*it);
|
||||
ChannelMode *cm = debug_cast<ChannelMode *>(*it);
|
||||
|
||||
if (chan->HasMode(cm->Name))
|
||||
{
|
||||
@@ -937,7 +937,7 @@ Anope::string chan_get_modes(Channel *chan, int complete, int plus)
|
||||
{
|
||||
if (cm->Type == MODE_PARAM)
|
||||
{
|
||||
ChannelModeParam *cmp = dynamic_cast<ChannelModeParam *>(cm);
|
||||
ChannelModeParam *cmp = debug_cast<ChannelModeParam *>(cm);
|
||||
|
||||
if (plus || !cmp->MinusNoArg)
|
||||
{
|
||||
|
||||
+2
-2
@@ -160,7 +160,7 @@ Anope::string get_mlock_modes(ChannelInfo *ci, int complete)
|
||||
|
||||
if (cm->Type == MODE_PARAM)
|
||||
{
|
||||
cmp = dynamic_cast<ChannelModeParam *>(cm);
|
||||
cmp = debug_cast<ChannelModeParam *>(cm);
|
||||
|
||||
ci->GetParam(cmp->Name, param);
|
||||
|
||||
@@ -343,7 +343,7 @@ void check_modes(Channel *c)
|
||||
/* Add the eventual parameter */
|
||||
if (cm->Type == MODE_PARAM)
|
||||
{
|
||||
ChannelModeParam *cmp = dynamic_cast<ChannelModeParam *>(cm);
|
||||
ChannelModeParam *cmp = debug_cast<ChannelModeParam *>(cm);
|
||||
|
||||
if (!cmp->MinusNoArg)
|
||||
{
|
||||
|
||||
+12
-12
@@ -838,82 +838,82 @@ int ServerConfig::Read(bool bail)
|
||||
{
|
||||
case DT_NOSPACES:
|
||||
{
|
||||
ValueContainerString *vcs = dynamic_cast<ValueContainerString *>(Values[Index].val);
|
||||
ValueContainerString *vcs = debug_cast<ValueContainerString *>(Values[Index].val);
|
||||
ValidateNoSpaces(vi.GetValue(), Values[Index].tag, Values[Index].value);
|
||||
vcs->Set(vi.GetValue());
|
||||
}
|
||||
break;
|
||||
case DT_HOSTNAME:
|
||||
{
|
||||
ValueContainerString *vcs = dynamic_cast<ValueContainerString *>(Values[Index].val);
|
||||
ValueContainerString *vcs = debug_cast<ValueContainerString *>(Values[Index].val);
|
||||
ValidateHostname(vi.GetValue(), Values[Index].tag, Values[Index].value);
|
||||
vcs->Set(vi.GetValue());
|
||||
}
|
||||
break;
|
||||
case DT_IPADDRESS:
|
||||
{
|
||||
ValueContainerString *vcs = dynamic_cast<ValueContainerString *>(Values[Index].val);
|
||||
ValueContainerString *vcs = debug_cast<ValueContainerString *>(Values[Index].val);
|
||||
ValidateIP(vi.GetValue(), Values[Index].tag, Values[Index].value, allow_wild);
|
||||
vcs->Set(vi.GetValue());
|
||||
}
|
||||
break;
|
||||
case DT_CHARPTR:
|
||||
{
|
||||
ValueContainerChar *vcc = dynamic_cast<ValueContainerChar *>(Values[Index].val);
|
||||
ValueContainerChar *vcc = debug_cast<ValueContainerChar *>(Values[Index].val);
|
||||
// Make sure we also copy the null terminator
|
||||
vcc->Set(vi.GetString(), strlen(vi.GetString()) + 1);
|
||||
}
|
||||
break;
|
||||
case DT_CSSTRING:
|
||||
{
|
||||
ValueContainerCSString *vcs = dynamic_cast<ValueContainerCSString *>(Values[Index].val);
|
||||
ValueContainerCSString *vcs = debug_cast<ValueContainerCSString *>(Values[Index].val);
|
||||
vcs->Set(vi.GetCSValue());
|
||||
}
|
||||
break;
|
||||
case DT_CISTRING:
|
||||
{
|
||||
ValueContainerCIString *vcs = dynamic_cast<ValueContainerCIString *>(Values[Index].val);
|
||||
ValueContainerCIString *vcs = debug_cast<ValueContainerCIString *>(Values[Index].val);
|
||||
vcs->Set(vi.GetCIValue());
|
||||
}
|
||||
break;
|
||||
case DT_STRING:
|
||||
{
|
||||
ValueContainerString *vcs = dynamic_cast<ValueContainerString *>(Values[Index].val);
|
||||
ValueContainerString *vcs = debug_cast<ValueContainerString *>(Values[Index].val);
|
||||
vcs->Set(vi.GetValue());
|
||||
}
|
||||
break;
|
||||
case DT_INTEGER:
|
||||
{
|
||||
int val = vi.GetInteger();
|
||||
ValueContainerInt *vci = dynamic_cast<ValueContainerInt *>(Values[Index].val);
|
||||
ValueContainerInt *vci = debug_cast<ValueContainerInt *>(Values[Index].val);
|
||||
vci->Set(&val, sizeof(int));
|
||||
}
|
||||
break;
|
||||
case DT_UINTEGER:
|
||||
{
|
||||
unsigned val = vi.GetInteger();
|
||||
ValueContainerUInt *vci = dynamic_cast<ValueContainerUInt *>(Values[Index].val);
|
||||
ValueContainerUInt *vci = debug_cast<ValueContainerUInt *>(Values[Index].val);
|
||||
vci->Set(&val, sizeof(unsigned));
|
||||
}
|
||||
break;
|
||||
case DT_LUINTEGER:
|
||||
{
|
||||
unsigned long val = vi.GetInteger();
|
||||
ValueContainerLUInt *vci = dynamic_cast<ValueContainerLUInt *>(Values[Index].val);
|
||||
ValueContainerLUInt *vci = debug_cast<ValueContainerLUInt *>(Values[Index].val);
|
||||
vci->Set(&val, sizeof(unsigned long));
|
||||
}
|
||||
break;
|
||||
case DT_TIME:
|
||||
{
|
||||
time_t time = dotime(vi.GetValue());
|
||||
ValueContainerTime *vci = dynamic_cast<ValueContainerTime *>(Values[Index].val);
|
||||
ValueContainerTime *vci = debug_cast<ValueContainerTime *>(Values[Index].val);
|
||||
vci->Set(&time, sizeof(time_t));
|
||||
}
|
||||
break;
|
||||
case DT_BOOLEAN:
|
||||
{
|
||||
bool val = vi.GetBool();
|
||||
ValueContainerBool *vcb = dynamic_cast<ValueContainerBool *>(Values[Index].val);
|
||||
ValueContainerBool *vcb = debug_cast<ValueContainerBool *>(Values[Index].val);
|
||||
vcb->Set(&val, sizeof(bool));
|
||||
}
|
||||
break;
|
||||
|
||||
+2
-2
@@ -87,7 +87,7 @@ void SetDefaultMLock()
|
||||
ChannelMode *cm = ModeManager::FindChannelModeByChar(Config.BotModes[i]);
|
||||
|
||||
if (cm && cm->Type == MODE_STATUS && std::find(BotModes.begin(), BotModes.end(), cm) == BotModes.end())
|
||||
BotModes.push_back(dynamic_cast<ChannelModeStatus *>(cm));
|
||||
BotModes.push_back(debug_cast<ChannelModeStatus *>(cm));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -730,7 +730,7 @@ char ModeManager::GetStatusChar(char Value)
|
||||
cm = it->second;
|
||||
if (cm->Type == MODE_STATUS)
|
||||
{
|
||||
cms = dynamic_cast<ChannelModeStatus *>(cm);
|
||||
cms = debug_cast<ChannelModeStatus *>(cm);
|
||||
|
||||
if (Value == cms->Symbol)
|
||||
return it->first;
|
||||
|
||||
+3
-3
@@ -352,7 +352,7 @@ void ChannelInfo::LoadMLock()
|
||||
{
|
||||
if ((*mit)->Class == MC_CHANNEL)
|
||||
{
|
||||
ChannelMode *cm = dynamic_cast<ChannelMode *>(*mit);
|
||||
ChannelMode *cm = debug_cast<ChannelMode *>(*mit);
|
||||
|
||||
if (cm->NameAsString.equals_ci(*it))
|
||||
this->SetMLock(cm->Name, true);
|
||||
@@ -371,7 +371,7 @@ void ChannelInfo::LoadMLock()
|
||||
{
|
||||
if ((*mit)->Class == MC_CHANNEL)
|
||||
{
|
||||
ChannelMode *cm = dynamic_cast<ChannelMode *>(*mit);
|
||||
ChannelMode *cm = debug_cast<ChannelMode *>(*mit);
|
||||
|
||||
if (cm->NameAsString.equals_ci(*it))
|
||||
this->SetMLock(cm->Name, false);
|
||||
@@ -392,7 +392,7 @@ void ChannelInfo::LoadMLock()
|
||||
{
|
||||
if ((*mit)->Class == MC_CHANNEL)
|
||||
{
|
||||
ChannelMode *cm = dynamic_cast<ChannelMode *>(*mit);
|
||||
ChannelMode *cm = debug_cast<ChannelMode *>(*mit);
|
||||
|
||||
if (cm->NameAsString.equals_ci(it->first))
|
||||
this->SetMLock(cm->Name, true, it->second);
|
||||
|
||||
Reference in New Issue
Block a user