]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Move a few trivial functions into headers
authorattilamolnar <attilamolnar@hush.com>
Sat, 1 Jun 2013 22:28:55 +0000 (00:28 +0200)
committerattilamolnar <attilamolnar@hush.com>
Sat, 1 Jun 2013 22:28:55 +0000 (00:28 +0200)
include/channels.h
include/configreader.h
include/hashcomp.h
include/inspircd.h
include/mode.h
src/channels.cpp
src/configreader.cpp
src/hashcomp.cpp
src/helperfuncs.cpp
src/mode.cpp
src/modules.cpp

index b71da1570fbe5b41fdfca96031a4386fd8dbf973..44198724c262622a0473ca654fcecd0c0f0cc6be 100644 (file)
@@ -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());
+}
index 70f81371f6213131eaca9e71b17008c87e5d414c..cc14120963d8ccf5e080ca6ebea78303b6d6820d 100644 (file)
@@ -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
index 1f1e541d3aeabf3aac8d6a916bf747cfa7f9ebcd..e142dcfd39393560721e259d81b20ecdd94309a9 100644 (file)
@@ -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.
index 6e75cc9a840a2bc9dad70df1ac14c2b240ff1085..957032da2f227c23a51d7d1c32dc9b0d6ac232d9 100644 (file)
@@ -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);
+}
index fc012278882409f9c1507c2ad0b5af0bf00f4ae5..172b014deb166e4078bb931cb74fc2bd9b8a5bb7 100644 (file)
@@ -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.
index 1c8e9e8568940b0f499f946455c5faebcfa1e1fa..4010f819a39d102c6b93ac9d56fb0bd3f5849b65 100644 (file)
@@ -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",
index 0016fccaf51eb4c519a1e7c6abdbb444208a2382..a8c0abe89056b4ed9fc11f5d47ab81ffa3285360 100644 (file)
@@ -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();
index b320f3546fa6b5a7dd507774d2a52c4719ec0d5f..1d37c2a80e7858370b9f37116ade3b78475ccbb1 100644 (file)
@@ -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)
 {
index e86c0bc7076d8c911791822e83b8b9d28932486e..9ed77fb99332cfa7cd1046990bf37d408b74fbfe 100644 (file)
@@ -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();
index c96f25f7fad857a745ff2382af774a0af7c56794..578fc2c27a518469d35db84ea721ce05bf921df7 100644 (file)
@@ -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('!');
index dfbe1358e15093a96c50566fbcaec01a4858c150..871bb94995cc696ac9e316a4bf4c134aa058f1e3 100644 (file)
@@ -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);