diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-15 13:11:42 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-15 13:11:42 +0000 |
commit | ac60f15b03d248318e9378ce2abfb7c9a1663dd4 (patch) | |
tree | 0249287d9f3828b4af66c42b0f21d60f6743bfc4 | |
parent | cdd87fec57f147184fda4e73e1f432bbb272eb2a (diff) |
/MAP and /LINKS added back (do not use - needs testing)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@609 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | include/connection.h | 2 | ||||
-rw-r--r-- | src/connection.cpp | 10 | ||||
-rw-r--r-- | src/inspircd.cpp | 62 |
3 files changed, 49 insertions, 25 deletions
diff --git a/include/connection.h b/include/connection.h index de6635f4a..954cc919b 100644 --- a/include/connection.h +++ b/include/connection.h @@ -74,6 +74,8 @@ class ircd_connector : public classbase int GetState(); void SetState(int state); char* GetServerIP(); + std::string GetDescription(); + void SetDescription(std::string desc); int GetServerPort(); bool SetHostAndPort(char* host, int port); }; diff --git a/src/connection.cpp b/src/connection.cpp index 0409f4f47..413c1cf5d 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -267,11 +267,21 @@ std::string ircd_connector::GetServerName() return this->servername; } +std::string ircd_connector::GetDescription() +{ + return this->description; +} + void ircd_connector::SetServerName(std::string serv) { this->servername = serv; } +void ircd_connector::SetDescription(std::string desc) +{ + this->servername = desc; +} + int ircd_connector::GetDescriptor() { diff --git a/src/inspircd.cpp b/src/inspircd.cpp index ae8c60706..07e04fad1 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -5350,29 +5350,35 @@ void handle_squit(char **parameters, int pcnt, userrec *user) // send out an squit across the mesh and then clear the server list (for local squit) } -char islast(serverrec* s) +char islast(const char* s) { char c = '`'; - /*for (int j = 0; j < 255; j++) + for (int j = 0; j < 32; j++) { - if (servers[j] != NULL) - { - c = '|'; - } - if (servers[j] == s) - { - c = '`'; + if (me[j] != NULL) + { + for (int k = 0; k < me[j]->connectors.size(); k++) + { + if (strcasecmp(me[j]->connectors[k].GetServerName().c_str(),s)) + { + c = '|'; + } + if (!strcasecmp(me[j]->connectors[k].GetServerName().c_str(),s)) + { + c = '`'; + } + } } - }*/ + } return c; } -long map_count(serverrec* s) +long map_count(const char* s) { int c = 0; for (user_hash::const_iterator i = clientlist.begin(); i != clientlist.end(); i++) { - if ((i->second->fd) && (isnick(i->second->nick)) && (!strcasecmp(i->second->server,s->name))) c++; + if ((i->second->fd) && (isnick(i->second->nick)) && (!strcasecmp(i->second->server,s))) c++; } return c; } @@ -5380,12 +5386,15 @@ long map_count(serverrec* s) void handle_links(char **parameters, int pcnt, userrec *user) { WriteServ(user->fd,"364 %s %s %s :0 %s",user->nick,ServerName,ServerName,ServerDesc); - for (int j = 0; j < 255; j++) + for (int j = 0; j < 32; j++) { - // if (servers[j] != NULL) - // { - // WriteServ(user->fd,"364 %s %s %s :1 %s",user->nick,servers[j]->name,ServerName,servers[j]->description); - // } + if (me[j] != NULL) + { + for (int k = 0; k < me[j]->connectors.size(); k++) + { + WriteServ(user->fd,"364 %s %s %s :1 %s",user->nick,me[j]->connectors[k].GetServerName().c_str(),ServerName,me[j]->connectors[k].GetDescription().c_str()); + } + } } WriteServ(user->fd,"365 %s * :End of /LINKS list.",user->nick); } @@ -5397,15 +5406,18 @@ void handle_map(char **parameters, int pcnt, userrec *user) while (strlen(line) < 50) strcat(line," "); WriteServ(user->fd,"%s%d (%.2f%%)",line,local_count(),(float)(((float)local_count()/(float)usercnt())*100)); - for (int j = 0; j < 255; j++) + for (int j = 0; j < 32; j++) { - // if (servers[j] != NULL) - // { - // snprintf(line,MAXBUF,"006 %s :%c-%s",user->nick,islast(servers[j]),servers[j]->name); - // while (strlen(line) < 50) - // strcat(line," "); - // WriteServ(user->fd,"%s%d (%.2f%%)",line,map_count(servers[j]),(float)(((float)map_count(servers[j])/(float)usercnt())*100)); - // } + if (me[j] != NULL) + { + for (int k = 0; k < me[j]->connectors.size(); k++) + { + snprintf(line,MAXBUF,"006 %s :%c-%s",user->nick,islast(me[j]->connectors[k].GetServerName().c_str()),me[j]->connectors[k].GetServerName().c_str()); + while (strlen(line) < 50) + strcat(line," "); + WriteServ(user->fd,"%s%d (%.2f%%)",line,map_count(me[j]->connectors[k].GetServerName().c_str()),(float)(((float)map_count(me[j]->connectors[k].GetServerName().c_str())/(float)usercnt())*100)); + } + } } WriteServ(user->fd,"007 %s :End of /MAP",user->nick); } |