diff options
author | attilamolnar <attilamolnar@hush.com> | 2013-06-02 00:28:55 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-06-02 00:28:55 +0200 |
commit | b01dc3cb865c2faacfa69f6a081117bf349c6f40 (patch) | |
tree | 085867c898f36c12260a5933b74df1b11a623363 | |
parent | 3e704abc5af27cc6d8d3e5e720d2fe497b423417 (diff) |
Move a few trivial functions into headers
-rw-r--r-- | include/channels.h | 13 | ||||
-rw-r--r-- | include/configreader.h | 2 | ||||
-rw-r--r-- | include/hashcomp.h | 2 | ||||
-rw-r--r-- | include/inspircd.h | 7 | ||||
-rw-r--r-- | include/mode.h | 4 | ||||
-rw-r--r-- | src/channels.cpp | 15 | ||||
-rw-r--r-- | src/configreader.cpp | 5 | ||||
-rw-r--r-- | src/hashcomp.cpp | 5 | ||||
-rw-r--r-- | src/helperfuncs.cpp | 6 | ||||
-rw-r--r-- | src/mode.cpp | 10 | ||||
-rw-r--r-- | src/modules.cpp | 6 |
11 files changed, 18 insertions, 57 deletions
diff --git a/include/channels.h b/include/channels.h index b71da1570..44198724c 100644 --- a/include/channels.h +++ b/include/channels.h @@ -129,13 +129,11 @@ class CoreExport Channel : public Extensible, public InviteBase int SetTopic(User *u, std::string &t, bool forceset = false); /** Obtain the channel "user counter" - * This returns the channel reference counter, which is initialized - * to 0 when the channel is created and incremented/decremented - * upon joins, parts quits and kicks. + * This returns the number of users on this channel * * @return The number of users on this channel */ - long GetUserCounter(); + long GetUserCounter() const { return userlist.size(); } /** Add a user pointer to the internal reference list * @param user The user to add @@ -161,7 +159,7 @@ class CoreExport Channel : public Extensible, public InviteBase * * @return This function returns pointer to a map of User pointers (CUList*). */ - const UserMembList* GetUsers(); + const UserMembList* GetUsers() const { return &userlist; } /** Returns true if the user given is on the given channel. * @param user The user to look for @@ -357,3 +355,8 @@ class CoreExport Channel : public Extensible, public InviteBase */ ModResult GetExtBanStatus(User *u, char type); }; + +inline bool Channel::HasUser(User* user) +{ + return (userlist.find(user) != userlist.end()); +} diff --git a/include/configreader.h b/include/configreader.h index 70f81371f..cc1412096 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -487,7 +487,7 @@ class CoreExport ServerConfig /** Get server ID as string with required leading zeroes */ - const std::string& GetSID(); + const std::string& GetSID() const { return sid; } /** Read the entire configuration into memory * and initialize this class. All other methods diff --git a/include/hashcomp.h b/include/hashcomp.h index 1f1e541d3..e142dcfd3 100644 --- a/include/hashcomp.h +++ b/include/hashcomp.h @@ -190,7 +190,7 @@ namespace irc /** Get the joined sequence * @return A constant reference to the joined string */ - const std::string& GetJoined() const; + const std::string& GetJoined() const { return joined; } }; /** irc::modestacker stacks mode sequences into a list. diff --git a/include/inspircd.h b/include/inspircd.h index 6e75cc9a8..957032da2 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -537,7 +537,7 @@ class CoreExport InspIRCd /** Return a count of channels on the network * @return The number of channels */ - long ChannelCount(); + long ChannelCount() const { return chanlist->size(); } /** Send an error notice to all local users, opered and unopered * @param s The error string to send @@ -774,3 +774,8 @@ class CommandModule : public Module return Version(cmd.name, VF_VENDOR|VF_CORE); } }; + +inline void InspIRCd::SendMode(const std::vector<std::string>& parameters, User* user) +{ + this->Modes->Process(parameters, user); +} diff --git a/include/mode.h b/include/mode.h index fc0122788..172b014de 100644 --- a/include/mode.h +++ b/include/mode.h @@ -172,7 +172,7 @@ class CoreExport ModeHandler : public ServiceProvider /** * Returns true if the mode is a list mode */ - bool IsListMode(); + bool IsListMode() const { return list; } /** * Mode prefix or 0. If this is defined, you should * also implement GetPrefixRank() to return an integer @@ -492,7 +492,7 @@ class CoreExport ModeParser * may be different to what you sent after it has been 'cleaned up' by the parser. * @return Last parsed string, as seen by users. */ - const std::string& GetLastParse(); + const std::string& GetLastParse() const { return LastParse; } const std::vector<std::string>& GetLastParseParams() { return LastParseParams; } const std::vector<TranslateType>& GetLastParseTranslate() { return LastParseTranslate; } /** Add a mode to the mode parser. diff --git a/src/channels.cpp b/src/channels.cpp index 1c8e9e856..4010f819a 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -137,11 +137,6 @@ int Channel::SetTopic(User *u, std::string &ntopic, bool forceset) return CMD_SUCCESS; } -long Channel::GetUserCounter() -{ - return userlist.size(); -} - Membership* Channel::AddUser(User* user) { Membership*& memb = userlist[user]; @@ -182,11 +177,6 @@ void Channel::DelUser(User* user) } } -bool Channel::HasUser(User* user) -{ - return (userlist.find(user) != userlist.end()); -} - Membership* Channel::GetUser(User* user) { UserMembIter i = userlist.find(user); @@ -195,11 +185,6 @@ Membership* Channel::GetUser(User* user) return i->second; } -const UserMembList* Channel::GetUsers() -{ - return &userlist; -} - void Channel::SetDefaultModes() { ServerInstance->Logs->Log("CHANNELS", LOG_DEBUG, "SetDefaultModes %s", diff --git a/src/configreader.cpp b/src/configreader.cpp index 0016fccaf..a8c0abe89 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -784,11 +784,6 @@ const char* ServerConfig::CleanFilename(const char* name) return (p != name ? ++p : p); } -const std::string& ServerConfig::GetSID() -{ - return sid; -} - void ConfigReaderThread::Run() { Config->Read(); diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index b320f3546..1d37c2a80 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -432,11 +432,6 @@ irc::stringjoiner::stringjoiner(const std::string& seperator, const std::vector< joined.append(sequence[end]); } -const std::string& irc::stringjoiner::GetJoined() const -{ - return joined; -} - irc::portparser::portparser(const std::string &source, bool allow_overlapped) : sep(source), in_range(0), range_begin(0), range_end(0), overlapped(allow_overlapped) { diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index e86c0bc70..9ed77fb99 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -116,12 +116,6 @@ void InspIRCd::SendError(const std::string &s) } } -/* return channel count */ -long InspIRCd::ChannelCount() -{ - return chanlist->size(); -} - bool InspIRCd::IsValidMask(const std::string &mask) { const char* dest = mask.c_str(); diff --git a/src/mode.cpp b/src/mode.cpp index c96f25f7f..578fc2c27 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -44,11 +44,6 @@ ModeHandler::~ModeHandler() { } -bool ModeHandler::IsListMode() -{ - return list; -} - unsigned int ModeHandler::GetPrefixRank() { return 0; @@ -556,11 +551,6 @@ void ModeParser::DisplayListModes(User* user, Channel* chan, std::string &mode_s } } -const std::string& ModeParser::GetLastParse() -{ - return LastParse; -} - void ModeParser::CleanMask(std::string &mask) { std::string::size_type pos_of_pling = mask.find_first_of('!'); diff --git a/src/modules.cpp b/src/modules.cpp index dfbe1358e..871bb9499 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -552,12 +552,6 @@ void dynamic_reference_base::resolve() value = NULL; } -void InspIRCd::SendMode(const std::vector<std::string>& parameters, User *user) -{ - this->Modes->Process(parameters, user); -} - - void InspIRCd::SendGlobalMode(const std::vector<std::string>& parameters, User *user) { Modes->Process(parameters, user); |