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 /include | |
parent | 3e704abc5af27cc6d8d3e5e720d2fe497b423417 (diff) |
Move a few trivial functions into headers
Diffstat (limited to 'include')
-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 |
5 files changed, 18 insertions, 10 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. |