summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2015-01-20 17:42:31 +0100
committerAttila Molnar <attilamolnar@hush.com>2015-01-20 17:42:31 +0100
commit4bb972550e79292c5571714103780d873f5e82aa (patch)
tree939e8d882fc9cb8da37d7fbb222b071ec50d1295 /src/modules
parent4b6f7d789333dd9fd3b08f8742a68c0f9c6c2254 (diff)
m_spanningtree Get rid of some boilerplate
Make methods const while at it
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_spanningtree/treeserver.cpp33
-rw-r--r--src/modules/m_spanningtree/treeserver.h12
-rw-r--r--src/modules/m_spanningtree/treesocket.h2
-rw-r--r--src/modules/m_spanningtree/treesocket1.cpp5
4 files changed, 7 insertions, 45 deletions
diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp
index 98d7c8754..6eb9dd3c6 100644
--- a/src/modules/m_spanningtree/treeserver.cpp
+++ b/src/modules/m_spanningtree/treeserver.cpp
@@ -127,11 +127,6 @@ void TreeServer::BeginBurst(unsigned long startms)
ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Server %s started bursting at time %lu behind_bursting %u", sid.c_str(), startms, behind_bursting);
}
-const std::string& TreeServer::GetID()
-{
- return sid;
-}
-
void TreeServer::FinishBurstInternal()
{
// Check is needed because 1202 protocol servers don't send the bursting state of a server, so servers
@@ -266,19 +261,6 @@ void TreeServer::AddHashEntry()
Utils->sidlist[sid] = this;
}
-/** These accessors etc should be pretty self-
- * explanitory.
- */
-TreeServer* TreeServer::GetRoute()
-{
- return Route;
-}
-
-const std::string& TreeServer::GetVersion()
-{
- return VersionString;
-}
-
void TreeServer::SetNextPingTime(time_t t)
{
this->NextPing = t;
@@ -300,21 +282,6 @@ void TreeServer::SetPingFlag()
LastPingWasGood = true;
}
-TreeSocket* TreeServer::GetSocket()
-{
- return Socket;
-}
-
-TreeServer* TreeServer::GetParent()
-{
- return Parent;
-}
-
-void TreeServer::SetVersion(const std::string &Version)
-{
- VersionString = Version;
-}
-
void TreeServer::AddChild(TreeServer* Child)
{
Children.push_back(Child);
diff --git a/src/modules/m_spanningtree/treeserver.h b/src/modules/m_spanningtree/treeserver.h
index f06e0bafa..d7fbfdf53 100644
--- a/src/modules/m_spanningtree/treeserver.h
+++ b/src/modules/m_spanningtree/treeserver.h
@@ -119,7 +119,7 @@ class TreeServer : public Server
* The 'route' is defined as the locally-
* connected server which can be used to reach this server.
*/
- TreeServer* GetRoute();
+ TreeServer* GetRoute() const { return Route; }
/** Returns true if this server is the tree root (i.e.: us)
*/
@@ -136,7 +136,7 @@ class TreeServer : public Server
/** Get server version string
*/
- const std::string& GetVersion();
+ const std::string& GetVersion() const { return VersionString; }
/** Get the full version string of this server
* @return The full version string of this server, including patch version and other info
@@ -178,16 +178,16 @@ class TreeServer : public Server
/** Get the TreeSocket pointer for local servers.
* For remote servers, this returns NULL.
*/
- TreeSocket* GetSocket();
+ TreeSocket* GetSocket() const { return Socket; }
/** Get the parent server.
* For the root node, this returns NULL.
*/
- TreeServer* GetParent();
+ TreeServer* GetParent() const { return Parent; }
/** Set the server version string
*/
- void SetVersion(const std::string &Version);
+ void SetVersion(const std::string& verstr) { VersionString = verstr; }
/** Set the full version string
* @param verstr The version string to set
@@ -214,7 +214,7 @@ class TreeServer : public Server
/** Get server ID
*/
- const std::string& GetID();
+ const std::string& GetID() const { return sid; }
/** Marks a server as having finished bursting and performs appropriate actions.
*/
diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h
index 6dc584537..4887623c1 100644
--- a/src/modules/m_spanningtree/treesocket.h
+++ b/src/modules/m_spanningtree/treesocket.h
@@ -174,7 +174,7 @@ class TreeSocket : public BufferedSocket
/** Get link state
*/
- ServerState GetLinkState();
+ ServerState GetLinkState() const { return LinkState; }
/** Get challenge set in our CAPAB for challenge/response
*/
diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp
index d2fec0118..025bd1e61 100644
--- a/src/modules/m_spanningtree/treesocket1.cpp
+++ b/src/modules/m_spanningtree/treesocket1.cpp
@@ -69,11 +69,6 @@ TreeSocket::TreeSocket(int newfd, ListenSocket* via, irc::sockets::sockaddrs* cl
Utils->timeoutlist[this] = std::pair<std::string, int>(linkID, 30);
}
-ServerState TreeSocket::GetLinkState()
-{
- return this->LinkState;
-}
-
void TreeSocket::CleanNegotiationInfo()
{
// connect is good, reset the autoconnect block (if used)