1
0
mirror of https://github.com/anope/anope.git synced 2026-07-08 21:13:13 +02:00

Removed some assertions, replaced with throwing CoreExceptions

This commit is contained in:
Adam
2010-07-27 22:12:20 -04:00
parent 4b870cc5f9
commit a2573a2c30
33 changed files with 66 additions and 34 deletions
-1
View File
@@ -39,7 +39,6 @@
#include <sys/stat.h> /* for umask() on some systems */
#include <sys/types.h>
#include <assert.h>
#include <fcntl.h>
#include <typeinfo>
+2 -1
View File
@@ -23,7 +23,8 @@ class CommandCSSASetNoexpire : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
assert(ci);
if (!ci)
throw CoreException("NULL ci in CommandCSSASetNoexpire");
if (params[1].equals_ci("ON"))
{
+2 -1
View File
@@ -23,7 +23,8 @@ class CommandCSSetBanType : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
assert(ci);
if (!ci)
throw CoreException("NULL ci in CommandCSSetBanType");
Anope::string end;
+2 -1
View File
@@ -23,7 +23,8 @@ class CommandCSSetDescription : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
assert(ci);
if (!ci)
throw CoreException("NULL ci in CommandCSSetDescription");
ci->desc = params[1];
+2 -1
View File
@@ -23,7 +23,8 @@ class CommandCSSetEntryMsg : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
assert(ci);
if (!ci)
throw CoreException("NULL ci in CommandCSSetEntryMsg");
if (params.size() > 1)
{
+2 -1
View File
@@ -23,7 +23,8 @@ class CommandCSSetFounder : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
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)))
{
+2 -1
View File
@@ -23,7 +23,8 @@ class CommandCSSetKeepTopic : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
assert(ci);
if (!ci)
throw CoreException("NULL ci in CommandCSSetKeepTopic");
if (params[1].equals_ci("ON"))
{
+2 -1
View File
@@ -23,7 +23,8 @@ class CommandCSSetMLock : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
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;
+2 -1
View File
@@ -23,7 +23,8 @@ class CommandCSSetOpNotice : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
assert(ci);
if (!ci)
throw CoreException("NULL ci in CommandCSSetOpNotice");
if (params[1].equals_ci("ON"))
{
+2 -1
View File
@@ -23,7 +23,8 @@ class CommandCSSetPeace : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
assert(ci);
if (!ci)
throw CoreException("NULL ci in CommandCSSetPeace");
if (params[1].equals_ci("ON"))
{
+2 -1
View File
@@ -23,7 +23,8 @@ class CommandCSSetPersist : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
assert(ci);
if (!ci)
throw CoreException("NULL ci in CommandCSSetPersist");
ChannelMode *cm = ModeManager::FindChannelModeByName(CMODE_PERM);
+2 -1
View File
@@ -23,7 +23,8 @@ class CommandCSSetPrivate : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
assert(ci);
if (!ci)
throw CoreException("NULL ci in CommandCSSetPrivate");
if (params[1].equals_ci("ON"))
{
+2 -1
View File
@@ -22,7 +22,8 @@ class CommandCSSetRestricted : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
assert(ci);
if (!ci)
throw CoreException("NULL ci in CommandCSSetRestricted");
if (params[1].equals_ci("ON"))
{
+2 -1
View File
@@ -23,7 +23,8 @@ class CommandCSSetSecure : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
assert(ci);
if (!ci)
throw CoreException("NULL ci in CommandCSSetSecure");
if (params[1].equals_ci("ON"))
{
+2 -1
View File
@@ -23,7 +23,8 @@ class CommandCSSetSecureFounder : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
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))
{
+2 -1
View File
@@ -23,7 +23,8 @@ class CommandCSSetSecureOps : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
assert(ci);
if (!ci)
throw CoreException("NULL ci in CommandCSSetSecureIos");
if (params[1].equals_ci("ON"))
{
+2 -1
View File
@@ -23,7 +23,8 @@ class CommandCSSetSignKick : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
assert(ci);
if (!ci)
throw CoreException("NULL ci in CommandCSSetSignKick");
if (params[1].equals_ci("ON"))
{
+2 -1
View File
@@ -23,7 +23,8 @@ class CommandCSSetSuccessor : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
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))
{
+2 -1
View File
@@ -23,7 +23,8 @@ class CommandCSSetTopicLock : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0]);
assert(ci);
if (!ci)
throw CoreException("NULL ci in CommandCSSetTopicLock");
if (params[1].equals_ci("ON"))
{
+2 -1
View File
@@ -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"))
{
+4 -2
View File
@@ -128,7 +128,8 @@ class CommandNSSASetDisplay : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
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> &params)
{
NickCore *nc = findcore(params[0]);
assert(nc);
if (!nc)
throw CoreException("NULL nc in CommandNSSASetPassword");
size_t len = params[1].length();
+2 -1
View File
@@ -23,7 +23,8 @@ class CommandNSSASetNoexpire : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
NickAlias *na = findnick(params[0]);
assert(na);
if (!na)
throw CoreException("NULL na in CommandNSSASsetNoexpire");
Anope::string param = params.size() > 1 ? params[1] : "";
+2 -1
View File
@@ -65,7 +65,8 @@ class CommandNSSASetAutoOp : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
NickCore *nc = findcore(params[0]);
assert(nc);
if (!nc)
throw CoreException("NULL nc in CommandNSSASetAutoOp");
Anope::string param = params[1];
+2 -1
View File
@@ -71,7 +71,8 @@ class CommandNSSASetEmail : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
NickCore *nc = findcore(params[0]);
assert(nc);
if (!nc)
throw CoreException("NULL nc in CommandNSSASetEmail");
Anope::string param = params.size() > 1 ? params[1] : "";
+2 -1
View File
@@ -58,7 +58,8 @@ class CommandNSSASetGreet : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
NickCore *nc = findcore(params[0]);
assert(nc);
if (!nc)
throw CoreException("NULL nc in CommandNSSASetGreet");
Anope::string param = params.size() > 1 ? params[1] : "";
+2 -1
View File
@@ -98,7 +98,8 @@ class CommandNSSASetHide : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
NickCore *nc = findcore(params[0]);
assert(nc);
if (!nc)
throw CoreException("NULL nc in CommandNSSASetHide");
Anope::string param = params[1];
+2 -1
View File
@@ -88,7 +88,8 @@ class CommandNSSASetKill : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
NickCore *nc = findcore(params[0]);
assert(nc);
if (!nc)
throw CoreException("NULL nc in CommandNSSASetKill");
Anope::string param = params[1];
+2 -1
View File
@@ -70,7 +70,8 @@ class CommandNSSASetLanguage : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
NickCore *nc = findcore(params[0]);
assert(nc);
if (!nc)
throw CoreException("NULL nc in CommandNSSASetLanguage");
Anope::string param = params[1];
+2 -1
View File
@@ -71,7 +71,8 @@ class CommandNSSASetMessage : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
NickCore *nc = findcore(params[0]);
assert(nc);
if (!nc)
throw CoreException("NULL nc in CommandNSSASetMessage");
Anope::string param = params[1];
+2 -1
View File
@@ -65,7 +65,8 @@ class CommandNSSASetPrivate : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
NickCore *nc = findcore(params[0]);
assert(nc);
if (!nc)
throw CoreException("NULL nc in CommandNSSASetPrivate");
Anope::string param = params[1];
+2 -1
View File
@@ -65,7 +65,8 @@ class CommandNSSASetSecure : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
NickCore *nc = findcore(params[0]);
assert(nc);
if (!nc)
throw CoreException("NULL nc in CommandNSSASetSecure");
Anope::string param = params[1];
+2 -1
View File
@@ -23,7 +23,8 @@ class CommandCSSetMisc : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
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)
+2 -1
View File
@@ -22,7 +22,8 @@ class CommandNSSetMisc : public Command
CommandReturn RealExecute(User *u, const std::vector<Anope::string> &params)
{
NickCore *nc = findcore(params[0]);
assert(nc);
if (!nc)
throw CoreException("NULL nc in CommandNSSetMisc");
nc->Shrink("nickserv:" + this->name);
if (params.size() > 1)