diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-11-26 20:01:56 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-11-26 20:01:56 +0000 |
commit | 21d26b403e30dec3a33aa6fccafdf884f834ed9f (patch) | |
tree | 0a66aa554e8390f0fc7a1218c0fa55f83906b5f8 /src/modules | |
parent | 2bcef988d778ee30371133b8ef052fbae37cd05a (diff) |
Added TreeServer class (actual tree structure)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1959 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_spanningtree.cpp | 52 |
1 files changed, 51 insertions, 1 deletions
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: * <brain@chatspike.net> * <Craig@chatspike.net> @@ -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<TreeServer*> 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<TreeServer*>::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; |