summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-09-15 10:11:31 -0400
committerAdam <Adam@anope.org>2012-09-30 20:30:27 -0400
commit9ba719688161499f01c168b1aed84a563bcb5953 (patch)
treeb2ffbe3ceebf2a32820780fb76d30967af8ea50c /src
parent1e71303ffaf263adb0cc659505caa223f7f27b85 (diff)
Make CommandSource use references, sometimes we hold them for awhile
Diffstat (limited to 'src')
-rw-r--r--src/command.cpp18
-rw-r--r--src/logger.cpp2
2 files changed, 13 insertions, 7 deletions
diff --git a/src/command.cpp b/src/command.cpp
index 21901bd34..9f1b26fa4 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -15,6 +15,7 @@
#include "opertype.h"
#include "access.h"
#include "regchannel.h"
+#include "channels.h"
CommandSource::CommandSource(const Anope::string &n, User *user, NickCore *core, CommandReply *r) : nick(n), u(user), nc(core), reply(r),
c(NULL), owner(NULL), service(NULL)
@@ -26,12 +27,17 @@ const Anope::string &CommandSource::GetNick() const
return this->nick;
}
-User *CommandSource::GetUser() const
+User *CommandSource::GetUser()
{
return this->u;
}
-AccessGroup CommandSource::AccessFor(ChannelInfo *ci) const
+NickCore *CommandSource::GetAccount()
+{
+ return this->nc;
+}
+
+AccessGroup CommandSource::AccessFor(ChannelInfo *ci)
{
if (this->u)
return ci->AccessFor(this->u);
@@ -41,12 +47,12 @@ AccessGroup CommandSource::AccessFor(ChannelInfo *ci) const
return AccessGroup();
}
-bool CommandSource::IsFounder(ChannelInfo *ci) const
+bool CommandSource::IsFounder(ChannelInfo *ci)
{
if (this->u)
return ::IsFounder(this->u, ci);
else if (this->nc)
- return this->nc == ci->GetFounder();
+ return *this->nc == ci->GetFounder();
return false;
}
@@ -68,7 +74,7 @@ bool CommandSource::HasPriv(const Anope::string &cmd)
return false;
}
-bool CommandSource::IsServicesOper() const
+bool CommandSource::IsServicesOper()
{
if (this->u)
return this->u->IsServicesOper();
@@ -77,7 +83,7 @@ bool CommandSource::IsServicesOper() const
return false;
}
-bool CommandSource::IsOper() const
+bool CommandSource::IsOper()
{
if (this->u)
return this->u->HasMode(UMODE_OPER);
diff --git a/src/logger.cpp b/src/logger.cpp
index f14664cdb..6547e3e6b 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -85,7 +85,7 @@ Log::Log(LogType type, const Anope::string &category, const BotInfo *b) : bi(b),
this->Sources.push_back(bi->nick);
}
-Log::Log(LogType type, const CommandSource &source, Command *_c, const ChannelInfo *_ci) : nick(source.GetNick()), u(source.GetUser()), nc(source.nc), c(_c), chan(NULL), ci(_ci), s(NULL), Type(type)
+Log::Log(LogType type, CommandSource &source, Command *_c, const ChannelInfo *_ci) : nick(source.GetNick()), u(source.GetUser()), nc(source.nc), c(_c), chan(NULL), ci(_ci), s(NULL), Type(type)
{
if (!c)
throw CoreException("Invalid pointers passed to Log::Log");