diff options
-rw-r--r-- | include/socket.h | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree.cpp | 43 | ||||
-rw-r--r-- | src/socket.cpp | 3 |
3 files changed, 43 insertions, 5 deletions
diff --git a/include/socket.h b/include/socket.h index ace21b78f..7571d1481 100644 --- a/include/socket.h +++ b/include/socket.h @@ -46,7 +46,7 @@ private: socklen_t length; public: InspSocket(); - InspSocket(int newfd); + InspSocket(int newfd, char* ip); InspSocket(std::string host, int port, bool listening, unsigned long maxtime); virtual bool OnConnected(); virtual void OnError(InspSocketError e); diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index 71f3af876..8ec9e564e 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -66,6 +66,41 @@ class TreeServer UserCount = OperCount = 0; } + std::string GetName() + { + return this->ServerName; + } + + std::string GetDesc() + { + return this->ServerDesc; + } + + std::string GetVersion() + { + return this->VersionString; + } + + int GetUserCount() + { + return this->UserCount; + } + + int GetOperCount() + { + return this->OperCount; + } + + TreeSocket* GetSocket() + { + return this->Socket; + } + + TreeServer* GetParent() + { + return this->Parent; + } + void AddChild(TreeServer* Child) { Children.push_back(Child); @@ -128,8 +163,8 @@ class TreeSocket : public InspSocket this->LinkState = CONNECTING; } - TreeSocket(int newfd) - : InspSocket(newfd) + TreeSocket(int newfd, char* ip) + : InspSocket(newfd, ip) { Srv->Log(DEBUG,"Associate new inbound"); this->LinkState = WAIT_AUTH_1; @@ -139,6 +174,7 @@ class TreeSocket : public InspSocket { if (this->LinkState == CONNECTING) { + Srv->SendOpers("*** Connection to "+myhost+"["+this->GetIP()+"] established."); // we should send our details here. // if the other side is satisfied, they send theirs. // we do not need to change state here. @@ -168,6 +204,7 @@ class TreeSocket : public InspSocket void DoBurst(TreeServer* s) { log(DEBUG,"Beginning network burst"); + Srv->SendOpers("*** Bursting to "+s->GetName()+"."); this->WriteLine("BURST"); this->WriteLine("ENDBURST"); } @@ -420,7 +457,7 @@ class TreeSocket : public InspSocket virtual int OnIncomingConnection(int newsock, char* ip) { - TreeSocket* s = new TreeSocket(newsock); + TreeSocket* s = new TreeSocket(newsock, ip); Srv->AddSocket(s); return true; } diff --git a/src/socket.cpp b/src/socket.cpp index aa028b8a5..36b6d1d1e 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -48,10 +48,11 @@ InspSocket::InspSocket() this->state = I_DISCONNECTED; } -InspSocket::InspSocket(int newfd) +InspSocket::InspSocket(int newfd, char* ip) { this->fd = newfd; this->state = I_CONNECTED; + this->IP = ip; } InspSocket::InspSocket(std::string host, int port, bool listening, unsigned long maxtime) |