From 21d26b403e30dec3a33aa6fccafdf884f834ed9f Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 26 Nov 2005 20:01:56 +0000 Subject: Added TreeServer class (actual tree structure) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1959 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree.cpp | 52 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) (limited to 'src/modules') diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index 4cf8cbdea..3dc5af0d3 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -2,7 +2,7 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * Inspire is copyright (C) 2002-2004 ChatSpike-Dev. + * Inspire is copyright (C) 2002-2005 ChatSpike-Dev. * E-mail: * * @@ -23,6 +23,56 @@ using namespace std; #include "modules.h" #include "socket.h" +enum ServerState { CONNECTING, WAIT_AUTH_1, WAIT_AUTH_2, CONNECTED }; + +class TreeServer; +class TreeSocket; + +class TreeServer +{ + TreeServer* Parent; + std::vector Children; + std::string ServerName; + std::string ServerDesc; + std::string VersionString; + int UserCount; + int OperCount; + ServerState State; + TreeSocket* Socket; // for directly connected servers this points at the socket object + + public: + + TreeServer() + { + } + + TreeServer(std::string Name, std::string Desc) : ServerName(Name), ServerDesc(Desc) + { + } + + TreeServer(std::string Name, std::string Desc, TreeServer* Above) : Parent(Above), ServerName(Name), ServerDesc(Desc) + { + } + + void AddChild(TreeServer* Child) + { + Children.push_back(Child); + } + + bool DelChild(TreeServer* Child) + { + for (std::vector::iterator a = Children.begin(); a < Children.end(); a++) + { + if (*a == Child) + { + Children.erase(a); + return true; + } + } + return false; + } +}; + /* $ModDesc: Povides a spanning tree server link protocol */ Server *Srv; -- cgit v1.2.3