summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2016-12-30 18:51:56 +0100
committerAttila Molnar <attilamolnar@hush.com>2016-12-30 18:51:56 +0100
commit8db52f66a2ff587457c34889b31e7ef70876c7fa (patch)
tree40f6b21ae462b3e083b1027a84def6be7c51f4d1
parent0c3b041d1b36d1515913da5230399b379a802b81 (diff)
Make all User::IsModeSet() methods const, accept const ModeHandler
-rw-r--r--include/users.h12
-rw-r--r--src/users.cpp2
2 files changed, 7 insertions, 7 deletions
diff --git a/include/users.h b/include/users.h
index 8cf78a585..29c573daa 100644
--- a/include/users.h
+++ b/include/users.h
@@ -427,10 +427,10 @@ class CoreExport User : public Extensible
* @param m The user mode
* @return True if the mode is set
*/
- bool IsModeSet(unsigned char m);
- bool IsModeSet(ModeHandler* mh);
- bool IsModeSet(ModeHandler& mh) { return IsModeSet(&mh); }
- bool IsModeSet(UserModeReference& moderef);
+ bool IsModeSet(unsigned char m) const;
+ bool IsModeSet(const ModeHandler* mh) const;
+ bool IsModeSet(const ModeHandler& mh) const { return IsModeSet(&mh); }
+ bool IsModeSet(UserModeReference& moderef) const;
/** Set a specific usermode to on or off
* @param m The user mode
@@ -924,12 +924,12 @@ inline FakeUser* IS_SERVER(User* u)
return u->usertype == USERTYPE_SERVER ? static_cast<FakeUser*>(u) : NULL;
}
-inline bool User::IsModeSet(ModeHandler* mh)
+inline bool User::IsModeSet(const ModeHandler* mh) const
{
return (modes[mh->GetId()]);
}
-inline bool User::IsModeSet(UserModeReference& moderef)
+inline bool User::IsModeSet(UserModeReference& moderef) const
{
if (!moderef)
return false;
diff --git a/src/users.cpp b/src/users.cpp
index 06a1c1149..90978a496 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -33,7 +33,7 @@ bool User::IsNoticeMaskSet(unsigned char sm)
return (snomasks[sm-65]);
}
-bool User::IsModeSet(unsigned char m)
+bool User::IsModeSet(unsigned char m) const
{
ModeHandler* mh = ServerInstance->Modes->FindMode(m, MODETYPE_USER);
return (mh && modes[mh->GetId()]);